repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
RuedigerMoeller/kontraktor | examples/REST/src/main/java/examples/rest/RESTActor.java | RESTActor.postStuff1 | public IPromise postStuff1(JsonObject body, HeaderMap headerValues ) {
headerValues.forEach( hv -> {
Log.Info(this,""+hv.getHeaderName());
hv.forEach( s -> {
Log.Info(this," "+s);
});
});
Log.Info(this,""+body);
return resolve(new Pair(202,body.toString()));
} | java | public IPromise postStuff1(JsonObject body, HeaderMap headerValues ) {
headerValues.forEach( hv -> {
Log.Info(this,""+hv.getHeaderName());
hv.forEach( s -> {
Log.Info(this," "+s);
});
});
Log.Info(this,""+body);
return resolve(new Pair(202,body.toString()));
} | [
"public",
"IPromise",
"postStuff1",
"(",
"JsonObject",
"body",
",",
"HeaderMap",
"headerValues",
")",
"{",
"headerValues",
".",
"forEach",
"(",
"hv",
"->",
"{",
"Log",
".",
"Info",
"(",
"this",
",",
"\"\"",
"+",
"hv",
".",
"getHeaderName",
"(",
")",
")",... | curl -i -X POST --data "{ \"key\": \"value\", \"nkey\": 13 }" http://localhost:8080/api/stuff1 | [
"curl",
"-",
"i",
"-",
"X",
"POST",
"--",
"data",
"{",
"\\",
"key",
"\\",
":",
"\\",
"value",
"\\",
"\\",
"nkey",
"\\",
":",
"13",
"}",
"http",
":",
"//",
"localhost",
":",
"8080",
"/",
"api",
"/",
"stuff1"
] | train | https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/examples/REST/src/main/java/examples/rest/RESTActor.java#L35-L44 |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/VfsOld.java | VfsOld.lookupNative | public static PathImpl lookupNative(String url, Map<String,Object> attr)
{
return getPwd().lookupNative(url, attr);
} | java | public static PathImpl lookupNative(String url, Map<String,Object> attr)
{
return getPwd().lookupNative(url, attr);
} | [
"public",
"static",
"PathImpl",
"lookupNative",
"(",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"attr",
")",
"{",
"return",
"getPwd",
"(",
")",
".",
"lookupNative",
"(",
"url",
",",
"attr",
")",
";",
"}"
] | Returns a native filesystem path with attributes.
@param url a relative path using the native filesystem conventions.
@param attr attributes used in searching for the url | [
"Returns",
"a",
"native",
"filesystem",
"path",
"with",
"attributes",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/VfsOld.java#L227-L230 |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/ComputeFunction.java | ComputeFunction.sendMessageTo | public final void sendMessageTo(K target, Message m) {
outMsg.f0 = target;
outMsg.f1 = m;
out.collect(Either.Right(outMsg));
} | java | public final void sendMessageTo(K target, Message m) {
outMsg.f0 = target;
outMsg.f1 = m;
out.collect(Either.Right(outMsg));
} | [
"public",
"final",
"void",
"sendMessageTo",
"(",
"K",
"target",
",",
"Message",
"m",
")",
"{",
"outMsg",
".",
"f0",
"=",
"target",
";",
"outMsg",
".",
"f1",
"=",
"m",
";",
"out",
".",
"collect",
"(",
"Either",
".",
"Right",
"(",
"outMsg",
")",
")",... | Sends the given message to the vertex identified by the given key. If the target vertex does not exist,
the next superstep will cause an exception due to a non-deliverable message.
@param target The key (id) of the target vertex to message.
@param m The message. | [
"Sends",
"the",
"given",
"message",
"to",
"the",
"vertex",
"identified",
"by",
"the",
"given",
"key",
".",
"If",
"the",
"target",
"vertex",
"does",
"not",
"exist",
"the",
"next",
"superstep",
"will",
"cause",
"an",
"exception",
"due",
"to",
"a",
"non",
"... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/ComputeFunction.java#L115-L121 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISFunctions.java | H2GISFunctions.unRegisterFunction | public static void unRegisterFunction(Statement st, Function function) throws SQLException {
String functionAlias = getStringProperty(function, Function.PROP_NAME);
if(functionAlias.isEmpty()) {
functionAlias = function.getClass().getSimpleName();
}
st.execute("DROP ALIAS IF EXISTS " + functionAlias);
} | java | public static void unRegisterFunction(Statement st, Function function) throws SQLException {
String functionAlias = getStringProperty(function, Function.PROP_NAME);
if(functionAlias.isEmpty()) {
functionAlias = function.getClass().getSimpleName();
}
st.execute("DROP ALIAS IF EXISTS " + functionAlias);
} | [
"public",
"static",
"void",
"unRegisterFunction",
"(",
"Statement",
"st",
",",
"Function",
"function",
")",
"throws",
"SQLException",
"{",
"String",
"functionAlias",
"=",
"getStringProperty",
"(",
"function",
",",
"Function",
".",
"PROP_NAME",
")",
";",
"if",
"(... | Remove the specified function from the provided DataBase connection
@param st Active statement
@param function function to remove
@throws SQLException | [
"Remove",
"the",
"specified",
"function",
"from",
"the",
"provided",
"DataBase",
"connection"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISFunctions.java#L518-L524 |
kiswanij/jk-util | src/main/java/com/jk/util/JKIOUtil.java | JKIOUtil.writeDataToFile | public static File writeDataToFile(final byte[] data, final File file, final boolean append) {
try (FileOutputStream out = new FileOutputStream(file, append)) {
out.write(data);
out.flush();
out.close();
return file;
} catch (Exception e) {
JKExceptionUtil.handle(e);
return null;
}
} | java | public static File writeDataToFile(final byte[] data, final File file, final boolean append) {
try (FileOutputStream out = new FileOutputStream(file, append)) {
out.write(data);
out.flush();
out.close();
return file;
} catch (Exception e) {
JKExceptionUtil.handle(e);
return null;
}
} | [
"public",
"static",
"File",
"writeDataToFile",
"(",
"final",
"byte",
"[",
"]",
"data",
",",
"final",
"File",
"file",
",",
"final",
"boolean",
"append",
")",
"{",
"try",
"(",
"FileOutputStream",
"out",
"=",
"new",
"FileOutputStream",
"(",
"file",
",",
"appe... | Write data to file.
@param data the data
@param file the file
@param append the append
@return the file | [
"Write",
"data",
"to",
"file",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKIOUtil.java#L350-L360 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/lib/FileUtil.java | FileUtil.renameOverwrite | private boolean renameOverwrite(String oldname, String newname) {
boolean deleted = delete(newname);
if (exists(oldname)) {
File file = new File(oldname);
return file.renameTo(new File(newname));
}
return deleted;
} | java | private boolean renameOverwrite(String oldname, String newname) {
boolean deleted = delete(newname);
if (exists(oldname)) {
File file = new File(oldname);
return file.renameTo(new File(newname));
}
return deleted;
} | [
"private",
"boolean",
"renameOverwrite",
"(",
"String",
"oldname",
",",
"String",
"newname",
")",
"{",
"boolean",
"deleted",
"=",
"delete",
"(",
"newname",
")",
";",
"if",
"(",
"exists",
"(",
"oldname",
")",
")",
"{",
"File",
"file",
"=",
"new",
"File",
... | Rename the file with oldname to newname. If a file with newname already
exists, it is deleted before the renaming operation proceeds.
If a file with oldname does not exist, no file will exist after the
operation. | [
"Rename",
"the",
"file",
"with",
"oldname",
"to",
"newname",
".",
"If",
"a",
"file",
"with",
"newname",
"already",
"exists",
"it",
"is",
"deleted",
"before",
"the",
"renaming",
"operation",
"proceeds",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/FileUtil.java#L169-L180 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cdn_dedicated_serviceName_backend_duration_POST | public OvhOrder cdn_dedicated_serviceName_backend_duration_POST(String serviceName, String duration, Long backend) throws IOException {
String qPath = "/order/cdn/dedicated/{serviceName}/backend/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "backend", backend);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder cdn_dedicated_serviceName_backend_duration_POST(String serviceName, String duration, Long backend) throws IOException {
String qPath = "/order/cdn/dedicated/{serviceName}/backend/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "backend", backend);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"cdn_dedicated_serviceName_backend_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"Long",
"backend",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cdn/dedicated/{serviceName}/backend/{duration}\"",
";... | Create order
REST: POST /order/cdn/dedicated/{serviceName}/backend/{duration}
@param backend [required] Backend number that will be ordered
@param serviceName [required] The internal name of your CDN offer
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5245-L5252 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.getAt | @SuppressWarnings("unchecked")
public static List<Character> getAt(char[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
} | java | @SuppressWarnings("unchecked")
public static List<Character> getAt(char[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Character",
">",
"getAt",
"(",
"char",
"[",
"]",
"array",
",",
"ObjectRange",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
... | Support the subscript operator with an ObjectRange for a char array
@param array a char array
@param range an ObjectRange indicating the indices for the items to retrieve
@return list of the retrieved chars
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"with",
"an",
"ObjectRange",
"for",
"a",
"char",
"array"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13847-L13850 |
FXMisc/Flowless | src/main/java/org/fxmisc/flowless/CellPositioner.java | CellPositioner.placeEndFromEnd | public C placeEndFromEnd(int itemIndex, double endOffEnd) {
C cell = getSizedCell(itemIndex);
double y = sizeTracker.getViewportLength() + endOffEnd - orientation.length(cell);
relocate(cell, 0, y);
cell.getNode().setVisible(true);
return cell;
} | java | public C placeEndFromEnd(int itemIndex, double endOffEnd) {
C cell = getSizedCell(itemIndex);
double y = sizeTracker.getViewportLength() + endOffEnd - orientation.length(cell);
relocate(cell, 0, y);
cell.getNode().setVisible(true);
return cell;
} | [
"public",
"C",
"placeEndFromEnd",
"(",
"int",
"itemIndex",
",",
"double",
"endOffEnd",
")",
"{",
"C",
"cell",
"=",
"getSizedCell",
"(",
"itemIndex",
")",
";",
"double",
"y",
"=",
"sizeTracker",
".",
"getViewportLength",
"(",
")",
"+",
"endOffEnd",
"-",
"or... | Properly resizes the cell's node, and sets its "layoutY" value, so that is the last visible
node in the viewport, and further offsets this value by {@code endOffStart}, so that
the node's <em>bottom</em> edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the
viewport's "bottom" edge. See {@link OrientationHelper}'s javadoc for more explanation on what quoted terms mean.
<pre><code>
|--------- bottom of cell's node if endOffEnd is negative
|
|_________ "bottom edge" of viewport / bottom of cell's node if endOffEnd = 0
--------- bottom of cell's node if endOffEnd is positive
</code></pre>
@param itemIndex the index of the item in the list of all (not currently visible) cells
@param endOffEnd the amount by which to offset the "layoutY" value of the cell's node | [
"Properly",
"resizes",
"the",
"cell",
"s",
"node",
"and",
"sets",
"its",
"layoutY",
"value",
"so",
"that",
"is",
"the",
"last",
"visible",
"node",
"in",
"the",
"viewport",
"and",
"further",
"offsets",
"this",
"value",
"by",
"{",
"@code",
"endOffStart",
"}"... | train | https://github.com/FXMisc/Flowless/blob/dce2269ebafed8f79203d00085af41f06f3083bc/src/main/java/org/fxmisc/flowless/CellPositioner.java#L177-L183 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/mappings/FilePathMappingUtils.java | FilePathMappingUtils.buildFilePathMapping | public static FilePathMapping buildFilePathMapping(String path,
ResourceReaderHandler rsHandler) {
return buildFilePathMapping(null, path, rsHandler);
} | java | public static FilePathMapping buildFilePathMapping(String path,
ResourceReaderHandler rsHandler) {
return buildFilePathMapping(null, path, rsHandler);
} | [
"public",
"static",
"FilePathMapping",
"buildFilePathMapping",
"(",
"String",
"path",
",",
"ResourceReaderHandler",
"rsHandler",
")",
"{",
"return",
"buildFilePathMapping",
"(",
"null",
",",
"path",
",",
"rsHandler",
")",
";",
"}"
] | Builds the File path mapping
@param path the resource path
@param rsHandler the resource reader handler
@return the file path mapping | [
"Builds",
"the",
"File",
"path",
"mapping"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/mappings/FilePathMappingUtils.java#L42-L46 |
duracloud/duracloud | s3storageprovider/src/main/java/org/duracloud/s3task/streaminghls/BaseHlsTaskRunner.java | BaseHlsTaskRunner.setDistributionState | protected void setDistributionState(String distId, boolean enabled) {
GetDistributionConfigResult result =
cfClient.getDistributionConfig(new GetDistributionConfigRequest(distId));
DistributionConfig distConfig = result.getDistributionConfig();
distConfig.setEnabled(enabled);
cfClient.updateDistribution(new UpdateDistributionRequest()
.withDistributionConfig(distConfig)
.withIfMatch(result.getETag())
.withId(distId));
} | java | protected void setDistributionState(String distId, boolean enabled) {
GetDistributionConfigResult result =
cfClient.getDistributionConfig(new GetDistributionConfigRequest(distId));
DistributionConfig distConfig = result.getDistributionConfig();
distConfig.setEnabled(enabled);
cfClient.updateDistribution(new UpdateDistributionRequest()
.withDistributionConfig(distConfig)
.withIfMatch(result.getETag())
.withId(distId));
} | [
"protected",
"void",
"setDistributionState",
"(",
"String",
"distId",
",",
"boolean",
"enabled",
")",
"{",
"GetDistributionConfigResult",
"result",
"=",
"cfClient",
".",
"getDistributionConfig",
"(",
"new",
"GetDistributionConfigRequest",
"(",
"distId",
")",
")",
";",... | Enables or disables an existing distribution
@param distId the ID of the distribution
@param enabled true to enable, false to disable | [
"Enables",
"or",
"disables",
"an",
"existing",
"distribution"
] | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/s3storageprovider/src/main/java/org/duracloud/s3task/streaminghls/BaseHlsTaskRunner.java#L124-L135 |
Netflix/ribbon | ribbon-transport/src/main/java/com/netflix/ribbon/transport/netty/LoadBalancingRxClient.java | LoadBalancingRxClient.getProperty | protected <S> S getProperty(IClientConfigKey<S> key, @Nullable IClientConfig requestConfig, S defaultValue) {
if (requestConfig != null && requestConfig.get(key) != null) {
return requestConfig.get(key);
} else {
return clientConfig.get(key, defaultValue);
}
} | java | protected <S> S getProperty(IClientConfigKey<S> key, @Nullable IClientConfig requestConfig, S defaultValue) {
if (requestConfig != null && requestConfig.get(key) != null) {
return requestConfig.get(key);
} else {
return clientConfig.get(key, defaultValue);
}
} | [
"protected",
"<",
"S",
">",
"S",
"getProperty",
"(",
"IClientConfigKey",
"<",
"S",
">",
"key",
",",
"@",
"Nullable",
"IClientConfig",
"requestConfig",
",",
"S",
"defaultValue",
")",
"{",
"if",
"(",
"requestConfig",
"!=",
"null",
"&&",
"requestConfig",
".",
... | Resolve the final property value from,
1. Request specific configuration
2. Default configuration
3. Default value
@param key
@param requestConfig
@param defaultValue
@return | [
"Resolve",
"the",
"final",
"property",
"value",
"from",
"1",
".",
"Request",
"specific",
"configuration",
"2",
".",
"Default",
"configuration",
"3",
".",
"Default",
"value"
] | train | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-transport/src/main/java/com/netflix/ribbon/transport/netty/LoadBalancingRxClient.java#L165-L171 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/convolution/Cnn3DLossLayer.java | Cnn3DLossLayer.computeScoreForExamples | @Override
public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr) {
//For 3D CNN: need to sum up the score over each x/y/z location before returning
if (input == null || labels == null)
throw new IllegalStateException("Cannot calculate score without input and labels " + layerId());
INDArray input2d = ConvolutionUtils.reshape5dTo2d(layerConf().getDataFormat(), input, workspaceMgr, ArrayType.FF_WORKING_MEM);
INDArray labels2d = ConvolutionUtils.reshape5dTo2d(layerConf().getDataFormat(), labels, workspaceMgr, ArrayType.FF_WORKING_MEM);
INDArray maskReshaped = ConvolutionUtils.reshapeCnn3dMask(layerConf().getDataFormat(), maskArray, input, workspaceMgr, ArrayType.FF_WORKING_MEM);
ILossFunction lossFunction = layerConf().getLossFn();
INDArray scoreArray =
lossFunction.computeScoreArray(labels2d, input2d, layerConf().getActivationFn(), maskReshaped);
//scoreArray: shape [minibatch*d*h*w, 1]
//Reshape it to [minibatch, 1, d, h, w] then sum over x/y/z to give [minibatch, 1]
val newShape = input.shape().clone();
newShape[1] = 1;
// FIXME
int n = (int)input.size(0);
int d, h, w, c;
if(layerConf().getDataFormat() == Convolution3D.DataFormat.NDHWC){
d = (int)input.size(1);
h = (int)input.size(2);
w = (int)input.size(3);
c = (int)input.size(4);
} else {
d = (int)input.size(2);
h = (int)input.size(3);
w = (int)input.size(4);
c = (int)input.size(1);
}
INDArray scoreArrayTs = ConvolutionUtils.reshape2dTo5d(layerConf().getDataFormat(), scoreArray, n, d, h, w, c, workspaceMgr, ArrayType.FF_WORKING_MEM);
INDArray summedScores = scoreArrayTs.sum(1,2,3,4);
if (fullNetRegTerm != 0.0) {
summedScores.addi(fullNetRegTerm);
}
return workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, summedScores);
} | java | @Override
public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr) {
//For 3D CNN: need to sum up the score over each x/y/z location before returning
if (input == null || labels == null)
throw new IllegalStateException("Cannot calculate score without input and labels " + layerId());
INDArray input2d = ConvolutionUtils.reshape5dTo2d(layerConf().getDataFormat(), input, workspaceMgr, ArrayType.FF_WORKING_MEM);
INDArray labels2d = ConvolutionUtils.reshape5dTo2d(layerConf().getDataFormat(), labels, workspaceMgr, ArrayType.FF_WORKING_MEM);
INDArray maskReshaped = ConvolutionUtils.reshapeCnn3dMask(layerConf().getDataFormat(), maskArray, input, workspaceMgr, ArrayType.FF_WORKING_MEM);
ILossFunction lossFunction = layerConf().getLossFn();
INDArray scoreArray =
lossFunction.computeScoreArray(labels2d, input2d, layerConf().getActivationFn(), maskReshaped);
//scoreArray: shape [minibatch*d*h*w, 1]
//Reshape it to [minibatch, 1, d, h, w] then sum over x/y/z to give [minibatch, 1]
val newShape = input.shape().clone();
newShape[1] = 1;
// FIXME
int n = (int)input.size(0);
int d, h, w, c;
if(layerConf().getDataFormat() == Convolution3D.DataFormat.NDHWC){
d = (int)input.size(1);
h = (int)input.size(2);
w = (int)input.size(3);
c = (int)input.size(4);
} else {
d = (int)input.size(2);
h = (int)input.size(3);
w = (int)input.size(4);
c = (int)input.size(1);
}
INDArray scoreArrayTs = ConvolutionUtils.reshape2dTo5d(layerConf().getDataFormat(), scoreArray, n, d, h, w, c, workspaceMgr, ArrayType.FF_WORKING_MEM);
INDArray summedScores = scoreArrayTs.sum(1,2,3,4);
if (fullNetRegTerm != 0.0) {
summedScores.addi(fullNetRegTerm);
}
return workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, summedScores);
} | [
"@",
"Override",
"public",
"INDArray",
"computeScoreForExamples",
"(",
"double",
"fullNetRegTerm",
",",
"LayerWorkspaceMgr",
"workspaceMgr",
")",
"{",
"//For 3D CNN: need to sum up the score over each x/y/z location before returning",
"if",
"(",
"input",
"==",
"null",
"||",
"... | Compute the score for each example individually, after labels and input have been set.
@param fullNetRegTerm Regularization score term for the entire network (or, 0.0 to not include regularization)
@return A column INDArray of shape [numExamples,1], where entry i is the score of the ith example | [
"Compute",
"the",
"score",
"for",
"each",
"example",
"individually",
"after",
"labels",
"and",
"input",
"have",
"been",
"set",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/convolution/Cnn3DLossLayer.java#L245-L287 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISDBFactory.java | H2GISDBFactory.createSpatialDataBase | public static Connection createSpatialDataBase(String dbName,boolean initSpatial, String h2Parameters )throws SQLException, ClassNotFoundException {
String databasePath = initDBFile(dbName, h2Parameters);
org.h2.Driver.load();
// Keep a connection alive to not close the DataBase on each unit test
Connection connection = DriverManager.getConnection(databasePath,
"sa", "sa");
// Init spatial ext
if(initSpatial) {
H2GISFunctions.load(connection);
}
return connection;
} | java | public static Connection createSpatialDataBase(String dbName,boolean initSpatial, String h2Parameters )throws SQLException, ClassNotFoundException {
String databasePath = initDBFile(dbName, h2Parameters);
org.h2.Driver.load();
// Keep a connection alive to not close the DataBase on each unit test
Connection connection = DriverManager.getConnection(databasePath,
"sa", "sa");
// Init spatial ext
if(initSpatial) {
H2GISFunctions.load(connection);
}
return connection;
} | [
"public",
"static",
"Connection",
"createSpatialDataBase",
"(",
"String",
"dbName",
",",
"boolean",
"initSpatial",
",",
"String",
"h2Parameters",
")",
"throws",
"SQLException",
",",
"ClassNotFoundException",
"{",
"String",
"databasePath",
"=",
"initDBFile",
"(",
"dbNa... | Create a spatial database
@param dbName filename
@param initSpatial If true add spatial features to the database
@param h2Parameters Additional h2 parameters
@return Connection
@throws java.sql.SQLException
@throws java.lang.ClassNotFoundException | [
"Create",
"a",
"spatial",
"database"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISDBFactory.java#L154-L165 |
Netflix/astyanax | astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftConverter.java | ThriftConverter.getColumnParent | public static <K> ColumnParent getColumnParent(ColumnFamily<?, ?> columnFamily, ColumnPath<?> path)
throws BadRequestException {
ColumnParent cp = new ColumnParent();
cp.setColumn_family(columnFamily.getName());
if (path != null) {
Iterator<ByteBuffer> columns = path.iterator();
if (columnFamily.getType() == ColumnType.SUPER && columns.hasNext()) {
cp.setSuper_column(columns.next());
}
}
return cp;
} | java | public static <K> ColumnParent getColumnParent(ColumnFamily<?, ?> columnFamily, ColumnPath<?> path)
throws BadRequestException {
ColumnParent cp = new ColumnParent();
cp.setColumn_family(columnFamily.getName());
if (path != null) {
Iterator<ByteBuffer> columns = path.iterator();
if (columnFamily.getType() == ColumnType.SUPER && columns.hasNext()) {
cp.setSuper_column(columns.next());
}
}
return cp;
} | [
"public",
"static",
"<",
"K",
">",
"ColumnParent",
"getColumnParent",
"(",
"ColumnFamily",
"<",
"?",
",",
"?",
">",
"columnFamily",
",",
"ColumnPath",
"<",
"?",
">",
"path",
")",
"throws",
"BadRequestException",
"{",
"ColumnParent",
"cp",
"=",
"new",
"Column... | Construct a Hector ColumnParent based on the information in the query and
the type of column family being queried.
@param <K>
@param columnFamily
@param path
@return
@throws BadRequestException | [
"Construct",
"a",
"Hector",
"ColumnParent",
"based",
"on",
"the",
"information",
"in",
"the",
"query",
"and",
"the",
"type",
"of",
"column",
"family",
"being",
"queried",
"."
] | train | https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftConverter.java#L68-L79 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/MultipartAttachmentWriter.java | MultipartAttachmentWriter.setBody | public void setBody(Map<String, Object> body) {
this.id = (String) body.get(CouchConstants._id);
this.bodyBytes = JSONUtils.serializeAsBytes(body);
contentLength += bodyBytes.length;
} | java | public void setBody(Map<String, Object> body) {
this.id = (String) body.get(CouchConstants._id);
this.bodyBytes = JSONUtils.serializeAsBytes(body);
contentLength += bodyBytes.length;
} | [
"public",
"void",
"setBody",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"body",
")",
"{",
"this",
".",
"id",
"=",
"(",
"String",
")",
"body",
".",
"get",
"(",
"CouchConstants",
".",
"_id",
")",
";",
"this",
".",
"bodyBytes",
"=",
"JSONUtils",
"... | Set the JSON body (the first MIME body) for the writer.
@param body The DocumentRevision to be serialised as JSON | [
"Set",
"the",
"JSON",
"body",
"(",
"the",
"first",
"MIME",
"body",
")",
"for",
"the",
"writer",
"."
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/MultipartAttachmentWriter.java#L143-L147 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java | ThreadLocalRandom.internalNextDouble | final double internalNextDouble(double origin, double bound) {
double r = (nextLong() >>> 11) * DOUBLE_UNIT;
if (origin < bound) {
r = r * (bound - origin) + origin;
if (r >= bound) // correct for rounding
r = Double.longBitsToDouble(Double.doubleToLongBits(bound) - 1);
}
return r;
} | java | final double internalNextDouble(double origin, double bound) {
double r = (nextLong() >>> 11) * DOUBLE_UNIT;
if (origin < bound) {
r = r * (bound - origin) + origin;
if (r >= bound) // correct for rounding
r = Double.longBitsToDouble(Double.doubleToLongBits(bound) - 1);
}
return r;
} | [
"final",
"double",
"internalNextDouble",
"(",
"double",
"origin",
",",
"double",
"bound",
")",
"{",
"double",
"r",
"=",
"(",
"nextLong",
"(",
")",
">>>",
"11",
")",
"*",
"DOUBLE_UNIT",
";",
"if",
"(",
"origin",
"<",
"bound",
")",
"{",
"r",
"=",
"r",
... | The form of nextDouble used by DoubleStream Spliterators.
@param origin the least value, unless greater than bound
@param bound the upper bound (exclusive), must not equal origin
@return a pseudorandom value | [
"The",
"form",
"of",
"nextDouble",
"used",
"by",
"DoubleStream",
"Spliterators",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java#L267-L275 |
marvinlabs/android-slideshow-widget | library/src/main/java/com/marvinlabs/widget/slideshow/SlideShowView.java | SlideShowView.recyclePreviousSlideView | private void recyclePreviousSlideView(int position, View view) {
// Remove view from our hierarchy
removeView(view);
// Add to recycled views
int viewType = adapter.getItemViewType(position);
recycledViews.put(viewType, view);
view.destroyDrawingCache();
if (view instanceof ImageView) {
((ImageView) view).setImageDrawable(null);
}
Log.d("SlideShowView", "View added to recycling bin: " + view);
// The adapter can recycle some memory with discard slide
adapter.discardSlide(position);
// The adapter can prepare the next slide
prepareSlide(getPlaylist().getNextSlide());
} | java | private void recyclePreviousSlideView(int position, View view) {
// Remove view from our hierarchy
removeView(view);
// Add to recycled views
int viewType = adapter.getItemViewType(position);
recycledViews.put(viewType, view);
view.destroyDrawingCache();
if (view instanceof ImageView) {
((ImageView) view).setImageDrawable(null);
}
Log.d("SlideShowView", "View added to recycling bin: " + view);
// The adapter can recycle some memory with discard slide
adapter.discardSlide(position);
// The adapter can prepare the next slide
prepareSlide(getPlaylist().getNextSlide());
} | [
"private",
"void",
"recyclePreviousSlideView",
"(",
"int",
"position",
",",
"View",
"view",
")",
"{",
"// Remove view from our hierarchy",
"removeView",
"(",
"view",
")",
";",
"// Add to recycled views",
"int",
"viewType",
"=",
"adapter",
".",
"getItemViewType",
"(",
... | Once the previous slide has disappeared, we remove its view from our hierarchy and add it to
the views that can be re-used.
@param position The position of the slide to recycle
@param view The view to recycle | [
"Once",
"the",
"previous",
"slide",
"has",
"disappeared",
"we",
"remove",
"its",
"view",
"from",
"our",
"hierarchy",
"and",
"add",
"it",
"to",
"the",
"views",
"that",
"can",
"be",
"re",
"-",
"used",
"."
] | train | https://github.com/marvinlabs/android-slideshow-widget/blob/0d8ddca9a8f62787d78b5eb7f184cabfee569d8d/library/src/main/java/com/marvinlabs/widget/slideshow/SlideShowView.java#L674-L694 |
mjeanroy/junit-runif | src/main/java/com/github/mjeanroy/junit4/runif/conditions/JavaUtils.java | JavaUtils.getSystemProperty | private static String getSystemProperty(String property) {
try {
return System.getProperty(property);
} catch (SecurityException ex) {
throw new SystemPropertyReadingException(ex, property);
}
} | java | private static String getSystemProperty(String property) {
try {
return System.getProperty(property);
} catch (SecurityException ex) {
throw new SystemPropertyReadingException(ex, property);
}
} | [
"private",
"static",
"String",
"getSystemProperty",
"(",
"String",
"property",
")",
"{",
"try",
"{",
"return",
"System",
".",
"getProperty",
"(",
"property",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"ex",
")",
"{",
"throw",
"new",
"SystemPropertyReadi... | Gets a System property, and throw {@link SystemPropertyReadingException} if system property cannot
be read.
@param property the system property name
@return the system property value.
@throws SystemPropertyReadingException If the property cannot be read. | [
"Gets",
"a",
"System",
"property",
"and",
"throw",
"{",
"@link",
"SystemPropertyReadingException",
"}",
"if",
"system",
"property",
"cannot",
"be",
"read",
"."
] | train | https://github.com/mjeanroy/junit-runif/blob/6fcfe39196d3f51ee1a8db7316567f540063e255/src/main/java/com/github/mjeanroy/junit4/runif/conditions/JavaUtils.java#L73-L79 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/PresenceSubscriber.java | PresenceSubscriber.refreshBuddy | public boolean refreshBuddy(String eventId, long timeout) {
if (parent.getBuddyList().get(targetUri) == null) {
setReturnCode(SipSession.INVALID_ARGUMENT);
setErrorMessage("Buddy refresh for URI " + targetUri + " failed, not found in buddy list.");
return false;
}
return refreshBuddy(getTimeLeft(), eventId, timeout);
} | java | public boolean refreshBuddy(String eventId, long timeout) {
if (parent.getBuddyList().get(targetUri) == null) {
setReturnCode(SipSession.INVALID_ARGUMENT);
setErrorMessage("Buddy refresh for URI " + targetUri + " failed, not found in buddy list.");
return false;
}
return refreshBuddy(getTimeLeft(), eventId, timeout);
} | [
"public",
"boolean",
"refreshBuddy",
"(",
"String",
"eventId",
",",
"long",
"timeout",
")",
"{",
"if",
"(",
"parent",
".",
"getBuddyList",
"(",
")",
".",
"get",
"(",
"targetUri",
")",
"==",
"null",
")",
"{",
"setReturnCode",
"(",
"SipSession",
".",
"INVA... | This method is the same as refreshBuddy(duration, eventId, timeout) except that the SUBSCRIBE
duration sent will be however much time is left on the current subscription. If time left on
the subscription <= 0, unsubscribe occurs (note, the buddy stays in the list). | [
"This",
"method",
"is",
"the",
"same",
"as",
"refreshBuddy",
"(",
"duration",
"eventId",
"timeout",
")",
"except",
"that",
"the",
"SUBSCRIBE",
"duration",
"sent",
"will",
"be",
"however",
"much",
"time",
"is",
"left",
"on",
"the",
"current",
"subscription",
... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/PresenceSubscriber.java#L334-L342 |
riversun/string-grabber | src/main/java/org/riversun/string_grabber/StringCropper.java | StringCropper.getBeforeOfWithDetails | public StrPosition getBeforeOfWithDetails(String srcStr, String token) {
final StrPosition retVal = new StrPosition();
if (isBlank(srcStr) || isBlank(token)) {
return retVal;
}
int tokenStartIndex = srcStr.indexOf(token);
if (tokenStartIndex < 0) {
return null;
}
String beforeTokenStr = getLeftOf(srcStr, tokenStartIndex);
retVal.startIndex = 0;
retVal.endIndex = tokenStartIndex - 1;
retVal.str = beforeTokenStr;
return retVal;
} | java | public StrPosition getBeforeOfWithDetails(String srcStr, String token) {
final StrPosition retVal = new StrPosition();
if (isBlank(srcStr) || isBlank(token)) {
return retVal;
}
int tokenStartIndex = srcStr.indexOf(token);
if (tokenStartIndex < 0) {
return null;
}
String beforeTokenStr = getLeftOf(srcStr, tokenStartIndex);
retVal.startIndex = 0;
retVal.endIndex = tokenStartIndex - 1;
retVal.str = beforeTokenStr;
return retVal;
} | [
"public",
"StrPosition",
"getBeforeOfWithDetails",
"(",
"String",
"srcStr",
",",
"String",
"token",
")",
"{",
"final",
"StrPosition",
"retVal",
"=",
"new",
"StrPosition",
"(",
")",
";",
"if",
"(",
"isBlank",
"(",
"srcStr",
")",
"||",
"isBlank",
"(",
"token",... | returns the string that is cropped before token with position-detail-info<br>
@param srcStr
@param token
@return | [
"returns",
"the",
"string",
"that",
"is",
"cropped",
"before",
"token",
"with",
"position",
"-",
"detail",
"-",
"info<br",
">"
] | train | https://github.com/riversun/string-grabber/blob/b5aadc21fe15f50d35392188dec6ab81dcf8d464/src/main/java/org/riversun/string_grabber/StringCropper.java#L232-L253 |
teatrove/teatrove | trove/src/main/java/org/teatrove/trove/classfile/ConstantLongInfo.java | ConstantLongInfo.make | static ConstantLongInfo make(ConstantPool cp, long value) {
ConstantInfo ci = new ConstantLongInfo(value);
return (ConstantLongInfo)cp.addConstant(ci);
} | java | static ConstantLongInfo make(ConstantPool cp, long value) {
ConstantInfo ci = new ConstantLongInfo(value);
return (ConstantLongInfo)cp.addConstant(ci);
} | [
"static",
"ConstantLongInfo",
"make",
"(",
"ConstantPool",
"cp",
",",
"long",
"value",
")",
"{",
"ConstantInfo",
"ci",
"=",
"new",
"ConstantLongInfo",
"(",
"value",
")",
";",
"return",
"(",
"ConstantLongInfo",
")",
"cp",
".",
"addConstant",
"(",
"ci",
")",
... | Will return either a new ConstantLongInfo object or one already in
the constant pool. If it is a new ConstantLongInfo, it will be
inserted into the pool. | [
"Will",
"return",
"either",
"a",
"new",
"ConstantLongInfo",
"object",
"or",
"one",
"already",
"in",
"the",
"constant",
"pool",
".",
"If",
"it",
"is",
"a",
"new",
"ConstantLongInfo",
"it",
"will",
"be",
"inserted",
"into",
"the",
"pool",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ConstantLongInfo.java#L35-L38 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.updateWithOptimisticLockingInternal | @SuppressWarnings("unchecked")
protected <E> E updateWithOptimisticLockingInternal(E entity, PropertyMetadata versionMetadata) {
Transaction transaction = null;
try {
entityManager.executeEntityListeners(CallbackType.PRE_UPDATE, entity);
Entity nativeEntity = (Entity) Marshaller.marshal(entityManager, entity, Intent.UPDATE);
transaction = datastore.newTransaction();
Entity storedNativeEntity = transaction.get(nativeEntity.getKey());
if (storedNativeEntity == null) {
throw new OptimisticLockException(
String.format("Entity does not exist: %s", nativeEntity.getKey()));
}
String versionPropertyName = versionMetadata.getMappedName();
long version = nativeEntity.getLong(versionPropertyName) - 1;
long storedVersion = storedNativeEntity.getLong(versionPropertyName);
if (version != storedVersion) {
throw new OptimisticLockException(
String.format("Expecting version %d, but found %d", version, storedVersion));
}
transaction.update(nativeEntity);
transaction.commit();
E updatedEntity = (E) Unmarshaller.unmarshal(nativeEntity, entity.getClass());
entityManager.executeEntityListeners(CallbackType.POST_UPDATE, updatedEntity);
return updatedEntity;
} catch (DatastoreException exp) {
throw DatastoreUtils.wrap(exp);
} finally {
rollbackIfActive(transaction);
}
} | java | @SuppressWarnings("unchecked")
protected <E> E updateWithOptimisticLockingInternal(E entity, PropertyMetadata versionMetadata) {
Transaction transaction = null;
try {
entityManager.executeEntityListeners(CallbackType.PRE_UPDATE, entity);
Entity nativeEntity = (Entity) Marshaller.marshal(entityManager, entity, Intent.UPDATE);
transaction = datastore.newTransaction();
Entity storedNativeEntity = transaction.get(nativeEntity.getKey());
if (storedNativeEntity == null) {
throw new OptimisticLockException(
String.format("Entity does not exist: %s", nativeEntity.getKey()));
}
String versionPropertyName = versionMetadata.getMappedName();
long version = nativeEntity.getLong(versionPropertyName) - 1;
long storedVersion = storedNativeEntity.getLong(versionPropertyName);
if (version != storedVersion) {
throw new OptimisticLockException(
String.format("Expecting version %d, but found %d", version, storedVersion));
}
transaction.update(nativeEntity);
transaction.commit();
E updatedEntity = (E) Unmarshaller.unmarshal(nativeEntity, entity.getClass());
entityManager.executeEntityListeners(CallbackType.POST_UPDATE, updatedEntity);
return updatedEntity;
} catch (DatastoreException exp) {
throw DatastoreUtils.wrap(exp);
} finally {
rollbackIfActive(transaction);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"E",
">",
"E",
"updateWithOptimisticLockingInternal",
"(",
"E",
"entity",
",",
"PropertyMetadata",
"versionMetadata",
")",
"{",
"Transaction",
"transaction",
"=",
"null",
";",
"try",
"{",
"entit... | Worker method for updating the given entity with optimistic locking.
@param entity
the entity to update
@param versionMetadata
the metadata for optimistic locking
@return the updated entity | [
"Worker",
"method",
"for",
"updating",
"the",
"given",
"entity",
"with",
"optimistic",
"locking",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L257-L286 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/PairwiseSetOperations.java | PairwiseSetOperations.aNotB | public static CompactSketch aNotB(final Sketch skA, final Sketch skB) {
if ((skA == null) && (skB == null)) { return null; }
final short seedHash = (skA == null) ? skB.getSeedHash() : skA.getSeedHash();
final HeapAnotB anotb = new HeapAnotB(seedHash);
return anotb.aNotB(skA, skB, true, null);
} | java | public static CompactSketch aNotB(final Sketch skA, final Sketch skB) {
if ((skA == null) && (skB == null)) { return null; }
final short seedHash = (skA == null) ? skB.getSeedHash() : skA.getSeedHash();
final HeapAnotB anotb = new HeapAnotB(seedHash);
return anotb.aNotB(skA, skB, true, null);
} | [
"public",
"static",
"CompactSketch",
"aNotB",
"(",
"final",
"Sketch",
"skA",
",",
"final",
"Sketch",
"skB",
")",
"{",
"if",
"(",
"(",
"skA",
"==",
"null",
")",
"&&",
"(",
"skB",
"==",
"null",
")",
")",
"{",
"return",
"null",
";",
"}",
"final",
"sho... | This implements a stateless, pair-wise <i>A AND NOT B</i> operation on Sketches
that are either Heap-based or Direct.
If both inputs are null a null is returned.
@param skA The first Sketch argument.
@param skB The second Sketch argument.
@return the result as an ordered CompactSketch on the heap. | [
"This",
"implements",
"a",
"stateless",
"pair",
"-",
"wise",
"<i",
">",
"A",
"AND",
"NOT",
"B<",
"/",
"i",
">",
"operation",
"on",
"Sketches",
"that",
"are",
"either",
"Heap",
"-",
"based",
"or",
"Direct",
".",
"If",
"both",
"inputs",
"are",
"null",
... | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/PairwiseSetOperations.java#L51-L56 |
imsweb/naaccr-xml | src/main/java/com/imsweb/naaccrxml/runtime/RuntimeNaaccrDictionary.java | RuntimeNaaccrDictionary.computeId | public static String computeId(String recordType, NaaccrDictionary baseDictionary, Collection<NaaccrDictionary> userDictionaries) {
if (baseDictionary == null)
return recordType;
StringBuilder buf = new StringBuilder(recordType);
buf.append(";").append(baseDictionary.getDictionaryUri());
if (userDictionaries != null)
for (NaaccrDictionary userDictionary : userDictionaries)
if (userDictionary != null)
buf.append(";").append(userDictionary.getDictionaryUri());
return buf.toString();
} | java | public static String computeId(String recordType, NaaccrDictionary baseDictionary, Collection<NaaccrDictionary> userDictionaries) {
if (baseDictionary == null)
return recordType;
StringBuilder buf = new StringBuilder(recordType);
buf.append(";").append(baseDictionary.getDictionaryUri());
if (userDictionaries != null)
for (NaaccrDictionary userDictionary : userDictionaries)
if (userDictionary != null)
buf.append(";").append(userDictionary.getDictionaryUri());
return buf.toString();
} | [
"public",
"static",
"String",
"computeId",
"(",
"String",
"recordType",
",",
"NaaccrDictionary",
"baseDictionary",
",",
"Collection",
"<",
"NaaccrDictionary",
">",
"userDictionaries",
")",
"{",
"if",
"(",
"baseDictionary",
"==",
"null",
")",
"return",
"recordType",
... | Helper method to compute an ID for a runtime dictionary based on the URI of its base and user dictionaries.
@param baseDictionary base dictionary (required)
@param userDictionaries user-defined dictionaries (optional, can be null or empty)
@return computed runtime dictionary ID, never null | [
"Helper",
"method",
"to",
"compute",
"an",
"ID",
"for",
"a",
"runtime",
"dictionary",
"based",
"on",
"the",
"URI",
"of",
"its",
"base",
"and",
"user",
"dictionaries",
"."
] | train | https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/runtime/RuntimeNaaccrDictionary.java#L124-L135 |
qiujuer/Genius-Android | caprice/kit-handler/src/main/java/net/qiujuer/genius/kit/handler/Run.java | Run.onUiAsync | public static Result onUiAsync(Action action) {
if (Looper.myLooper() == Looper.getMainLooper()) {
action.call();
return new ActionAsyncTask(action, true);
}
ActionAsyncTask task = new ActionAsyncTask(action);
getUiPoster().async(task);
return task;
} | java | public static Result onUiAsync(Action action) {
if (Looper.myLooper() == Looper.getMainLooper()) {
action.call();
return new ActionAsyncTask(action, true);
}
ActionAsyncTask task = new ActionAsyncTask(action);
getUiPoster().async(task);
return task;
} | [
"public",
"static",
"Result",
"onUiAsync",
"(",
"Action",
"action",
")",
"{",
"if",
"(",
"Looper",
".",
"myLooper",
"(",
")",
"==",
"Looper",
".",
"getMainLooper",
"(",
")",
")",
"{",
"action",
".",
"call",
"(",
")",
";",
"return",
"new",
"ActionAsyncT... | Asynchronously
The current thread asynchronous run relative to the main thread,
not blocking the current thread
@param action Action Interface | [
"Asynchronously",
"The",
"current",
"thread",
"asynchronous",
"run",
"relative",
"to",
"the",
"main",
"thread",
"not",
"blocking",
"the",
"current",
"thread"
] | train | https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/kit-handler/src/main/java/net/qiujuer/genius/kit/handler/Run.java#L134-L142 |
samskivert/samskivert | src/main/java/com/samskivert/util/BaseArrayList.java | BaseArrayList.rangeCheck | protected final void rangeCheck (int index, boolean insert)
{
if ((index < 0) || (insert ? (index > _size) : (index >= _size))) {
throw new IndexOutOfBoundsException(
"Index: " + index + ", Size: " + _size);
}
} | java | protected final void rangeCheck (int index, boolean insert)
{
if ((index < 0) || (insert ? (index > _size) : (index >= _size))) {
throw new IndexOutOfBoundsException(
"Index: " + index + ", Size: " + _size);
}
} | [
"protected",
"final",
"void",
"rangeCheck",
"(",
"int",
"index",
",",
"boolean",
"insert",
")",
"{",
"if",
"(",
"(",
"index",
"<",
"0",
")",
"||",
"(",
"insert",
"?",
"(",
"index",
">",
"_size",
")",
":",
"(",
"index",
">=",
"_size",
")",
")",
")... | Check the range of a passed-in index to make sure it's valid.
@param insert if true, an index equal to our size is valid. | [
"Check",
"the",
"range",
"of",
"a",
"passed",
"-",
"in",
"index",
"to",
"make",
"sure",
"it",
"s",
"valid",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/BaseArrayList.java#L153-L159 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/FilterExprIteratorSimple.java | FilterExprIteratorSimple.setRoot | public void setRoot(int context, Object environment)
{
super.setRoot(context, environment);
m_exprObj = executeFilterExpr(context, m_execContext, getPrefixResolver(),
getIsTopLevel(), m_stackFrame, m_expr);
} | java | public void setRoot(int context, Object environment)
{
super.setRoot(context, environment);
m_exprObj = executeFilterExpr(context, m_execContext, getPrefixResolver(),
getIsTopLevel(), m_stackFrame, m_expr);
} | [
"public",
"void",
"setRoot",
"(",
"int",
"context",
",",
"Object",
"environment",
")",
"{",
"super",
".",
"setRoot",
"(",
"context",
",",
"environment",
")",
";",
"m_exprObj",
"=",
"executeFilterExpr",
"(",
"context",
",",
"m_execContext",
",",
"getPrefixResol... | Initialize the context values for this expression
after it is cloned.
@param context The XPath runtime context for this
transformation. | [
"Initialize",
"the",
"context",
"values",
"for",
"this",
"expression",
"after",
"it",
"is",
"cloned",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/FilterExprIteratorSimple.java#L76-L81 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/core/util/ResourceUtil.java | ResourceUtil.isWriteEnabled | public static boolean isWriteEnabled(Resource resource, String relPath) throws RepositoryException {
ResourceResolver resolver = resource.getResourceResolver();
Session session = resolver.adaptTo(Session.class);
AccessControlManager accessManager = AccessControlUtil.getAccessControlManager(session);
String resourcePath = resource.getPath();
Privilege[] addPrivileges = new Privilege[]{
accessManager.privilegeFromName(Privilege.JCR_ADD_CHILD_NODES)
};
boolean result = accessManager.hasPrivileges(resourcePath, addPrivileges);
if (StringUtils.isNotBlank(relPath)) {
if (!resourcePath.endsWith("/")) {
resourcePath += "/";
}
resourcePath += relPath;
}
Privilege[] changePrivileges = new Privilege[]{
accessManager.privilegeFromName(Privilege.JCR_MODIFY_PROPERTIES)
};
try {
result = result && accessManager.hasPrivileges(resourcePath, changePrivileges);
} catch (PathNotFoundException pnfex) {
// ok, let's create it
}
return result;
} | java | public static boolean isWriteEnabled(Resource resource, String relPath) throws RepositoryException {
ResourceResolver resolver = resource.getResourceResolver();
Session session = resolver.adaptTo(Session.class);
AccessControlManager accessManager = AccessControlUtil.getAccessControlManager(session);
String resourcePath = resource.getPath();
Privilege[] addPrivileges = new Privilege[]{
accessManager.privilegeFromName(Privilege.JCR_ADD_CHILD_NODES)
};
boolean result = accessManager.hasPrivileges(resourcePath, addPrivileges);
if (StringUtils.isNotBlank(relPath)) {
if (!resourcePath.endsWith("/")) {
resourcePath += "/";
}
resourcePath += relPath;
}
Privilege[] changePrivileges = new Privilege[]{
accessManager.privilegeFromName(Privilege.JCR_MODIFY_PROPERTIES)
};
try {
result = result && accessManager.hasPrivileges(resourcePath, changePrivileges);
} catch (PathNotFoundException pnfex) {
// ok, let's create it
}
return result;
} | [
"public",
"static",
"boolean",
"isWriteEnabled",
"(",
"Resource",
"resource",
",",
"String",
"relPath",
")",
"throws",
"RepositoryException",
"{",
"ResourceResolver",
"resolver",
"=",
"resource",
".",
"getResourceResolver",
"(",
")",
";",
"Session",
"session",
"=",
... | Checks the access control policies for enabled changes (node creation and property change).
@param resource
@param relPath
@return
@throws RepositoryException | [
"Checks",
"the",
"access",
"control",
"policies",
"for",
"enabled",
"changes",
"(",
"node",
"creation",
"and",
"property",
"change",
")",
"."
] | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/ResourceUtil.java#L399-L427 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java | SphereUtil.cosineFormulaDeg | public static double cosineFormulaDeg(double lat1, double lon1, double lat2, double lon2) {
return cosineFormulaRad(deg2rad(lat1), deg2rad(lon1), deg2rad(lat2), deg2rad(lon2));
} | java | public static double cosineFormulaDeg(double lat1, double lon1, double lat2, double lon2) {
return cosineFormulaRad(deg2rad(lat1), deg2rad(lon1), deg2rad(lat2), deg2rad(lon2));
} | [
"public",
"static",
"double",
"cosineFormulaDeg",
"(",
"double",
"lat1",
",",
"double",
"lon1",
",",
"double",
"lat2",
",",
"double",
"lon2",
")",
"{",
"return",
"cosineFormulaRad",
"(",
"deg2rad",
"(",
"lat1",
")",
",",
"deg2rad",
"(",
"lon1",
")",
",",
... | Compute the approximate great-circle distance of two points using the
Haversine formula
<p>
Complexity: 6 trigonometric functions.
<p>
Reference:
<p>
R. W. Sinnott,<br>
Virtues of the Haversine<br>
Sky and Telescope 68(2)
@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 on unit sphere | [
"Compute",
"the",
"approximate",
"great",
"-",
"circle",
"distance",
"of",
"two",
"points",
"using",
"the",
"Haversine",
"formula",
"<p",
">",
"Complexity",
":",
"6",
"trigonometric",
"functions",
".",
"<p",
">",
"Reference",
":",
"<p",
">",
"R",
".",
"W",... | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L100-L102 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getGeoInterface | public synchronized GeoInterface getGeoInterface() {
if (geoInterface == null) {
geoInterface = new GeoInterface(apiKey, sharedSecret, transport);
}
return geoInterface;
} | java | public synchronized GeoInterface getGeoInterface() {
if (geoInterface == null) {
geoInterface = new GeoInterface(apiKey, sharedSecret, transport);
}
return geoInterface;
} | [
"public",
"synchronized",
"GeoInterface",
"getGeoInterface",
"(",
")",
"{",
"if",
"(",
"geoInterface",
"==",
"null",
")",
"{",
"geoInterface",
"=",
"new",
"GeoInterface",
"(",
"apiKey",
",",
"sharedSecret",
",",
"transport",
")",
";",
"}",
"return",
"geoInterf... | Get the geo interface.
@return Access class to the flickr.photos.geo methods. | [
"Get",
"the",
"geo",
"interface",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L124-L129 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_cron_POST | public String serviceName_cron_POST(String serviceName, String command, String description, String email, String frequency, OvhLanguageEnum language, net.minidev.ovh.api.hosting.web.cron.OvhStatusEnum status) throws IOException {
String qPath = "/hosting/web/{serviceName}/cron";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "command", command);
addBody(o, "description", description);
addBody(o, "email", email);
addBody(o, "frequency", frequency);
addBody(o, "language", language);
addBody(o, "status", status);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, String.class);
} | java | public String serviceName_cron_POST(String serviceName, String command, String description, String email, String frequency, OvhLanguageEnum language, net.minidev.ovh.api.hosting.web.cron.OvhStatusEnum status) throws IOException {
String qPath = "/hosting/web/{serviceName}/cron";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "command", command);
addBody(o, "description", description);
addBody(o, "email", email);
addBody(o, "frequency", frequency);
addBody(o, "language", language);
addBody(o, "status", status);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, String.class);
} | [
"public",
"String",
"serviceName_cron_POST",
"(",
"String",
"serviceName",
",",
"String",
"command",
",",
"String",
"description",
",",
"String",
"email",
",",
"String",
"frequency",
",",
"OvhLanguageEnum",
"language",
",",
"net",
".",
"minidev",
".",
"ovh",
"."... | Create new cron
REST: POST /hosting/web/{serviceName}/cron
@param status [required] Cron status
@param language [required] Cron language
@param command [required] Command to execute
@param description [required] Description field for you
@param email [required] Email used to receive error log ( stderr )
@param frequency [required] Frequency ( crontab format ) define for the script ( minutes are ignored )
@param serviceName [required] The internal name of your hosting | [
"Create",
"new",
"cron"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2148-L2160 |
googlearchive/firebase-simple-login-java | src/main/java/com/firebase/simplelogin/SimpleLogin.java | SimpleLogin.loginWithGoogle | public void loginWithGoogle(final String accessToken, final SimpleLoginAuthenticatedHandler completionHandler) {
if(accessToken == null) {
handleInvalidInvalidToken(completionHandler);
}
else {
HashMap<String, String> data = new HashMap<String, String>();
data.put("access_token", accessToken);
loginWithToken(Constants.FIREBASE_AUTH_GOOGLE_PATH, Provider.GOOGLE, data, completionHandler);
}
} | java | public void loginWithGoogle(final String accessToken, final SimpleLoginAuthenticatedHandler completionHandler) {
if(accessToken == null) {
handleInvalidInvalidToken(completionHandler);
}
else {
HashMap<String, String> data = new HashMap<String, String>();
data.put("access_token", accessToken);
loginWithToken(Constants.FIREBASE_AUTH_GOOGLE_PATH, Provider.GOOGLE, data, completionHandler);
}
} | [
"public",
"void",
"loginWithGoogle",
"(",
"final",
"String",
"accessToken",
",",
"final",
"SimpleLoginAuthenticatedHandler",
"completionHandler",
")",
"{",
"if",
"(",
"accessToken",
"==",
"null",
")",
"{",
"handleInvalidInvalidToken",
"(",
"completionHandler",
")",
";... | Login to Firebase using a Google access token. The returned FirebaseSimpleLoginUser object will contain pertinent
Google data accessible with getThirdPartyUserData().
@param accessToken Access token returned by Facebook SDK.
@param completionHandler Handler for asynchronous events. | [
"Login",
"to",
"Firebase",
"using",
"a",
"Google",
"access",
"token",
".",
"The",
"returned",
"FirebaseSimpleLoginUser",
"object",
"will",
"contain",
"pertinent",
"Google",
"data",
"accessible",
"with",
"getThirdPartyUserData",
"()",
"."
] | train | https://github.com/googlearchive/firebase-simple-login-java/blob/40498ad173b5fa69c869ba0d29cec187271fda13/src/main/java/com/firebase/simplelogin/SimpleLogin.java#L678-L688 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/core/query/Criteria.java | Criteria.near | public Criteria near(Point location, @Nullable Distance distance) {
Assert.notNull(location, "Location must not be 'null' for near criteria.");
assertPositiveDistanceValue(distance);
predicates.add(
new Predicate(OperationKey.NEAR, new Object[] { location, distance != null ? distance : new Distance(0) }));
return this;
} | java | public Criteria near(Point location, @Nullable Distance distance) {
Assert.notNull(location, "Location must not be 'null' for near criteria.");
assertPositiveDistanceValue(distance);
predicates.add(
new Predicate(OperationKey.NEAR, new Object[] { location, distance != null ? distance : new Distance(0) }));
return this;
} | [
"public",
"Criteria",
"near",
"(",
"Point",
"location",
",",
"@",
"Nullable",
"Distance",
"distance",
")",
"{",
"Assert",
".",
"notNull",
"(",
"location",
",",
"\"Location must not be 'null' for near criteria.\"",
")",
";",
"assertPositiveDistanceValue",
"(",
"distanc... | Creates new {@link Predicate} for {@code !bbox} for a specified distance. The difference between this and
{@code within} is this is approximate while {@code within} is exact.
@param location
@param distance
@return
@throws IllegalArgumentException if location is null
@throws InvalidDataAccessApiUsageException if distance is negative | [
"Creates",
"new",
"{",
"@link",
"Predicate",
"}",
"for",
"{",
"@code",
"!bbox",
"}",
"for",
"a",
"specified",
"distance",
".",
"The",
"difference",
"between",
"this",
"and",
"{",
"@code",
"within",
"}",
"is",
"this",
"is",
"approximate",
"while",
"{",
"@... | train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L542-L549 |
bluelinelabs/Conductor | conductor/src/main/java/com/bluelinelabs/conductor/changehandler/SharedElementTransitionChangeHandler.java | SharedElementTransitionChangeHandler.addSharedElement | protected final void addSharedElement(@NonNull View sharedElement, @NonNull String toName) {
String transitionName = sharedElement.getTransitionName();
if (transitionName == null) {
throw new IllegalArgumentException("Unique transitionNames are required for all sharedElements");
}
sharedElementNames.put(transitionName, toName);
} | java | protected final void addSharedElement(@NonNull View sharedElement, @NonNull String toName) {
String transitionName = sharedElement.getTransitionName();
if (transitionName == null) {
throw new IllegalArgumentException("Unique transitionNames are required for all sharedElements");
}
sharedElementNames.put(transitionName, toName);
} | [
"protected",
"final",
"void",
"addSharedElement",
"(",
"@",
"NonNull",
"View",
"sharedElement",
",",
"@",
"NonNull",
"String",
"toName",
")",
"{",
"String",
"transitionName",
"=",
"sharedElement",
".",
"getTransitionName",
"(",
")",
";",
"if",
"(",
"transitionNa... | Used to register an element that will take part in the shared element transition. Maps the name used in the
"from" view to the name used in the "to" view if they are not the same.
@param sharedElement The view from the "from" view that will take part in the shared element transition
@param toName The transition name used in the "to" view | [
"Used",
"to",
"register",
"an",
"element",
"that",
"will",
"take",
"part",
"in",
"the",
"shared",
"element",
"transition",
".",
"Maps",
"the",
"name",
"used",
"in",
"the",
"from",
"view",
"to",
"the",
"name",
"used",
"in",
"the",
"to",
"view",
"if",
"t... | train | https://github.com/bluelinelabs/Conductor/blob/94c9121bb16f93b481954513a8e3905846829fb2/conductor/src/main/java/com/bluelinelabs/conductor/changehandler/SharedElementTransitionChangeHandler.java#L574-L580 |
messagebird/java-rest-api | api/src/main/java/com/messagebird/MessageBirdClient.java | MessageBirdClient.sendVoiceMessage | public VoiceMessageResponse sendVoiceMessage(final String body, final List<BigInteger> recipients) throws UnauthorizedException, GeneralException {
final VoiceMessage message = new VoiceMessage(body, recipients);
return messageBirdService.sendPayLoad(VOICEMESSAGESPATH, message, VoiceMessageResponse.class);
} | java | public VoiceMessageResponse sendVoiceMessage(final String body, final List<BigInteger> recipients) throws UnauthorizedException, GeneralException {
final VoiceMessage message = new VoiceMessage(body, recipients);
return messageBirdService.sendPayLoad(VOICEMESSAGESPATH, message, VoiceMessageResponse.class);
} | [
"public",
"VoiceMessageResponse",
"sendVoiceMessage",
"(",
"final",
"String",
"body",
",",
"final",
"List",
"<",
"BigInteger",
">",
"recipients",
")",
"throws",
"UnauthorizedException",
",",
"GeneralException",
"{",
"final",
"VoiceMessage",
"message",
"=",
"new",
"V... | Convenient function to send a simple message to a list of recipients
@param body Body of the message
@param recipients List of recipients
@return VoiceMessageResponse
@throws UnauthorizedException if client is unauthorized
@throws GeneralException general exception | [
"Convenient",
"function",
"to",
"send",
"a",
"simple",
"message",
"to",
"a",
"list",
"of",
"recipients"
] | train | https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L273-L276 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/UsersApi.java | UsersApi.getUsersAsync | public com.squareup.okhttp.Call getUsersAsync(String searchTerm, BigDecimal groupId, String sort, String sortBy, BigDecimal limit, BigDecimal offset, String channels, final ApiCallback<ApiSuccessResponse> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getUsersValidateBeforeCall(searchTerm, groupId, sort, sortBy, limit, offset, channels, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | java | public com.squareup.okhttp.Call getUsersAsync(String searchTerm, BigDecimal groupId, String sort, String sortBy, BigDecimal limit, BigDecimal offset, String channels, final ApiCallback<ApiSuccessResponse> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getUsersValidateBeforeCall(searchTerm, groupId, sort, sortBy, limit, offset, channels, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"getUsersAsync",
"(",
"String",
"searchTerm",
",",
"BigDecimal",
"groupId",
",",
"String",
"sort",
",",
"String",
"sortBy",
",",
"BigDecimal",
"limit",
",",
"BigDecimal",
"offset",
",",
"String",
... | Search for users. (asynchronously)
Search for users with the specified filters.
@param searchTerm The text to search. (optional)
@param groupId The ID of the group where the user belongs. (optional)
@param sort The sort order, either `asc` (ascending) or `desc` (descending). The default is `asc`. (optional)
@param sortBy The sort order by criteria, either comma-separated list of criteria. Possible ccriteria 'firstName', 'lastName', 'userName'. The default is `firstName,lastName`. (optional)
@param limit Number of results to return. The default value is 100. (optional)
@param offset The offset to start from in the results. The default value is 0. (optional)
@param channels List of restricted channel, either comma-separated list of channels. If channels is not defined all available channels are returned. (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"Search",
"for",
"users",
".",
"(",
"asynchronously",
")",
"Search",
"for",
"users",
"with",
"the",
"specified",
"filters",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UsersApi.java#L190-L215 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java | MethodBuilder.buildMethodDoc | public void buildMethodDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
if (writer == null) {
return;
}
if (hasMembersToDocument()) {
Content methodDetailsTree = writer.getMethodDetailsTreeHeader(typeElement,
memberDetailsTree);
Element lastElement = methods.get(methods.size() - 1);
for (Element method : methods) {
currentMethod = (ExecutableElement)method;
Content methodDocTree = writer.getMethodDocTreeHeader(currentMethod, methodDetailsTree);
buildChildren(node, methodDocTree);
methodDetailsTree.addContent(writer.getMethodDoc(
methodDocTree, currentMethod == lastElement));
}
memberDetailsTree.addContent(writer.getMethodDetails(methodDetailsTree));
}
} | java | public void buildMethodDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
if (writer == null) {
return;
}
if (hasMembersToDocument()) {
Content methodDetailsTree = writer.getMethodDetailsTreeHeader(typeElement,
memberDetailsTree);
Element lastElement = methods.get(methods.size() - 1);
for (Element method : methods) {
currentMethod = (ExecutableElement)method;
Content methodDocTree = writer.getMethodDocTreeHeader(currentMethod, methodDetailsTree);
buildChildren(node, methodDocTree);
methodDetailsTree.addContent(writer.getMethodDoc(
methodDocTree, currentMethod == lastElement));
}
memberDetailsTree.addContent(writer.getMethodDetails(methodDetailsTree));
}
} | [
"public",
"void",
"buildMethodDoc",
"(",
"XMLNode",
"node",
",",
"Content",
"memberDetailsTree",
")",
"throws",
"DocletException",
"{",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"hasMembersToDocument",
"(",
")",
")",
"{",
... | Build the method documentation.
@param node the XML element that specifies which components to document
@param memberDetailsTree the content tree to which the documentation will be added
@throws DocletException if there is a problem while building the documentation | [
"Build",
"the",
"method",
"documentation",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java#L139-L157 |
mokies/ratelimitj | ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java | RequestLimitRule.matchingKeys | public RequestLimitRule matchingKeys(Set<String> keys) {
return new RequestLimitRule(this.durationSeconds, this.limit, this.precision, this.name, keys);
} | java | public RequestLimitRule matchingKeys(Set<String> keys) {
return new RequestLimitRule(this.durationSeconds, this.limit, this.precision, this.name, keys);
} | [
"public",
"RequestLimitRule",
"matchingKeys",
"(",
"Set",
"<",
"String",
">",
"keys",
")",
"{",
"return",
"new",
"RequestLimitRule",
"(",
"this",
".",
"durationSeconds",
",",
"this",
".",
"limit",
",",
"this",
".",
"precision",
",",
"this",
".",
"name",
",... | Applies a key to the rate limit that defines to which keys, the rule applies, null for any unmatched key.
@param keys Defines a set of keys to which the rule applies.
@return a limit rule | [
"Applies",
"a",
"key",
"to",
"the",
"rate",
"limit",
"that",
"defines",
"to",
"which",
"keys",
"the",
"rule",
"applies",
"null",
"for",
"any",
"unmatched",
"key",
"."
] | train | https://github.com/mokies/ratelimitj/blob/eb15ec42055c46b2b3f6f84131d86f570e489c32/ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java#L102-L104 |
jbundle/jcalendarbutton | src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java | JCalendarPopup.createCalendarPopup | public static JCalendarPopup createCalendarPopup(Date dateTarget, Component button)
{
return JCalendarPopup.createCalendarPopup(null, dateTarget, button, null);
} | java | public static JCalendarPopup createCalendarPopup(Date dateTarget, Component button)
{
return JCalendarPopup.createCalendarPopup(null, dateTarget, button, null);
} | [
"public",
"static",
"JCalendarPopup",
"createCalendarPopup",
"(",
"Date",
"dateTarget",
",",
"Component",
"button",
")",
"{",
"return",
"JCalendarPopup",
".",
"createCalendarPopup",
"(",
"null",
",",
"dateTarget",
",",
"button",
",",
"null",
")",
";",
"}"
] | Create this calendar in a popup menu and synchronize the text field on change.
@param dateTarget The initial date for this button.
@param button The calling button. | [
"Create",
"this",
"calendar",
"in",
"a",
"popup",
"menu",
"and",
"synchronize",
"the",
"text",
"field",
"on",
"change",
"."
] | train | https://github.com/jbundle/jcalendarbutton/blob/2944e6a0b634b83768d5c0b7b4a2898176421403/src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java#L572-L575 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getToString | @Nullable
public static String getToString (@Nullable final Object aObject, @Nullable final String sNullValue)
{
return aObject == null ? sNullValue : aObject.toString ();
} | java | @Nullable
public static String getToString (@Nullable final Object aObject, @Nullable final String sNullValue)
{
return aObject == null ? sNullValue : aObject.toString ();
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getToString",
"(",
"@",
"Nullable",
"final",
"Object",
"aObject",
",",
"@",
"Nullable",
"final",
"String",
"sNullValue",
")",
"{",
"return",
"aObject",
"==",
"null",
"?",
"sNullValue",
":",
"aObject",
".",
"toS... | Convert the passed object to a string using the {@link Object#toString()}
method or otherwise return the passed default value.
@param aObject
The value to be converted. May be <code>null</code>.
@param sNullValue
The value to be returned in case the passed object is
<code>null</code>. May be <code>null</code> itself.
@return The passed default value in case the passed object was
<code>null</code> or the result of {@link Object#toString()} on the
passed object.
@see Object#toString() | [
"Convert",
"the",
"passed",
"object",
"to",
"a",
"string",
"using",
"the",
"{",
"@link",
"Object#toString",
"()",
"}",
"method",
"or",
"otherwise",
"return",
"the",
"passed",
"default",
"value",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L4636-L4640 |
stapler/stapler | core/src/main/java/org/kohsuke/stapler/Stapler.java | Stapler.invoke | void invoke(RequestImpl req, ResponseImpl rsp, Object node ) throws IOException, ServletException {
if(node==null) {
// node is null
if(!Dispatcher.isTraceEnabled(req)) {
rsp.sendError(SC_NOT_FOUND);
} else {
// show error page
rsp.setStatus(SC_NOT_FOUND);
rsp.setContentType("text/html;charset=UTF-8");
PrintWriter w = rsp.getWriter();
w.println("<html><body>");
w.println("<h1>404 Not Found</h1>");
w.println("<p>Stapler processed this HTTP request as follows, but couldn't find the resource to consume the request");
w.println("<pre>");
EvaluationTrace.get(req).printHtml(w);
w.println("<font color=red>-> unexpected null!</font>");
w.println("</pre>");
w.println("<p>If this 404 is unexpected, double check the last part of the trace to see if it should have evaluated to null.");
w.println("</body></html>");
}
return;
}
if (tryInvoke(req,rsp,node))
return; // done
// we really run out of options.
if(!Dispatcher.isTraceEnabled(req)) {
rsp.sendError(SC_NOT_FOUND);
} else {
// show error page
rsp.setStatus(SC_NOT_FOUND);
rsp.setContentType("text/html;charset=UTF-8");
PrintWriter w = rsp.getWriter();
w.println("<html><body>");
w.println("<h1>404 Not Found</h1>");
w.println("<p>Stapler processed this HTTP request as follows, but couldn't find the resource to consume the request");
w.println("<pre>");
EvaluationTrace.get(req).printHtml(w);
w.printf("<font color=red>-> No matching rule was found on <%s> for \"%s\"</font>\n", escape(node.toString()), req.tokens.assembleOriginalRestOfPath());
w.println("</pre>");
w.printf("<p><%s> has the following URL mappings, in the order of preference:", escape(node.toString()));
w.println("<ol>");
MetaClass metaClass = webApp.getMetaClass(node);
for (Dispatcher d : metaClass.dispatchers) {
w.println("<li>");
w.println(d.toString());
}
w.println("</ol>");
w.println("</body></html>");
}
} | java | void invoke(RequestImpl req, ResponseImpl rsp, Object node ) throws IOException, ServletException {
if(node==null) {
// node is null
if(!Dispatcher.isTraceEnabled(req)) {
rsp.sendError(SC_NOT_FOUND);
} else {
// show error page
rsp.setStatus(SC_NOT_FOUND);
rsp.setContentType("text/html;charset=UTF-8");
PrintWriter w = rsp.getWriter();
w.println("<html><body>");
w.println("<h1>404 Not Found</h1>");
w.println("<p>Stapler processed this HTTP request as follows, but couldn't find the resource to consume the request");
w.println("<pre>");
EvaluationTrace.get(req).printHtml(w);
w.println("<font color=red>-> unexpected null!</font>");
w.println("</pre>");
w.println("<p>If this 404 is unexpected, double check the last part of the trace to see if it should have evaluated to null.");
w.println("</body></html>");
}
return;
}
if (tryInvoke(req,rsp,node))
return; // done
// we really run out of options.
if(!Dispatcher.isTraceEnabled(req)) {
rsp.sendError(SC_NOT_FOUND);
} else {
// show error page
rsp.setStatus(SC_NOT_FOUND);
rsp.setContentType("text/html;charset=UTF-8");
PrintWriter w = rsp.getWriter();
w.println("<html><body>");
w.println("<h1>404 Not Found</h1>");
w.println("<p>Stapler processed this HTTP request as follows, but couldn't find the resource to consume the request");
w.println("<pre>");
EvaluationTrace.get(req).printHtml(w);
w.printf("<font color=red>-> No matching rule was found on <%s> for \"%s\"</font>\n", escape(node.toString()), req.tokens.assembleOriginalRestOfPath());
w.println("</pre>");
w.printf("<p><%s> has the following URL mappings, in the order of preference:", escape(node.toString()));
w.println("<ol>");
MetaClass metaClass = webApp.getMetaClass(node);
for (Dispatcher d : metaClass.dispatchers) {
w.println("<li>");
w.println(d.toString());
}
w.println("</ol>");
w.println("</body></html>");
}
} | [
"void",
"invoke",
"(",
"RequestImpl",
"req",
",",
"ResponseImpl",
"rsp",
",",
"Object",
"node",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"// node is null",
"if",
"(",
"!",
"Dispatcher",
".",
"is... | Try to dispatch the request against the given node, and if it fails, report an error to the client. | [
"Try",
"to",
"dispatch",
"the",
"request",
"against",
"the",
"given",
"node",
"and",
"if",
"it",
"fails",
"report",
"an",
"error",
"to",
"the",
"client",
"."
] | train | https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/core/src/main/java/org/kohsuke/stapler/Stapler.java#L855-L906 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata2/products/SwapAnnuity.java | SwapAnnuity.getSwapAnnuity | public static RandomVariable getSwapAnnuity(TimeDiscretization tenor, DiscountCurveInterface discountCurve) {
return getSwapAnnuity(new RegularSchedule(tenor), discountCurve);
} | java | public static RandomVariable getSwapAnnuity(TimeDiscretization tenor, DiscountCurveInterface discountCurve) {
return getSwapAnnuity(new RegularSchedule(tenor), discountCurve);
} | [
"public",
"static",
"RandomVariable",
"getSwapAnnuity",
"(",
"TimeDiscretization",
"tenor",
",",
"DiscountCurveInterface",
"discountCurve",
")",
"{",
"return",
"getSwapAnnuity",
"(",
"new",
"RegularSchedule",
"(",
"tenor",
")",
",",
"discountCurve",
")",
";",
"}"
] | Function to calculate an (idealized) swap annuity for a given schedule and discount curve.
@param tenor The schedule discretization, i.e., the period start and end dates. End dates are considered payment dates and start of the next period.
@param discountCurve The discount curve.
@return The swap annuity. | [
"Function",
"to",
"calculate",
"an",
"(",
"idealized",
")",
"swap",
"annuity",
"for",
"a",
"given",
"schedule",
"and",
"discount",
"curve",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/products/SwapAnnuity.java#L59-L61 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/TreeGraph.java | TreeGraph.addNodeToIndexMap | public void addNodeToIndexMap(int index, TreeGraphNode node) {
indexMap.put(Integer.valueOf(index), node);
} | java | public void addNodeToIndexMap(int index, TreeGraphNode node) {
indexMap.put(Integer.valueOf(index), node);
} | [
"public",
"void",
"addNodeToIndexMap",
"(",
"int",
"index",
",",
"TreeGraphNode",
"node",
")",
"{",
"indexMap",
".",
"put",
"(",
"Integer",
".",
"valueOf",
"(",
"index",
")",
",",
"node",
")",
";",
"}"
] | Store a mapping from an arbitrary integer index to a node in
this treegraph. Normally a client shouldn't need to use this,
as the nodes are automatically indexed by the
<code>TreeGraph</code> constructor.
@param index the arbitrary integer index
@param node the <code>TreeGraphNode</code> to be indexed | [
"Store",
"a",
"mapping",
"from",
"an",
"arbitrary",
"integer",
"index",
"to",
"a",
"node",
"in",
"this",
"treegraph",
".",
"Normally",
"a",
"client",
"shouldn",
"t",
"need",
"to",
"use",
"this",
"as",
"the",
"nodes",
"are",
"automatically",
"indexed",
"by"... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/TreeGraph.java#L70-L72 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/model/monitor/ServiceLevelAgreement.java | ServiceLevelAgreement.secondsToUnits | public static String secondsToUnits(int seconds, String unit) {
if (unit == null) return String.valueOf(seconds);
else if (unit.equals(INTERVAL_DAYS)) return String.valueOf(Math.round(seconds/86400));
else if (unit.equals(INTERVAL_HOURS)) return String.valueOf(Math.round(seconds/3600));
else if (unit.equals(INTERVAL_MINUTES)) return String.valueOf(Math.round(seconds/60));
else return String.valueOf(seconds);
} | java | public static String secondsToUnits(int seconds, String unit) {
if (unit == null) return String.valueOf(seconds);
else if (unit.equals(INTERVAL_DAYS)) return String.valueOf(Math.round(seconds/86400));
else if (unit.equals(INTERVAL_HOURS)) return String.valueOf(Math.round(seconds/3600));
else if (unit.equals(INTERVAL_MINUTES)) return String.valueOf(Math.round(seconds/60));
else return String.valueOf(seconds);
} | [
"public",
"static",
"String",
"secondsToUnits",
"(",
"int",
"seconds",
",",
"String",
"unit",
")",
"{",
"if",
"(",
"unit",
"==",
"null",
")",
"return",
"String",
".",
"valueOf",
"(",
"seconds",
")",
";",
"else",
"if",
"(",
"unit",
".",
"equals",
"(",
... | Convert seconds to specified units
@param seconds
@param unit
@return | [
"Convert",
"seconds",
"to",
"specified",
"units"
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/model/monitor/ServiceLevelAgreement.java#L83-L89 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/inventory_status.java | inventory_status.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
inventory_status_responses result = (inventory_status_responses) service.get_payload_formatter().string_to_resource(inventory_status_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.inventory_status_response_array);
}
inventory_status[] result_inventory_status = new inventory_status[result.inventory_status_response_array.length];
for(int i = 0; i < result.inventory_status_response_array.length; i++)
{
result_inventory_status[i] = result.inventory_status_response_array[i].inventory_status[0];
}
return result_inventory_status;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
inventory_status_responses result = (inventory_status_responses) service.get_payload_formatter().string_to_resource(inventory_status_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.inventory_status_response_array);
}
inventory_status[] result_inventory_status = new inventory_status[result.inventory_status_response_array.length];
for(int i = 0; i < result.inventory_status_response_array.length; i++)
{
result_inventory_status[i] = result.inventory_status_response_array[i].inventory_status[0];
}
return result_inventory_status;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"inventory_status_responses",
"result",
"=",
"(",
"inventory_status_responses",
")",
"service",
".",
"get_payl... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/inventory_status.java#L323-L340 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-dns/src/main/java/com/google/cloud/dns/DnsException.java | DnsException.translateAndThrow | static DnsException translateAndThrow(RetryHelperException ex) {
BaseServiceException.translate(ex);
throw new DnsException(UNKNOWN_CODE, ex.getMessage(), ex.getCause());
} | java | static DnsException translateAndThrow(RetryHelperException ex) {
BaseServiceException.translate(ex);
throw new DnsException(UNKNOWN_CODE, ex.getMessage(), ex.getCause());
} | [
"static",
"DnsException",
"translateAndThrow",
"(",
"RetryHelperException",
"ex",
")",
"{",
"BaseServiceException",
".",
"translate",
"(",
"ex",
")",
";",
"throw",
"new",
"DnsException",
"(",
"UNKNOWN_CODE",
",",
"ex",
".",
"getMessage",
"(",
")",
",",
"ex",
"... | Translate RetryHelperException to the DnsException that caused the error. This method will
always throw an exception.
@throws DnsException when {@code ex} was caused by a {@code DnsException} | [
"Translate",
"RetryHelperException",
"to",
"the",
"DnsException",
"that",
"caused",
"the",
"error",
".",
"This",
"method",
"will",
"always",
"throw",
"an",
"exception",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dns/src/main/java/com/google/cloud/dns/DnsException.java#L59-L62 |
shibme/jbotstats | src/me/shib/java/lib/jbotstats/AnalyticsBot.java | AnalyticsBot.getChatMember | @Override
public ChatMember getChatMember(ChatId chat_id, long user_id) throws IOException {
AnalyticsData data = new AnalyticsData("getChatMember");
IOException ioException = null;
ChatMember chatMember = null;
data.setValue("chat_id", chat_id);
data.setValue("user_id", user_id);
try {
chatMember = bot.getChatMember(chat_id, user_id);
data.setReturned(chatMember);
} catch (IOException e) {
ioException = e;
data.setIoException(ioException);
}
analyticsWorker.putData(data);
if (ioException != null) {
throw ioException;
}
return chatMember;
} | java | @Override
public ChatMember getChatMember(ChatId chat_id, long user_id) throws IOException {
AnalyticsData data = new AnalyticsData("getChatMember");
IOException ioException = null;
ChatMember chatMember = null;
data.setValue("chat_id", chat_id);
data.setValue("user_id", user_id);
try {
chatMember = bot.getChatMember(chat_id, user_id);
data.setReturned(chatMember);
} catch (IOException e) {
ioException = e;
data.setIoException(ioException);
}
analyticsWorker.putData(data);
if (ioException != null) {
throw ioException;
}
return chatMember;
} | [
"@",
"Override",
"public",
"ChatMember",
"getChatMember",
"(",
"ChatId",
"chat_id",
",",
"long",
"user_id",
")",
"throws",
"IOException",
"{",
"AnalyticsData",
"data",
"=",
"new",
"AnalyticsData",
"(",
"\"getChatMember\"",
")",
";",
"IOException",
"ioException",
"... | Use this method to get information about a member of a chat.
@param chat_id Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
@param user_id Unique identifier of the target user
@return On success, returns a ChatMember object
@throws IOException an exception is thrown in case of any service call failures | [
"Use",
"this",
"method",
"to",
"get",
"information",
"about",
"a",
"member",
"of",
"a",
"chat",
"."
] | train | https://github.com/shibme/jbotstats/blob/ba15c43a0722c2b7fd2a8396852bec787cca7b9d/src/me/shib/java/lib/jbotstats/AnalyticsBot.java#L728-L747 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlClient.java | AptControlClient.initControls | protected ArrayList<AptControlField> initControls()
{
ArrayList<AptControlField> controls = new ArrayList<AptControlField>();
if ( _clientDecl == null || _clientDecl.getFields() == null )
return controls;
Collection<FieldDeclaration> declaredFields = _clientDecl.getFields();
for (FieldDeclaration fieldDecl : declaredFields)
{
if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.bean.Control.class) != null)
controls.add(new AptControlField(this, fieldDecl, _ap));
}
return controls;
} | java | protected ArrayList<AptControlField> initControls()
{
ArrayList<AptControlField> controls = new ArrayList<AptControlField>();
if ( _clientDecl == null || _clientDecl.getFields() == null )
return controls;
Collection<FieldDeclaration> declaredFields = _clientDecl.getFields();
for (FieldDeclaration fieldDecl : declaredFields)
{
if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.bean.Control.class) != null)
controls.add(new AptControlField(this, fieldDecl, _ap));
}
return controls;
} | [
"protected",
"ArrayList",
"<",
"AptControlField",
">",
"initControls",
"(",
")",
"{",
"ArrayList",
"<",
"AptControlField",
">",
"controls",
"=",
"new",
"ArrayList",
"<",
"AptControlField",
">",
"(",
")",
";",
"if",
"(",
"_clientDecl",
"==",
"null",
"||",
"_c... | Initializes the list of ControlFields declared directly by this ControlClient | [
"Initializes",
"the",
"list",
"of",
"ControlFields",
"declared",
"directly",
"by",
"this",
"ControlClient"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlClient.java#L171-L185 |
jingwei/krati | krati-main/src/main/java/krati/core/array/entry/EntryValueLong.java | EntryValueLong.updateArrayFile | @Override
public void updateArrayFile(DataWriter writer, long position) throws IOException {
writer.writeLong(position, val);
} | java | @Override
public void updateArrayFile(DataWriter writer, long position) throws IOException {
writer.writeLong(position, val);
} | [
"@",
"Override",
"public",
"void",
"updateArrayFile",
"(",
"DataWriter",
"writer",
",",
"long",
"position",
")",
"throws",
"IOException",
"{",
"writer",
".",
"writeLong",
"(",
"position",
",",
"val",
")",
";",
"}"
] | Writes this EntryValue at a given position of a data writer.
@param writer
@param position
@throws IOException | [
"Writes",
"this",
"EntryValue",
"at",
"a",
"given",
"position",
"of",
"a",
"data",
"writer",
"."
] | train | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/entry/EntryValueLong.java#L94-L97 |
fcrepo4-labs/fcrepo4-client | fcrepo-client-impl/src/main/java/org/fcrepo/client/utils/RDFSinkFilter.java | RDFSinkFilter.filterTriples | public static Graph filterTriples (
final Iterator<Triple> triples,
final Node... properties) {
final Graph filteredGraph = new RandomOrderGraph(RandomOrderGraph.createDefaultGraph());
final Sink<Triple> graphOutput = new SinkTriplesToGraph(true, filteredGraph);
final RDFSinkFilter rdfFilter = new RDFSinkFilter(graphOutput, properties);
rdfFilter.start();
while (triples.hasNext()) {
final Triple triple = triples.next();
rdfFilter.triple(triple);
}
rdfFilter.finish();
return filteredGraph;
} | java | public static Graph filterTriples (
final Iterator<Triple> triples,
final Node... properties) {
final Graph filteredGraph = new RandomOrderGraph(RandomOrderGraph.createDefaultGraph());
final Sink<Triple> graphOutput = new SinkTriplesToGraph(true, filteredGraph);
final RDFSinkFilter rdfFilter = new RDFSinkFilter(graphOutput, properties);
rdfFilter.start();
while (triples.hasNext()) {
final Triple triple = triples.next();
rdfFilter.triple(triple);
}
rdfFilter.finish();
return filteredGraph;
} | [
"public",
"static",
"Graph",
"filterTriples",
"(",
"final",
"Iterator",
"<",
"Triple",
">",
"triples",
",",
"final",
"Node",
"...",
"properties",
")",
"{",
"final",
"Graph",
"filteredGraph",
"=",
"new",
"RandomOrderGraph",
"(",
"RandomOrderGraph",
".",
"createDe... | Filter the triples
@param triples Iterator of triples
@param properties Properties to include
@return Graph containing the fitlered triples | [
"Filter",
"the",
"triples"
] | train | https://github.com/fcrepo4-labs/fcrepo4-client/blob/21eaf27200c5b2542095f6ebb9dd8ec865b95bbd/fcrepo-client-impl/src/main/java/org/fcrepo/client/utils/RDFSinkFilter.java#L68-L81 |
duracloud/duracloud | syncoptimize/src/main/java/org/duracloud/syncoptimize/SyncOptimizeDriver.java | SyncOptimizeDriver.getOptimalThreads | public int getOptimalThreads(SyncOptimizeConfig syncOptConfig)
throws IOException {
File tempDir = FileUtils.getTempDirectory();
this.dataDir = new File(tempDir, DATA_DIR_NAME);
this.workDir = new File(tempDir, WORK_DIR_NAME);
String prefix = "sync-optimize/" +
InetAddress.getLocalHost().getHostName() + "/";
TestDataHandler dataHandler = new TestDataHandler();
dataHandler.createDirectories(dataDir, workDir);
dataHandler.createTestData(dataDir,
syncOptConfig.getNumFiles(),
syncOptConfig.getSizeFiles());
SyncTestManager testManager =
new SyncTestManager(syncOptConfig, dataDir, workDir,
syncTestStatus, prefix);
int optimalThreads = testManager.runTest();
dataHandler.removeDirectories(dataDir, workDir);
return optimalThreads;
} | java | public int getOptimalThreads(SyncOptimizeConfig syncOptConfig)
throws IOException {
File tempDir = FileUtils.getTempDirectory();
this.dataDir = new File(tempDir, DATA_DIR_NAME);
this.workDir = new File(tempDir, WORK_DIR_NAME);
String prefix = "sync-optimize/" +
InetAddress.getLocalHost().getHostName() + "/";
TestDataHandler dataHandler = new TestDataHandler();
dataHandler.createDirectories(dataDir, workDir);
dataHandler.createTestData(dataDir,
syncOptConfig.getNumFiles(),
syncOptConfig.getSizeFiles());
SyncTestManager testManager =
new SyncTestManager(syncOptConfig, dataDir, workDir,
syncTestStatus, prefix);
int optimalThreads = testManager.runTest();
dataHandler.removeDirectories(dataDir, workDir);
return optimalThreads;
} | [
"public",
"int",
"getOptimalThreads",
"(",
"SyncOptimizeConfig",
"syncOptConfig",
")",
"throws",
"IOException",
"{",
"File",
"tempDir",
"=",
"FileUtils",
".",
"getTempDirectory",
"(",
")",
";",
"this",
".",
"dataDir",
"=",
"new",
"File",
"(",
"tempDir",
",",
"... | Determines the optimal SyncTool thread count value. This value is
discovered by running a series of timed tests and returning the fastest
performer. The results of these tests depend highly on the machine they
are run on, and the capacity of the network available to that machine.
@param syncOptConfig tool configuration
@return optimal thread count
@throws IOException | [
"Determines",
"the",
"optimal",
"SyncTool",
"thread",
"count",
"value",
".",
"This",
"value",
"is",
"discovered",
"by",
"running",
"a",
"series",
"of",
"timed",
"tests",
"and",
"returning",
"the",
"fastest",
"performer",
".",
"The",
"results",
"of",
"these",
... | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/syncoptimize/src/main/java/org/duracloud/syncoptimize/SyncOptimizeDriver.java#L74-L97 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java | GeodesicPosition.toDecimalDegreeString | @Pure
public static String toDecimalDegreeString(double lambda, double phi, boolean useSymbolicDirection) {
final StringBuilder b = new StringBuilder();
final SexagesimalLatitudeAxis latitudeAxis = (phi < 0.) ? SexagesimalLatitudeAxis.SOUTH : SexagesimalLatitudeAxis.NORTH;
final SexagesimalLongitudeAxis longitudeAxis = (lambda < 0.) ? SexagesimalLongitudeAxis.WEST
: SexagesimalLongitudeAxis.EAST;
if (useSymbolicDirection) {
b.append(Locale.getString("D_DEG", Math.abs(phi), Locale.getString(latitudeAxis.name()))); //$NON-NLS-1$
} else {
b.append(Locale.getString("D_DEG", phi, EMPTY_STRING)); //$NON-NLS-1$
}
b.append(" "); //$NON-NLS-1$
if (useSymbolicDirection) {
b.append(Locale.getString("D_DEG", Math.abs(lambda), Locale.getString(longitudeAxis.name()))); //$NON-NLS-1$
} else {
b.append(Locale.getString("D_DEG", lambda, EMPTY_STRING)); //$NON-NLS-1$
}
return b.toString();
} | java | @Pure
public static String toDecimalDegreeString(double lambda, double phi, boolean useSymbolicDirection) {
final StringBuilder b = new StringBuilder();
final SexagesimalLatitudeAxis latitudeAxis = (phi < 0.) ? SexagesimalLatitudeAxis.SOUTH : SexagesimalLatitudeAxis.NORTH;
final SexagesimalLongitudeAxis longitudeAxis = (lambda < 0.) ? SexagesimalLongitudeAxis.WEST
: SexagesimalLongitudeAxis.EAST;
if (useSymbolicDirection) {
b.append(Locale.getString("D_DEG", Math.abs(phi), Locale.getString(latitudeAxis.name()))); //$NON-NLS-1$
} else {
b.append(Locale.getString("D_DEG", phi, EMPTY_STRING)); //$NON-NLS-1$
}
b.append(" "); //$NON-NLS-1$
if (useSymbolicDirection) {
b.append(Locale.getString("D_DEG", Math.abs(lambda), Locale.getString(longitudeAxis.name()))); //$NON-NLS-1$
} else {
b.append(Locale.getString("D_DEG", lambda, EMPTY_STRING)); //$NON-NLS-1$
}
return b.toString();
} | [
"@",
"Pure",
"public",
"static",
"String",
"toDecimalDegreeString",
"(",
"double",
"lambda",
",",
"double",
"phi",
",",
"boolean",
"useSymbolicDirection",
")",
"{",
"final",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"SexagesimalL... | Replies the string representation of the longitude/latitude coordinates
in the Decimal Degree format: coordinate containing only degrees (integer, or real number).
<p>Example: <code>40.446195N 79.948862W</code>
@param lambda is the longitude in degrees.
@param phi is the latitude in degrees.
@param useSymbolicDirection indicates if the directions should be output with there
symbols or if there are represented by the signs of the coordinates.
@return the string representation of the longitude/latitude coordinates. | [
"Replies",
"the",
"string",
"representation",
"of",
"the",
"longitude",
"/",
"latitude",
"coordinates",
"in",
"the",
"Decimal",
"Degree",
"format",
":",
"coordinate",
"containing",
"only",
"degrees",
"(",
"integer",
"or",
"real",
"number",
")",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java#L352-L370 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/search/bingcustomimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/customimagesearch/implementation/BingCustomInstancesImpl.java | BingCustomInstancesImpl.imageSearchWithServiceResponseAsync | public Observable<ServiceResponse<Images>> imageSearchWithServiceResponseAsync(long customConfig, String query, ImageSearchOptionalParameter imageSearchOptionalParameter) {
if (query == null) {
throw new IllegalArgumentException("Parameter query is required and cannot be null.");
}
final String acceptLanguage = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.acceptLanguage() : null;
final String userAgent = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.userAgent() : this.client.userAgent();
final String clientId = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.clientId() : null;
final String clientIp = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.clientIp() : null;
final String location = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.location() : null;
final ImageAspect aspect = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.aspect() : null;
final ImageColor color = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.color() : null;
final String countryCode = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.countryCode() : null;
final Integer count = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.count() : null;
final Freshness freshness = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.freshness() : null;
final Integer height = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.height() : null;
final String id = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.id() : null;
final ImageContent imageContent = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.imageContent() : null;
final ImageType imageType = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.imageType() : null;
final ImageLicense license = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.license() : null;
final String market = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.market() : null;
final Long maxFileSize = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.maxFileSize() : null;
final Long maxHeight = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.maxHeight() : null;
final Long maxWidth = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.maxWidth() : null;
final Long minFileSize = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.minFileSize() : null;
final Long minHeight = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.minHeight() : null;
final Long minWidth = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.minWidth() : null;
final Long offset = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.offset() : null;
final SafeSearch safeSearch = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.safeSearch() : null;
final ImageSize size = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.size() : null;
final String setLang = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.setLang() : null;
final Integer width = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.width() : null;
return imageSearchWithServiceResponseAsync(customConfig, query, acceptLanguage, userAgent, clientId, clientIp, location, aspect, color, countryCode, count, freshness, height, id, imageContent, imageType, license, market, maxFileSize, maxHeight, maxWidth, minFileSize, minHeight, minWidth, offset, safeSearch, size, setLang, width);
} | java | public Observable<ServiceResponse<Images>> imageSearchWithServiceResponseAsync(long customConfig, String query, ImageSearchOptionalParameter imageSearchOptionalParameter) {
if (query == null) {
throw new IllegalArgumentException("Parameter query is required and cannot be null.");
}
final String acceptLanguage = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.acceptLanguage() : null;
final String userAgent = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.userAgent() : this.client.userAgent();
final String clientId = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.clientId() : null;
final String clientIp = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.clientIp() : null;
final String location = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.location() : null;
final ImageAspect aspect = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.aspect() : null;
final ImageColor color = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.color() : null;
final String countryCode = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.countryCode() : null;
final Integer count = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.count() : null;
final Freshness freshness = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.freshness() : null;
final Integer height = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.height() : null;
final String id = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.id() : null;
final ImageContent imageContent = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.imageContent() : null;
final ImageType imageType = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.imageType() : null;
final ImageLicense license = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.license() : null;
final String market = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.market() : null;
final Long maxFileSize = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.maxFileSize() : null;
final Long maxHeight = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.maxHeight() : null;
final Long maxWidth = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.maxWidth() : null;
final Long minFileSize = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.minFileSize() : null;
final Long minHeight = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.minHeight() : null;
final Long minWidth = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.minWidth() : null;
final Long offset = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.offset() : null;
final SafeSearch safeSearch = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.safeSearch() : null;
final ImageSize size = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.size() : null;
final String setLang = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.setLang() : null;
final Integer width = imageSearchOptionalParameter != null ? imageSearchOptionalParameter.width() : null;
return imageSearchWithServiceResponseAsync(customConfig, query, acceptLanguage, userAgent, clientId, clientIp, location, aspect, color, countryCode, count, freshness, height, id, imageContent, imageType, license, market, maxFileSize, maxHeight, maxWidth, minFileSize, minHeight, minWidth, offset, safeSearch, size, setLang, width);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Images",
">",
">",
"imageSearchWithServiceResponseAsync",
"(",
"long",
"customConfig",
",",
"String",
"query",
",",
"ImageSearchOptionalParameter",
"imageSearchOptionalParameter",
")",
"{",
"if",
"(",
"query",
"==",
... | The Custom Image Search API lets you send an image search query to Bing and get image results found in your custom view of the web.
@param customConfig The identifier for the custom search configuration
@param query The user's search query term. The term cannot be empty. The term may contain [Bing Advanced Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to limit images to a specific domain, use the [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help improve relevance of an insights query (see [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)), you should always include the user's query term. Use this parameter only with the Image Search API.Do not specify this parameter when calling the Trending Images API.
@param imageSearchOptionalParameter 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 Images object | [
"The",
"Custom",
"Image",
"Search",
"API",
"lets",
"you",
"send",
"an",
"image",
"search",
"query",
"to",
"Bing",
"and",
"get",
"image",
"results",
"found",
"in",
"your",
"custom",
"view",
"of",
"the",
"web",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingcustomimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/customimagesearch/implementation/BingCustomInstancesImpl.java#L127-L160 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/JSType.java | JSType.getTypesUnderShallowInequality | public TypePair getTypesUnderShallowInequality(JSType that) {
// union types
if (that.isUnionType()) {
TypePair p = that.toMaybeUnionType().getTypesUnderShallowInequality(this);
return new TypePair(p.typeB, p.typeA);
}
// Other types.
// There are only two types whose shallow inequality is deterministically
// true -- null and undefined. We can just enumerate them.
if ((isNullType() && that.isNullType()) || (isVoidType() && that.isVoidType())) {
return new TypePair(null, null);
} else {
return new TypePair(this, that);
}
} | java | public TypePair getTypesUnderShallowInequality(JSType that) {
// union types
if (that.isUnionType()) {
TypePair p = that.toMaybeUnionType().getTypesUnderShallowInequality(this);
return new TypePair(p.typeB, p.typeA);
}
// Other types.
// There are only two types whose shallow inequality is deterministically
// true -- null and undefined. We can just enumerate them.
if ((isNullType() && that.isNullType()) || (isVoidType() && that.isVoidType())) {
return new TypePair(null, null);
} else {
return new TypePair(this, that);
}
} | [
"public",
"TypePair",
"getTypesUnderShallowInequality",
"(",
"JSType",
"that",
")",
"{",
"// union types",
"if",
"(",
"that",
".",
"isUnionType",
"(",
")",
")",
"{",
"TypePair",
"p",
"=",
"that",
".",
"toMaybeUnionType",
"(",
")",
".",
"getTypesUnderShallowInequ... | Computes the subset of {@code this} and {@code that} types under
shallow inequality.
@return A pair containing the restricted type of {@code this} as the first
component and the restricted type of {@code that} as the second
element. The returned pair is never {@code null} even though its
components may be {@code null} | [
"Computes",
"the",
"subset",
"of",
"{",
"@code",
"this",
"}",
"and",
"{",
"@code",
"that",
"}",
"types",
"under",
"shallow",
"inequality",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSType.java#L1433-L1448 |
beders/Resty | src/main/java/us/monoid/json/JSONObject.java | JSONObject.putOpt | public JSONObject putOpt(Enum<?> key, Object value) throws JSONException {
return putOpt(key.name(), value);
} | java | public JSONObject putOpt(Enum<?> key, Object value) throws JSONException {
return putOpt(key.name(), value);
} | [
"public",
"JSONObject",
"putOpt",
"(",
"Enum",
"<",
"?",
">",
"key",
",",
"Object",
"value",
")",
"throws",
"JSONException",
"{",
"return",
"putOpt",
"(",
"key",
".",
"name",
"(",
")",
",",
"value",
")",
";",
"}"
] | Put a key/value pair in the JSONObject, but only if the key and the value
are both non-null.
@param key
A key string.
@param value
An object which is the value. It should be of one of these types:
Boolean, Double, Integer, JSONArray, JSONObject, Long, String, or
the JSONObject.NULL object.
@return this.
@throws JSONException
If the value is a non-finite number. | [
"Put",
"a",
"key",
"/",
"value",
"pair",
"in",
"the",
"JSONObject",
"but",
"only",
"if",
"the",
"key",
"and",
"the",
"value",
"are",
"both",
"non",
"-",
"null",
"."
] | train | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/json/JSONObject.java#L1571-L1573 |
di2e/Argo | PluginFramework/src/main/java/ws/argo/probe/Probe.java | Probe.getCombinedIdentifierList | public LinkedList<ProbeIdEntry> getCombinedIdentifierList() {
LinkedList<ProbeIdEntry> combinedList = new LinkedList<ProbeIdEntry>();
for (String id : this.getProbeWrapper().getServiceContractIDs()) {
combinedList.add(new ProbeIdEntry("scid", id));
}
for (String id : this.getProbeWrapper().getServiceInstanceIDs()) {
combinedList.add(new ProbeIdEntry("siid", id));
}
return combinedList;
} | java | public LinkedList<ProbeIdEntry> getCombinedIdentifierList() {
LinkedList<ProbeIdEntry> combinedList = new LinkedList<ProbeIdEntry>();
for (String id : this.getProbeWrapper().getServiceContractIDs()) {
combinedList.add(new ProbeIdEntry("scid", id));
}
for (String id : this.getProbeWrapper().getServiceInstanceIDs()) {
combinedList.add(new ProbeIdEntry("siid", id));
}
return combinedList;
} | [
"public",
"LinkedList",
"<",
"ProbeIdEntry",
">",
"getCombinedIdentifierList",
"(",
")",
"{",
"LinkedList",
"<",
"ProbeIdEntry",
">",
"combinedList",
"=",
"new",
"LinkedList",
"<",
"ProbeIdEntry",
">",
"(",
")",
";",
"for",
"(",
"String",
"id",
":",
"this",
... | Create and return a LinkedList of a combination of both scids and siids.
This is a method that is used primarily in the creation of split packets.
@return combined LikedList | [
"Create",
"and",
"return",
"a",
"LinkedList",
"of",
"a",
"combination",
"of",
"both",
"scids",
"and",
"siids",
".",
"This",
"is",
"a",
"method",
"that",
"is",
"used",
"primarily",
"in",
"the",
"creation",
"of",
"split",
"packets",
"."
] | train | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/PluginFramework/src/main/java/ws/argo/probe/Probe.java#L283-L293 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/script/Script.java | Script.executeCheckLockTimeVerify | private static void executeCheckLockTimeVerify(Transaction txContainingThis, int index, LinkedList<byte[]> stack, Set<VerifyFlag> verifyFlags) throws ScriptException {
if (stack.size() < 1)
throw new ScriptException(ScriptError.SCRIPT_ERR_INVALID_STACK_OPERATION, "Attempted OP_CHECKLOCKTIMEVERIFY on a stack with size < 1");
// Thus as a special case we tell CScriptNum to accept up
// to 5-byte bignums to avoid year 2038 issue.
final BigInteger nLockTime = castToBigInteger(stack.getLast(), 5, verifyFlags.contains(VerifyFlag.MINIMALDATA));
if (nLockTime.compareTo(BigInteger.ZERO) < 0)
throw new ScriptException(ScriptError.SCRIPT_ERR_NEGATIVE_LOCKTIME, "Negative locktime");
// There are two kinds of nLockTime, need to ensure we're comparing apples-to-apples
if (!(
((txContainingThis.getLockTime() < Transaction.LOCKTIME_THRESHOLD) && (nLockTime.compareTo(Transaction.LOCKTIME_THRESHOLD_BIG)) < 0) ||
((txContainingThis.getLockTime() >= Transaction.LOCKTIME_THRESHOLD) && (nLockTime.compareTo(Transaction.LOCKTIME_THRESHOLD_BIG)) >= 0))
)
throw new ScriptException(ScriptError.SCRIPT_ERR_UNSATISFIED_LOCKTIME, "Locktime requirement type mismatch");
// Now that we know we're comparing apples-to-apples, the
// comparison is a simple numeric one.
if (nLockTime.compareTo(BigInteger.valueOf(txContainingThis.getLockTime())) > 0)
throw new ScriptException(ScriptError.SCRIPT_ERR_UNSATISFIED_LOCKTIME, "Locktime requirement not satisfied");
// Finally the nLockTime feature can be disabled and thus
// CHECKLOCKTIMEVERIFY bypassed if every txin has been
// finalized by setting nSequence to maxint. The
// transaction would be allowed into the blockchain, making
// the opcode ineffective.
//
// Testing if this vin is not final is sufficient to
// prevent this condition. Alternatively we could test all
// inputs, but testing just this input minimizes the data
// required to prove correct CHECKLOCKTIMEVERIFY execution.
if (!txContainingThis.getInput(index).hasSequence())
throw new ScriptException(ScriptError.SCRIPT_ERR_UNSATISFIED_LOCKTIME, "Transaction contains a final transaction input for a CHECKLOCKTIMEVERIFY script.");
} | java | private static void executeCheckLockTimeVerify(Transaction txContainingThis, int index, LinkedList<byte[]> stack, Set<VerifyFlag> verifyFlags) throws ScriptException {
if (stack.size() < 1)
throw new ScriptException(ScriptError.SCRIPT_ERR_INVALID_STACK_OPERATION, "Attempted OP_CHECKLOCKTIMEVERIFY on a stack with size < 1");
// Thus as a special case we tell CScriptNum to accept up
// to 5-byte bignums to avoid year 2038 issue.
final BigInteger nLockTime = castToBigInteger(stack.getLast(), 5, verifyFlags.contains(VerifyFlag.MINIMALDATA));
if (nLockTime.compareTo(BigInteger.ZERO) < 0)
throw new ScriptException(ScriptError.SCRIPT_ERR_NEGATIVE_LOCKTIME, "Negative locktime");
// There are two kinds of nLockTime, need to ensure we're comparing apples-to-apples
if (!(
((txContainingThis.getLockTime() < Transaction.LOCKTIME_THRESHOLD) && (nLockTime.compareTo(Transaction.LOCKTIME_THRESHOLD_BIG)) < 0) ||
((txContainingThis.getLockTime() >= Transaction.LOCKTIME_THRESHOLD) && (nLockTime.compareTo(Transaction.LOCKTIME_THRESHOLD_BIG)) >= 0))
)
throw new ScriptException(ScriptError.SCRIPT_ERR_UNSATISFIED_LOCKTIME, "Locktime requirement type mismatch");
// Now that we know we're comparing apples-to-apples, the
// comparison is a simple numeric one.
if (nLockTime.compareTo(BigInteger.valueOf(txContainingThis.getLockTime())) > 0)
throw new ScriptException(ScriptError.SCRIPT_ERR_UNSATISFIED_LOCKTIME, "Locktime requirement not satisfied");
// Finally the nLockTime feature can be disabled and thus
// CHECKLOCKTIMEVERIFY bypassed if every txin has been
// finalized by setting nSequence to maxint. The
// transaction would be allowed into the blockchain, making
// the opcode ineffective.
//
// Testing if this vin is not final is sufficient to
// prevent this condition. Alternatively we could test all
// inputs, but testing just this input minimizes the data
// required to prove correct CHECKLOCKTIMEVERIFY execution.
if (!txContainingThis.getInput(index).hasSequence())
throw new ScriptException(ScriptError.SCRIPT_ERR_UNSATISFIED_LOCKTIME, "Transaction contains a final transaction input for a CHECKLOCKTIMEVERIFY script.");
} | [
"private",
"static",
"void",
"executeCheckLockTimeVerify",
"(",
"Transaction",
"txContainingThis",
",",
"int",
"index",
",",
"LinkedList",
"<",
"byte",
"[",
"]",
">",
"stack",
",",
"Set",
"<",
"VerifyFlag",
">",
"verifyFlags",
")",
"throws",
"ScriptException",
"... | This is more or less a direct translation of the code in Bitcoin Core | [
"This",
"is",
"more",
"or",
"less",
"a",
"direct",
"translation",
"of",
"the",
"code",
"in",
"Bitcoin",
"Core"
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/Script.java#L1305-L1340 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/cache/ElementCollectionCacheManager.java | ElementCollectionCacheManager.getElementCollectionObjectName | public String getElementCollectionObjectName(Object rowKey, Object elementCollectionObject)
{
if (getElementCollectionCache().isEmpty() || getElementCollectionCache().get(rowKey) == null)
{
log.debug("No element collection object map found in cache for Row key " + rowKey);
return null;
}
else
{
Map<Object, String> elementCollectionObjectMap = getElementCollectionCache().get(rowKey);
String elementCollectionObjectName = elementCollectionObjectMap.get(elementCollectionObject);
if (elementCollectionObjectName == null)
{
for (Object obj : elementCollectionObjectMap.keySet())
{
if (DeepEquals.deepEquals(elementCollectionObject, obj))
{
elementCollectionObjectName = elementCollectionObjectMap.get(obj);
break;
}
}
}
if (elementCollectionObjectName == null)
{
log.debug("No element collection object name found in cache for object:" + elementCollectionObject);
return null;
}
else
{
return elementCollectionObjectName;
}
}
} | java | public String getElementCollectionObjectName(Object rowKey, Object elementCollectionObject)
{
if (getElementCollectionCache().isEmpty() || getElementCollectionCache().get(rowKey) == null)
{
log.debug("No element collection object map found in cache for Row key " + rowKey);
return null;
}
else
{
Map<Object, String> elementCollectionObjectMap = getElementCollectionCache().get(rowKey);
String elementCollectionObjectName = elementCollectionObjectMap.get(elementCollectionObject);
if (elementCollectionObjectName == null)
{
for (Object obj : elementCollectionObjectMap.keySet())
{
if (DeepEquals.deepEquals(elementCollectionObject, obj))
{
elementCollectionObjectName = elementCollectionObjectMap.get(obj);
break;
}
}
}
if (elementCollectionObjectName == null)
{
log.debug("No element collection object name found in cache for object:" + elementCollectionObject);
return null;
}
else
{
return elementCollectionObjectName;
}
}
} | [
"public",
"String",
"getElementCollectionObjectName",
"(",
"Object",
"rowKey",
",",
"Object",
"elementCollectionObject",
")",
"{",
"if",
"(",
"getElementCollectionCache",
"(",
")",
".",
"isEmpty",
"(",
")",
"||",
"getElementCollectionCache",
"(",
")",
".",
"get",
... | Gets the element collection object name.
@param rowKey
the row key
@param elementCollectionObject
the element collection object
@return the element collection object name | [
"Gets",
"the",
"element",
"collection",
"object",
"name",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/cache/ElementCollectionCacheManager.java#L132-L165 |
unbescape/unbescape | src/main/java/org/unbescape/xml/XmlEscape.java | XmlEscape.escapeXml10Attribute | public static void escapeXml10Attribute(final String text, final Writer writer)
throws IOException {
escapeXml(text, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS,
XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA,
XmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT);
} | java | public static void escapeXml10Attribute(final String text, final Writer writer)
throws IOException {
escapeXml(text, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS,
XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA,
XmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT);
} | [
"public",
"static",
"void",
"escapeXml10Attribute",
"(",
"final",
"String",
"text",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapeXml",
"(",
"text",
",",
"writer",
",",
"XmlEscapeSymbols",
".",
"XML10_ATTRIBUTE_SYMBOLS",
",",
"XmlEsca... | <p>
Perform an XML 1.0 level 2 (markup-significant and all non-ASCII chars) <strong>escape</strong> operation
on a <tt>String</tt> input meant to be an XML attribute value, writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 2</em> means this method will escape:
</p>
<ul>
<li>The five markup-significant characters: <tt><</tt>, <tt>></tt>, <tt>&</tt>,
<tt>"</tt> and <tt>'</tt></li>
<li>All non ASCII characters.</li>
</ul>
<p>
This escape will be performed by replacing those chars by the corresponding XML Character Entity References
(e.g. <tt>'&lt;'</tt>) when such CER exists for the replaced character, and replacing by a hexadecimal
character reference (e.g. <tt>'&#x2430;'</tt>) when there there is no CER for the replaced character.
</p>
<p>
Besides, being an attribute value also <tt>\t</tt>, <tt>\n</tt> and <tt>\r</tt> will
be escaped to avoid white-space normalization from removing line feeds (turning them into white
spaces) during future parsing operations.
</p>
<p>
This method calls {@link #escapeXml10(String, Writer, XmlEscapeType, XmlEscapeLevel)} with the following
preconfigured values:
</p>
<ul>
<li><tt>type</tt>:
{@link org.unbescape.xml.XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA}</li>
<li><tt>level</tt>:
{@link org.unbescape.xml.XmlEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.5 | [
"<p",
">",
"Perform",
"an",
"XML",
"1",
".",
"0",
"level",
"2",
"(",
"markup",
"-",
"significant",
"and",
"all",
"non",
"-",
"ASCII",
"chars",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L968-L973 |
dita-ot/dita-ot | src/main/java/org/dita/dost/util/URLUtils.java | URLUtils.setFragment | public static URI setFragment(final URI path, final String fragment) {
try {
if (path.getPath() != null) {
return new URI(path.getScheme(), path.getUserInfo(), path.getHost(), path.getPort(), path.getPath(), path.getQuery(), fragment);
} else {
return new URI(path.getScheme(), path.getSchemeSpecificPart(), fragment);
}
} catch (final URISyntaxException e) {
throw new RuntimeException(e.getMessage(), e);
}
} | java | public static URI setFragment(final URI path, final String fragment) {
try {
if (path.getPath() != null) {
return new URI(path.getScheme(), path.getUserInfo(), path.getHost(), path.getPort(), path.getPath(), path.getQuery(), fragment);
} else {
return new URI(path.getScheme(), path.getSchemeSpecificPart(), fragment);
}
} catch (final URISyntaxException e) {
throw new RuntimeException(e.getMessage(), e);
}
} | [
"public",
"static",
"URI",
"setFragment",
"(",
"final",
"URI",
"path",
",",
"final",
"String",
"fragment",
")",
"{",
"try",
"{",
"if",
"(",
"path",
".",
"getPath",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"new",
"URI",
"(",
"path",
".",
"getScheme... | Create new URI with a given fragment.
@param path URI to set fragment on
@param fragment new fragment, {@code null} for no fragment
@return new URI instance with given fragment | [
"Create",
"new",
"URI",
"with",
"a",
"given",
"fragment",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L551-L561 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java | FileOperations.listFilesFromComputeNode | public PagedList<NodeFile> listFilesFromComputeNode(String poolId, String nodeId) throws BatchErrorException, IOException {
return listFilesFromComputeNode(poolId, nodeId, null, null, null);
} | java | public PagedList<NodeFile> listFilesFromComputeNode(String poolId, String nodeId) throws BatchErrorException, IOException {
return listFilesFromComputeNode(poolId, nodeId, null, null, null);
} | [
"public",
"PagedList",
"<",
"NodeFile",
">",
"listFilesFromComputeNode",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"return",
"listFilesFromComputeNode",
"(",
"poolId",
",",
"nodeId",
",",
"null",... | Lists files on the specified compute node.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node.
@return A list of {@link NodeFile} objects.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Lists",
"files",
"on",
"the",
"specified",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java#L122-L124 |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java | PipelineManager.deletePipelineRecords | public static void deletePipelineRecords(String pipelineHandle, boolean force, boolean async)
throws NoSuchObjectException, IllegalStateException {
checkNonEmpty(pipelineHandle, "pipelineHandle");
Key key = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, pipelineHandle);
backEnd.deletePipeline(key, force, async);
} | java | public static void deletePipelineRecords(String pipelineHandle, boolean force, boolean async)
throws NoSuchObjectException, IllegalStateException {
checkNonEmpty(pipelineHandle, "pipelineHandle");
Key key = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, pipelineHandle);
backEnd.deletePipeline(key, force, async);
} | [
"public",
"static",
"void",
"deletePipelineRecords",
"(",
"String",
"pipelineHandle",
",",
"boolean",
"force",
",",
"boolean",
"async",
")",
"throws",
"NoSuchObjectException",
",",
"IllegalStateException",
"{",
"checkNonEmpty",
"(",
"pipelineHandle",
",",
"\"pipelineHan... | Delete all data store entities corresponding to the given pipeline.
@param pipelineHandle The handle of the pipeline to be deleted
@param force If this parameter is not {@code true} then this method will
throw an {@link IllegalStateException} if the specified pipeline is
not in the {@link State#FINALIZED} or {@link State#STOPPED} state.
@param async If this parameter is {@code true} then instead of performing
the delete operation synchronously, this method will enqueue a task
to perform the operation.
@throws NoSuchObjectException If there is no Job with the given key.
@throws IllegalStateException If {@code force = false} and the specified
pipeline is not in the {@link State#FINALIZED} or
{@link State#STOPPED} state. | [
"Delete",
"all",
"data",
"store",
"entities",
"corresponding",
"to",
"the",
"given",
"pipeline",
"."
] | train | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java#L409-L414 |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/LoginService.java | LoginService.performLcdsHeartBeat | public String performLcdsHeartBeat(long accountId, String sessionToken, int heartBeatCount, Date date) {
return client.sendRpcAndWait(SERVICE, "performLCDSHeartBeat", accountId, sessionToken, heartBeatCount, format.format(date));
} | java | public String performLcdsHeartBeat(long accountId, String sessionToken, int heartBeatCount, Date date) {
return client.sendRpcAndWait(SERVICE, "performLCDSHeartBeat", accountId, sessionToken, heartBeatCount, format.format(date));
} | [
"public",
"String",
"performLcdsHeartBeat",
"(",
"long",
"accountId",
",",
"String",
"sessionToken",
",",
"int",
"heartBeatCount",
",",
"Date",
"date",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"performLCDSHeartBeat\"",
",",
"acco... | Perform a heartbeat
@param accountId The user id
@param sessionToken The token for the current session
@param heartBeatCount The amount of heartbeats that have been sent
@param date The time of the heart beat
@return A string | [
"Perform",
"a",
"heartbeat"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/LoginService.java#L69-L71 |
gotev/android-upload-service | uploadservice/src/main/java/net/gotev/uploadservice/UploadRequest.java | UploadRequest.startUpload | public String startUpload() {
UploadService.setUploadStatusDelegate(params.id, delegate);
final Intent intent = new Intent(context, UploadService.class);
this.initializeIntent(intent);
intent.setAction(UploadService.getActionUpload());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (params.notificationConfig == null) {
throw new IllegalArgumentException("Android Oreo requires a notification configuration for the service to run. https://developer.android.com/reference/android/content/Context.html#startForegroundService(android.content.Intent)");
}
context.startForegroundService(intent);
} else {
context.startService(intent);
}
return params.id;
} | java | public String startUpload() {
UploadService.setUploadStatusDelegate(params.id, delegate);
final Intent intent = new Intent(context, UploadService.class);
this.initializeIntent(intent);
intent.setAction(UploadService.getActionUpload());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (params.notificationConfig == null) {
throw new IllegalArgumentException("Android Oreo requires a notification configuration for the service to run. https://developer.android.com/reference/android/content/Context.html#startForegroundService(android.content.Intent)");
}
context.startForegroundService(intent);
} else {
context.startService(intent);
}
return params.id;
} | [
"public",
"String",
"startUpload",
"(",
")",
"{",
"UploadService",
".",
"setUploadStatusDelegate",
"(",
"params",
".",
"id",
",",
"delegate",
")",
";",
"final",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"context",
",",
"UploadService",
".",
"class",
")"... | Start the background file upload service.
@return the uploadId string. If you have passed your own uploadId in the constructor, this
method will return that same uploadId, otherwise it will return the automatically
generated uploadId | [
"Start",
"the",
"background",
"file",
"upload",
"service",
"."
] | train | https://github.com/gotev/android-upload-service/blob/0952fcbe4b32c100150ffd0a237de3be4942e0a8/uploadservice/src/main/java/net/gotev/uploadservice/UploadRequest.java#L63-L80 |
Azure/azure-sdk-for-java | kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java | DatabasesInner.listByCluster | public List<DatabaseInner> listByCluster(String resourceGroupName, String clusterName) {
return listByClusterWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | java | public List<DatabaseInner> listByCluster(String resourceGroupName, String clusterName) {
return listByClusterWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | [
"public",
"List",
"<",
"DatabaseInner",
">",
"listByCluster",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
")",
"{",
"return",
"listByClusterWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
")",
".",
"toBlocking",
"(",
")",... | Returns the list of databases of the given Kusto cluster.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@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 List<DatabaseInner> object if successful. | [
"Returns",
"the",
"list",
"of",
"databases",
"of",
"the",
"given",
"Kusto",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java#L219-L221 |
samskivert/samskivert | src/main/java/com/samskivert/util/CompactIntListUtil.java | CompactIntListUtil.indexOf | public static int indexOf (int[] list, int value)
{
int llength = list.length; // no optimizing bastards
for (int i = 0; i < llength; i++) {
if (list[i] == value) {
return i;
}
}
return -1;
} | java | public static int indexOf (int[] list, int value)
{
int llength = list.length; // no optimizing bastards
for (int i = 0; i < llength; i++) {
if (list[i] == value) {
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"int",
"[",
"]",
"list",
",",
"int",
"value",
")",
"{",
"int",
"llength",
"=",
"list",
".",
"length",
";",
"// no optimizing bastards",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"llength",
";",
"i",
... | Looks for an element that is equal to the supplied value and
returns its index in the array.
@return the index of the first matching value if one was found,
-1 otherwise. | [
"Looks",
"for",
"an",
"element",
"that",
"is",
"equal",
"to",
"the",
"supplied",
"value",
"and",
"returns",
"its",
"index",
"in",
"the",
"array",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/CompactIntListUtil.java#L72-L81 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/DBUpdate.java | DBUpdate.addToSet | public static Builder addToSet(String field, Object value) {
return new Builder().addToSet(field, value);
} | java | public static Builder addToSet(String field, Object value) {
return new Builder().addToSet(field, value);
} | [
"public",
"static",
"Builder",
"addToSet",
"(",
"String",
"field",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"Builder",
"(",
")",
".",
"addToSet",
"(",
"field",
",",
"value",
")",
";",
"}"
] | Add the given value to the array value if it doesn't already exist in the specified field atomically
@param field The field to add the value to
@param value The value to add
@return this object | [
"Add",
"the",
"given",
"value",
"to",
"the",
"array",
"value",
"if",
"it",
"doesn",
"t",
"already",
"exist",
"in",
"the",
"specified",
"field",
"atomically"
] | train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBUpdate.java#L123-L125 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/convert/BooleanConverter.java | BooleanConverter.toBooleanWithDefault | public static boolean toBooleanWithDefault(Object value, boolean defaultValue) {
Boolean result = toNullableBoolean(value);
return result != null ? (boolean) result : defaultValue;
} | java | public static boolean toBooleanWithDefault(Object value, boolean defaultValue) {
Boolean result = toNullableBoolean(value);
return result != null ? (boolean) result : defaultValue;
} | [
"public",
"static",
"boolean",
"toBooleanWithDefault",
"(",
"Object",
"value",
",",
"boolean",
"defaultValue",
")",
"{",
"Boolean",
"result",
"=",
"toNullableBoolean",
"(",
"value",
")",
";",
"return",
"result",
"!=",
"null",
"?",
"(",
"boolean",
")",
"result"... | Converts value into boolean or returns default value when conversion is not
possible
@param value the value to convert.
@param defaultValue the default value
@return boolean value or default when conversion is not supported.
@see BooleanConverter#toNullableBoolean(Object) | [
"Converts",
"value",
"into",
"boolean",
"or",
"returns",
"default",
"value",
"when",
"conversion",
"is",
"not",
"possible"
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/convert/BooleanConverter.java#L74-L77 |
Jasig/uPortal | uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/lookup/PersonLookupHelperImpl.java | PersonLookupHelperImpl.getPermittedAttributes | protected Set<String> getPermittedAttributes(final IAuthorizationPrincipal principal) {
final Set<String> attributeNames = personAttributeDao.getPossibleUserAttributeNames();
return getPermittedAttributes(principal, attributeNames);
} | java | protected Set<String> getPermittedAttributes(final IAuthorizationPrincipal principal) {
final Set<String> attributeNames = personAttributeDao.getPossibleUserAttributeNames();
return getPermittedAttributes(principal, attributeNames);
} | [
"protected",
"Set",
"<",
"String",
">",
"getPermittedAttributes",
"(",
"final",
"IAuthorizationPrincipal",
"principal",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"attributeNames",
"=",
"personAttributeDao",
".",
"getPossibleUserAttributeNames",
"(",
")",
";",
"r... | Get the set of all user attribute names defined in the portal for which the specified
principal has the attribute viewing permission.
@param principal
@return | [
"Get",
"the",
"set",
"of",
"all",
"user",
"attribute",
"names",
"defined",
"in",
"the",
"portal",
"for",
"which",
"the",
"specified",
"principal",
"has",
"the",
"attribute",
"viewing",
"permission",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/lookup/PersonLookupHelperImpl.java#L423-L426 |
jhunters/jprotobuf | v3/src/main/java/com/baidu/bjf/remoting/protobuf/MapEntryLite.java | MapEntryLite.computeMessageSize | public int computeMessageSize(int fieldNumber, K key, V value) {
return CodedOutputStream.computeTagSize(fieldNumber)
+ CodedConstant.computeLengthDelimitedFieldSize(computeSerializedSize(metadata, key, value));
} | java | public int computeMessageSize(int fieldNumber, K key, V value) {
return CodedOutputStream.computeTagSize(fieldNumber)
+ CodedConstant.computeLengthDelimitedFieldSize(computeSerializedSize(metadata, key, value));
} | [
"public",
"int",
"computeMessageSize",
"(",
"int",
"fieldNumber",
",",
"K",
"key",
",",
"V",
"value",
")",
"{",
"return",
"CodedOutputStream",
".",
"computeTagSize",
"(",
"fieldNumber",
")",
"+",
"CodedConstant",
".",
"computeLengthDelimitedFieldSize",
"(",
"compu... | Computes the message size for the provided key and value as though they were wrapped by a {@link MapEntryLite}.
This helper method avoids allocation of a {@link MapEntryLite} built with a key and value and is called from
generated code directly.
@param fieldNumber the field number
@param key the key
@param value the value
@return the int | [
"Computes",
"the",
"message",
"size",
"for",
"the",
"provided",
"key",
"and",
"value",
"as",
"though",
"they",
"were",
"wrapped",
"by",
"a",
"{",
"@link",
"MapEntryLite",
"}",
".",
"This",
"helper",
"method",
"avoids",
"allocation",
"of",
"a",
"{",
"@link"... | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/MapEntryLite.java#L248-L251 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java | CalendarAstronomer.getSunTime | public long getSunTime(double desired, boolean next)
{
return timeOfAngle( new AngleFunc() { @Override
public double eval() { return getSunLongitude(); } },
desired,
TROPICAL_YEAR,
MINUTE_MS,
next);
} | java | public long getSunTime(double desired, boolean next)
{
return timeOfAngle( new AngleFunc() { @Override
public double eval() { return getSunLongitude(); } },
desired,
TROPICAL_YEAR,
MINUTE_MS,
next);
} | [
"public",
"long",
"getSunTime",
"(",
"double",
"desired",
",",
"boolean",
"next",
")",
"{",
"return",
"timeOfAngle",
"(",
"new",
"AngleFunc",
"(",
")",
"{",
"@",
"Override",
"public",
"double",
"eval",
"(",
")",
"{",
"return",
"getSunLongitude",
"(",
")",
... | Find the next time at which the sun's ecliptic longitude will have
the desired value.
@hide draft / provisional / internal are hidden on Android | [
"Find",
"the",
"next",
"time",
"at",
"which",
"the",
"sun",
"s",
"ecliptic",
"longitude",
"will",
"have",
"the",
"desired",
"value",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java#L662-L670 |
actorapp/actor-platform | actor-server/actor-frontend/src/main/java/im/actor/crypto/primitives/curve25519/fe_add.java | fe_add.fe_add | public static void fe_add(int[] h,int[] f,int[] g)
{
int f0 = f[0];
int f1 = f[1];
int f2 = f[2];
int f3 = f[3];
int f4 = f[4];
int f5 = f[5];
int f6 = f[6];
int f7 = f[7];
int f8 = f[8];
int f9 = f[9];
int g0 = g[0];
int g1 = g[1];
int g2 = g[2];
int g3 = g[3];
int g4 = g[4];
int g5 = g[5];
int g6 = g[6];
int g7 = g[7];
int g8 = g[8];
int g9 = g[9];
int h0 = f0 + g0;
int h1 = f1 + g1;
int h2 = f2 + g2;
int h3 = f3 + g3;
int h4 = f4 + g4;
int h5 = f5 + g5;
int h6 = f6 + g6;
int h7 = f7 + g7;
int h8 = f8 + g8;
int h9 = f9 + g9;
h[0] = (int)h0;
h[1] = (int)h1;
h[2] = (int)h2;
h[3] = (int)h3;
h[4] = (int)h4;
h[5] = (int)h5;
h[6] = (int)h6;
h[7] = (int)h7;
h[8] = (int)h8;
h[9] = (int)h9;
} | java | public static void fe_add(int[] h,int[] f,int[] g)
{
int f0 = f[0];
int f1 = f[1];
int f2 = f[2];
int f3 = f[3];
int f4 = f[4];
int f5 = f[5];
int f6 = f[6];
int f7 = f[7];
int f8 = f[8];
int f9 = f[9];
int g0 = g[0];
int g1 = g[1];
int g2 = g[2];
int g3 = g[3];
int g4 = g[4];
int g5 = g[5];
int g6 = g[6];
int g7 = g[7];
int g8 = g[8];
int g9 = g[9];
int h0 = f0 + g0;
int h1 = f1 + g1;
int h2 = f2 + g2;
int h3 = f3 + g3;
int h4 = f4 + g4;
int h5 = f5 + g5;
int h6 = f6 + g6;
int h7 = f7 + g7;
int h8 = f8 + g8;
int h9 = f9 + g9;
h[0] = (int)h0;
h[1] = (int)h1;
h[2] = (int)h2;
h[3] = (int)h3;
h[4] = (int)h4;
h[5] = (int)h5;
h[6] = (int)h6;
h[7] = (int)h7;
h[8] = (int)h8;
h[9] = (int)h9;
} | [
"public",
"static",
"void",
"fe_add",
"(",
"int",
"[",
"]",
"h",
",",
"int",
"[",
"]",
"f",
",",
"int",
"[",
"]",
"g",
")",
"{",
"int",
"f0",
"=",
"f",
"[",
"0",
"]",
";",
"int",
"f1",
"=",
"f",
"[",
"1",
"]",
";",
"int",
"f2",
"=",
"f"... | /*
h = f + g
Can overlap h with f or g.
Preconditions:
|f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
|g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
Postconditions:
|h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. | [
"/",
"*",
"h",
"=",
"f",
"+",
"g",
"Can",
"overlap",
"h",
"with",
"f",
"or",
"g",
"."
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-server/actor-frontend/src/main/java/im/actor/crypto/primitives/curve25519/fe_add.java#L19-L61 |
appium/java-client | src/main/java/io/appium/java_client/TouchAction.java | TouchAction.longPress | public T longPress(PointOption longPressOptions) {
ActionParameter action = new ActionParameter("longPress", longPressOptions);
parameterBuilder.add(action);
//noinspection unchecked
return (T) this;
} | java | public T longPress(PointOption longPressOptions) {
ActionParameter action = new ActionParameter("longPress", longPressOptions);
parameterBuilder.add(action);
//noinspection unchecked
return (T) this;
} | [
"public",
"T",
"longPress",
"(",
"PointOption",
"longPressOptions",
")",
"{",
"ActionParameter",
"action",
"=",
"new",
"ActionParameter",
"(",
"\"longPress\"",
",",
"longPressOptions",
")",
";",
"parameterBuilder",
".",
"add",
"(",
"action",
")",
";",
"//noinspect... | Press and hold the at the center of an element until the context menu event has fired.
@param longPressOptions see {@link PointOption} and {@link ElementOption}.
@return this TouchAction, for chaining. | [
"Press",
"and",
"hold",
"the",
"at",
"the",
"center",
"of",
"an",
"element",
"until",
"the",
"context",
"menu",
"event",
"has",
"fired",
"."
] | train | https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/TouchAction.java#L165-L170 |
forge/core | dependencies/api/src/main/java/org/jboss/forge/addon/dependencies/util/Dependencies.java | Dependencies.areEquivalent | public static boolean areEquivalent(Coordinate l, Coordinate r)
{
if (l == r)
{
return true;
}
if ((l == null) && (r == null))
{
return true;
}
else if ((l == null) || (r == null))
{
return false;
}
String lPackacking = l.getPackaging() == null ? "jar" : l.getPackaging();
String rPackaging = r.getPackaging() == null ? "jar" : r.getPackaging();
return !(l.getArtifactId() != null ? !l.getArtifactId()
.equals(r.getArtifactId()) : r.getArtifactId() != null)
&&
!(l.getGroupId() != null ? !l.getGroupId()
.equals(r.getGroupId()) : r.getGroupId() != null)
&&
!(l.getClassifier() != null ? !l.getClassifier()
.equals(r.getClassifier()) : r.getClassifier() != null)
&&
lPackacking.equals(rPackaging);
} | java | public static boolean areEquivalent(Coordinate l, Coordinate r)
{
if (l == r)
{
return true;
}
if ((l == null) && (r == null))
{
return true;
}
else if ((l == null) || (r == null))
{
return false;
}
String lPackacking = l.getPackaging() == null ? "jar" : l.getPackaging();
String rPackaging = r.getPackaging() == null ? "jar" : r.getPackaging();
return !(l.getArtifactId() != null ? !l.getArtifactId()
.equals(r.getArtifactId()) : r.getArtifactId() != null)
&&
!(l.getGroupId() != null ? !l.getGroupId()
.equals(r.getGroupId()) : r.getGroupId() != null)
&&
!(l.getClassifier() != null ? !l.getClassifier()
.equals(r.getClassifier()) : r.getClassifier() != null)
&&
lPackacking.equals(rPackaging);
} | [
"public",
"static",
"boolean",
"areEquivalent",
"(",
"Coordinate",
"l",
",",
"Coordinate",
"r",
")",
"{",
"if",
"(",
"l",
"==",
"r",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"(",
"l",
"==",
"null",
")",
"&&",
"(",
"r",
"==",
"null",
")",
... | Compare the {@link Coordinate} of each given {@link Dependency} for equivalence. | [
"Compare",
"the",
"{"
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/dependencies/api/src/main/java/org/jboss/forge/addon/dependencies/util/Dependencies.java#L41-L69 |
loicoudot/java4cpp-core | src/main/java/com/github/loicoudot/java4cpp/TypeTemplates.java | TypeTemplates.processTemplate | private String processTemplate(Template template, Object model) {
if (template != null) {
StringWriter sw = new StringWriter();
try {
template.process(model, sw);
} catch (Exception e) {
throw new RuntimeException("Failed to process template " + e.getMessage());
}
return sw.toString();
}
return "";
} | java | private String processTemplate(Template template, Object model) {
if (template != null) {
StringWriter sw = new StringWriter();
try {
template.process(model, sw);
} catch (Exception e) {
throw new RuntimeException("Failed to process template " + e.getMessage());
}
return sw.toString();
}
return "";
} | [
"private",
"String",
"processTemplate",
"(",
"Template",
"template",
",",
"Object",
"model",
")",
"{",
"if",
"(",
"template",
"!=",
"null",
")",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"try",
"{",
"template",
".",
"process",
... | Process a freemarker templates <code>template</code> with the model
<code>classModel</code> and return the resulting strings. At this stage
some informations of the class are updated in the <code>classModel</code>
and these informations can be used inside the freemarker
<code>template</code> to deduce the C++ source code. <br>
Templates exemple :<br>
<code>"std::vector<${innerType.type.cppReturnType} >"</code><br>
<code>"${type.addInclude("<vector>")}"</code>
@param template
a freemarker template for generating parts of C++ source code
@param model
a semi-filled <code>ClassModel</code>
@return the freemarker template processing results | [
"Process",
"a",
"freemarker",
"templates",
"<code",
">",
"template<",
"/",
"code",
">",
"with",
"the",
"model",
"<code",
">",
"classModel<",
"/",
"code",
">",
"and",
"return",
"the",
"resulting",
"strings",
".",
"At",
"this",
"stage",
"some",
"informations",... | train | https://github.com/loicoudot/java4cpp-core/blob/7fe5a5dd5a29c3f95b62f46eaacbb8f8778b9493/src/main/java/com/github/loicoudot/java4cpp/TypeTemplates.java#L85-L96 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.getValue | public double getValue(String tenorCode, int moneynessBP, QuotingConvention convention, double displacement, AnalyticModel model) {
DataKey key = new DataKey(tenorCode, moneynessBP);
return convertToConvention(getValue(key), key, convention, displacement, quotingConvention, this.displacement, model);
} | java | public double getValue(String tenorCode, int moneynessBP, QuotingConvention convention, double displacement, AnalyticModel model) {
DataKey key = new DataKey(tenorCode, moneynessBP);
return convertToConvention(getValue(key), key, convention, displacement, quotingConvention, this.displacement, model);
} | [
"public",
"double",
"getValue",
"(",
"String",
"tenorCode",
",",
"int",
"moneynessBP",
",",
"QuotingConvention",
"convention",
",",
"double",
"displacement",
",",
"AnalyticModel",
"model",
")",
"{",
"DataKey",
"key",
"=",
"new",
"DataKey",
"(",
"tenorCode",
",",... | Return the value in the given quoting convention.
Conversion involving receiver premium assumes zero wide collar.
@param tenorCode The schedule of the swaption encoded in the format '6M10Y'
@param moneynessBP The moneyness in basis points on the par swap rate, as understood in the original convention.
@param convention The desired quoting convention.
@param displacement The displacement to be used, if converting to log normal implied volatility.
@param model The model for context.
@return The value converted to the convention. | [
"Return",
"the",
"value",
"in",
"the",
"given",
"quoting",
"convention",
".",
"Conversion",
"involving",
"receiver",
"premium",
"assumes",
"zero",
"wide",
"collar",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L647-L650 |
livetribe/livetribe-slp | core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java | StandardDirectoryAgentServer.handleTCPSrvTypeRqst | protected void handleTCPSrvTypeRqst(SrvTypeRqst srvTypeRqst, Socket socket)
{
// Match scopes, RFC 2608, 11.1
if (!scopes.weakMatch(srvTypeRqst.getScopes()))
{
tcpSrvTypeRply.perform(socket, srvTypeRqst, SLPError.SCOPE_NOT_SUPPORTED);
return;
}
List<ServiceType> serviceTypes = matchServiceTypes(srvTypeRqst);
if (logger.isLoggable(Level.FINE))
logger.fine("DirectoryAgent " + this + " returning service types " + serviceTypes);
tcpSrvTypeRply.perform(socket, srvTypeRqst, serviceTypes);
} | java | protected void handleTCPSrvTypeRqst(SrvTypeRqst srvTypeRqst, Socket socket)
{
// Match scopes, RFC 2608, 11.1
if (!scopes.weakMatch(srvTypeRqst.getScopes()))
{
tcpSrvTypeRply.perform(socket, srvTypeRqst, SLPError.SCOPE_NOT_SUPPORTED);
return;
}
List<ServiceType> serviceTypes = matchServiceTypes(srvTypeRqst);
if (logger.isLoggable(Level.FINE))
logger.fine("DirectoryAgent " + this + " returning service types " + serviceTypes);
tcpSrvTypeRply.perform(socket, srvTypeRqst, serviceTypes);
} | [
"protected",
"void",
"handleTCPSrvTypeRqst",
"(",
"SrvTypeRqst",
"srvTypeRqst",
",",
"Socket",
"socket",
")",
"{",
"// Match scopes, RFC 2608, 11.1",
"if",
"(",
"!",
"scopes",
".",
"weakMatch",
"(",
"srvTypeRqst",
".",
"getScopes",
"(",
")",
")",
")",
"{",
"tcpS... | Handles a unicast TCP SrvTypeRqst message arrived to this directory agent.
<br />
This directory agent will reply with an SrvTypeRply containing the service types.
@param srvTypeRqst the SrvTypeRqst message to handle
@param socket the socket connected to the client where to write the reply | [
"Handles",
"a",
"unicast",
"TCP",
"SrvTypeRqst",
"message",
"arrived",
"to",
"this",
"directory",
"agent",
".",
"<br",
"/",
">",
"This",
"directory",
"agent",
"will",
"reply",
"with",
"an",
"SrvTypeRply",
"containing",
"the",
"service",
"types",
"."
] | train | https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java#L721-L735 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicLongArray.java | AtomicLongArray.getAndUpdate | public final long getAndUpdate(int i, LongUnaryOperator updateFunction) {
// long offset = checkedByteOffset(i);
long prev, next;
do {
prev = get(i);
next = updateFunction.applyAsLong(prev);
} while (!compareAndSet(i, prev, next));
return prev;
} | java | public final long getAndUpdate(int i, LongUnaryOperator updateFunction) {
// long offset = checkedByteOffset(i);
long prev, next;
do {
prev = get(i);
next = updateFunction.applyAsLong(prev);
} while (!compareAndSet(i, prev, next));
return prev;
} | [
"public",
"final",
"long",
"getAndUpdate",
"(",
"int",
"i",
",",
"LongUnaryOperator",
"updateFunction",
")",
"{",
"// long offset = checkedByteOffset(i);",
"long",
"prev",
",",
"next",
";",
"do",
"{",
"prev",
"=",
"get",
"(",
"i",
")",
";",
"next",
"=",
"upd... | Atomically updates the element at index {@code i} with the results
of applying the given function, returning the previous value. The
function should be side-effect-free, since it may be re-applied
when attempted updates fail due to contention among threads.
@param i the index
@param updateFunction a side-effect-free function
@return the previous value
@since 1.8 | [
"Atomically",
"updates",
"the",
"element",
"at",
"index",
"{",
"@code",
"i",
"}",
"with",
"the",
"results",
"of",
"applying",
"the",
"given",
"function",
"returning",
"the",
"previous",
"value",
".",
"The",
"function",
"should",
"be",
"side",
"-",
"effect",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicLongArray.java#L285-L293 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java | ElementUI.createFromTemplate | protected BaseUIComponent createFromTemplate(String template, BaseComponent parent, Object controller) {
if (StringUtils.isEmpty(template)) {
template = getTemplateUrl();
} else if (!template.startsWith("web/")) {
template = CWFUtil.getResourcePath(getClass()) + template;
}
BaseUIComponent top = null;
try {
top = (BaseUIComponent) PageUtil.createPage(template, parent).get(0);
top.wireController(controller);
} catch (Exception e) {
CWFException.raise("Error creating element from template.", e);
}
return top;
} | java | protected BaseUIComponent createFromTemplate(String template, BaseComponent parent, Object controller) {
if (StringUtils.isEmpty(template)) {
template = getTemplateUrl();
} else if (!template.startsWith("web/")) {
template = CWFUtil.getResourcePath(getClass()) + template;
}
BaseUIComponent top = null;
try {
top = (BaseUIComponent) PageUtil.createPage(template, parent).get(0);
top.wireController(controller);
} catch (Exception e) {
CWFException.raise("Error creating element from template.", e);
}
return top;
} | [
"protected",
"BaseUIComponent",
"createFromTemplate",
"(",
"String",
"template",
",",
"BaseComponent",
"parent",
",",
"Object",
"controller",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"template",
")",
")",
"{",
"template",
"=",
"getTemplateUrl",
"... | Create wrapped component(s) from specified template (a cwf page).
@param template URL of cwf page that will serve as a template. If the URL is not specified,
the template name is obtained from getTemplateUrl.
@param parent The component that will become the parent.
@param controller If specified, events and variables are autowired to the controller.
@return Top level component. | [
"Create",
"wrapped",
"component",
"(",
"s",
")",
"from",
"specified",
"template",
"(",
"a",
"cwf",
"page",
")",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java#L160-L177 |
soi-toolkit/soi-toolkit-mule | commons/components/commons-xml/src/main/java/org/soitoolkit/commons/xml/XPathUtil.java | XPathUtil.lookupParameterValue | public static String lookupParameterValue(String key, String string) {
Pattern p = Pattern.compile("\\[" + key + "=[^\\]]*\\]");
Matcher m = p.matcher(string);
m.find();
String f = m.group();
int p1 = f.indexOf('=');
int p2 = f.indexOf(']');
return f.substring(p1+1, p2);
} | java | public static String lookupParameterValue(String key, String string) {
Pattern p = Pattern.compile("\\[" + key + "=[^\\]]*\\]");
Matcher m = p.matcher(string);
m.find();
String f = m.group();
int p1 = f.indexOf('=');
int p2 = f.indexOf(']');
return f.substring(p1+1, p2);
} | [
"public",
"static",
"String",
"lookupParameterValue",
"(",
"String",
"key",
",",
"String",
"string",
")",
"{",
"Pattern",
"p",
"=",
"Pattern",
".",
"compile",
"(",
"\"\\\\[\"",
"+",
"key",
"+",
"\"=[^\\\\]]*\\\\]\"",
")",
";",
"Matcher",
"m",
"=",
"p",
"."... | Search for patterns [key=value] and returns the value given the key.
@param key
@param string
@return | [
"Search",
"for",
"patterns",
"[",
"key",
"=",
"value",
"]",
"and",
"returns",
"the",
"value",
"given",
"the",
"key",
"."
] | train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-xml/src/main/java/org/soitoolkit/commons/xml/XPathUtil.java#L255-L263 |
jhalterman/failsafe | src/main/java/net/jodah/failsafe/FailsafeExecutor.java | FailsafeExecutor.callAsync | @SuppressWarnings("unchecked")
private <T> CompletableFuture<T> callAsync(
Function<AsyncExecution, Supplier<CompletableFuture<ExecutionResult>>> supplierFn, boolean asyncExecution) {
FailsafeFuture<T> future = new FailsafeFuture(this);
AsyncExecution execution = new AsyncExecution(scheduler, future, this);
future.inject(execution);
execution.inject(supplierFn.apply(execution), asyncExecution);
execution.executeAsync(asyncExecution);
return future;
} | java | @SuppressWarnings("unchecked")
private <T> CompletableFuture<T> callAsync(
Function<AsyncExecution, Supplier<CompletableFuture<ExecutionResult>>> supplierFn, boolean asyncExecution) {
FailsafeFuture<T> future = new FailsafeFuture(this);
AsyncExecution execution = new AsyncExecution(scheduler, future, this);
future.inject(execution);
execution.inject(supplierFn.apply(execution), asyncExecution);
execution.executeAsync(asyncExecution);
return future;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"callAsync",
"(",
"Function",
"<",
"AsyncExecution",
",",
"Supplier",
"<",
"CompletableFuture",
"<",
"ExecutionResult",
">",
">",
">",
"supplierFn",... | Calls the asynchronous {@code supplier} via the configured Scheduler, handling results according to the configured
policies.
<p>
If a configured circuit breaker is open, the resulting future is completed with {@link
CircuitBreakerOpenException}.
@param asyncExecution whether this is a detached, async execution that must be manually completed
@throws NullPointerException if the {@code supplierFn} is null
@throws RejectedExecutionException if the {@code supplierFn} cannot be scheduled for execution | [
"Calls",
"the",
"asynchronous",
"{",
"@code",
"supplier",
"}",
"via",
"the",
"configured",
"Scheduler",
"handling",
"results",
"according",
"to",
"the",
"configured",
"policies",
".",
"<p",
">",
"If",
"a",
"configured",
"circuit",
"breaker",
"is",
"open",
"the... | train | https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/FailsafeExecutor.java#L336-L345 |
otto-de/edison-microservice | edison-core/src/main/java/de/otto/edison/status/domain/ServiceType.java | ServiceType.serviceType | public static ServiceType serviceType(final String type, final Criticality criticality, final String disasterImpact) {
return new ServiceType(type, criticality, disasterImpact);
} | java | public static ServiceType serviceType(final String type, final Criticality criticality, final String disasterImpact) {
return new ServiceType(type, criticality, disasterImpact);
} | [
"public",
"static",
"ServiceType",
"serviceType",
"(",
"final",
"String",
"type",
",",
"final",
"Criticality",
"criticality",
",",
"final",
"String",
"disasterImpact",
")",
"{",
"return",
"new",
"ServiceType",
"(",
"type",
",",
"criticality",
",",
"disasterImpact"... | Creates a ServiceType.
@param type The type of the service dependency.
@param criticality The criticality of the required service for the operation of this service.
@param disasterImpact Short description of the impact of outages: what would happen if the system is not operational?
@return ServiceType | [
"Creates",
"a",
"ServiceType",
"."
] | train | https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-core/src/main/java/de/otto/edison/status/domain/ServiceType.java#L35-L37 |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/output/PangoolMultipleOutputs.java | PangoolMultipleOutputs.addNamedOutputContext | public static void addNamedOutputContext(Job job, String namedOutput, String key, String value) {
// Check that this named output has been configured before
Configuration conf = job.getConfiguration();
// Add specific configuration
conf.set(MO_PREFIX + namedOutput + CONF + "." + key, value);
} | java | public static void addNamedOutputContext(Job job, String namedOutput, String key, String value) {
// Check that this named output has been configured before
Configuration conf = job.getConfiguration();
// Add specific configuration
conf.set(MO_PREFIX + namedOutput + CONF + "." + key, value);
} | [
"public",
"static",
"void",
"addNamedOutputContext",
"(",
"Job",
"job",
",",
"String",
"namedOutput",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"// Check that this named output has been configured before",
"Configuration",
"conf",
"=",
"job",
".",
"getCo... | Added this method for allowing specific (key, value) configurations for each Output. Some Output Formats read
specific configuration values and act based on them.
@param namedOutput
@param key
@param value | [
"Added",
"this",
"method",
"for",
"allowing",
"specific",
"(",
"key",
"value",
")",
"configurations",
"for",
"each",
"Output",
".",
"Some",
"Output",
"Formats",
"read",
"specific",
"configuration",
"values",
"and",
"act",
"based",
"on",
"them",
"."
] | train | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/output/PangoolMultipleOutputs.java#L236-L241 |
sagiegurari/fax4j | src/main/java/org/fax4j/common/AbstractLogger.java | AbstractLogger.logInfo | public void logInfo(Object[] message,Throwable throwable)
{
this.log(LogLevel.INFO,message,throwable);
} | java | public void logInfo(Object[] message,Throwable throwable)
{
this.log(LogLevel.INFO,message,throwable);
} | [
"public",
"void",
"logInfo",
"(",
"Object",
"[",
"]",
"message",
",",
"Throwable",
"throwable",
")",
"{",
"this",
".",
"log",
"(",
"LogLevel",
".",
"INFO",
",",
"message",
",",
"throwable",
")",
";",
"}"
] | Logs the provided data at the info level.
@param message
The message parts (may be null)
@param throwable
The error (may be null) | [
"Logs",
"the",
"provided",
"data",
"at",
"the",
"info",
"level",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/common/AbstractLogger.java#L183-L186 |
lucee/Lucee | core/src/main/java/lucee/runtime/text/xml/XMLCaster.java | XMLCaster.toComment | public static Comment toComment(Document doc, Object o) throws PageException {
if (o instanceof Comment) return (Comment) o;
else if (o instanceof CharacterData) return doc.createComment(((CharacterData) o).getData());
return doc.createComment(Caster.toString(o));
} | java | public static Comment toComment(Document doc, Object o) throws PageException {
if (o instanceof Comment) return (Comment) o;
else if (o instanceof CharacterData) return doc.createComment(((CharacterData) o).getData());
return doc.createComment(Caster.toString(o));
} | [
"public",
"static",
"Comment",
"toComment",
"(",
"Document",
"doc",
",",
"Object",
"o",
")",
"throws",
"PageException",
"{",
"if",
"(",
"o",
"instanceof",
"Comment",
")",
"return",
"(",
"Comment",
")",
"o",
";",
"else",
"if",
"(",
"o",
"instanceof",
"Cha... | casts a value to a XML Comment Object
@param doc XML Document
@param o Object to cast
@return XML Comment Object
@throws PageException | [
"casts",
"a",
"value",
"to",
"a",
"XML",
"Comment",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L218-L222 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ContextsClient.java | ContextsClient.createContext | public final Context createContext(String parent, Context context) {
CreateContextRequest request =
CreateContextRequest.newBuilder().setParent(parent).setContext(context).build();
return createContext(request);
} | java | public final Context createContext(String parent, Context context) {
CreateContextRequest request =
CreateContextRequest.newBuilder().setParent(parent).setContext(context).build();
return createContext(request);
} | [
"public",
"final",
"Context",
"createContext",
"(",
"String",
"parent",
",",
"Context",
"context",
")",
"{",
"CreateContextRequest",
"request",
"=",
"CreateContextRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".",
"setContext",
"("... | Creates a context.
<p>If the specified context already exists, overrides the context.
<p>Sample code:
<pre><code>
try (ContextsClient contextsClient = ContextsClient.create()) {
SessionName parent = SessionName.of("[PROJECT]", "[SESSION]");
Context context = Context.newBuilder().build();
Context response = contextsClient.createContext(parent.toString(), context);
}
</code></pre>
@param parent Required. The session to create a context for. Format: `projects/<Project
ID>/agent/sessions/<Session ID>` or `projects/<Project
ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session
ID>`. If `Environment ID` is not specified, we assume default 'draft' environment. If
`User ID` is not specified, we assume default '-' user.
@param context Required. The context to create.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"context",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ContextsClient.java#L465-L470 |
mgm-tp/jfunk | jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MessagePredicates.java | MessagePredicates.forRecipient | public static Predicate<Message> forRecipient(final String recipient) {
return new Predicate<Message>() {
@Override
public boolean apply(final Message input) {
Address[] addresses;
try {
addresses = input.getAllRecipients();
if (addresses == null) {
return false;
}
for (Address address : addresses) {
if (StringUtils.equalsIgnoreCase(address.toString(), recipient)) {
return true;
}
}
} catch (MessagingException e) {
throw new MailException("Error while reading recipients", e);
}
return false;
}
@Override
public String toString() {
return String.format("recipient to include %s", recipient);
}
};
} | java | public static Predicate<Message> forRecipient(final String recipient) {
return new Predicate<Message>() {
@Override
public boolean apply(final Message input) {
Address[] addresses;
try {
addresses = input.getAllRecipients();
if (addresses == null) {
return false;
}
for (Address address : addresses) {
if (StringUtils.equalsIgnoreCase(address.toString(), recipient)) {
return true;
}
}
} catch (MessagingException e) {
throw new MailException("Error while reading recipients", e);
}
return false;
}
@Override
public String toString() {
return String.format("recipient to include %s", recipient);
}
};
} | [
"public",
"static",
"Predicate",
"<",
"Message",
">",
"forRecipient",
"(",
"final",
"String",
"recipient",
")",
"{",
"return",
"new",
"Predicate",
"<",
"Message",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"apply",
"(",
"final",
"Message",
"... | Creates a {@link Predicate} for matching a mail recipient. This Predicate returns true if at least
one recipient matches the given value.
@param recipient
the recipient to match
@return the predicate | [
"Creates",
"a",
"{",
"@link",
"Predicate",
"}",
"for",
"matching",
"a",
"mail",
"recipient",
".",
"This",
"Predicate",
"returns",
"true",
"if",
"at",
"least",
"one",
"recipient",
"matches",
"the",
"given",
"value",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MessagePredicates.java#L78-L104 |
riversun/d6 | src/main/java/org/riversun/d6/core/D6Crud.java | D6Crud.execInsert | public boolean execInsert(D6Model[] modelObjects) {
final D6Inex includeExcludeColumnNames = null;
return execInsert(modelObjects, includeExcludeColumnNames, false);
} | java | public boolean execInsert(D6Model[] modelObjects) {
final D6Inex includeExcludeColumnNames = null;
return execInsert(modelObjects, includeExcludeColumnNames, false);
} | [
"public",
"boolean",
"execInsert",
"(",
"D6Model",
"[",
"]",
"modelObjects",
")",
"{",
"final",
"D6Inex",
"includeExcludeColumnNames",
"=",
"null",
";",
"return",
"execInsert",
"(",
"modelObjects",
",",
"includeExcludeColumnNames",
",",
"false",
")",
";",
"}"
] | Insert the specified model object into the DB
@param modelObjects
@return true:DB operation success false:failure | [
"Insert",
"the",
"specified",
"model",
"object",
"into",
"the",
"DB"
] | train | https://github.com/riversun/d6/blob/2798bd876b9380dbfea8182d11ad306cb1b0e114/src/main/java/org/riversun/d6/core/D6Crud.java#L478-L481 |
belaban/JGroups | src/org/jgroups/stack/Configurator.java | Configurator.addPropertyToDependencyList | static void addPropertyToDependencyList(List<AccessibleObject> orderedList, Map<String, AccessibleObject> props, Stack<AccessibleObject> stack, AccessibleObject obj) {
if (orderedList.contains(obj))
return ;
if (stack.search(obj) > 0) {
throw new RuntimeException("Deadlock in @Property dependency processing") ;
}
// record the fact that we are processing obj
stack.push(obj) ;
// process dependencies for this object before adding it to the list
Property annotation = obj.getAnnotation(Property.class) ;
String dependsClause = annotation.dependsUpon() ;
StringTokenizer st = new StringTokenizer(dependsClause, ",") ;
while (st.hasMoreTokens()) {
String token = st.nextToken().trim();
AccessibleObject dep = props.get(token) ;
// if null, throw exception
addPropertyToDependencyList(orderedList, props, stack, dep) ;
}
// indicate we're done with processing dependencies
stack.pop() ;
// we can now add in dependency order
orderedList.add(obj) ;
} | java | static void addPropertyToDependencyList(List<AccessibleObject> orderedList, Map<String, AccessibleObject> props, Stack<AccessibleObject> stack, AccessibleObject obj) {
if (orderedList.contains(obj))
return ;
if (stack.search(obj) > 0) {
throw new RuntimeException("Deadlock in @Property dependency processing") ;
}
// record the fact that we are processing obj
stack.push(obj) ;
// process dependencies for this object before adding it to the list
Property annotation = obj.getAnnotation(Property.class) ;
String dependsClause = annotation.dependsUpon() ;
StringTokenizer st = new StringTokenizer(dependsClause, ",") ;
while (st.hasMoreTokens()) {
String token = st.nextToken().trim();
AccessibleObject dep = props.get(token) ;
// if null, throw exception
addPropertyToDependencyList(orderedList, props, stack, dep) ;
}
// indicate we're done with processing dependencies
stack.pop() ;
// we can now add in dependency order
orderedList.add(obj) ;
} | [
"static",
"void",
"addPropertyToDependencyList",
"(",
"List",
"<",
"AccessibleObject",
">",
"orderedList",
",",
"Map",
"<",
"String",
",",
"AccessibleObject",
">",
"props",
",",
"Stack",
"<",
"AccessibleObject",
">",
"stack",
",",
"AccessibleObject",
"obj",
")",
... | DFS of dependency graph formed by Property annotations and dependsUpon parameter
This is used to create a list of Properties in dependency order | [
"DFS",
"of",
"dependency",
"graph",
"formed",
"by",
"Property",
"annotations",
"and",
"dependsUpon",
"parameter",
"This",
"is",
"used",
"to",
"create",
"a",
"list",
"of",
"Properties",
"in",
"dependency",
"order"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/Configurator.java#L803-L827 |
tommyettinger/RegExodus | src/main/java/regexodus/Pattern.java | Pattern.matcher | public Matcher matcher(MatchResult res, String groupName) {
Integer id = res.pattern().groupId(groupName);
if (id == null) throw new IllegalArgumentException("group not found:" + groupName);
int group = id;
return matcher(res, group);
} | java | public Matcher matcher(MatchResult res, String groupName) {
Integer id = res.pattern().groupId(groupName);
if (id == null) throw new IllegalArgumentException("group not found:" + groupName);
int group = id;
return matcher(res, group);
} | [
"public",
"Matcher",
"matcher",
"(",
"MatchResult",
"res",
",",
"String",
"groupName",
")",
"{",
"Integer",
"id",
"=",
"res",
".",
"pattern",
"(",
")",
".",
"groupId",
"(",
"groupName",
")",
";",
"if",
"(",
"id",
"==",
"null",
")",
"throw",
"new",
"I... | Just as above, yet with symbolic group name.
@throws NullPointerException if there is no group with such name | [
"Just",
"as",
"above",
"yet",
"with",
"symbolic",
"group",
"name",
"."
] | train | https://github.com/tommyettinger/RegExodus/blob/d4af9bb7c132c5f9d29f45b76121f93b2f89de16/src/main/java/regexodus/Pattern.java#L527-L532 |
leancloud/java-sdk-all | core/src/main/java/cn/leancloud/AVACL.java | AVACL.setWriteAccess | public void setWriteAccess(String userId, boolean allowed) {
if (StringUtil.isEmpty(userId)) {
throw new IllegalArgumentException("cannot setRead/WriteAccess for null userId");
}
boolean readPermission = getReadAccess(userId);
setPermissionsIfNonEmpty(userId, readPermission, allowed);
} | java | public void setWriteAccess(String userId, boolean allowed) {
if (StringUtil.isEmpty(userId)) {
throw new IllegalArgumentException("cannot setRead/WriteAccess for null userId");
}
boolean readPermission = getReadAccess(userId);
setPermissionsIfNonEmpty(userId, readPermission, allowed);
} | [
"public",
"void",
"setWriteAccess",
"(",
"String",
"userId",
",",
"boolean",
"allowed",
")",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"userId",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"cannot setRead/WriteAccess for null userId\""... | Set whether the given user id is allowed to write this object. | [
"Set",
"whether",
"the",
"given",
"user",
"id",
"is",
"allowed",
"to",
"write",
"this",
"object",
"."
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/core/src/main/java/cn/leancloud/AVACL.java#L193-L199 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxAPIConnection.java | BoxAPIConnection.revokeToken | public void revokeToken() {
URL url = null;
try {
url = new URL(this.revokeURL);
} catch (MalformedURLException e) {
assert false : "An invalid refresh URL indicates a bug in the SDK.";
throw new RuntimeException("An invalid refresh URL indicates a bug in the SDK.", e);
}
String urlParameters = String.format("token=%s&client_id=%s&client_secret=%s",
this.accessToken, this.clientID, this.clientSecret);
BoxAPIRequest request = new BoxAPIRequest(this, url, "POST");
request.shouldAuthenticate(false);
request.setBody(urlParameters);
try {
request.send();
} catch (BoxAPIException e) {
throw e;
}
} | java | public void revokeToken() {
URL url = null;
try {
url = new URL(this.revokeURL);
} catch (MalformedURLException e) {
assert false : "An invalid refresh URL indicates a bug in the SDK.";
throw new RuntimeException("An invalid refresh URL indicates a bug in the SDK.", e);
}
String urlParameters = String.format("token=%s&client_id=%s&client_secret=%s",
this.accessToken, this.clientID, this.clientSecret);
BoxAPIRequest request = new BoxAPIRequest(this, url, "POST");
request.shouldAuthenticate(false);
request.setBody(urlParameters);
try {
request.send();
} catch (BoxAPIException e) {
throw e;
}
} | [
"public",
"void",
"revokeToken",
"(",
")",
"{",
"URL",
"url",
"=",
"null",
";",
"try",
"{",
"url",
"=",
"new",
"URL",
"(",
"this",
".",
"revokeURL",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"assert",
"false",
":",
"\"An in... | Revokes the tokens associated with this API connection. This results in the connection no
longer being able to make API calls until a fresh authorization is made by calling authenticate() | [
"Revokes",
"the",
"tokens",
"associated",
"with",
"this",
"API",
"connection",
".",
"This",
"results",
"in",
"the",
"connection",
"no",
"longer",
"being",
"able",
"to",
"make",
"API",
"calls",
"until",
"a",
"fresh",
"authorization",
"is",
"made",
"by",
"call... | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxAPIConnection.java#L739-L761 |
vlingo/vlingo-actors | src/main/java/io/vlingo/actors/World.java | World.registerCommonSupervisor | @Override
public void registerCommonSupervisor(final String stageName, final String name, final Class<?> supervisedProtocol, final Class<? extends Actor> supervisorClass) {
try {
final String actualStageName = stageName.equals("default") ? DEFAULT_STAGE : stageName;
final Stage stage = stageNamed(actualStageName);
final Supervisor common = stage.actorFor(Supervisor.class, Definition.has(supervisorClass, Definition.NoParameters, name));
stage.registerCommonSupervisor(supervisedProtocol, common);
} catch (Exception e) {
defaultLogger().log("vlingo/actors: World cannot register common supervisor: " + supervisedProtocol.getName(), e);
}
} | java | @Override
public void registerCommonSupervisor(final String stageName, final String name, final Class<?> supervisedProtocol, final Class<? extends Actor> supervisorClass) {
try {
final String actualStageName = stageName.equals("default") ? DEFAULT_STAGE : stageName;
final Stage stage = stageNamed(actualStageName);
final Supervisor common = stage.actorFor(Supervisor.class, Definition.has(supervisorClass, Definition.NoParameters, name));
stage.registerCommonSupervisor(supervisedProtocol, common);
} catch (Exception e) {
defaultLogger().log("vlingo/actors: World cannot register common supervisor: " + supervisedProtocol.getName(), e);
}
} | [
"@",
"Override",
"public",
"void",
"registerCommonSupervisor",
"(",
"final",
"String",
"stageName",
",",
"final",
"String",
"name",
",",
"final",
"Class",
"<",
"?",
">",
"supervisedProtocol",
",",
"final",
"Class",
"<",
"?",
"extends",
"Actor",
">",
"superviso... | Registers the {@code supervisorClass} plugin by {@code name} that will supervise all {@code Actors} that implement the {@code supervisedProtocol}.
@param stageName the {@code String} name of the {@code Stage} in which the {@code supervisorClass} is to be registered
@param name the {@code String} name of the supervisor to register
@param supervisedProtocol the protocol of {@code Class<?>} for which the supervisor will supervise
@param supervisorClass the {@code Class<? extends Actor>} to register as a supervisor | [
"Registers",
"the",
"{"
] | train | https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/World.java#L310-L320 |
knowm/XChange | xchange-wex/src/main/java/org/knowm/xchange/wex/v3/service/WexMarketDataService.java | WexMarketDataService.getOrderBook | @Override
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException {
String pairs = WexAdapters.getPair(currencyPair);
WexDepthWrapper wexDepthWrapper = null;
if (args != null && args.length > 0) {
Object arg0 = args[0];
if (!(arg0 instanceof Integer) || ((Integer) arg0 < 1) || ((Integer) arg0 > FULL_SIZE)) {
throw new ExchangeException(
"Orderbook size argument must be an Integer in the range: (1, 2000)!");
} else {
wexDepthWrapper = getBTCEDepth(pairs, (Integer) arg0);
}
} else { // default to full orderbook
wexDepthWrapper = getBTCEDepth(pairs, FULL_SIZE);
}
// Adapt to XChange DTOs
List<LimitOrder> asks =
WexAdapters.adaptOrders(
wexDepthWrapper.getDepth(WexAdapters.getPair(currencyPair)).getAsks(),
currencyPair,
"ask",
"");
List<LimitOrder> bids =
WexAdapters.adaptOrders(
wexDepthWrapper.getDepth(WexAdapters.getPair(currencyPair)).getBids(),
currencyPair,
"bid",
"");
return new OrderBook(null, asks, bids);
} | java | @Override
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException {
String pairs = WexAdapters.getPair(currencyPair);
WexDepthWrapper wexDepthWrapper = null;
if (args != null && args.length > 0) {
Object arg0 = args[0];
if (!(arg0 instanceof Integer) || ((Integer) arg0 < 1) || ((Integer) arg0 > FULL_SIZE)) {
throw new ExchangeException(
"Orderbook size argument must be an Integer in the range: (1, 2000)!");
} else {
wexDepthWrapper = getBTCEDepth(pairs, (Integer) arg0);
}
} else { // default to full orderbook
wexDepthWrapper = getBTCEDepth(pairs, FULL_SIZE);
}
// Adapt to XChange DTOs
List<LimitOrder> asks =
WexAdapters.adaptOrders(
wexDepthWrapper.getDepth(WexAdapters.getPair(currencyPair)).getAsks(),
currencyPair,
"ask",
"");
List<LimitOrder> bids =
WexAdapters.adaptOrders(
wexDepthWrapper.getDepth(WexAdapters.getPair(currencyPair)).getBids(),
currencyPair,
"bid",
"");
return new OrderBook(null, asks, bids);
} | [
"@",
"Override",
"public",
"OrderBook",
"getOrderBook",
"(",
"CurrencyPair",
"currencyPair",
",",
"Object",
"...",
"args",
")",
"throws",
"IOException",
"{",
"String",
"pairs",
"=",
"WexAdapters",
".",
"getPair",
"(",
"currencyPair",
")",
";",
"WexDepthWrapper",
... | Get market depth from exchange
@param args Optional arguments. Exchange-specific. This implementation assumes: Integer value
from 1 to 2000 -> get corresponding number of items
@return The OrderBook
@throws IOException | [
"Get",
"market",
"depth",
"from",
"exchange"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-wex/src/main/java/org/knowm/xchange/wex/v3/service/WexMarketDataService.java#L49-L82 |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.fromTupleDataSet | public static <K, VV, EV> Graph<K, VV, EV> fromTupleDataSet(DataSet<Tuple3<K, K, EV>> edges,
final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) {
DataSet<Edge<K, EV>> edgeDataSet = edges
.map(new Tuple3ToEdgeMap<>())
.name("Type conversion");
return fromDataSet(edgeDataSet, vertexValueInitializer, context);
} | java | public static <K, VV, EV> Graph<K, VV, EV> fromTupleDataSet(DataSet<Tuple3<K, K, EV>> edges,
final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) {
DataSet<Edge<K, EV>> edgeDataSet = edges
.map(new Tuple3ToEdgeMap<>())
.name("Type conversion");
return fromDataSet(edgeDataSet, vertexValueInitializer, context);
} | [
"public",
"static",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"fromTupleDataSet",
"(",
"DataSet",
"<",
"Tuple3",
"<",
"K",
",",
"K",
",",
"EV",
">",
">",
"edges",
",",
"final",
"MapFunction",
"<",
"K",
"... | Creates a graph from a DataSet of Tuple3 objects for edges.
<p>Each Tuple3 will become one Edge, where the source ID will be the first field of the Tuple2,
the target ID will be the second field of the Tuple2
and the Edge value will be the third field of the Tuple3.
<p>Vertices are created automatically and their values are initialized
by applying the provided vertexValueInitializer map function to the vertex IDs.
@param edges a DataSet of Tuple3.
@param vertexValueInitializer the mapper function that initializes the vertex values.
It allows to apply a map transformation on the vertex ID to produce an initial vertex value.
@param context the flink execution environment.
@return the newly created graph. | [
"Creates",
"a",
"graph",
"from",
"a",
"DataSet",
"of",
"Tuple3",
"objects",
"for",
"edges",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L321-L329 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/NotesApi.java | NotesApi.createMergeRequestNote | public Note createMergeRequestNote(Object projectIdOrPath, Integer mergeRequestIid, String body) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("body", body, true);
Response response = post(Response.Status.CREATED, formData,
"projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes");
return (response.readEntity(Note.class));
} | java | public Note createMergeRequestNote(Object projectIdOrPath, Integer mergeRequestIid, String body) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("body", body, true);
Response response = post(Response.Status.CREATED, formData,
"projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes");
return (response.readEntity(Note.class));
} | [
"public",
"Note",
"createMergeRequestNote",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"mergeRequestIid",
",",
"String",
"body",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(... | Create a merge request's note.
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param mergeRequestIid the merge request IID to create the notes for
@param body the content of note
@return the created Note instance
@throws GitLabApiException if any exception occurs | [
"Create",
"a",
"merge",
"request",
"s",
"note",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L386-L391 |
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/DogmaApi.java | DogmaApi.getDogmaEffectsEffectId | public DogmaEffectResponse getDogmaEffectsEffectId(Integer effectId, String datasource, String ifNoneMatch)
throws ApiException {
ApiResponse<DogmaEffectResponse> resp = getDogmaEffectsEffectIdWithHttpInfo(effectId, datasource, ifNoneMatch);
return resp.getData();
} | java | public DogmaEffectResponse getDogmaEffectsEffectId(Integer effectId, String datasource, String ifNoneMatch)
throws ApiException {
ApiResponse<DogmaEffectResponse> resp = getDogmaEffectsEffectIdWithHttpInfo(effectId, datasource, ifNoneMatch);
return resp.getData();
} | [
"public",
"DogmaEffectResponse",
"getDogmaEffectsEffectId",
"(",
"Integer",
"effectId",
",",
"String",
"datasource",
",",
"String",
"ifNoneMatch",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"DogmaEffectResponse",
">",
"resp",
"=",
"getDogmaEffectsEffectIdWith... | Get effect information Get information on a dogma effect --- This route
expires daily at 11:05
@param effectId
A dogma effect ID (required)
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param ifNoneMatch
ETag from a previous request. A 304 will be returned if this
matches the current ETag (optional)
@return DogmaEffectResponse
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body | [
"Get",
"effect",
"information",
"Get",
"information",
"on",
"a",
"dogma",
"effect",
"---",
"This",
"route",
"expires",
"daily",
"at",
"11",
":",
"05"
] | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/DogmaApi.java#L719-L723 |
cdk/cdk | descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java | LargestPiSystemDescriptor.breadthFirstSearch | private void breadthFirstSearch(IAtomContainer container, List<IAtom> sphere, List<IAtom> path) throws CDKException {
IAtom nextAtom;
List<IAtom> newSphere = new ArrayList<IAtom>();
//logger.debug("Start of breadthFirstSearch");
for (IAtom atom : sphere) {
//logger.debug("BreadthFirstSearch around atom " + (atomNr + 1));
List bonds = container.getConnectedBondsList(atom);
for (Object bond : bonds) {
nextAtom = ((IBond) bond).getOther(atom);
if ((container.getMaximumBondOrder(nextAtom) != IBond.Order.SINGLE
|| Math.abs(nextAtom.getFormalCharge()) >= 1 || nextAtom.getFlag(CDKConstants.ISAROMATIC)
|| nextAtom.getSymbol().equals("N") || nextAtom.getSymbol().equals("O"))
& !nextAtom.getFlag(CDKConstants.VISITED)) {
//logger.debug("BDS> AtomNr:"+container.indexOf(nextAtom)+" maxBondOrder:"+container.getMaximumBondOrder(nextAtom)+" Aromatic:"+nextAtom.getFlag(CDKConstants.ISAROMATIC)+" FormalCharge:"+nextAtom.getFormalCharge()+" Charge:"+nextAtom.getCharge()+" Flag:"+nextAtom.getFlag(CDKConstants.VISITED));
path.add(nextAtom);
//logger.debug("BreadthFirstSearch is meeting new atom " + (nextAtomNr + 1));
nextAtom.setFlag(CDKConstants.VISITED, true);
if (container.getConnectedBondsCount(nextAtom) > 1) {
newSphere.add(nextAtom);
}
} else {
nextAtom.setFlag(CDKConstants.VISITED, true);
}
}
}
if (newSphere.size() > 0) {
breadthFirstSearch(container, newSphere, path);
}
} | java | private void breadthFirstSearch(IAtomContainer container, List<IAtom> sphere, List<IAtom> path) throws CDKException {
IAtom nextAtom;
List<IAtom> newSphere = new ArrayList<IAtom>();
//logger.debug("Start of breadthFirstSearch");
for (IAtom atom : sphere) {
//logger.debug("BreadthFirstSearch around atom " + (atomNr + 1));
List bonds = container.getConnectedBondsList(atom);
for (Object bond : bonds) {
nextAtom = ((IBond) bond).getOther(atom);
if ((container.getMaximumBondOrder(nextAtom) != IBond.Order.SINGLE
|| Math.abs(nextAtom.getFormalCharge()) >= 1 || nextAtom.getFlag(CDKConstants.ISAROMATIC)
|| nextAtom.getSymbol().equals("N") || nextAtom.getSymbol().equals("O"))
& !nextAtom.getFlag(CDKConstants.VISITED)) {
//logger.debug("BDS> AtomNr:"+container.indexOf(nextAtom)+" maxBondOrder:"+container.getMaximumBondOrder(nextAtom)+" Aromatic:"+nextAtom.getFlag(CDKConstants.ISAROMATIC)+" FormalCharge:"+nextAtom.getFormalCharge()+" Charge:"+nextAtom.getCharge()+" Flag:"+nextAtom.getFlag(CDKConstants.VISITED));
path.add(nextAtom);
//logger.debug("BreadthFirstSearch is meeting new atom " + (nextAtomNr + 1));
nextAtom.setFlag(CDKConstants.VISITED, true);
if (container.getConnectedBondsCount(nextAtom) > 1) {
newSphere.add(nextAtom);
}
} else {
nextAtom.setFlag(CDKConstants.VISITED, true);
}
}
}
if (newSphere.size() > 0) {
breadthFirstSearch(container, newSphere, path);
}
} | [
"private",
"void",
"breadthFirstSearch",
"(",
"IAtomContainer",
"container",
",",
"List",
"<",
"IAtom",
">",
"sphere",
",",
"List",
"<",
"IAtom",
">",
"path",
")",
"throws",
"CDKException",
"{",
"IAtom",
"nextAtom",
";",
"List",
"<",
"IAtom",
">",
"newSphere... | Performs a breadthFirstSearch in an AtomContainer starting with a
particular sphere, which usually consists of one start atom, and searches
for a pi system.
@param container The AtomContainer to
be searched
@param sphere A sphere of atoms to
start the search with
@param path An array list which stores the atoms belonging to the pi system
@throws org.openscience.cdk.exception.CDKException
Description of the
Exception | [
"Performs",
"a",
"breadthFirstSearch",
"in",
"an",
"AtomContainer",
"starting",
"with",
"a",
"particular",
"sphere",
"which",
"usually",
"consists",
"of",
"one",
"start",
"atom",
"and",
"searches",
"for",
"a",
"pi",
"system",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java#L237-L265 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java | ISPNIndexUpdateMonitor.cacheEntryModified | @CacheEntryModified
public void cacheEntryModified(CacheEntryModifiedEvent<Serializable, Object> event)
{
if (!event.isPre() && event.getKey().equals(updateKey))
{
Object value = event.getValue();
localUpdateInProgress = value != null ? (Boolean)value : false;
for (IndexUpdateMonitorListener listener : listeners)
{
listener.onUpdateInProgressChange(localUpdateInProgress);
}
}
} | java | @CacheEntryModified
public void cacheEntryModified(CacheEntryModifiedEvent<Serializable, Object> event)
{
if (!event.isPre() && event.getKey().equals(updateKey))
{
Object value = event.getValue();
localUpdateInProgress = value != null ? (Boolean)value : false;
for (IndexUpdateMonitorListener listener : listeners)
{
listener.onUpdateInProgressChange(localUpdateInProgress);
}
}
} | [
"@",
"CacheEntryModified",
"public",
"void",
"cacheEntryModified",
"(",
"CacheEntryModifiedEvent",
"<",
"Serializable",
",",
"Object",
">",
"event",
")",
"{",
"if",
"(",
"!",
"event",
".",
"isPre",
"(",
")",
"&&",
"event",
".",
"getKey",
"(",
")",
".",
"eq... | Method will be invoked when a cache entry has been modified only in READ_ONLY mode.
@param event
CacheEntryModifiedEvent | [
"Method",
"will",
"be",
"invoked",
"when",
"a",
"cache",
"entry",
"has",
"been",
"modified",
"only",
"in",
"READ_ONLY",
"mode",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java#L217-L230 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.