repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
jaxio/celerio | celerio-engine/src/main/java/com/jaxio/celerio/util/IOUtil.java | IOUtil.inputStreamToFile | public void inputStreamToFile(InputStream is, String filename) throws IOException {
FileOutputStream fos = new FileOutputStream(filename);
inputStreamToOutputStream(is, fos);
fos.close();
} | java | public void inputStreamToFile(InputStream is, String filename) throws IOException {
FileOutputStream fos = new FileOutputStream(filename);
inputStreamToOutputStream(is, fos);
fos.close();
} | [
"public",
"void",
"inputStreamToFile",
"(",
"InputStream",
"is",
",",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"filename",
")",
";",
"inputStreamToOutputStream",
"(",
"is",
",",
"fos",... | Write to a file the bytes read from an input stream.
@param filename the full or relative path to the file. | [
"Write",
"to",
"a",
"file",
"the",
"bytes",
"read",
"from",
"an",
"input",
"stream",
"."
] | train | https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/util/IOUtil.java#L92-L96 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/rewrite/rewritepolicylabel_stats.java | rewritepolicylabel_stats.get | public static rewritepolicylabel_stats get(nitro_service service, String labelname) throws Exception{
rewritepolicylabel_stats obj = new rewritepolicylabel_stats();
obj.set_labelname(labelname);
rewritepolicylabel_stats response = (rewritepolicylabel_stats) obj.stat_resource(service);
return response;
} | java | public static rewritepolicylabel_stats get(nitro_service service, String labelname) throws Exception{
rewritepolicylabel_stats obj = new rewritepolicylabel_stats();
obj.set_labelname(labelname);
rewritepolicylabel_stats response = (rewritepolicylabel_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"rewritepolicylabel_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"labelname",
")",
"throws",
"Exception",
"{",
"rewritepolicylabel_stats",
"obj",
"=",
"new",
"rewritepolicylabel_stats",
"(",
")",
";",
"obj",
".",
"set_labelname",
... | Use this API to fetch statistics of rewritepolicylabel_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"rewritepolicylabel_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/rewrite/rewritepolicylabel_stats.java#L149-L154 |
kiswanij/jk-util | src/main/java/com/jk/util/model/table/JKDefaultTableModel.java | JKDefaultTableModel.setDataVector | public void setDataVector(final Object[][] dataVector, final Object[] columnIdentifiers) {
setDataVector(convertToVector(dataVector), convertToVector(columnIdentifiers));
} | java | public void setDataVector(final Object[][] dataVector, final Object[] columnIdentifiers) {
setDataVector(convertToVector(dataVector), convertToVector(columnIdentifiers));
} | [
"public",
"void",
"setDataVector",
"(",
"final",
"Object",
"[",
"]",
"[",
"]",
"dataVector",
",",
"final",
"Object",
"[",
"]",
"columnIdentifiers",
")",
"{",
"setDataVector",
"(",
"convertToVector",
"(",
"dataVector",
")",
",",
"convertToVector",
"(",
"columnI... | Replaces the value in the <code>dataVector</code> instance variable with the
values in the array <code>dataVector</code>. The first index in the
<code>Object[][]</code> array is the row index and the second is the column
index. <code>columnIdentifiers</code> are the names of the new columns.
@param dataVector the new data vector
@param columnIdentifiers the names of the columns
@see #setDataVector(Vector, Vector) | [
"Replaces",
"the",
"value",
"in",
"the",
"<code",
">",
"dataVector<",
"/",
"code",
">",
"instance",
"variable",
"with",
"the",
"values",
"in",
"the",
"array",
"<code",
">",
"dataVector<",
"/",
"code",
">",
".",
"The",
"first",
"index",
"in",
"the",
"<cod... | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKDefaultTableModel.java#L637-L639 |
apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java | SchedulerUtils.getExecutorCommand | public static String[] getExecutorCommand(
Config config,
Config runtime,
int shardId,
Map<ExecutorPort, String> ports) {
return getExecutorCommand(config, runtime, Integer.toString(shardId), ports);
} | java | public static String[] getExecutorCommand(
Config config,
Config runtime,
int shardId,
Map<ExecutorPort, String> ports) {
return getExecutorCommand(config, runtime, Integer.toString(shardId), ports);
} | [
"public",
"static",
"String",
"[",
"]",
"getExecutorCommand",
"(",
"Config",
"config",
",",
"Config",
"runtime",
",",
"int",
"shardId",
",",
"Map",
"<",
"ExecutorPort",
",",
"String",
">",
"ports",
")",
"{",
"return",
"getExecutorCommand",
"(",
"config",
","... | Utils method to construct the command to start heron-executor
@param config The static config
@param runtime The runtime config
@param shardId the executor/container index
@param ports a map of ports to use where the key indicate the port type and the
value is the port
@return String[] representing the command to start heron-executor | [
"Utils",
"method",
"to",
"construct",
"the",
"command",
"to",
"start",
"heron",
"-",
"executor"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java#L192-L198 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxFile.java | BoxFile.getMetadata | public Metadata getMetadata(String typeName, String scope) {
URL url = METADATA_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID(), scope, typeName);
BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
return new Metadata(JsonObject.readFrom(response.getJSON()));
} | java | public Metadata getMetadata(String typeName, String scope) {
URL url = METADATA_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID(), scope, typeName);
BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
return new Metadata(JsonObject.readFrom(response.getJSON()));
} | [
"public",
"Metadata",
"getMetadata",
"(",
"String",
"typeName",
",",
"String",
"scope",
")",
"{",
"URL",
"url",
"=",
"METADATA_URL_TEMPLATE",
".",
"build",
"(",
"this",
".",
"getAPI",
"(",
")",
".",
"getBaseURL",
"(",
")",
",",
"this",
".",
"getID",
"(",... | Gets the file metadata of specified template type.
@param typeName the metadata template type name.
@param scope the metadata scope (global or enterprise).
@return the metadata returned from the server. | [
"Gets",
"the",
"file",
"metadata",
"of",
"specified",
"template",
"type",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFile.java#L1276-L1281 |
pravega/pravega | common/src/main/java/io/pravega/common/util/BitConverter.java | BitConverter.writeUUID | public static int writeUUID(byte[] target, int offset, UUID value) {
writeLong(target, offset, value.getMostSignificantBits());
writeLong(target, offset + Long.BYTES, value.getLeastSignificantBits());
return 2 * Long.BYTES;
} | java | public static int writeUUID(byte[] target, int offset, UUID value) {
writeLong(target, offset, value.getMostSignificantBits());
writeLong(target, offset + Long.BYTES, value.getLeastSignificantBits());
return 2 * Long.BYTES;
} | [
"public",
"static",
"int",
"writeUUID",
"(",
"byte",
"[",
"]",
"target",
",",
"int",
"offset",
",",
"UUID",
"value",
")",
"{",
"writeLong",
"(",
"target",
",",
"offset",
",",
"value",
".",
"getMostSignificantBits",
"(",
")",
")",
";",
"writeLong",
"(",
... | Writes the given 128-bit UUID to the given byte array at the given offset.
@param target The byte array to write to.
@param offset The offset within the byte array to write at.
@param value The value to write.
@return The number of bytes written. | [
"Writes",
"the",
"given",
"128",
"-",
"bit",
"UUID",
"to",
"the",
"given",
"byte",
"array",
"at",
"the",
"given",
"offset",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L203-L207 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayReader.java | ByteArrayReader.readInt | public static long readInt(byte[] data, int start) {
long ret = (((long) (data[start] & 0xFF) << 24) & 0xFFFFFFFFL)
| ((data[start + 1] & 0xFF) << 16)
| ((data[start + 2] & 0xFF) << 8)
| ((data[start + 3] & 0xFF) << 0);
return ret;
} | java | public static long readInt(byte[] data, int start) {
long ret = (((long) (data[start] & 0xFF) << 24) & 0xFFFFFFFFL)
| ((data[start + 1] & 0xFF) << 16)
| ((data[start + 2] & 0xFF) << 8)
| ((data[start + 3] & 0xFF) << 0);
return ret;
} | [
"public",
"static",
"long",
"readInt",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
")",
"{",
"long",
"ret",
"=",
"(",
"(",
"(",
"long",
")",
"(",
"data",
"[",
"start",
"]",
"&",
"0xFF",
")",
"<<",
"24",
")",
"&",
"0xFFFFFFFF",
"L",
")",... | Read an integer (4 bytes) from the array. This is returned as a long as
we deal with unsigned ints so the value may be higher than the standard
java int.
@param data
@param start
@return the value represent by a long. | [
"Read",
"an",
"integer",
"(",
"4",
"bytes",
")",
"from",
"the",
"array",
".",
"This",
"is",
"returned",
"as",
"a",
"long",
"as",
"we",
"deal",
"with",
"unsigned",
"ints",
"so",
"the",
"value",
"may",
"be",
"higher",
"than",
"the",
"standard",
"java",
... | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayReader.java#L170-L177 |
google/closure-compiler | src/com/google/javascript/rhino/HamtPMap.java | HamtPMap.equivalent | @Override
public boolean equivalent(PMap<K, V> that, BiPredicate<V, V> equivalence) {
return equivalent(
!this.isEmpty() ? this : null, !that.isEmpty() ? (HamtPMap<K, V>) that : null, equivalence);
} | java | @Override
public boolean equivalent(PMap<K, V> that, BiPredicate<V, V> equivalence) {
return equivalent(
!this.isEmpty() ? this : null, !that.isEmpty() ? (HamtPMap<K, V>) that : null, equivalence);
} | [
"@",
"Override",
"public",
"boolean",
"equivalent",
"(",
"PMap",
"<",
"K",
",",
"V",
">",
"that",
",",
"BiPredicate",
"<",
"V",
",",
"V",
">",
"equivalence",
")",
"{",
"return",
"equivalent",
"(",
"!",
"this",
".",
"isEmpty",
"(",
")",
"?",
"this",
... | Checks equality recursively based on the given equivalence. Short-circuits as soon as a 'false'
result is found. | [
"Checks",
"equality",
"recursively",
"based",
"on",
"the",
"given",
"equivalence",
".",
"Short",
"-",
"circuits",
"as",
"soon",
"as",
"a",
"false",
"result",
"is",
"found",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L375-L379 |
xvik/generics-resolver | src/main/java/ru/vyarus/java/generics/resolver/util/GenericsUtils.java | GenericsUtils.recordVariable | private static void recordVariable(final TypeVariable var, final List<TypeVariable> found) {
// prevent cycles
if (!found.contains(var)) {
found.add(var);
for (Type type : var.getBounds()) {
findVariables(type, found);
}
}
} | java | private static void recordVariable(final TypeVariable var, final List<TypeVariable> found) {
// prevent cycles
if (!found.contains(var)) {
found.add(var);
for (Type type : var.getBounds()) {
findVariables(type, found);
}
}
} | [
"private",
"static",
"void",
"recordVariable",
"(",
"final",
"TypeVariable",
"var",
",",
"final",
"List",
"<",
"TypeVariable",
">",
"found",
")",
"{",
"// prevent cycles",
"if",
"(",
"!",
"found",
".",
"contains",
"(",
"var",
")",
")",
"{",
"found",
".",
... | variables could also contain variables, e.g. <T, K extends List<T>> | [
"variables",
"could",
"also",
"contain",
"variables",
"e",
".",
"g",
".",
"<T",
"K",
"extends",
"List<T",
">>"
] | train | https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/GenericsUtils.java#L617-L625 |
finmath/finmath-lib | src/main/java6/net/finmath/functions/AnalyticFormulas.java | AnalyticFormulas.sabrBerestyckiNormalVolatilityApproximation | public static double sabrBerestyckiNormalVolatilityApproximation(double alpha, double beta, double rho, double nu, double displacement, double underlying, double strike, double maturity)
{
// Apply displacement. Displaced model is just a shift on underlying and strike.
underlying += displacement;
strike += displacement;
double forwardStrikeAverage = (underlying+strike) / 2.0; // Original paper uses a geometric average here
double z;
if(beta < 1.0) {
z = nu / alpha * (Math.pow(underlying, 1.0-beta) - Math.pow(strike, 1.0-beta)) / (1.0-beta);
} else {
z = nu / alpha * Math.log(underlying/strike);
}
double x = Math.log((Math.sqrt(1.0 - 2.0*rho*z + z*z) + z - rho) / (1.0-rho));
double term1;
if(Math.abs(underlying - strike) < 1E-10 * (1+Math.abs(underlying))) {
// ATM case - we assume underlying = strike
term1 = alpha * Math.pow(underlying, beta);
}
else {
term1 = nu * (underlying-strike) / x;
}
double sigma = term1 * (1.0 + maturity * ((-beta*(2-beta)*alpha*alpha)/(24*Math.pow(forwardStrikeAverage,2.0*(1.0-beta))) + beta*alpha*rho*nu / (4*Math.pow(forwardStrikeAverage,(1.0-beta))) + (2.0 -3.0*rho*rho)*nu*nu/24));
return Math.max(sigma, 0.0);
} | java | public static double sabrBerestyckiNormalVolatilityApproximation(double alpha, double beta, double rho, double nu, double displacement, double underlying, double strike, double maturity)
{
// Apply displacement. Displaced model is just a shift on underlying and strike.
underlying += displacement;
strike += displacement;
double forwardStrikeAverage = (underlying+strike) / 2.0; // Original paper uses a geometric average here
double z;
if(beta < 1.0) {
z = nu / alpha * (Math.pow(underlying, 1.0-beta) - Math.pow(strike, 1.0-beta)) / (1.0-beta);
} else {
z = nu / alpha * Math.log(underlying/strike);
}
double x = Math.log((Math.sqrt(1.0 - 2.0*rho*z + z*z) + z - rho) / (1.0-rho));
double term1;
if(Math.abs(underlying - strike) < 1E-10 * (1+Math.abs(underlying))) {
// ATM case - we assume underlying = strike
term1 = alpha * Math.pow(underlying, beta);
}
else {
term1 = nu * (underlying-strike) / x;
}
double sigma = term1 * (1.0 + maturity * ((-beta*(2-beta)*alpha*alpha)/(24*Math.pow(forwardStrikeAverage,2.0*(1.0-beta))) + beta*alpha*rho*nu / (4*Math.pow(forwardStrikeAverage,(1.0-beta))) + (2.0 -3.0*rho*rho)*nu*nu/24));
return Math.max(sigma, 0.0);
} | [
"public",
"static",
"double",
"sabrBerestyckiNormalVolatilityApproximation",
"(",
"double",
"alpha",
",",
"double",
"beta",
",",
"double",
"rho",
",",
"double",
"nu",
",",
"double",
"displacement",
",",
"double",
"underlying",
",",
"double",
"strike",
",",
"double... | Return the implied normal volatility (Bachelier volatility) under a SABR model using the
approximation of Berestycki.
@param alpha initial value of the stochastic volatility process of the SABR model.
@param beta CEV parameter of the SABR model.
@param rho Correlation (leverages) of the stochastic volatility.
@param nu Volatility of the stochastic volatility (vol-of-vol).
@param displacement The displacement parameter d.
@param underlying Underlying (spot) value.
@param strike Strike.
@param maturity Maturity.
@return The implied normal volatility (Bachelier volatility) | [
"Return",
"the",
"implied",
"normal",
"volatility",
"(",
"Bachelier",
"volatility",
")",
"under",
"a",
"SABR",
"model",
"using",
"the",
"approximation",
"of",
"Berestycki",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/functions/AnalyticFormulas.java#L1092-L1120 |
ModeShape/modeshape | index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/LuceneQueryFactory.java | LuceneQueryFactory.forSingleColumnIndex | public static LuceneQueryFactory forSingleColumnIndex( ValueFactories factories,
Map<String, Object> variables,
Map<String, PropertyType> propertyTypesByName ) {
return new SingleColumnQueryFactory(factories, variables, propertyTypesByName);
} | java | public static LuceneQueryFactory forSingleColumnIndex( ValueFactories factories,
Map<String, Object> variables,
Map<String, PropertyType> propertyTypesByName ) {
return new SingleColumnQueryFactory(factories, variables, propertyTypesByName);
} | [
"public",
"static",
"LuceneQueryFactory",
"forSingleColumnIndex",
"(",
"ValueFactories",
"factories",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"variables",
",",
"Map",
"<",
"String",
",",
"PropertyType",
">",
"propertyTypesByName",
")",
"{",
"return",
"new",... | Creates a new query factory which can be used to produce Lucene queries for {@link org.modeshape.jcr.index.lucene.SingleColumnIndex}
indexes.
@param factories a {@link ValueFactories} instance; may not be null
@param variables a {@link Map} instance which contains the query variables for a particular query; may be {@code null}
@param propertyTypesByName a {@link Map} representing the columns and their types for the index definition
for which the query should be created; may not be null.
@return a {@link LuceneQueryFactory} instance, never {@code null} | [
"Creates",
"a",
"new",
"query",
"factory",
"which",
"can",
"be",
"used",
"to",
"produce",
"Lucene",
"queries",
"for",
"{",
"@link",
"org",
".",
"modeshape",
".",
"jcr",
".",
"index",
".",
"lucene",
".",
"SingleColumnIndex",
"}",
"indexes",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/LuceneQueryFactory.java#L142-L146 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java | JobExecutionsInner.create | public JobExecutionInner create(String resourceGroupName, String serverName, String jobAgentName, String jobName) {
return createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().last().body();
} | java | public JobExecutionInner create(String resourceGroupName, String serverName, String jobAgentName, String jobName) {
return createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().last().body();
} | [
"public",
"JobExecutionInner",
"create",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"jobAgentName",
",",
"String",
"jobName",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"... | Starts an elastic job execution.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param jobName The name of the job to get.
@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 JobExecutionInner object if successful. | [
"Starts",
"an",
"elastic",
"job",
"execution",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java#L521-L523 |
lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceClassLoader.java | ResourceClassLoader.getCustomResourceClassLoader | public ResourceClassLoader getCustomResourceClassLoader(Resource[] resources) throws IOException {
if (ArrayUtil.isEmpty(resources)) return this;
String key = hash(resources);
ResourceClassLoader rcl = (customCLs == null) ? null : customCLs.get(key);
if (rcl != null) return rcl;
resources = ResourceUtil.merge(this.getResources(), resources);
rcl = new ResourceClassLoader(resources, getParent());
if (customCLs == null) customCLs = new ReferenceMap<String, ResourceClassLoader>();
customCLs.put(key, rcl);
return rcl;
} | java | public ResourceClassLoader getCustomResourceClassLoader(Resource[] resources) throws IOException {
if (ArrayUtil.isEmpty(resources)) return this;
String key = hash(resources);
ResourceClassLoader rcl = (customCLs == null) ? null : customCLs.get(key);
if (rcl != null) return rcl;
resources = ResourceUtil.merge(this.getResources(), resources);
rcl = new ResourceClassLoader(resources, getParent());
if (customCLs == null) customCLs = new ReferenceMap<String, ResourceClassLoader>();
customCLs.put(key, rcl);
return rcl;
} | [
"public",
"ResourceClassLoader",
"getCustomResourceClassLoader",
"(",
"Resource",
"[",
"]",
"resources",
")",
"throws",
"IOException",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"resources",
")",
")",
"return",
"this",
";",
"String",
"key",
"=",
"hash",
... | /*
public synchronized void addResources(Resource[] reses) throws IOException { for(int
i=0;i<reses.length;i++){ if(!this.resources.contains(reses[i])){ this.resources.add(reses[i]);
addURL(doURL(reses[i])); } } } | [
"/",
"*",
"public",
"synchronized",
"void",
"addResources",
"(",
"Resource",
"[]",
"reses",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i<reses",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!this",
".",
"resour... | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceClassLoader.java#L105-L121 |
Erudika/para | para-server/src/main/java/com/erudika/para/security/RestAuthFilter.java | RestAuthFilter.doFilter | @Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException {
// We must wrap the request in order to read the InputStream twice:
// - first read - used to calculate the signature
// - second read - used as request payload
BufferedRequestWrapper request = new BufferedRequestWrapper((HttpServletRequest) req);
HttpServletResponse response = (HttpServletResponse) res;
boolean proceed = true;
try {
// users are allowed to GET '/_me' - used on the client-side for checking authentication
String appid = RestUtils.extractAccessKey(request);
boolean isApp = !StringUtils.isBlank(appid);
boolean isGuest = RestUtils.isAnonymousRequest(request);
if (isGuest && RestRequestMatcher.INSTANCE.matches(request)) {
proceed = guestAuthRequestHandler(appid, (HttpServletRequest) req, response);
} else if (!isApp && RestRequestMatcher.INSTANCE.matches(request)) {
proceed = userAuthRequestHandler((HttpServletRequest) req, response);
} else if (isApp && RestRequestMatcher.INSTANCE_STRICT.matches(request)) {
proceed = appAuthRequestHandler(appid, request, response);
}
} catch (Exception e) {
logger.error("Failed to authorize request.", e);
}
if (proceed) {
chain.doFilter(request, res);
}
} | java | @Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException {
// We must wrap the request in order to read the InputStream twice:
// - first read - used to calculate the signature
// - second read - used as request payload
BufferedRequestWrapper request = new BufferedRequestWrapper((HttpServletRequest) req);
HttpServletResponse response = (HttpServletResponse) res;
boolean proceed = true;
try {
// users are allowed to GET '/_me' - used on the client-side for checking authentication
String appid = RestUtils.extractAccessKey(request);
boolean isApp = !StringUtils.isBlank(appid);
boolean isGuest = RestUtils.isAnonymousRequest(request);
if (isGuest && RestRequestMatcher.INSTANCE.matches(request)) {
proceed = guestAuthRequestHandler(appid, (HttpServletRequest) req, response);
} else if (!isApp && RestRequestMatcher.INSTANCE.matches(request)) {
proceed = userAuthRequestHandler((HttpServletRequest) req, response);
} else if (isApp && RestRequestMatcher.INSTANCE_STRICT.matches(request)) {
proceed = appAuthRequestHandler(appid, request, response);
}
} catch (Exception e) {
logger.error("Failed to authorize request.", e);
}
if (proceed) {
chain.doFilter(request, res);
}
} | [
"@",
"Override",
"public",
"void",
"doFilter",
"(",
"ServletRequest",
"req",
",",
"ServletResponse",
"res",
",",
"FilterChain",
"chain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"// We must wrap the request in order to read the InputStream twice:",
"// - ... | Authenticates an application or user or guest.
@param req a request
@param res a response
@param chain filter chain
@throws IOException ex
@throws ServletException ex | [
"Authenticates",
"an",
"application",
"or",
"user",
"or",
"guest",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/RestAuthFilter.java#L66-L95 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getRegexEntityEntityInfoAsync | public Observable<RegexEntityExtractor> getRegexEntityEntityInfoAsync(UUID appId, String versionId, UUID regexEntityId) {
return getRegexEntityEntityInfoWithServiceResponseAsync(appId, versionId, regexEntityId).map(new Func1<ServiceResponse<RegexEntityExtractor>, RegexEntityExtractor>() {
@Override
public RegexEntityExtractor call(ServiceResponse<RegexEntityExtractor> response) {
return response.body();
}
});
} | java | public Observable<RegexEntityExtractor> getRegexEntityEntityInfoAsync(UUID appId, String versionId, UUID regexEntityId) {
return getRegexEntityEntityInfoWithServiceResponseAsync(appId, versionId, regexEntityId).map(new Func1<ServiceResponse<RegexEntityExtractor>, RegexEntityExtractor>() {
@Override
public RegexEntityExtractor call(ServiceResponse<RegexEntityExtractor> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RegexEntityExtractor",
">",
"getRegexEntityEntityInfoAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"regexEntityId",
")",
"{",
"return",
"getRegexEntityEntityInfoWithServiceResponseAsync",
"(",
"appId",
",",
"versionId... | Gets information of a regex entity model.
@param appId The application ID.
@param versionId The version ID.
@param regexEntityId The regex entity model ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RegexEntityExtractor object | [
"Gets",
"information",
"of",
"a",
"regex",
"entity",
"model",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L10206-L10213 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java | PermissionUtil.getExplicitPermission | public static long getExplicitPermission(Channel channel, Role role)
{
Checks.notNull(channel, "Channel");
Checks.notNull(role, "Role");
final Guild guild = role.getGuild();
checkGuild(channel.getGuild(), guild, "Role");
long permission = role.getPermissionsRaw() | guild.getPublicRole().getPermissionsRaw();
PermissionOverride override = channel.getPermissionOverride(guild.getPublicRole());
if (override != null)
permission = apply(permission, override.getAllowedRaw(), override.getDeniedRaw());
if (role.isPublicRole())
return permission;
override = channel.getPermissionOverride(role);
return override == null
? permission
: apply(permission, override.getAllowedRaw(), override.getDeniedRaw());
} | java | public static long getExplicitPermission(Channel channel, Role role)
{
Checks.notNull(channel, "Channel");
Checks.notNull(role, "Role");
final Guild guild = role.getGuild();
checkGuild(channel.getGuild(), guild, "Role");
long permission = role.getPermissionsRaw() | guild.getPublicRole().getPermissionsRaw();
PermissionOverride override = channel.getPermissionOverride(guild.getPublicRole());
if (override != null)
permission = apply(permission, override.getAllowedRaw(), override.getDeniedRaw());
if (role.isPublicRole())
return permission;
override = channel.getPermissionOverride(role);
return override == null
? permission
: apply(permission, override.getAllowedRaw(), override.getDeniedRaw());
} | [
"public",
"static",
"long",
"getExplicitPermission",
"(",
"Channel",
"channel",
",",
"Role",
"role",
")",
"{",
"Checks",
".",
"notNull",
"(",
"channel",
",",
"\"Channel\"",
")",
";",
"Checks",
".",
"notNull",
"(",
"role",
",",
"\"Role\"",
")",
";",
"final"... | Retrieves the explicit permissions of the specified {@link net.dv8tion.jda.core.entities.Role Role}
in its hosting {@link net.dv8tion.jda.core.entities.Guild Guild} and specific {@link net.dv8tion.jda.core.entities.Channel Channel}.
<br><b>Allowed permissions override denied permissions of {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides}!</b>
<p>All permissions returned are explicitly granted to this Role.
<br>Permissions like {@link net.dv8tion.jda.core.Permission#ADMINISTRATOR Permission.ADMINISTRATOR} do not
grant other permissions in this value.
<p>This factor in existing {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides} if possible.
@param channel
The target channel of which to check {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides}
@param role
The non-null {@link net.dv8tion.jda.core.entities.Role Role} for which to get implicit permissions
@throws IllegalArgumentException
If any of the arguments is {@code null}
or the specified entities are not from the same {@link net.dv8tion.jda.core.entities.Guild Guild}
@return Primitive (unsigned) long value with the implicit permissions of the specified role in the specified channel
@since 3.1 | [
"Retrieves",
"the",
"explicit",
"permissions",
"of",
"the",
"specified",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"core",
".",
"entities",
".",
"Role",
"Role",
"}",
"in",
"its",
"hosting",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
"... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java#L552-L572 |
offbynull/coroutines | instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/SynchronizationGenerators.java | SynchronizationGenerators.enterStoredMonitors | public static InsnList enterStoredMonitors(MarkerType markerType, LockVariables lockVars) {
Validate.notNull(markerType);
Validate.notNull(lockVars);
Variable lockStateVar = lockVars.getLockStateVar();
Variable counterVar = lockVars.getCounterVar();
Variable arrayLenVar = lockVars.getArrayLenVar();
Validate.isTrue(lockStateVar != null);
Validate.isTrue(counterVar != null);
Validate.isTrue(arrayLenVar != null);
return forEach(counterVar, arrayLenVar,
merge(
debugMarker(markerType, "Loading monitors to enter"),
call(LOCKSTATE_TOARRAY_METHOD, loadVar(lockStateVar))
),
merge(
debugMarker(markerType, "Entering monitor"),
new InsnNode(Opcodes.MONITORENTER)
)
);
} | java | public static InsnList enterStoredMonitors(MarkerType markerType, LockVariables lockVars) {
Validate.notNull(markerType);
Validate.notNull(lockVars);
Variable lockStateVar = lockVars.getLockStateVar();
Variable counterVar = lockVars.getCounterVar();
Variable arrayLenVar = lockVars.getArrayLenVar();
Validate.isTrue(lockStateVar != null);
Validate.isTrue(counterVar != null);
Validate.isTrue(arrayLenVar != null);
return forEach(counterVar, arrayLenVar,
merge(
debugMarker(markerType, "Loading monitors to enter"),
call(LOCKSTATE_TOARRAY_METHOD, loadVar(lockStateVar))
),
merge(
debugMarker(markerType, "Entering monitor"),
new InsnNode(Opcodes.MONITORENTER)
)
);
} | [
"public",
"static",
"InsnList",
"enterStoredMonitors",
"(",
"MarkerType",
"markerType",
",",
"LockVariables",
"lockVars",
")",
"{",
"Validate",
".",
"notNull",
"(",
"markerType",
")",
";",
"Validate",
".",
"notNull",
"(",
"lockVars",
")",
";",
"Variable",
"lockS... | Generates instruction to enter all monitors in the {@link LockState} object sitting in the lockstate variable.
@param markerType debug marker type
@param lockVars variables for lock/synchpoint functionality
@return instructions to enter all monitors in the {@link LockState} object
@throws NullPointerException if any argument is {@code null}
@throws IllegalArgumentException if lock variables aren't set (the method doesn't contain any monitorenter/monitorexit instructions) | [
"Generates",
"instruction",
"to",
"enter",
"all",
"monitors",
"in",
"the",
"{"
] | train | https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/SynchronizationGenerators.java#L86-L107 |
s1-platform/s1 | s1-core/src/java/org/s1/ws/SOAPHelper.java | SOAPHelper.validateMessage | public static void validateMessage(String basePath, Document wsdl, SOAPMessage msg) throws XSDFormatException, XSDValidationException{
LOG.debug("Validating message on WSDL");
//get schema
//Element schemaNode = (Element)wsdl.getElementsByTagNameNS(XMLConstants"http://www.w3.org/2001/XMLSchema","schema").item(0);
NodeList schemaNodes = wsdl.getElementsByTagNameNS(
XMLConstants.W3C_XML_SCHEMA_NS_URI, "schema");
int nrSchemas = schemaNodes.getLength();
Source[] schemas = new Source[nrSchemas];
for (int i = 0; i < nrSchemas; i++) {
schemas[i] = new DOMSource(schemaNodes.item(i));
}
//get body
Element body = null;
try {
body = msg.getSOAPBody();
} catch (SOAPException e) {
throw S1SystemError.wrap(e);
}
if(msg.getAttachments().hasNext()){
//copy
body = (Element)body.cloneNode(true);
//remove xop:Includes
NodeList nl = body.getElementsByTagNameNS("http://www.w3.org/2004/08/xop/include","Include");
for(int i=0;i<nl.getLength();i++){
Node n = nl.item(i);
n.getParentNode().removeChild(n);
}
}
//validate Body children
for(Element el:XMLFormat.getChildElementList(body,null,null)){
XMLFormat.validate(basePath, schemas, el);
}
} | java | public static void validateMessage(String basePath, Document wsdl, SOAPMessage msg) throws XSDFormatException, XSDValidationException{
LOG.debug("Validating message on WSDL");
//get schema
//Element schemaNode = (Element)wsdl.getElementsByTagNameNS(XMLConstants"http://www.w3.org/2001/XMLSchema","schema").item(0);
NodeList schemaNodes = wsdl.getElementsByTagNameNS(
XMLConstants.W3C_XML_SCHEMA_NS_URI, "schema");
int nrSchemas = schemaNodes.getLength();
Source[] schemas = new Source[nrSchemas];
for (int i = 0; i < nrSchemas; i++) {
schemas[i] = new DOMSource(schemaNodes.item(i));
}
//get body
Element body = null;
try {
body = msg.getSOAPBody();
} catch (SOAPException e) {
throw S1SystemError.wrap(e);
}
if(msg.getAttachments().hasNext()){
//copy
body = (Element)body.cloneNode(true);
//remove xop:Includes
NodeList nl = body.getElementsByTagNameNS("http://www.w3.org/2004/08/xop/include","Include");
for(int i=0;i<nl.getLength();i++){
Node n = nl.item(i);
n.getParentNode().removeChild(n);
}
}
//validate Body children
for(Element el:XMLFormat.getChildElementList(body,null,null)){
XMLFormat.validate(basePath, schemas, el);
}
} | [
"public",
"static",
"void",
"validateMessage",
"(",
"String",
"basePath",
",",
"Document",
"wsdl",
",",
"SOAPMessage",
"msg",
")",
"throws",
"XSDFormatException",
",",
"XSDValidationException",
"{",
"LOG",
".",
"debug",
"(",
"\"Validating message on WSDL\"",
")",
";... | Validate message on wsdl
@param wsdl
@param msg
@throws XSDFormatException
@throws XSDValidationException | [
"Validate",
"message",
"on",
"wsdl"
] | train | https://github.com/s1-platform/s1/blob/370101c13fef01af524bc171bcc1a97e5acc76e8/s1-core/src/java/org/s1/ws/SOAPHelper.java#L140-L179 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/alias/CmsAliasTableController.java | CmsAliasTableController.editNewAlias | public void editNewAlias(String aliasPath, String resourcePath, CmsAliasMode mode) {
CmsAliasTableRow row = new CmsAliasTableRow();
row.setEdited(true);
row.setAliasPath(aliasPath);
row.setResourcePath(resourcePath);
row.setMode(mode);
validateNew(row);
} | java | public void editNewAlias(String aliasPath, String resourcePath, CmsAliasMode mode) {
CmsAliasTableRow row = new CmsAliasTableRow();
row.setEdited(true);
row.setAliasPath(aliasPath);
row.setResourcePath(resourcePath);
row.setMode(mode);
validateNew(row);
} | [
"public",
"void",
"editNewAlias",
"(",
"String",
"aliasPath",
",",
"String",
"resourcePath",
",",
"CmsAliasMode",
"mode",
")",
"{",
"CmsAliasTableRow",
"row",
"=",
"new",
"CmsAliasTableRow",
"(",
")",
";",
"row",
".",
"setEdited",
"(",
"true",
")",
";",
"row... | This method is called when the user wants to add a new alias entry.<p>
@param aliasPath the alias path
@param resourcePath the resource site path
@param mode the alias mode | [
"This",
"method",
"is",
"called",
"when",
"the",
"user",
"wants",
"to",
"add",
"a",
"new",
"alias",
"entry",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/alias/CmsAliasTableController.java#L181-L189 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java | PersistenceBrokerImpl.setFKField | private void setFKField(Object targetObject, ClassDescriptor cld, ObjectReferenceDescriptor rds, Object referencedObject)
{
ValueContainer[] refPkValues;
FieldDescriptor fld;
FieldDescriptor[] objFkFields = rds.getForeignKeyFieldDescriptors(cld);
if (objFkFields == null)
{
throw new PersistenceBrokerException("No foreign key fields defined for class '"+cld.getClassNameOfObject()+"'");
}
if(referencedObject == null)
{
refPkValues = null;
}
else
{
Class refClass = proxyFactory.getRealClass(referencedObject);
ClassDescriptor refCld = getClassDescriptor(refClass);
refPkValues = brokerHelper.getKeyValues(refCld, referencedObject, false);
}
for (int i = 0; i < objFkFields.length; i++)
{
fld = objFkFields[i];
/*
arminw:
we set the FK value when the extracted PK fields from the referenced object are not null at all
or if null, the FK field was not a PK field of target object too.
Should be ok, because the values of the extracted PK field values should never be null and never
change, so it doesn't matter if the target field is a PK too.
*/
if(refPkValues != null || !fld.isPrimaryKey())
{
fld.getPersistentField().set(targetObject, refPkValues != null ? refPkValues[i].getValue(): null);
}
}
} | java | private void setFKField(Object targetObject, ClassDescriptor cld, ObjectReferenceDescriptor rds, Object referencedObject)
{
ValueContainer[] refPkValues;
FieldDescriptor fld;
FieldDescriptor[] objFkFields = rds.getForeignKeyFieldDescriptors(cld);
if (objFkFields == null)
{
throw new PersistenceBrokerException("No foreign key fields defined for class '"+cld.getClassNameOfObject()+"'");
}
if(referencedObject == null)
{
refPkValues = null;
}
else
{
Class refClass = proxyFactory.getRealClass(referencedObject);
ClassDescriptor refCld = getClassDescriptor(refClass);
refPkValues = brokerHelper.getKeyValues(refCld, referencedObject, false);
}
for (int i = 0; i < objFkFields.length; i++)
{
fld = objFkFields[i];
/*
arminw:
we set the FK value when the extracted PK fields from the referenced object are not null at all
or if null, the FK field was not a PK field of target object too.
Should be ok, because the values of the extracted PK field values should never be null and never
change, so it doesn't matter if the target field is a PK too.
*/
if(refPkValues != null || !fld.isPrimaryKey())
{
fld.getPersistentField().set(targetObject, refPkValues != null ? refPkValues[i].getValue(): null);
}
}
} | [
"private",
"void",
"setFKField",
"(",
"Object",
"targetObject",
",",
"ClassDescriptor",
"cld",
",",
"ObjectReferenceDescriptor",
"rds",
",",
"Object",
"referencedObject",
")",
"{",
"ValueContainer",
"[",
"]",
"refPkValues",
";",
"FieldDescriptor",
"fld",
";",
"Field... | Set the FK value on the target object, extracted from the referenced object. If the referenced object was
<i>null</i> the FK values were set to <i>null</i>, expect when the FK field was declared as PK.
@param targetObject real (non-proxy) target object
@param cld {@link ClassDescriptor} of the real target object
@param rds An {@link ObjectReferenceDescriptor} or {@link CollectionDescriptor}
@param referencedObject The referenced object or <i>null</i> | [
"Set",
"the",
"FK",
"value",
"on",
"the",
"target",
"object",
"extracted",
"from",
"the",
"referenced",
"object",
".",
"If",
"the",
"referenced",
"object",
"was",
"<i",
">",
"null<",
"/",
"i",
">",
"the",
"FK",
"values",
"were",
"set",
"to",
"<i",
">",... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1255-L1289 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuGraphAddChildGraphNode | public static int cuGraphAddChildGraphNode(CUgraphNode phGraphNode, CUgraph hGraph, CUgraphNode dependencies[], long numDependencies, CUgraph childGraph)
{
return checkResult(cuGraphAddChildGraphNodeNative(phGraphNode, hGraph, dependencies, numDependencies, childGraph));
} | java | public static int cuGraphAddChildGraphNode(CUgraphNode phGraphNode, CUgraph hGraph, CUgraphNode dependencies[], long numDependencies, CUgraph childGraph)
{
return checkResult(cuGraphAddChildGraphNodeNative(phGraphNode, hGraph, dependencies, numDependencies, childGraph));
} | [
"public",
"static",
"int",
"cuGraphAddChildGraphNode",
"(",
"CUgraphNode",
"phGraphNode",
",",
"CUgraph",
"hGraph",
",",
"CUgraphNode",
"dependencies",
"[",
"]",
",",
"long",
"numDependencies",
",",
"CUgraph",
"childGraph",
")",
"{",
"return",
"checkResult",
"(",
... | Creates a child graph node and adds it to a graph.<br>
<br>
Creates a new node which executes an embedded graph, and adds it to \p hGraph with
\p numDependencies dependencies specified via \p dependencies.
It is possible for \p numDependencies to be 0, in which case the node will be placed
at the root of the graph. \p dependencies may not have any duplicate entries.
A handle to the new node will be returned in \p phGraphNode.<br>
<br>
The node executes an embedded child graph. The child graph is cloned in this call.
@param phGraphNode - Returns newly created node
@param hGraph - Graph to which to add the node
@param dependencies - Dependencies of the node
@param numDependencies - Number of dependencies
@param childGraph - The graph to clone into this node
@return
CUDA_SUCCESS,
CUDA_ERROR_DEINITIALIZED,
CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_VALUE,
@see
JCudaDriver#cuGraphChildGraphNodeGetGraph
JCudaDriver#cuGraphCreate
JCudaDriver#cuGraphDestroyNode
JCudaDriver#cuGraphAddEmptyNode
JCudaDriver#cuGraphAddKernelNode
JCudaDriver#cuGraphAddHostNode
JCudaDriver#cuGraphAddMemcpyNode
JCudaDriver#cuGraphAddMemsetNode
JCudaDriver#cuGraphClone | [
"Creates",
"a",
"child",
"graph",
"node",
"and",
"adds",
"it",
"to",
"a",
"graph",
".",
"<br",
">",
"<br",
">",
"Creates",
"a",
"new",
"node",
"which",
"executes",
"an",
"embedded",
"graph",
"and",
"adds",
"it",
"to",
"\\",
"p",
"hGraph",
"with",
"\\... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12483-L12486 |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByBirthday | public Iterable<DContact> queryByBirthday(Object parent, java.util.Date birthday) {
return queryByField(parent, DContactMapper.Field.BIRTHDAY.getFieldName(), birthday);
} | java | public Iterable<DContact> queryByBirthday(Object parent, java.util.Date birthday) {
return queryByField(parent, DContactMapper.Field.BIRTHDAY.getFieldName(), birthday);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByBirthday",
"(",
"Object",
"parent",
",",
"java",
".",
"util",
".",
"Date",
"birthday",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"BIRTHDAY",
".",
"getField... | query-by method for field birthday
@param birthday the specified attribute
@return an Iterable of DContacts for the specified birthday | [
"query",
"-",
"by",
"method",
"for",
"field",
"birthday"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L97-L99 |
jcuda/jcusolver | JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java | JCusolverDn.cusolverDnSorgbr_bufferSize | public static int cusolverDnSorgbr_bufferSize(
cusolverDnHandle handle,
int side,
int m,
int n,
int k,
Pointer A,
int lda,
Pointer tau,
int[] lwork)
{
return checkResult(cusolverDnSorgbr_bufferSizeNative(handle, side, m, n, k, A, lda, tau, lwork));
} | java | public static int cusolverDnSorgbr_bufferSize(
cusolverDnHandle handle,
int side,
int m,
int n,
int k,
Pointer A,
int lda,
Pointer tau,
int[] lwork)
{
return checkResult(cusolverDnSorgbr_bufferSizeNative(handle, side, m, n, k, A, lda, tau, lwork));
} | [
"public",
"static",
"int",
"cusolverDnSorgbr_bufferSize",
"(",
"cusolverDnHandle",
"handle",
",",
"int",
"side",
",",
"int",
"m",
",",
"int",
"n",
",",
"int",
"k",
",",
"Pointer",
"A",
",",
"int",
"lda",
",",
"Pointer",
"tau",
",",
"int",
"[",
"]",
"lw... | generates one of the unitary matrices Q or P**T determined by GEBRD | [
"generates",
"one",
"of",
"the",
"unitary",
"matrices",
"Q",
"or",
"P",
"**",
"T",
"determined",
"by",
"GEBRD"
] | train | https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java#L1935-L1947 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/utility/ReadBufferManager.java | ReadBufferManager.getWindowOffset | private int getWindowOffset(long bytePos, int length) throws IOException {
long desiredMax = bytePos + length - 1;
if ((bytePos >= windowStart)
&& (desiredMax < windowStart + buffer.capacity())) {
long res = bytePos - windowStart;
if (res < Integer.MAX_VALUE) {
return (int) res;
} else {
throw new IOException("This buffer is quite large...");
}
} else {
long bufferCapacity = Math.max(bufferSize, length);
long size = channel.size();
bufferCapacity = Math.min(bufferCapacity, size - bytePos);
if (bufferCapacity > Integer.MAX_VALUE) {
throw new IOException("Woaw ! You want to have a REALLY LARGE buffer !");
}
windowStart = bytePos;
channel.position(windowStart);
if (buffer.capacity() != bufferCapacity) {
ByteOrder order = buffer.order();
buffer = ByteBuffer.allocate((int)bufferCapacity);
buffer.order(order);
} else {
buffer.clear();
}
channel.read(buffer);
buffer.flip();
return (int) (bytePos - windowStart);
}
} | java | private int getWindowOffset(long bytePos, int length) throws IOException {
long desiredMax = bytePos + length - 1;
if ((bytePos >= windowStart)
&& (desiredMax < windowStart + buffer.capacity())) {
long res = bytePos - windowStart;
if (res < Integer.MAX_VALUE) {
return (int) res;
} else {
throw new IOException("This buffer is quite large...");
}
} else {
long bufferCapacity = Math.max(bufferSize, length);
long size = channel.size();
bufferCapacity = Math.min(bufferCapacity, size - bytePos);
if (bufferCapacity > Integer.MAX_VALUE) {
throw new IOException("Woaw ! You want to have a REALLY LARGE buffer !");
}
windowStart = bytePos;
channel.position(windowStart);
if (buffer.capacity() != bufferCapacity) {
ByteOrder order = buffer.order();
buffer = ByteBuffer.allocate((int)bufferCapacity);
buffer.order(order);
} else {
buffer.clear();
}
channel.read(buffer);
buffer.flip();
return (int) (bytePos - windowStart);
}
} | [
"private",
"int",
"getWindowOffset",
"(",
"long",
"bytePos",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"long",
"desiredMax",
"=",
"bytePos",
"+",
"length",
"-",
"1",
";",
"if",
"(",
"(",
"bytePos",
">=",
"windowStart",
")",
"&&",
"(",
"des... | Moves the window if necessary to contain the desired byte and returns the
position of the byte in the window
@param bytePos
@throws java.io.IOException | [
"Moves",
"the",
"window",
"if",
"necessary",
"to",
"contain",
"the",
"desired",
"byte",
"and",
"returns",
"the",
"position",
"of",
"the",
"byte",
"in",
"the",
"window"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/utility/ReadBufferManager.java#L70-L102 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java | DependencyBundlingAnalyzer.countChar | private int countChar(String string, char c) {
int count = 0;
final int max = string.length();
for (int i = 0; i < max; i++) {
if (c == string.charAt(i)) {
count++;
}
}
return count;
} | java | private int countChar(String string, char c) {
int count = 0;
final int max = string.length();
for (int i = 0; i < max; i++) {
if (c == string.charAt(i)) {
count++;
}
}
return count;
} | [
"private",
"int",
"countChar",
"(",
"String",
"string",
",",
"char",
"c",
")",
"{",
"int",
"count",
"=",
"0",
";",
"final",
"int",
"max",
"=",
"string",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
... | Counts the number of times the character is present in the string.
@param string the string to count the characters in
@param c the character to count
@return the number of times the character is present in the string | [
"Counts",
"the",
"number",
"of",
"times",
"the",
"character",
"is",
"present",
"in",
"the",
"string",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java#L455-L464 |
elki-project/elki | elki-index-preprocessed/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/knn/MaterializeKNNAndRKNNPreprocessor.java | MaterializeKNNAndRKNNPreprocessor.materializeKNNAndRKNNs | private void materializeKNNAndRKNNs(ArrayDBIDs ids, FiniteProgress progress) {
// add an empty list to each rknn
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
if(materialized_RkNN.get(iter) == null) {
materialized_RkNN.put(iter, new TreeSet<DoubleDBIDPair>());
}
}
// knn query
List<? extends KNNList> kNNList = knnQuery.getKNNForBulkDBIDs(ids, k);
for(DBIDArrayIter id = ids.iter(); id.valid(); id.advance()) {
KNNList kNNs = kNNList.get(id.getOffset());
storage.put(id, kNNs);
for(DoubleDBIDListIter iter = kNNs.iter(); iter.valid(); iter.advance()) {
materialized_RkNN.get(iter).add(DBIDUtil.newPair(iter.doubleValue(), id));
}
LOG.incrementProcessed(progress);
}
LOG.ensureCompleted(progress);
} | java | private void materializeKNNAndRKNNs(ArrayDBIDs ids, FiniteProgress progress) {
// add an empty list to each rknn
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
if(materialized_RkNN.get(iter) == null) {
materialized_RkNN.put(iter, new TreeSet<DoubleDBIDPair>());
}
}
// knn query
List<? extends KNNList> kNNList = knnQuery.getKNNForBulkDBIDs(ids, k);
for(DBIDArrayIter id = ids.iter(); id.valid(); id.advance()) {
KNNList kNNs = kNNList.get(id.getOffset());
storage.put(id, kNNs);
for(DoubleDBIDListIter iter = kNNs.iter(); iter.valid(); iter.advance()) {
materialized_RkNN.get(iter).add(DBIDUtil.newPair(iter.doubleValue(), id));
}
LOG.incrementProcessed(progress);
}
LOG.ensureCompleted(progress);
} | [
"private",
"void",
"materializeKNNAndRKNNs",
"(",
"ArrayDBIDs",
"ids",
",",
"FiniteProgress",
"progress",
")",
"{",
"// add an empty list to each rknn",
"for",
"(",
"DBIDIter",
"iter",
"=",
"ids",
".",
"iter",
"(",
")",
";",
"iter",
".",
"valid",
"(",
")",
";"... | Materializes the kNNs and RkNNs of the specified object IDs.
@param ids the IDs of the objects | [
"Materializes",
"the",
"kNNs",
"and",
"RkNNs",
"of",
"the",
"specified",
"object",
"IDs",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-preprocessed/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/knn/MaterializeKNNAndRKNNPreprocessor.java#L95-L115 |
unbescape/unbescape | src/main/java/org/unbescape/java/JavaEscape.java | JavaEscape.unescapeJava | public static void unescapeJava(final char[] text, final int offset, final int len, final Writer writer)
throws IOException{
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
final int textLen = (text == null? 0 : text.length);
if (offset < 0 || offset > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
if (len < 0 || (offset + len) > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
JavaEscapeUtil.unescape(text, offset, len, writer);
} | java | public static void unescapeJava(final char[] text, final int offset, final int len, final Writer writer)
throws IOException{
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
final int textLen = (text == null? 0 : text.length);
if (offset < 0 || offset > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
if (len < 0 || (offset + len) > textLen) {
throw new IllegalArgumentException(
"Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen);
}
JavaEscapeUtil.unescape(text, offset, len, writer);
} | [
"public",
"static",
"void",
"unescapeJava",
"(",
"final",
"char",
"[",
"]",
"text",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"len",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"==",
"null",
")",
... | <p>
Perform a Java <strong>unescape</strong> operation on a <tt>char[]</tt> input.
</p>
<p>
No additional configuration arguments are required. Unescape operations
will always perform <em>complete</em> Java unescape of SECs, u-based and octal escapes.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>char[]</tt> to be unescaped.
@param offset the position in <tt>text</tt> at which the unescape operation should start.
@param len the number of characters in <tt>text</tt> that should be unescaped.
@param writer the <tt>java.io.Writer</tt> to which the unescaped 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 | [
"<p",
">",
"Perform",
"a",
"Java",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"char",
"[]",
"<",
"/",
"tt",
">",
"input",
".",
"<",
"/",
"p",
">",
"<p",
">",
"No",
"additional",
"configuration",
"arguments",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/java/JavaEscape.java#L949-L970 |
eurekaclinical/protempa | protempa-framework/src/main/java/org/protempa/proposition/interval/IntervalFactory.java | IntervalFactory.getInstance | public Interval getInstance(Long position, Granularity gran) {
List<Object> key = Arrays.asList(new Object[]{position, gran});
Interval result;
synchronized (cache) {
result = cache.get(key);
if (result == null) {
if (position == null) {
result = new DefaultInterval(position, gran, position, gran);
} else {
result = new SimpleInterval(position, gran);
}
cache.put(key, result);
}
}
return result;
} | java | public Interval getInstance(Long position, Granularity gran) {
List<Object> key = Arrays.asList(new Object[]{position, gran});
Interval result;
synchronized (cache) {
result = cache.get(key);
if (result == null) {
if (position == null) {
result = new DefaultInterval(position, gran, position, gran);
} else {
result = new SimpleInterval(position, gran);
}
cache.put(key, result);
}
}
return result;
} | [
"public",
"Interval",
"getInstance",
"(",
"Long",
"position",
",",
"Granularity",
"gran",
")",
"{",
"List",
"<",
"Object",
">",
"key",
"=",
"Arrays",
".",
"asList",
"(",
"new",
"Object",
"[",
"]",
"{",
"position",
",",
"gran",
"}",
")",
";",
"Interval"... | Returns an interval representing a position on the timeline or other axis
at a specified granularity. The interpretation of the
<code>position</code> parameter depends on what implementation of
{@link Granularity} is provided. For example, if the granularity
implementation is {@link AbsoluteTimeGranularity}, the
<code>position</code> is intepreted as a timestamp.
@param position a {
@ling Long} representing a single position on the timeline or other axis.
If <code>null</code>, the interval will be unbounded.
@param gran a {@link Granularity}.
@return an {@link Interval}. | [
"Returns",
"an",
"interval",
"representing",
"a",
"position",
"on",
"the",
"timeline",
"or",
"other",
"axis",
"at",
"a",
"specified",
"granularity",
".",
"The",
"interpretation",
"of",
"the",
"<code",
">",
"position<",
"/",
"code",
">",
"parameter",
"depends",... | train | https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/IntervalFactory.java#L143-L158 |
forge/furnace | container-api/src/main/java/org/jboss/forge/furnace/util/Annotations.java | Annotations.isAnnotationPresent | public static boolean isAnnotationPresent(final Class<?> c, final Class<? extends Annotation> type)
{
return getAnnotation(c, type) != null;
} | java | public static boolean isAnnotationPresent(final Class<?> c, final Class<? extends Annotation> type)
{
return getAnnotation(c, type) != null;
} | [
"public",
"static",
"boolean",
"isAnnotationPresent",
"(",
"final",
"Class",
"<",
"?",
">",
"c",
",",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"type",
")",
"{",
"return",
"getAnnotation",
"(",
"c",
",",
"type",
")",
"!=",
"null",
";",
... | Discover if a Class <b>c</b> has been annotated with <b>type</b>. This also discovers annotations defined through
a @{@link Stereotype}.
@param c The class to inspect.
@param type The targeted annotation class
@return True if annotation is present either on class, false if the annotation is not present. | [
"Discover",
"if",
"a",
"Class",
"<b",
">",
"c<",
"/",
"b",
">",
"has",
"been",
"annotated",
"with",
"<b",
">",
"type<",
"/",
"b",
">",
".",
"This",
"also",
"discovers",
"annotations",
"defined",
"through",
"a",
"@",
"{",
"@link",
"Stereotype",
"}",
"... | train | https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/container-api/src/main/java/org/jboss/forge/furnace/util/Annotations.java#L86-L89 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/LinkedConverter.java | LinkedConverter.setValue | public int setValue(double value, boolean bDisplayOption, int iMoveMode)
{
if (this.getNextConverter() != null)
return this.getNextConverter().setValue(value, bDisplayOption, iMoveMode);
else
return super.setValue(value, bDisplayOption, iMoveMode);
} | java | public int setValue(double value, boolean bDisplayOption, int iMoveMode)
{
if (this.getNextConverter() != null)
return this.getNextConverter().setValue(value, bDisplayOption, iMoveMode);
else
return super.setValue(value, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"setValue",
"(",
"double",
"value",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"this",
".",
"getNextConverter",
"(",
")",
"!=",
"null",
")",
"return",
"this",
".",
"getNextConverter",
"(",
")",
".",
"... | For numeric fields, set the current value.
Override this method to convert the value to the actual Physical Data Type.
@param bState the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code. | [
"For",
"numeric",
"fields",
"set",
"the",
"current",
"value",
".",
"Override",
"this",
"method",
"to",
"convert",
"the",
"value",
"to",
"the",
"actual",
"Physical",
"Data",
"Type",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/LinkedConverter.java#L302-L308 |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/DailyCalendar.java | DailyCalendar._validate | private void _validate (final int hourOfDay, final int minute, final int second, final int millis)
{
if (hourOfDay < 0 || hourOfDay > 23)
{
throw new IllegalArgumentException (invalidHourOfDay + hourOfDay);
}
if (minute < 0 || minute > 59)
{
throw new IllegalArgumentException (invalidMinute + minute);
}
if (second < 0 || second > 59)
{
throw new IllegalArgumentException (invalidSecond + second);
}
if (millis < 0 || millis > 999)
{
throw new IllegalArgumentException (invalidMillis + millis);
}
} | java | private void _validate (final int hourOfDay, final int minute, final int second, final int millis)
{
if (hourOfDay < 0 || hourOfDay > 23)
{
throw new IllegalArgumentException (invalidHourOfDay + hourOfDay);
}
if (minute < 0 || minute > 59)
{
throw new IllegalArgumentException (invalidMinute + minute);
}
if (second < 0 || second > 59)
{
throw new IllegalArgumentException (invalidSecond + second);
}
if (millis < 0 || millis > 999)
{
throw new IllegalArgumentException (invalidMillis + millis);
}
} | [
"private",
"void",
"_validate",
"(",
"final",
"int",
"hourOfDay",
",",
"final",
"int",
"minute",
",",
"final",
"int",
"second",
",",
"final",
"int",
"millis",
")",
"{",
"if",
"(",
"hourOfDay",
"<",
"0",
"||",
"hourOfDay",
">",
"23",
")",
"{",
"throw",
... | Checks the specified values for validity as a set of time values.
@param hourOfDay
the hour of the time to check (in military (24-hour) time)
@param minute
the minute of the time to check
@param second
the second of the time to check
@param millis
the millisecond of the time to check | [
"Checks",
"the",
"specified",
"values",
"for",
"validity",
"as",
"a",
"set",
"of",
"time",
"values",
"."
] | train | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/DailyCalendar.java#L925-L943 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/DBQuery.java | DBQuery.lessThanEquals | public static Query lessThanEquals(String field, Object value) {
return new Query().lessThanEquals(field, value);
} | java | public static Query lessThanEquals(String field, Object value) {
return new Query().lessThanEquals(field, value);
} | [
"public",
"static",
"Query",
"lessThanEquals",
"(",
"String",
"field",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"Query",
"(",
")",
".",
"lessThanEquals",
"(",
"field",
",",
"value",
")",
";",
"}"
] | The field is less than or equal to the given value
@param field The field to compare
@param value The value to compare to
@return the query | [
"The",
"field",
"is",
"less",
"than",
"or",
"equal",
"to",
"the",
"given",
"value"
] | train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBQuery.java#L73-L75 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java | JobSchedulesImpl.listNext | public PagedList<CloudJobSchedule> listNext(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) {
ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> response = listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single();
return new PagedList<CloudJobSchedule>(response.body()) {
@Override
public Page<CloudJobSchedule> nextPage(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single().body();
}
};
} | java | public PagedList<CloudJobSchedule> listNext(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) {
ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> response = listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single();
return new PagedList<CloudJobSchedule>(response.body()) {
@Override
public Page<CloudJobSchedule> nextPage(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single().body();
}
};
} | [
"public",
"PagedList",
"<",
"CloudJobSchedule",
">",
"listNext",
"(",
"final",
"String",
"nextPageLink",
",",
"final",
"JobScheduleListNextOptions",
"jobScheduleListNextOptions",
")",
"{",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"CloudJobSchedule",
">",
",",
"Jo... | Lists all of the job schedules in the specified account.
@param nextPageLink The NextLink from the previous successful call to List operation.
@param jobScheduleListNextOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PagedList<CloudJobSchedule> object if successful. | [
"Lists",
"all",
"of",
"the",
"job",
"schedules",
"in",
"the",
"specified",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java#L2581-L2589 |
UrielCh/ovh-java-sdk | ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java | ApiOvhMsServices.serviceName_account_userPrincipalName_sharepoint_PUT | public void serviceName_account_userPrincipalName_sharepoint_PUT(String serviceName, String userPrincipalName, OvhSharepointInformation body) throws IOException {
String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/sharepoint";
StringBuilder sb = path(qPath, serviceName, userPrincipalName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_account_userPrincipalName_sharepoint_PUT(String serviceName, String userPrincipalName, OvhSharepointInformation body) throws IOException {
String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/sharepoint";
StringBuilder sb = path(qPath, serviceName, userPrincipalName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_account_userPrincipalName_sharepoint_PUT",
"(",
"String",
"serviceName",
",",
"String",
"userPrincipalName",
",",
"OvhSharepointInformation",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/msServices/{serviceName}/account/{... | Alter this object properties
REST: PUT /msServices/{serviceName}/account/{userPrincipalName}/sharepoint
@param body [required] New object properties
@param serviceName [required] The internal name of your Active Directory organization
@param userPrincipalName [required] User Principal Name
API beta | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java#L339-L343 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/parser/lexparser/AbstractTreebankParserParams.java | AbstractTreebankParserParams.parsevalObjectify | public static Collection<Constituent> parsevalObjectify(Tree t, TreeTransformer collinizer) {
return parsevalObjectify(t,collinizer,true);
} | java | public static Collection<Constituent> parsevalObjectify(Tree t, TreeTransformer collinizer) {
return parsevalObjectify(t,collinizer,true);
} | [
"public",
"static",
"Collection",
"<",
"Constituent",
">",
"parsevalObjectify",
"(",
"Tree",
"t",
",",
"TreeTransformer",
"collinizer",
")",
"{",
"return",
"parsevalObjectify",
"(",
"t",
",",
"collinizer",
",",
"true",
")",
";",
"}"
] | Takes a Tree and a collinizer and returns a Collection of labeled
{@link Constituent}s for PARSEVAL.
@param t The tree to extract constituents from
@param collinizer The TreeTransformer used to normalize the tree for
evaluation
@return The bag of Constituents for PARSEVAL. | [
"Takes",
"a",
"Tree",
"and",
"a",
"collinizer",
"and",
"returns",
"a",
"Collection",
"of",
"labeled",
"{"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/AbstractTreebankParserParams.java#L304-L306 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/ParallelRunner.java | ParallelRunner.serializeToFile | public <T extends State> void serializeToFile(final T state, final Path outputFilePath) {
// Use a Callable with a Void return type to allow exceptions to be thrown
this.futures.add(new NamedFuture(this.executor.submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
SerializationUtils.serializeState(ParallelRunner.this.fs, outputFilePath, state);
return null;
}
}), "Serialize state to " + outputFilePath));
} | java | public <T extends State> void serializeToFile(final T state, final Path outputFilePath) {
// Use a Callable with a Void return type to allow exceptions to be thrown
this.futures.add(new NamedFuture(this.executor.submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
SerializationUtils.serializeState(ParallelRunner.this.fs, outputFilePath, state);
return null;
}
}), "Serialize state to " + outputFilePath));
} | [
"public",
"<",
"T",
"extends",
"State",
">",
"void",
"serializeToFile",
"(",
"final",
"T",
"state",
",",
"final",
"Path",
"outputFilePath",
")",
"{",
"// Use a Callable with a Void return type to allow exceptions to be thrown",
"this",
".",
"futures",
".",
"add",
"(",... | Serialize a {@link State} object into a file.
<p>
This method submits a task to serialize the {@link State} object and returns immediately
after the task is submitted.
</p>
@param state the {@link State} object to be serialized
@param outputFilePath the file to write the serialized {@link State} object to
@param <T> the {@link State} object type | [
"Serialize",
"a",
"{",
"@link",
"State",
"}",
"object",
"into",
"a",
"file",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ParallelRunner.java#L145-L155 |
killme2008/xmemcached | src/main/java/net/rubyeye/xmemcached/XMemcachedClient.java | XMemcachedClient.deleteWithNoReply | public final void deleteWithNoReply(final String key, final int time)
throws InterruptedException, MemcachedException {
try {
this.delete0(key, time, 0, true, this.opTimeout);
} catch (TimeoutException e) {
throw new MemcachedException(e);
}
} | java | public final void deleteWithNoReply(final String key, final int time)
throws InterruptedException, MemcachedException {
try {
this.delete0(key, time, 0, true, this.opTimeout);
} catch (TimeoutException e) {
throw new MemcachedException(e);
}
} | [
"public",
"final",
"void",
"deleteWithNoReply",
"(",
"final",
"String",
"key",
",",
"final",
"int",
"time",
")",
"throws",
"InterruptedException",
",",
"MemcachedException",
"{",
"try",
"{",
"this",
".",
"delete0",
"(",
"key",
",",
"time",
",",
"0",
",",
"... | Delete key's data item from memcached.This method doesn't wait for reply
@param key
@param time
@throws InterruptedException
@throws MemcachedException | [
"Delete",
"key",
"s",
"data",
"item",
"from",
"memcached",
".",
"This",
"method",
"doesn",
"t",
"wait",
"for",
"reply"
] | train | https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/XMemcachedClient.java#L1782-L1789 |
indeedeng/util | util-core/src/main/java/com/indeed/util/core/reference/AtomicSharedReference.java | AtomicSharedReference.mapWithCopy | public @Nullable <Z> Z mapWithCopy(Function<T, Z> f) throws IOException {
final @Nullable SharedReference<T> localRef = getCopy();
try {
if (localRef == null) {
return f.apply(null);
} else {
return f.apply(localRef.get());
}
} finally {
if (localRef != null) localRef.close();
}
} | java | public @Nullable <Z> Z mapWithCopy(Function<T, Z> f) throws IOException {
final @Nullable SharedReference<T> localRef = getCopy();
try {
if (localRef == null) {
return f.apply(null);
} else {
return f.apply(localRef.get());
}
} finally {
if (localRef != null) localRef.close();
}
} | [
"public",
"@",
"Nullable",
"<",
"Z",
">",
"Z",
"mapWithCopy",
"(",
"Function",
"<",
"T",
",",
"Z",
">",
"f",
")",
"throws",
"IOException",
"{",
"final",
"@",
"Nullable",
"SharedReference",
"<",
"T",
">",
"localRef",
"=",
"getCopy",
"(",
")",
";",
"tr... | Call some function f on a threadsafe copy of the reference we are storing.
Should be used if you expect the function to take a while to run.
Saving the value of T after this call returns is COMPLETELY UNSAFE. Don't do it.
@param f lambda(T x)
@param <Z> Return type; <? extends Object>
@return result of f
@throws IOException if closing the local reference throws. | [
"Call",
"some",
"function",
"f",
"on",
"a",
"threadsafe",
"copy",
"of",
"the",
"reference",
"we",
"are",
"storing",
".",
"Should",
"be",
"used",
"if",
"you",
"expect",
"the",
"function",
"to",
"take",
"a",
"while",
"to",
"run",
".",
"Saving",
"the",
"v... | train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/reference/AtomicSharedReference.java#L149-L160 |
temyers/cucumber-jvm-parallel-plugin | src/main/java/com/github/timm/cucumber/generate/GenerateRunnersMojo.java | GenerateRunnersMojo.execute | public void execute() throws MojoExecutionException {
if (!featuresDirectory.exists()) {
throw new MojoExecutionException("Features directory does not exist");
}
final Collection<File> featureFiles = listFiles(featuresDirectory, new String[] {"feature"}, true);
final List<File> sortedFeatureFiles = new NameFileComparator().sort(new ArrayList<File>(featureFiles));
createOutputDirIfRequired();
File packageDirectory = packageName == null
? outputDirectory
: new File(outputDirectory, packageName.replace('.','/'));
if (!packageDirectory.exists()) {
packageDirectory.mkdirs();
}
final CucumberITGenerator fileGenerator = createFileGenerator();
fileGenerator.generateCucumberITFiles(packageDirectory, sortedFeatureFiles);
getLog().info("Adding " + outputDirectory.getAbsolutePath()
+ " to test-compile source root");
project.addTestCompileSourceRoot(outputDirectory.getAbsolutePath());
} | java | public void execute() throws MojoExecutionException {
if (!featuresDirectory.exists()) {
throw new MojoExecutionException("Features directory does not exist");
}
final Collection<File> featureFiles = listFiles(featuresDirectory, new String[] {"feature"}, true);
final List<File> sortedFeatureFiles = new NameFileComparator().sort(new ArrayList<File>(featureFiles));
createOutputDirIfRequired();
File packageDirectory = packageName == null
? outputDirectory
: new File(outputDirectory, packageName.replace('.','/'));
if (!packageDirectory.exists()) {
packageDirectory.mkdirs();
}
final CucumberITGenerator fileGenerator = createFileGenerator();
fileGenerator.generateCucumberITFiles(packageDirectory, sortedFeatureFiles);
getLog().info("Adding " + outputDirectory.getAbsolutePath()
+ " to test-compile source root");
project.addTestCompileSourceRoot(outputDirectory.getAbsolutePath());
} | [
"public",
"void",
"execute",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"!",
"featuresDirectory",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"MojoExecutionException",
"(",
"\"Features directory does not exist\"",
")",
";",
"}",
"final",
... | Called by Maven to run this mojo after parameters have been injected. | [
"Called",
"by",
"Maven",
"to",
"run",
"this",
"mojo",
"after",
"parameters",
"have",
"been",
"injected",
"."
] | train | https://github.com/temyers/cucumber-jvm-parallel-plugin/blob/931628fc1e2822be667ec216e10e706993974aa4/src/main/java/com/github/timm/cucumber/generate/GenerateRunnersMojo.java#L190-L216 |
google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/OperatorRewriter.java | OperatorRewriter.getRetainedWithTarget | private Expression getRetainedWithTarget(Assignment node, VariableElement var) {
Expression lhs = node.getLeftHandSide();
if (!(lhs instanceof FieldAccess)) {
return new ThisExpression(ElementUtil.getDeclaringClass(var).asType());
}
// To avoid duplicating the target expression we must save the result to a local variable.
FieldAccess fieldAccess = (FieldAccess) lhs;
Expression target = fieldAccess.getExpression();
VariableElement targetVar = GeneratedVariableElement.newLocalVar(
"__rw$" + rwCount++, target.getTypeMirror(), null);
TreeUtil.asStatementList(TreeUtil.getOwningStatement(lhs))
.add(0, new VariableDeclarationStatement(targetVar, null));
fieldAccess.setExpression(new SimpleName(targetVar));
CommaExpression commaExpr = new CommaExpression(
new Assignment(new SimpleName(targetVar), target));
node.replaceWith(commaExpr);
commaExpr.addExpression(node);
return new SimpleName(targetVar);
} | java | private Expression getRetainedWithTarget(Assignment node, VariableElement var) {
Expression lhs = node.getLeftHandSide();
if (!(lhs instanceof FieldAccess)) {
return new ThisExpression(ElementUtil.getDeclaringClass(var).asType());
}
// To avoid duplicating the target expression we must save the result to a local variable.
FieldAccess fieldAccess = (FieldAccess) lhs;
Expression target = fieldAccess.getExpression();
VariableElement targetVar = GeneratedVariableElement.newLocalVar(
"__rw$" + rwCount++, target.getTypeMirror(), null);
TreeUtil.asStatementList(TreeUtil.getOwningStatement(lhs))
.add(0, new VariableDeclarationStatement(targetVar, null));
fieldAccess.setExpression(new SimpleName(targetVar));
CommaExpression commaExpr = new CommaExpression(
new Assignment(new SimpleName(targetVar), target));
node.replaceWith(commaExpr);
commaExpr.addExpression(node);
return new SimpleName(targetVar);
} | [
"private",
"Expression",
"getRetainedWithTarget",
"(",
"Assignment",
"node",
",",
"VariableElement",
"var",
")",
"{",
"Expression",
"lhs",
"=",
"node",
".",
"getLeftHandSide",
"(",
")",
";",
"if",
"(",
"!",
"(",
"lhs",
"instanceof",
"FieldAccess",
")",
")",
... | Gets the target object for a call to the RetainedWith wrapper. | [
"Gets",
"the",
"target",
"object",
"for",
"a",
"call",
"to",
"the",
"RetainedWith",
"wrapper",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/OperatorRewriter.java#L297-L315 |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBuffer.java | SharedBuffer.upsertEvent | void upsertEvent(EventId eventId, Lockable<V> event) {
this.eventsBufferCache.put(eventId, event);
} | java | void upsertEvent(EventId eventId, Lockable<V> event) {
this.eventsBufferCache.put(eventId, event);
} | [
"void",
"upsertEvent",
"(",
"EventId",
"eventId",
",",
"Lockable",
"<",
"V",
">",
"event",
")",
"{",
"this",
".",
"eventsBufferCache",
".",
"put",
"(",
"eventId",
",",
"event",
")",
";",
"}"
] | Inserts or updates an event in cache.
@param eventId id of the event
@param event event body | [
"Inserts",
"or",
"updates",
"an",
"event",
"in",
"cache",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBuffer.java#L162-L164 |
diirt/util | src/main/java/org/epics/util/text/CsvParser.java | CsvParser.isFirstLineData | private boolean isFirstLineData(State state, List<String> headerTokens) {
// Check whether the type of the header match the type of the following data
boolean headerCompatible = true;
// Check whether if all types where strings
boolean allStrings = true;
for (int i = 0; i < state.nColumns; i++) {
if (state.columnNumberParsable.get(i)) {
allStrings = false;
if (!isTokenNumberParsable(state, headerTokens.get(i))) {
headerCompatible = false;
}
}
}
// If all columns are strings, it's impossible to tell whether we have
// a header or not: assume we have a header.
// If the column types matches (e.g. the header for a number column is also
// a number) then we'll assume the header is actually data.
return !allStrings && headerCompatible;
} | java | private boolean isFirstLineData(State state, List<String> headerTokens) {
// Check whether the type of the header match the type of the following data
boolean headerCompatible = true;
// Check whether if all types where strings
boolean allStrings = true;
for (int i = 0; i < state.nColumns; i++) {
if (state.columnNumberParsable.get(i)) {
allStrings = false;
if (!isTokenNumberParsable(state, headerTokens.get(i))) {
headerCompatible = false;
}
}
}
// If all columns are strings, it's impossible to tell whether we have
// a header or not: assume we have a header.
// If the column types matches (e.g. the header for a number column is also
// a number) then we'll assume the header is actually data.
return !allStrings && headerCompatible;
} | [
"private",
"boolean",
"isFirstLineData",
"(",
"State",
"state",
",",
"List",
"<",
"String",
">",
"headerTokens",
")",
"{",
"// Check whether the type of the header match the type of the following data\r",
"boolean",
"headerCompatible",
"=",
"true",
";",
"// Check whether if a... | Checks whether the header can be safely interpreted as data.
This is used for the auto header detection.
@param state the state of the parser
@param headerTokens the header
@return true if header should be handled as data | [
"Checks",
"whether",
"the",
"header",
"can",
"be",
"safely",
"interpreted",
"as",
"data",
".",
"This",
"is",
"used",
"for",
"the",
"auto",
"header",
"detection",
"."
] | train | https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/text/CsvParser.java#L450-L468 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.createProjectForGroup | public GitlabProject createProjectForGroup(String name, GitlabGroup group, String description, String visibility) throws IOException {
return createProject(name, group.getId(), description, null, null, null, null, null, null, visibility, null);
} | java | public GitlabProject createProjectForGroup(String name, GitlabGroup group, String description, String visibility) throws IOException {
return createProject(name, group.getId(), description, null, null, null, null, null, null, visibility, null);
} | [
"public",
"GitlabProject",
"createProjectForGroup",
"(",
"String",
"name",
",",
"GitlabGroup",
"group",
",",
"String",
"description",
",",
"String",
"visibility",
")",
"throws",
"IOException",
"{",
"return",
"createProject",
"(",
"name",
",",
"group",
".",
"getId"... | Creates a group Project
@param name The name of the project
@param group The group for which the project should be crated
@param description The project description
@param visibility The project visibility level (private: 0, internal: 10, public: 20)
@return The GitLab Project
@throws IOException on gitlab api call error | [
"Creates",
"a",
"group",
"Project"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L1229-L1231 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/location/GeoLocationUtil.java | GeoLocationUtil.epsilonEqualsDistance | @Pure
public static boolean epsilonEqualsDistance(Point2D<?, ?> p1, Point2D<?, ?> p2) {
final double distance = p1.getDistance(p2);
return distance >= -distancePrecision && distance <= distancePrecision;
} | java | @Pure
public static boolean epsilonEqualsDistance(Point2D<?, ?> p1, Point2D<?, ?> p2) {
final double distance = p1.getDistance(p2);
return distance >= -distancePrecision && distance <= distancePrecision;
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"epsilonEqualsDistance",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"p1",
",",
"Point2D",
"<",
"?",
",",
"?",
">",
"p2",
")",
"{",
"final",
"double",
"distance",
"=",
"p1",
".",
"getDistance",
"(",
"p2",
")",... | Replies if the specified points are approximatively equal.
This function uses the distance precision.
@param p1 the first point.
@param p2 the second point.
@return <code>true</code> if both points are equal, otherwise <code>false</code> | [
"Replies",
"if",
"the",
"specified",
"points",
"are",
"approximatively",
"equal",
".",
"This",
"function",
"uses",
"the",
"distance",
"precision",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/location/GeoLocationUtil.java#L121-L125 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/ConsoleLogHandler.java | ConsoleLogHandler.setWriter | public void setWriter(Object sysLogHolder, Object sysErrHolder) {
this.sysOutHolder = (SystemLogHolder) sysLogHolder;
this.sysErrHolder = (SystemLogHolder) sysErrHolder;
} | java | public void setWriter(Object sysLogHolder, Object sysErrHolder) {
this.sysOutHolder = (SystemLogHolder) sysLogHolder;
this.sysErrHolder = (SystemLogHolder) sysErrHolder;
} | [
"public",
"void",
"setWriter",
"(",
"Object",
"sysLogHolder",
",",
"Object",
"sysErrHolder",
")",
"{",
"this",
".",
"sysOutHolder",
"=",
"(",
"SystemLogHolder",
")",
"sysLogHolder",
";",
"this",
".",
"sysErrHolder",
"=",
"(",
"SystemLogHolder",
")",
"sysErrHolde... | Set the writers for SystemOut and SystemErr respectfully
@param sysLogHolder SystemLogHolder object for SystemOut
@param sysErrHolder SystemLogHolder object for SystemErr | [
"Set",
"the",
"writers",
"for",
"SystemOut",
"and",
"SystemErr",
"respectfully"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/ConsoleLogHandler.java#L189-L192 |
mkotsur/restito | src/main/java/com/xebialabs/restito/semantics/Action.java | Action.resourceContent | public static Action resourceContent(final String resourcePath) {
return new Action(input -> {
final HttpResponsePacket responsePacket = input.getResponse();
String encoding = responsePacket == null ? input.getCharacterEncoding() : responsePacket.getCharacterEncoding();
return resourceContent(resourcePath, encoding).apply(input);
});
} | java | public static Action resourceContent(final String resourcePath) {
return new Action(input -> {
final HttpResponsePacket responsePacket = input.getResponse();
String encoding = responsePacket == null ? input.getCharacterEncoding() : responsePacket.getCharacterEncoding();
return resourceContent(resourcePath, encoding).apply(input);
});
} | [
"public",
"static",
"Action",
"resourceContent",
"(",
"final",
"String",
"resourcePath",
")",
"{",
"return",
"new",
"Action",
"(",
"input",
"->",
"{",
"final",
"HttpResponsePacket",
"responsePacket",
"=",
"input",
".",
"getResponse",
"(",
")",
";",
"String",
"... | Writes content and content-type of resource file to response.
Tries to detect content type based on file extension. If can not detect - content-type is not set.
For now there are following bindings:
<ul>
<li>.xml - `application/xml`</li>
<li>.json - `application/xml`</li>
</ul> | [
"Writes",
"content",
"and",
"content",
"-",
"type",
"of",
"resource",
"file",
"to",
"response",
".",
"Tries",
"to",
"detect",
"content",
"type",
"based",
"on",
"file",
"extension",
".",
"If",
"can",
"not",
"detect",
"-",
"content",
"-",
"type",
"is",
"no... | train | https://github.com/mkotsur/restito/blob/b999293616ca84fdea1ffe929e92a5db29c7e415/src/main/java/com/xebialabs/restito/semantics/Action.java#L80-L86 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java | ReflectUtil.getMethod | public static Method getMethod(Class<?> declaringType, String methodName, Class<?>... parameterTypes) {
return findMethod(declaringType, methodName, parameterTypes);
} | java | public static Method getMethod(Class<?> declaringType, String methodName, Class<?>... parameterTypes) {
return findMethod(declaringType, methodName, parameterTypes);
} | [
"public",
"static",
"Method",
"getMethod",
"(",
"Class",
"<",
"?",
">",
"declaringType",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"return",
"findMethod",
"(",
"declaringType",
",",
"methodName",
",",
"param... | Finds a method by name and parameter types.
@param declaringType the name of the class
@param methodName the name of the method to look for
@param parameterTypes the types of the parameters | [
"Finds",
"a",
"method",
"by",
"name",
"and",
"parameter",
"types",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java#L397-L399 |
pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/ZkOrderedStore.java | ZkOrderedStore.tryDeleteSealedCollection | private CompletableFuture<Void> tryDeleteSealedCollection(String scope, String stream, Integer collectionNum) {
// purge garbage znodes
// attempt to delete entities node
// delete collection
return getLatestCollection(scope, stream)
.thenCompose(latestcollectionNum ->
// 1. purge
storeHelper.getChildren(getEntitiesPath(scope, stream, collectionNum))
.thenCompose(entitiesPos -> {
String entitiesPath = getEntitiesPath(scope, stream, collectionNum);
// delete entities greater than max pos
return Futures.allOf(entitiesPos.stream().filter(pos -> getPositionFromPath(pos) > rollOverAfter)
.map(pos -> storeHelper.deletePath(ZKPaths.makePath(entitiesPath, pos), false))
.collect(Collectors.toList()));
}))
.thenCompose(x -> {
// 2. Try deleting entities root path.
// if we are able to delete entities node then we can delete the whole thing
return Futures.exceptionallyExpecting(storeHelper.deletePath(getEntitiesPath(scope, stream, collectionNum), false)
.thenCompose(v -> storeHelper.deleteTree(getCollectionPath(scope, stream, collectionNum))),
e -> Exceptions.unwrap(e) instanceof StoreException.DataNotEmptyException, null);
});
} | java | private CompletableFuture<Void> tryDeleteSealedCollection(String scope, String stream, Integer collectionNum) {
// purge garbage znodes
// attempt to delete entities node
// delete collection
return getLatestCollection(scope, stream)
.thenCompose(latestcollectionNum ->
// 1. purge
storeHelper.getChildren(getEntitiesPath(scope, stream, collectionNum))
.thenCompose(entitiesPos -> {
String entitiesPath = getEntitiesPath(scope, stream, collectionNum);
// delete entities greater than max pos
return Futures.allOf(entitiesPos.stream().filter(pos -> getPositionFromPath(pos) > rollOverAfter)
.map(pos -> storeHelper.deletePath(ZKPaths.makePath(entitiesPath, pos), false))
.collect(Collectors.toList()));
}))
.thenCompose(x -> {
// 2. Try deleting entities root path.
// if we are able to delete entities node then we can delete the whole thing
return Futures.exceptionallyExpecting(storeHelper.deletePath(getEntitiesPath(scope, stream, collectionNum), false)
.thenCompose(v -> storeHelper.deleteTree(getCollectionPath(scope, stream, collectionNum))),
e -> Exceptions.unwrap(e) instanceof StoreException.DataNotEmptyException, null);
});
} | [
"private",
"CompletableFuture",
"<",
"Void",
">",
"tryDeleteSealedCollection",
"(",
"String",
"scope",
",",
"String",
"stream",
",",
"Integer",
"collectionNum",
")",
"{",
"// purge garbage znodes",
"// attempt to delete entities node",
"// delete collection",
"return",
"get... | Collection should be sealed while calling this method
@param scope scope
@param stream stream
@param collectionNum collection to delete
@return future which when completed will have the collection deleted if it is empty or ignored otherwise. | [
"Collection",
"should",
"be",
"sealed",
"while",
"calling",
"this",
"method"
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/ZkOrderedStore.java#L263-L286 |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.forEachByte | public int forEachByte(int index, int length, ByteProcessor visitor) throws Exception {
if (isOutOfBounds(index, length, length())) {
throw new IndexOutOfBoundsException("expected: " + "0 <= index(" + index + ") <= start + length(" + length
+ ") <= " + "length(" + length() + ')');
}
return forEachByte0(index, length, visitor);
} | java | public int forEachByte(int index, int length, ByteProcessor visitor) throws Exception {
if (isOutOfBounds(index, length, length())) {
throw new IndexOutOfBoundsException("expected: " + "0 <= index(" + index + ") <= start + length(" + length
+ ") <= " + "length(" + length() + ')');
}
return forEachByte0(index, length, visitor);
} | [
"public",
"int",
"forEachByte",
"(",
"int",
"index",
",",
"int",
"length",
",",
"ByteProcessor",
"visitor",
")",
"throws",
"Exception",
"{",
"if",
"(",
"isOutOfBounds",
"(",
"index",
",",
"length",
",",
"length",
"(",
")",
")",
")",
"{",
"throw",
"new",
... | Iterates over the specified area of this buffer with the specified {@code processor} in ascending order.
(i.e. {@code index}, {@code (index + 1)}, .. {@code (index + length - 1)}).
@return {@code -1} if the processor iterated to or beyond the end of the specified area.
The last-visited index If the {@link ByteProcessor#process(byte)} returned {@code false}. | [
"Iterates",
"over",
"the",
"specified",
"area",
"of",
"this",
"buffer",
"with",
"the",
"specified",
"{",
"@code",
"processor",
"}",
"in",
"ascending",
"order",
".",
"(",
"i",
".",
"e",
".",
"{",
"@code",
"index",
"}",
"{",
"@code",
"(",
"index",
"+",
... | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L269-L275 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/ser/CollectSerIteratorFactory.java | CollectSerIteratorFactory.createIterable | @Override
public SerIterable createIterable(final MetaProperty<?> prop, Class<?> beanClass) {
if (Grid.class.isAssignableFrom(prop.propertyType())) {
Class<?> valueType = JodaBeanUtils.collectionType(prop, beanClass);
List<Class<?>> valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);
return grid(valueType, valueTypeTypes);
}
return super.createIterable(prop, beanClass);
} | java | @Override
public SerIterable createIterable(final MetaProperty<?> prop, Class<?> beanClass) {
if (Grid.class.isAssignableFrom(prop.propertyType())) {
Class<?> valueType = JodaBeanUtils.collectionType(prop, beanClass);
List<Class<?>> valueTypeTypes = JodaBeanUtils.collectionTypeTypes(prop, beanClass);
return grid(valueType, valueTypeTypes);
}
return super.createIterable(prop, beanClass);
} | [
"@",
"Override",
"public",
"SerIterable",
"createIterable",
"(",
"final",
"MetaProperty",
"<",
"?",
">",
"prop",
",",
"Class",
"<",
"?",
">",
"beanClass",
")",
"{",
"if",
"(",
"Grid",
".",
"class",
".",
"isAssignableFrom",
"(",
"prop",
".",
"propertyType",... | Creates an iterator wrapper for a meta-property value.
@param prop the meta-property defining the value, not null
@param beanClass the class of the bean, not the meta-property, for better generics, not null
@return the iterator, null if not a collection-like type | [
"Creates",
"an",
"iterator",
"wrapper",
"for",
"a",
"meta",
"-",
"property",
"value",
"."
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/CollectSerIteratorFactory.java#L100-L108 |
micronaut-projects/micronaut-core | session/src/main/java/io/micronaut/session/http/SessionForRequest.java | SessionForRequest.findOrCreate | public static Session findOrCreate(HttpRequest<?> request, SessionStore sessionStore) {
return find(request).orElseGet(() -> create(sessionStore, request));
} | java | public static Session findOrCreate(HttpRequest<?> request, SessionStore sessionStore) {
return find(request).orElseGet(() -> create(sessionStore, request));
} | [
"public",
"static",
"Session",
"findOrCreate",
"(",
"HttpRequest",
"<",
"?",
">",
"request",
",",
"SessionStore",
"sessionStore",
")",
"{",
"return",
"find",
"(",
"request",
")",
".",
"orElseGet",
"(",
"(",
")",
"->",
"create",
"(",
"sessionStore",
",",
"r... | Finds a session or creates a new one and stores it in the request attributes.
@param request The Http Request
@param sessionStore The session store to create the session if not found
@return A session if found in the request attributes or a new session
stored in the request attributes. | [
"Finds",
"a",
"session",
"or",
"creates",
"a",
"new",
"one",
"and",
"stores",
"it",
"in",
"the",
"request",
"attributes",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/session/src/main/java/io/micronaut/session/http/SessionForRequest.java#L62-L64 |
nguillaumin/slick2d-maven | slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/truetype/TTFSubSetFile.java | TTFSubSetFile.getLongCheckSum | private long getLongCheckSum(int start, int size) {
// All the tables here are aligned on four byte boundaries
// Add remainder to size if it's not a multiple of 4
int remainder = size % 4;
if (remainder != 0) {
size += remainder;
}
long sum = 0;
for (int i = 0; i < size; i += 4) {
int l = (output[start + i] << 24);
l += (output[start + i + 1] << 16);
l += (output[start + i + 2] << 16);
l += (output[start + i + 3] << 16);
sum += l;
if (sum > 0xffffffff) {
sum = sum - 0xffffffff;
}
}
return sum;
} | java | private long getLongCheckSum(int start, int size) {
// All the tables here are aligned on four byte boundaries
// Add remainder to size if it's not a multiple of 4
int remainder = size % 4;
if (remainder != 0) {
size += remainder;
}
long sum = 0;
for (int i = 0; i < size; i += 4) {
int l = (output[start + i] << 24);
l += (output[start + i + 1] << 16);
l += (output[start + i + 2] << 16);
l += (output[start + i + 3] << 16);
sum += l;
if (sum > 0xffffffff) {
sum = sum - 0xffffffff;
}
}
return sum;
} | [
"private",
"long",
"getLongCheckSum",
"(",
"int",
"start",
",",
"int",
"size",
")",
"{",
"// All the tables here are aligned on four byte boundaries",
"// Add remainder to size if it's not a multiple of 4",
"int",
"remainder",
"=",
"size",
"%",
"4",
";",
"if",
"(",
"remai... | Get the checksum as a long
@param start The start value
@param size The size of the values to checksum
@return The long checksum | [
"Get",
"the",
"checksum",
"as",
"a",
"long"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/truetype/TTFSubSetFile.java#L956-L978 |
spockframework/spock | spock-core/src/main/java/spock/lang/Specification.java | Specification.notThrown | public void notThrown(Class<? extends Throwable> type) {
Throwable thrown = getSpecificationContext().getThrownException();
if (thrown == null) return;
if (type.isAssignableFrom(thrown.getClass())) {
throw new UnallowedExceptionThrownError(type, thrown);
}
ExceptionUtil.sneakyThrow(thrown);
} | java | public void notThrown(Class<? extends Throwable> type) {
Throwable thrown = getSpecificationContext().getThrownException();
if (thrown == null) return;
if (type.isAssignableFrom(thrown.getClass())) {
throw new UnallowedExceptionThrownError(type, thrown);
}
ExceptionUtil.sneakyThrow(thrown);
} | [
"public",
"void",
"notThrown",
"(",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"type",
")",
"{",
"Throwable",
"thrown",
"=",
"getSpecificationContext",
"(",
")",
".",
"getThrownException",
"(",
")",
";",
"if",
"(",
"thrown",
"==",
"null",
")",
"return... | Specifies that no exception of the given type should be
thrown, failing with a {@link UnallowedExceptionThrownError} otherwise.
@param type the exception type that should not be thrown | [
"Specifies",
"that",
"no",
"exception",
"of",
"the",
"given",
"type",
"should",
"be",
"thrown",
"failing",
"with",
"a",
"{",
"@link",
"UnallowedExceptionThrownError",
"}",
"otherwise",
"."
] | train | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/lang/Specification.java#L102-L109 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/RowColumnOps.java | RowColumnOps.addDiag | public static void addDiag(Matrix A, int start, int to, double c)
{
for(int i = start; i < to; i++)
A.increment(i, i, c);
} | java | public static void addDiag(Matrix A, int start, int to, double c)
{
for(int i = start; i < to; i++)
A.increment(i, i, c);
} | [
"public",
"static",
"void",
"addDiag",
"(",
"Matrix",
"A",
",",
"int",
"start",
",",
"int",
"to",
",",
"double",
"c",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"to",
";",
"i",
"++",
")",
"A",
".",
"increment",
"(",
"i",
"... | Updates the values along the main diagonal of the matrix by adding a constant to them
@param A the matrix to perform the update on
@param start the first index of the diagonals to update (inclusive)
@param to the last index of the diagonals to update (exclusive)
@param c the constant to add to the diagonal | [
"Updates",
"the",
"values",
"along",
"the",
"main",
"diagonal",
"of",
"the",
"matrix",
"by",
"adding",
"a",
"constant",
"to",
"them"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L17-L21 |
hageldave/ImagingKit | ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ArrayUtils.java | ArrayUtils.shift2D | public static void shift2D(double[] a, int w, int h, int x, int y){
assertPositive(w, ()->"specified width is not positive. w="+w);
assertPositive(h, ()->"specified height is not positive. h="+h);
while(x < 0) x = w+x;
while(y < 0) y = h+y;
x %=w;
y %=h;
if(x==0 && y==0){
return;
}
for(int row = 0; row < h; row++){
int offset = row*w;
rotateArray(a, w, offset, x);
}
rotateArray(a,w*h, 0, y*w);
} | java | public static void shift2D(double[] a, int w, int h, int x, int y){
assertPositive(w, ()->"specified width is not positive. w="+w);
assertPositive(h, ()->"specified height is not positive. h="+h);
while(x < 0) x = w+x;
while(y < 0) y = h+y;
x %=w;
y %=h;
if(x==0 && y==0){
return;
}
for(int row = 0; row < h; row++){
int offset = row*w;
rotateArray(a, w, offset, x);
}
rotateArray(a,w*h, 0, y*w);
} | [
"public",
"static",
"void",
"shift2D",
"(",
"double",
"[",
"]",
"a",
",",
"int",
"w",
",",
"int",
"h",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"assertPositive",
"(",
"w",
",",
"(",
")",
"->",
"\"specified width is not positive. w=\"",
"+",
"w",
"... | Applies a 2D torus shift to the specified row major order array of specified dimensions.
The array is interpreted as an image of given width and height (with elements in row major order)
and is shifted by x to the right and by y to the bottom.
@param a array
@param w width
@param h height
@param x shift in x direction
@param y shift in y direction | [
"Applies",
"a",
"2D",
"torus",
"shift",
"to",
"the",
"specified",
"row",
"major",
"order",
"array",
"of",
"specified",
"dimensions",
".",
"The",
"array",
"is",
"interpreted",
"as",
"an",
"image",
"of",
"given",
"width",
"and",
"height",
"(",
"with",
"eleme... | train | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ArrayUtils.java#L41-L56 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/MediaManagementApi.java | MediaManagementApi.releaseSnapshot | public ApiSuccessResponse releaseSnapshot(String snapshotId, ReleaseSnapshotBody releaseSnapshotBody) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = releaseSnapshotWithHttpInfo(snapshotId, releaseSnapshotBody);
return resp.getData();
} | java | public ApiSuccessResponse releaseSnapshot(String snapshotId, ReleaseSnapshotBody releaseSnapshotBody) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = releaseSnapshotWithHttpInfo(snapshotId, releaseSnapshotBody);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"releaseSnapshot",
"(",
"String",
"snapshotId",
",",
"ReleaseSnapshotBody",
"releaseSnapshotBody",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"releaseSnapshotWithHttpInfo",
"(",
"snapshotId... | Release the snapshot
Release the snapshot specified.
@param snapshotId Id of the snapshot (required)
@param releaseSnapshotBody (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Release",
"the",
"snapshot",
"Release",
"the",
"snapshot",
"specified",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaManagementApi.java#L1126-L1129 |
bwkimmel/jdcp | jdcp-worker/src/main/java/ca/eandb/jdcp/worker/FileCachingJobServiceClassLoaderStrategy.java | FileCachingJobServiceClassLoaderStrategy.getCacheEntryFile | private File getCacheEntryFile(String name, byte[] digest, boolean createDirectory) {
File entryDirectory = new File(directory, name.replace('.', '/'));
if (createDirectory && !entryDirectory.isDirectory()) {
entryDirectory.mkdirs();
}
return new File(entryDirectory, StringUtil.toHex(digest));
} | java | private File getCacheEntryFile(String name, byte[] digest, boolean createDirectory) {
File entryDirectory = new File(directory, name.replace('.', '/'));
if (createDirectory && !entryDirectory.isDirectory()) {
entryDirectory.mkdirs();
}
return new File(entryDirectory, StringUtil.toHex(digest));
} | [
"private",
"File",
"getCacheEntryFile",
"(",
"String",
"name",
",",
"byte",
"[",
"]",
"digest",
",",
"boolean",
"createDirectory",
")",
"{",
"File",
"entryDirectory",
"=",
"new",
"File",
"(",
"directory",
",",
"name",
".",
"replace",
"(",
"'",
"'",
",",
... | Gets the <code>File</code> in which to store the given class definition.
@param name The fully qualified name of the class.
@param digest The MD5 digest of the class definition.
@param createDirectory A value indicating whether the directory
containing the file should be created if it does not yet exist.
@return The <code>File</code> to use for storing the cached class
definition. | [
"Gets",
"the",
"<code",
">",
"File<",
"/",
"code",
">",
"in",
"which",
"to",
"store",
"the",
"given",
"class",
"definition",
"."
] | train | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-worker/src/main/java/ca/eandb/jdcp/worker/FileCachingJobServiceClassLoaderStrategy.java#L125-L131 |
hal/elemento | core/src/main/java/org/jboss/gwt/elemento/core/Elements.java | Elements.failSafeRemove | public static boolean failSafeRemove(Node parent, Element child) {
//noinspection SimplifiableIfStatement
if (parent != null && child != null && parent.contains(child)) {
return parent.removeChild(child) != null;
}
return false;
} | java | public static boolean failSafeRemove(Node parent, Element child) {
//noinspection SimplifiableIfStatement
if (parent != null && child != null && parent.contains(child)) {
return parent.removeChild(child) != null;
}
return false;
} | [
"public",
"static",
"boolean",
"failSafeRemove",
"(",
"Node",
"parent",
",",
"Element",
"child",
")",
"{",
"//noinspection SimplifiableIfStatement",
"if",
"(",
"parent",
"!=",
"null",
"&&",
"child",
"!=",
"null",
"&&",
"parent",
".",
"contains",
"(",
"child",
... | Removes the child from parent if both parent and child are not null and parent contains child.
@return {@code true} if the the element has been removed from its parent, {@code false} otherwise. | [
"Removes",
"the",
"child",
"from",
"parent",
"if",
"both",
"parent",
"and",
"child",
"are",
"not",
"null",
"and",
"parent",
"contains",
"child",
"."
] | train | https://github.com/hal/elemento/blob/26da2d5a1fe2ec55b779737dbaeda25a942eee61/core/src/main/java/org/jboss/gwt/elemento/core/Elements.java#L727-L733 |
apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskRunner.java | SeekableStreamIndexTaskRunner.authorizationCheck | private Access authorizationCheck(final HttpServletRequest req, Action action)
{
return IndexTaskUtils.datasourceAuthorizationCheck(req, action, task.getDataSource(), authorizerMapper);
} | java | private Access authorizationCheck(final HttpServletRequest req, Action action)
{
return IndexTaskUtils.datasourceAuthorizationCheck(req, action, task.getDataSource(), authorizerMapper);
} | [
"private",
"Access",
"authorizationCheck",
"(",
"final",
"HttpServletRequest",
"req",
",",
"Action",
"action",
")",
"{",
"return",
"IndexTaskUtils",
".",
"datasourceAuthorizationCheck",
"(",
"req",
",",
"action",
",",
"task",
".",
"getDataSource",
"(",
")",
",",
... | Authorizes action to be performed on this task's datasource
@return authorization result | [
"Authorizes",
"action",
"to",
"be",
"performed",
"on",
"this",
"task",
"s",
"datasource"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskRunner.java#L1312-L1315 |
VoltDB/voltdb | src/frontend/org/voltdb/types/GeographyValue.java | GeographyValue.diagnoseLoop | private static <T> void diagnoseLoop(List<T> loop, String excpMsgPrf) throws IllegalArgumentException {
if (loop == null) {
throw new IllegalArgumentException(excpMsgPrf + "a polygon must contain at least one ring " +
"(with each ring at least 4 points, including repeated closing vertex)");
}
// 4 vertices = 3 unique vertices for polygon + 1 end point which is same as start point
if (loop.size() < 4) {
throw new IllegalArgumentException(excpMsgPrf + "a polygon ring must contain at least 4 points " +
"(including repeated closing vertex)");
}
// check if the end points of the loop are equal
if (loop.get(0).equals(loop.get(loop.size() - 1)) == false) {
throw new IllegalArgumentException(excpMsgPrf
+ "closing points of ring are not equal: \""
+ loop.get(0).toString()
+ "\" != \""
+ loop.get(loop.size()-1).toString()
+ "\"");
}
} | java | private static <T> void diagnoseLoop(List<T> loop, String excpMsgPrf) throws IllegalArgumentException {
if (loop == null) {
throw new IllegalArgumentException(excpMsgPrf + "a polygon must contain at least one ring " +
"(with each ring at least 4 points, including repeated closing vertex)");
}
// 4 vertices = 3 unique vertices for polygon + 1 end point which is same as start point
if (loop.size() < 4) {
throw new IllegalArgumentException(excpMsgPrf + "a polygon ring must contain at least 4 points " +
"(including repeated closing vertex)");
}
// check if the end points of the loop are equal
if (loop.get(0).equals(loop.get(loop.size() - 1)) == false) {
throw new IllegalArgumentException(excpMsgPrf
+ "closing points of ring are not equal: \""
+ loop.get(0).toString()
+ "\" != \""
+ loop.get(loop.size()-1).toString()
+ "\"");
}
} | [
"private",
"static",
"<",
"T",
">",
"void",
"diagnoseLoop",
"(",
"List",
"<",
"T",
">",
"loop",
",",
"String",
"excpMsgPrf",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"loop",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException"... | A helper function to validate the loop structure
If loop is invalid, it generates IllegalArgumentException exception | [
"A",
"helper",
"function",
"to",
"validate",
"the",
"loop",
"structure",
"If",
"loop",
"is",
"invalid",
"it",
"generates",
"IllegalArgumentException",
"exception"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/types/GeographyValue.java#L636-L657 |
jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HScreenField.java | HScreenField.printHtmlControlDesc | public void printHtmlControlDesc(PrintWriter out, String strFieldDesc, int iHtmlAttributes)
{
if ((iHtmlAttributes & HtmlConstants.HTML_ADD_DESC_COLUMN) != 0)
out.println("<td align=\"right\">" + strFieldDesc + "</td>");
} | java | public void printHtmlControlDesc(PrintWriter out, String strFieldDesc, int iHtmlAttributes)
{
if ((iHtmlAttributes & HtmlConstants.HTML_ADD_DESC_COLUMN) != 0)
out.println("<td align=\"right\">" + strFieldDesc + "</td>");
} | [
"public",
"void",
"printHtmlControlDesc",
"(",
"PrintWriter",
"out",
",",
"String",
"strFieldDesc",
",",
"int",
"iHtmlAttributes",
")",
"{",
"if",
"(",
"(",
"iHtmlAttributes",
"&",
"HtmlConstants",
".",
"HTML_ADD_DESC_COLUMN",
")",
"!=",
"0",
")",
"out",
".",
... | display this field's description in html format.
@param out The html out stream.
@param strFieldDesc The field description.
@param iHtmlAttribures The attributes. | [
"display",
"this",
"field",
"s",
"description",
"in",
"html",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HScreenField.java#L76-L80 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/streaming/StreamPlan.java | StreamPlan.requestRanges | public StreamPlan requestRanges(InetAddress from, InetAddress connecting, String keyspace, Collection<Range<Token>> ranges)
{
return requestRanges(from, connecting, keyspace, ranges, new String[0]);
} | java | public StreamPlan requestRanges(InetAddress from, InetAddress connecting, String keyspace, Collection<Range<Token>> ranges)
{
return requestRanges(from, connecting, keyspace, ranges, new String[0]);
} | [
"public",
"StreamPlan",
"requestRanges",
"(",
"InetAddress",
"from",
",",
"InetAddress",
"connecting",
",",
"String",
"keyspace",
",",
"Collection",
"<",
"Range",
"<",
"Token",
">",
">",
"ranges",
")",
"{",
"return",
"requestRanges",
"(",
"from",
",",
"connect... | Request data in {@code keyspace} and {@code ranges} from specific node.
@param from endpoint address to fetch data from.
@param connecting Actual connecting address for the endpoint
@param keyspace name of keyspace
@param ranges ranges to fetch
@return this object for chaining | [
"Request",
"data",
"in",
"{",
"@code",
"keyspace",
"}",
"and",
"{",
"@code",
"ranges",
"}",
"from",
"specific",
"node",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/streaming/StreamPlan.java#L71-L74 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java | Levenshtein.QGram | public static <T extends Levenshtein> T QGram(String baseTarget, String compareTarget) {
return QGram(baseTarget, compareTarget, null);
} | java | public static <T extends Levenshtein> T QGram(String baseTarget, String compareTarget) {
return QGram(baseTarget, compareTarget, null);
} | [
"public",
"static",
"<",
"T",
"extends",
"Levenshtein",
">",
"T",
"QGram",
"(",
"String",
"baseTarget",
",",
"String",
"compareTarget",
")",
"{",
"return",
"QGram",
"(",
"baseTarget",
",",
"compareTarget",
",",
"null",
")",
";",
"}"
] | Returns a new Q-Gram (Ukkonen) instance with compare target string
@see QGram
@param baseTarget
@param compareTarget
@return | [
"Returns",
"a",
"new",
"Q",
"-",
"Gram",
"(",
"Ukkonen",
")",
"instance",
"with",
"compare",
"target",
"string"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java#L184-L186 |
jamesagnew/hapi-fhir | hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/terminologies/LoincToDEConvertor.java | LoincToDEConvertor.makeUnits | private CodeableConcept makeUnits(String text, String ucum) {
if (Utilities.noString(text) && Utilities.noString(ucum))
return null;
CodeableConcept cc = new CodeableConcept();
cc.setText(text);
cc.getCoding().add(new Coding().setCode(ucum).setSystem("http://unitsofmeasure.org"));
return cc;
} | java | private CodeableConcept makeUnits(String text, String ucum) {
if (Utilities.noString(text) && Utilities.noString(ucum))
return null;
CodeableConcept cc = new CodeableConcept();
cc.setText(text);
cc.getCoding().add(new Coding().setCode(ucum).setSystem("http://unitsofmeasure.org"));
return cc;
} | [
"private",
"CodeableConcept",
"makeUnits",
"(",
"String",
"text",
",",
"String",
"ucum",
")",
"{",
"if",
"(",
"Utilities",
".",
"noString",
"(",
"text",
")",
"&&",
"Utilities",
".",
"noString",
"(",
"ucum",
")",
")",
"return",
"null",
";",
"CodeableConcept... | 18606-4: MMAT. 18665-0: PRF. 18671-8: TX. 55400-6: DT; 8251-1: FT | [
"18606",
"-",
"4",
":",
"MMAT",
".",
"18665",
"-",
"0",
":",
"PRF",
".",
"18671",
"-",
"8",
":",
"TX",
".",
"55400",
"-",
"6",
":",
"DT",
";",
"8251",
"-",
"1",
":",
"FT"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/terminologies/LoincToDEConvertor.java#L277-L284 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java | PathOverrideService.getGroupIdsInPathProfile | public String getGroupIdsInPathProfile(int profileId, int pathId) {
return (String) sqlService.getFromTable(Constants.PATH_PROFILE_GROUP_IDS, Constants.GENERIC_ID, pathId,
Constants.DB_TABLE_PATH);
} | java | public String getGroupIdsInPathProfile(int profileId, int pathId) {
return (String) sqlService.getFromTable(Constants.PATH_PROFILE_GROUP_IDS, Constants.GENERIC_ID, pathId,
Constants.DB_TABLE_PATH);
} | [
"public",
"String",
"getGroupIdsInPathProfile",
"(",
"int",
"profileId",
",",
"int",
"pathId",
")",
"{",
"return",
"(",
"String",
")",
"sqlService",
".",
"getFromTable",
"(",
"Constants",
".",
"PATH_PROFILE_GROUP_IDS",
",",
"Constants",
".",
"GENERIC_ID",
",",
"... | First we get the oldGroups by looking at the database to find the path/profile match
@param profileId ID of profile
@param pathId ID of path
@return Comma-delimited list of groups IDs | [
"First",
"we",
"get",
"the",
"oldGroups",
"by",
"looking",
"at",
"the",
"database",
"to",
"find",
"the",
"path",
"/",
"profile",
"match"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L326-L329 |
bazaarvoice/emodb | web/src/main/java/com/bazaarvoice/emodb/web/migrator/DistributedMigratorRangeMonitor.java | DistributedMigratorRangeMonitor.claimMigrationRangeTasks | private List<ClaimedTask> claimMigrationRangeTasks(int max) {
try {
Date claimTime = new Date();
List<ScanRangeTask> migrationRangeTasks = _workflow.claimScanRangeTasks(max, QUEUE_CLAIM_TTL);
if (migrationRangeTasks.isEmpty()) {
return ImmutableList.of();
}
List<ClaimedTask> newlyClaimedTasks = Lists.newArrayListWithCapacity(migrationRangeTasks.size());
for (ScanRangeTask task : migrationRangeTasks) {
final ClaimedTask claimedTask = new ClaimedTask(task, claimTime);
// Record that the task is claimed locally
boolean alreadyClaimed = _claimedTasks.putIfAbsent(task.getId(), claimedTask) != null;
if (alreadyClaimed) {
_log.warn("Workflow returned migration range task that is already claimed: {}", task);
// Do not acknowledge the task, let it expire naturally. Eventually it should come up again
// after the previous claim has been released.
} else {
_log.info("Claimed migration range task: {}", task);
newlyClaimedTasks.add(claimedTask);
// Schedule a follow-up to ensure the scanning service assigns it a thread
// in a reasonable amount of time.
_backgroundService.schedule(
new Runnable() {
@Override
public void run() {
validateClaimedTaskHasStarted(claimedTask);
}
},
CLAIM_START_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
}
}
return newlyClaimedTasks;
} catch (Exception e) {
_log.error("Failed to start next available migration range", e);
return ImmutableList.of();
}
} | java | private List<ClaimedTask> claimMigrationRangeTasks(int max) {
try {
Date claimTime = new Date();
List<ScanRangeTask> migrationRangeTasks = _workflow.claimScanRangeTasks(max, QUEUE_CLAIM_TTL);
if (migrationRangeTasks.isEmpty()) {
return ImmutableList.of();
}
List<ClaimedTask> newlyClaimedTasks = Lists.newArrayListWithCapacity(migrationRangeTasks.size());
for (ScanRangeTask task : migrationRangeTasks) {
final ClaimedTask claimedTask = new ClaimedTask(task, claimTime);
// Record that the task is claimed locally
boolean alreadyClaimed = _claimedTasks.putIfAbsent(task.getId(), claimedTask) != null;
if (alreadyClaimed) {
_log.warn("Workflow returned migration range task that is already claimed: {}", task);
// Do not acknowledge the task, let it expire naturally. Eventually it should come up again
// after the previous claim has been released.
} else {
_log.info("Claimed migration range task: {}", task);
newlyClaimedTasks.add(claimedTask);
// Schedule a follow-up to ensure the scanning service assigns it a thread
// in a reasonable amount of time.
_backgroundService.schedule(
new Runnable() {
@Override
public void run() {
validateClaimedTaskHasStarted(claimedTask);
}
},
CLAIM_START_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
}
}
return newlyClaimedTasks;
} catch (Exception e) {
_log.error("Failed to start next available migration range", e);
return ImmutableList.of();
}
} | [
"private",
"List",
"<",
"ClaimedTask",
">",
"claimMigrationRangeTasks",
"(",
"int",
"max",
")",
"{",
"try",
"{",
"Date",
"claimTime",
"=",
"new",
"Date",
"(",
")",
";",
"List",
"<",
"ScanRangeTask",
">",
"migrationRangeTasks",
"=",
"_workflow",
".",
"claimSc... | Claims migration range tasks that have been queued by the leader and are ready to scan. | [
"Claims",
"migration",
"range",
"tasks",
"that",
"have",
"been",
"queued",
"by",
"the",
"leader",
"and",
"are",
"ready",
"to",
"scan",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/migrator/DistributedMigratorRangeMonitor.java#L141-L182 |
jenkinsci/jenkins | core/src/main/java/hudson/model/AbstractProject.java | AbstractProject.checkAndRecord | private void checkAndRecord(AbstractProject that, TreeMap<Integer, RangeSet> r, Collection<R> builds) {
for (R build : builds) {
RangeSet rs = build.getDownstreamRelationship(that);
if(rs==null || rs.isEmpty())
continue;
int n = build.getNumber();
RangeSet value = r.get(n);
if(value==null)
r.put(n,rs);
else
value.add(rs);
}
} | java | private void checkAndRecord(AbstractProject that, TreeMap<Integer, RangeSet> r, Collection<R> builds) {
for (R build : builds) {
RangeSet rs = build.getDownstreamRelationship(that);
if(rs==null || rs.isEmpty())
continue;
int n = build.getNumber();
RangeSet value = r.get(n);
if(value==null)
r.put(n,rs);
else
value.add(rs);
}
} | [
"private",
"void",
"checkAndRecord",
"(",
"AbstractProject",
"that",
",",
"TreeMap",
"<",
"Integer",
",",
"RangeSet",
">",
"r",
",",
"Collection",
"<",
"R",
">",
"builds",
")",
"{",
"for",
"(",
"R",
"build",
":",
"builds",
")",
"{",
"RangeSet",
"rs",
"... | Helper method for getDownstreamRelationship.
For each given build, find the build number range of the given project and put that into the map. | [
"Helper",
"method",
"for",
"getDownstreamRelationship",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/AbstractProject.java#L1660-L1674 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java | DevicesInner.installUpdates | public void installUpdates(String deviceName, String resourceGroupName) {
installUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().last().body();
} | java | public void installUpdates(String deviceName, String resourceGroupName) {
installUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().last().body();
} | [
"public",
"void",
"installUpdates",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
")",
"{",
"installUpdatesWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"bod... | Installs the updates on the data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@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 | [
"Installs",
"the",
"updates",
"on",
"the",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1442-L1444 |
netty/netty | codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java | MqttDecoder.decodePayload | private static Result<?> decodePayload(
ByteBuf buffer,
MqttMessageType messageType,
int bytesRemainingInVariablePart,
Object variableHeader) {
switch (messageType) {
case CONNECT:
return decodeConnectionPayload(buffer, (MqttConnectVariableHeader) variableHeader);
case SUBSCRIBE:
return decodeSubscribePayload(buffer, bytesRemainingInVariablePart);
case SUBACK:
return decodeSubackPayload(buffer, bytesRemainingInVariablePart);
case UNSUBSCRIBE:
return decodeUnsubscribePayload(buffer, bytesRemainingInVariablePart);
case PUBLISH:
return decodePublishPayload(buffer, bytesRemainingInVariablePart);
default:
// unknown payload , no byte consumed
return new Result<Object>(null, 0);
}
} | java | private static Result<?> decodePayload(
ByteBuf buffer,
MqttMessageType messageType,
int bytesRemainingInVariablePart,
Object variableHeader) {
switch (messageType) {
case CONNECT:
return decodeConnectionPayload(buffer, (MqttConnectVariableHeader) variableHeader);
case SUBSCRIBE:
return decodeSubscribePayload(buffer, bytesRemainingInVariablePart);
case SUBACK:
return decodeSubackPayload(buffer, bytesRemainingInVariablePart);
case UNSUBSCRIBE:
return decodeUnsubscribePayload(buffer, bytesRemainingInVariablePart);
case PUBLISH:
return decodePublishPayload(buffer, bytesRemainingInVariablePart);
default:
// unknown payload , no byte consumed
return new Result<Object>(null, 0);
}
} | [
"private",
"static",
"Result",
"<",
"?",
">",
"decodePayload",
"(",
"ByteBuf",
"buffer",
",",
"MqttMessageType",
"messageType",
",",
"int",
"bytesRemainingInVariablePart",
",",
"Object",
"variableHeader",
")",
"{",
"switch",
"(",
"messageType",
")",
"{",
"case",
... | Decodes the payload.
@param buffer the buffer to decode from
@param messageType type of the message being decoded
@param bytesRemainingInVariablePart bytes remaining
@param variableHeader variable header of the same message
@return the payload | [
"Decodes",
"the",
"payload",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java#L306-L331 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/Messages.java | Messages.getFormattedMessage | public String getFormattedMessage(String messageKey, Object[] param, String defaultKey) {
String key = getString(messageKey);
String retVal = MessageFormat.format(key, param);
return retVal;
} | java | public String getFormattedMessage(String messageKey, Object[] param, String defaultKey) {
String key = getString(messageKey);
String retVal = MessageFormat.format(key, param);
return retVal;
} | [
"public",
"String",
"getFormattedMessage",
"(",
"String",
"messageKey",
",",
"Object",
"[",
"]",
"param",
",",
"String",
"defaultKey",
")",
"{",
"String",
"key",
"=",
"getString",
"(",
"messageKey",
")",
";",
"String",
"retVal",
"=",
"MessageFormat",
".",
"f... | Retrieve a message and format it with the parameters
@param messageKey
Message key to use
@param param
Object to use for formatting
@param defaultKey
The default key to use in case message key is not found
@return message formatted with the parameters | [
"Retrieve",
"a",
"message",
"and",
"format",
"it",
"with",
"the",
"parameters"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/Messages.java#L191-L195 |
mkobos/pca_transform | src/main/java/com/mkobos/pca_transform/covmatrixevd/EVDBased.java | EVDBased.calculateCovarianceMatrixOfCenteredData | public static Matrix calculateCovarianceMatrixOfCenteredData(Matrix data){
Assume.assume(data.getRowDimension()>1, "Number of data samples is "+
data.getRowDimension()+", but it has to be >1 to compute "+
"covariances");
int dimsNo = data.getColumnDimension();
int samplesNo = data.getRowDimension();
Matrix m = new Matrix(dimsNo, dimsNo);
for(int r = 0; r < dimsNo; r++)
for(int c = r; c < dimsNo; c++){
double sum = 0;
for(int i = 0; i < samplesNo; i++)
sum += data.get(i, r)*data.get(i, c);
m.set(r, c, sum/(samplesNo-1));
}
for(int r = 0; r < dimsNo; r++)
for(int c = 0; c < r; c++) m.set(r, c, m.get(c, r));
return m;
}
} | java | public static Matrix calculateCovarianceMatrixOfCenteredData(Matrix data){
Assume.assume(data.getRowDimension()>1, "Number of data samples is "+
data.getRowDimension()+", but it has to be >1 to compute "+
"covariances");
int dimsNo = data.getColumnDimension();
int samplesNo = data.getRowDimension();
Matrix m = new Matrix(dimsNo, dimsNo);
for(int r = 0; r < dimsNo; r++)
for(int c = r; c < dimsNo; c++){
double sum = 0;
for(int i = 0; i < samplesNo; i++)
sum += data.get(i, r)*data.get(i, c);
m.set(r, c, sum/(samplesNo-1));
}
for(int r = 0; r < dimsNo; r++)
for(int c = 0; c < r; c++) m.set(r, c, m.get(c, r));
return m;
}
} | [
"public",
"static",
"Matrix",
"calculateCovarianceMatrixOfCenteredData",
"(",
"Matrix",
"data",
")",
"{",
"Assume",
".",
"assume",
"(",
"data",
".",
"getRowDimension",
"(",
")",
">",
"1",
",",
"\"Number of data samples is \"",
"+",
"data",
".",
"getRowDimension",
... | Calculate covariance matrix with an assumption that data matrix is
centered i.e. for each column i: x_i' = x_i - E(x_i) | [
"Calculate",
"covariance",
"matrix",
"with",
"an",
"assumption",
"that",
"data",
"matrix",
"is",
"centered",
"i",
".",
"e",
".",
"for",
"each",
"column",
"i",
":",
"x_i",
"=",
"x_i",
"-",
"E",
"(",
"x_i",
")"
] | train | https://github.com/mkobos/pca_transform/blob/0f73f443465eeae2d2131fc0da82a7cf7dc92bc2/src/main/java/com/mkobos/pca_transform/covmatrixevd/EVDBased.java#L24-L42 |
lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.getMimeType | public static String getMimeType(Resource res, String defaultValue) {
return IOUtil.getMimeType(res, defaultValue);
} | java | public static String getMimeType(Resource res, String defaultValue) {
return IOUtil.getMimeType(res, defaultValue);
} | [
"public",
"static",
"String",
"getMimeType",
"(",
"Resource",
"res",
",",
"String",
"defaultValue",
")",
"{",
"return",
"IOUtil",
".",
"getMimeType",
"(",
"res",
",",
"defaultValue",
")",
";",
"}"
] | return the mime type of a file, dont check extension
@param res
@param defaultValue
@return mime type of the file | [
"return",
"the",
"mime",
"type",
"of",
"a",
"file",
"dont",
"check",
"extension"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L790-L792 |
rubenlagus/TelegramBots | telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java | BaseAbilityBot.getUserIdSendError | protected int getUserIdSendError(String username, MessageContext ctx) {
try {
return getUser(username).getId();
} catch (IllegalStateException ex) {
silent.send(getLocalizedMessage(USER_NOT_FOUND, ctx.user().getLanguageCode(), username), ctx.chatId());
throw propagate(ex);
}
} | java | protected int getUserIdSendError(String username, MessageContext ctx) {
try {
return getUser(username).getId();
} catch (IllegalStateException ex) {
silent.send(getLocalizedMessage(USER_NOT_FOUND, ctx.user().getLanguageCode(), username), ctx.chatId());
throw propagate(ex);
}
} | [
"protected",
"int",
"getUserIdSendError",
"(",
"String",
"username",
",",
"MessageContext",
"ctx",
")",
"{",
"try",
"{",
"return",
"getUser",
"(",
"username",
")",
".",
"getId",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalStateException",
"ex",
")",
"{",
"si... | Gets the user with the specified username. If user was not found, the bot will send a message on Telegram.
@param username the username of the required user
@param ctx the message context with the originating user
@return the id of the user | [
"Gets",
"the",
"user",
"with",
"the",
"specified",
"username",
".",
"If",
"user",
"was",
"not",
"found",
"the",
"bot",
"will",
"send",
"a",
"message",
"on",
"Telegram",
"."
] | train | https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java#L279-L286 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAuthTicketUrl.java | CustomerAuthTicketUrl.refreshUserAuthTicketUrl | public static MozuUrl refreshUserAuthTicketUrl(String refreshToken, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/authtickets/refresh?refreshToken={refreshToken}&responseFields={responseFields}");
formatter.formatUrl("refreshToken", refreshToken);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl refreshUserAuthTicketUrl(String refreshToken, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/authtickets/refresh?refreshToken={refreshToken}&responseFields={responseFields}");
formatter.formatUrl("refreshToken", refreshToken);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"refreshUserAuthTicketUrl",
"(",
"String",
"refreshToken",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/authtickets/refresh?refreshToken={refreshToken}&responseFie... | Get Resource Url for RefreshUserAuthTicket
@param refreshToken Alphanumeric string used for access tokens. This token refreshes access for accounts by generating a new developer or application account authentication ticket after an access token expires.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"RefreshUserAuthTicket"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAuthTicketUrl.java#L46-L52 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/IssuesApi.java | IssuesApi.getIssue | public Issue getIssue(Object projectIdOrPath, Integer issueIid) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid);
return (response.readEntity(Issue.class));
} | java | public Issue getIssue(Object projectIdOrPath, Integer issueIid) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid);
return (response.readEntity(Issue.class));
} | [
"public",
"Issue",
"getIssue",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"issueIid",
")",
"throws",
"GitLabApiException",
"{",
"Response",
"response",
"=",
"get",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
"getDefaultPerPageParam",
"(",
")",
",",
... | Get a single project issue.
<pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param issueIid the internal ID of a project's issue
@return the specified Issue instance
@throws GitLabApiException if any exception occurs | [
"Get",
"a",
"single",
"project",
"issue",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/IssuesApi.java#L293-L297 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/fieldprocessor/FieldProcessorRegistry.java | FieldProcessorRegistry.registerProcessor | public <A extends Annotation> void registerProcessor(final Class<A> annoClass, final FieldProcessor<A> processor) {
ArgUtils.notNull(annoClass, "annoClass");
ArgUtils.notNull(processor, "processor");
pocessorMap.put(annoClass, processor);
} | java | public <A extends Annotation> void registerProcessor(final Class<A> annoClass, final FieldProcessor<A> processor) {
ArgUtils.notNull(annoClass, "annoClass");
ArgUtils.notNull(processor, "processor");
pocessorMap.put(annoClass, processor);
} | [
"public",
"<",
"A",
"extends",
"Annotation",
">",
"void",
"registerProcessor",
"(",
"final",
"Class",
"<",
"A",
">",
"annoClass",
",",
"final",
"FieldProcessor",
"<",
"A",
">",
"processor",
")",
"{",
"ArgUtils",
".",
"notNull",
"(",
"annoClass",
",",
"\"an... | アノテーションに対する{@link FieldProcessor}を登録する。
@param annoClass 登録対象のアノテーションのクラスタイプ。
@param processor フィールドプロセッサーのインスタンス。{@link FieldProcessor}を実装している必要がある。
@throws NullPointerException {@literal annoClass == null or processor == null.} | [
"アノテーションに対する",
"{"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldprocessor/FieldProcessorRegistry.java#L82-L88 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/dimension/SizeLong.java | SizeLong.getBestMatchingSize | @Nonnull
@CheckReturnValue
public SizeLong getBestMatchingSize (@Nonnegative final long nMaxWidth, @Nonnegative final long nMaxHeight)
{
ValueEnforcer.isGT0 (nMaxWidth, "MaxWidth");
ValueEnforcer.isGT0 (nMaxHeight, "MaxHeight");
final double dRelWidth = MathHelper.getDividedDouble (m_nWidth, nMaxWidth);
final double dRelHeight = MathHelper.getDividedDouble (m_nHeight, nMaxHeight);
if (dRelWidth > dRelHeight)
{
if (m_nWidth > nMaxWidth)
return new SizeLong (nMaxWidth, (long) (m_nHeight / dRelWidth));
}
else
{
if (m_nHeight > nMaxHeight)
return new SizeLong ((long) (m_nWidth / dRelHeight), nMaxHeight);
}
return this;
} | java | @Nonnull
@CheckReturnValue
public SizeLong getBestMatchingSize (@Nonnegative final long nMaxWidth, @Nonnegative final long nMaxHeight)
{
ValueEnforcer.isGT0 (nMaxWidth, "MaxWidth");
ValueEnforcer.isGT0 (nMaxHeight, "MaxHeight");
final double dRelWidth = MathHelper.getDividedDouble (m_nWidth, nMaxWidth);
final double dRelHeight = MathHelper.getDividedDouble (m_nHeight, nMaxHeight);
if (dRelWidth > dRelHeight)
{
if (m_nWidth > nMaxWidth)
return new SizeLong (nMaxWidth, (long) (m_nHeight / dRelWidth));
}
else
{
if (m_nHeight > nMaxHeight)
return new SizeLong ((long) (m_nWidth / dRelHeight), nMaxHeight);
}
return this;
} | [
"@",
"Nonnull",
"@",
"CheckReturnValue",
"public",
"SizeLong",
"getBestMatchingSize",
"(",
"@",
"Nonnegative",
"final",
"long",
"nMaxWidth",
",",
"@",
"Nonnegative",
"final",
"long",
"nMaxHeight",
")",
"{",
"ValueEnforcer",
".",
"isGT0",
"(",
"nMaxWidth",
",",
"... | Return the scaled width and height relative to a maximum size.
@param nMaxWidth
Maximum width. Must be > 0.
@param nMaxHeight
Maximum height. Must be > 0.
@return An array with 2 elements, where the first element is the width, and
the second is the height. | [
"Return",
"the",
"scaled",
"width",
"and",
"height",
"relative",
"to",
"a",
"maximum",
"size",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/dimension/SizeLong.java#L80-L100 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ProtectedBranchesApi.java | ProtectedBranchesApi.unprotectBranch | public void unprotectBranch(Integer projectIdOrPath, String branchName) throws GitLabApiException {
delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "protected_branches", urlEncode(branchName));
} | java | public void unprotectBranch(Integer projectIdOrPath, String branchName) throws GitLabApiException {
delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "protected_branches", urlEncode(branchName));
} | [
"public",
"void",
"unprotectBranch",
"(",
"Integer",
"projectIdOrPath",
",",
"String",
"branchName",
")",
"throws",
"GitLabApiException",
"{",
"delete",
"(",
"Response",
".",
"Status",
".",
"NO_CONTENT",
",",
"null",
",",
"\"projects\"",
",",
"getProjectIdOrPath",
... | Unprotects the given protected branch or wildcard protected branch.
<pre><code>GitLab Endpoint: DELETE /projects/:id/protected_branches/:name</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param branchName the name of the branch to un-protect
@throws GitLabApiException if any exception occurs | [
"Unprotects",
"the",
"given",
"protected",
"branch",
"or",
"wildcard",
"protected",
"branch",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProtectedBranchesApi.java#L68-L70 |
borball/weixin-sdk | weixin-mp/src/main/java/com/riversoft/weixin/mp/media/Materials.java | Materials.updateMpNews | public void updateMpNews(String mediaId, int index, MpArticle article) {
String url = WxEndpoint.get("url.material.mpnews.update");
Map<String, Object> request = new HashMap<>();
request.put("media_id", mediaId);
request.put("index", index);
request.put("articles", article);
String json = JsonMapper.nonEmptyMapper().toJson(request);
logger.info("update mpnews: {}", json);
wxClient.post(url, json);
} | java | public void updateMpNews(String mediaId, int index, MpArticle article) {
String url = WxEndpoint.get("url.material.mpnews.update");
Map<String, Object> request = new HashMap<>();
request.put("media_id", mediaId);
request.put("index", index);
request.put("articles", article);
String json = JsonMapper.nonEmptyMapper().toJson(request);
logger.info("update mpnews: {}", json);
wxClient.post(url, json);
} | [
"public",
"void",
"updateMpNews",
"(",
"String",
"mediaId",
",",
"int",
"index",
",",
"MpArticle",
"article",
")",
"{",
"String",
"url",
"=",
"WxEndpoint",
".",
"get",
"(",
"\"url.material.mpnews.update\"",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",... | 修改图文素材
@param mediaId 图文素材 media id
@param index 要更新的文章在图文素材中的位置
@param article 文章 | [
"修改图文素材"
] | train | https://github.com/borball/weixin-sdk/blob/32bf5e45cdd8d0d28074e83954e1ec62dcf25cb7/weixin-mp/src/main/java/com/riversoft/weixin/mp/media/Materials.java#L113-L124 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java | SourceLineAnnotation.fromVisitedInstruction | public static SourceLineAnnotation fromVisitedInstruction(ClassContext classContext, PreorderVisitor visitor, int pc) {
return fromVisitedInstructionRange(classContext, visitor, pc, pc);
} | java | public static SourceLineAnnotation fromVisitedInstruction(ClassContext classContext, PreorderVisitor visitor, int pc) {
return fromVisitedInstructionRange(classContext, visitor, pc, pc);
} | [
"public",
"static",
"SourceLineAnnotation",
"fromVisitedInstruction",
"(",
"ClassContext",
"classContext",
",",
"PreorderVisitor",
"visitor",
",",
"int",
"pc",
")",
"{",
"return",
"fromVisitedInstructionRange",
"(",
"classContext",
",",
"visitor",
",",
"pc",
",",
"pc"... | Factory method for creating a source line annotation describing the
source line number for the instruction being visited by given visitor.
@param classContext
the ClassContext
@param visitor
a BetterVisitor which is visiting the method
@param pc
the bytecode offset of the instruction in the method
@return the SourceLineAnnotation, or null if we do not have line number
information for the instruction | [
"Factory",
"method",
"for",
"creating",
"a",
"source",
"line",
"annotation",
"describing",
"the",
"source",
"line",
"number",
"for",
"the",
"instruction",
"being",
"visited",
"by",
"given",
"visitor",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L384-L386 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java | TaskOperations.listSubtasks | public List<SubtaskInformation> listSubtasks(String jobId, String taskId) throws BatchErrorException, IOException {
return listSubtasks(jobId, taskId, null, null);
} | java | public List<SubtaskInformation> listSubtasks(String jobId, String taskId) throws BatchErrorException, IOException {
return listSubtasks(jobId, taskId, null, null);
} | [
"public",
"List",
"<",
"SubtaskInformation",
">",
"listSubtasks",
"(",
"String",
"jobId",
",",
"String",
"taskId",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"return",
"listSubtasks",
"(",
"jobId",
",",
"taskId",
",",
"null",
",",
"null",
"... | Lists the {@link SubtaskInformation subtasks} of the specified task.
@param jobId
The ID of the job containing the task.
@param taskId
The ID of the task.
@return A list of {@link SubtaskInformation} 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",
"the",
"{",
"@link",
"SubtaskInformation",
"subtasks",
"}",
"of",
"the",
"specified",
"task",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java#L469-L471 |
janus-project/guava.janusproject.io | guava/src/com/google/common/collect/MapMaker.java | MapMaker.expireAfterAccess | @Deprecated
@GwtIncompatible("To be supported")
@Override
MapMaker expireAfterAccess(long duration, TimeUnit unit) {
checkExpiration(duration, unit);
this.expireAfterAccessNanos = unit.toNanos(duration);
if (duration == 0 && this.nullRemovalCause == null) {
// SIZE trumps EXPIRED
this.nullRemovalCause = RemovalCause.EXPIRED;
}
useCustomMap = true;
return this;
} | java | @Deprecated
@GwtIncompatible("To be supported")
@Override
MapMaker expireAfterAccess(long duration, TimeUnit unit) {
checkExpiration(duration, unit);
this.expireAfterAccessNanos = unit.toNanos(duration);
if (duration == 0 && this.nullRemovalCause == null) {
// SIZE trumps EXPIRED
this.nullRemovalCause = RemovalCause.EXPIRED;
}
useCustomMap = true;
return this;
} | [
"@",
"Deprecated",
"@",
"GwtIncompatible",
"(",
"\"To be supported\"",
")",
"@",
"Override",
"MapMaker",
"expireAfterAccess",
"(",
"long",
"duration",
",",
"TimeUnit",
"unit",
")",
"{",
"checkExpiration",
"(",
"duration",
",",
"unit",
")",
";",
"this",
".",
"e... | Specifies that each entry should be automatically removed from the map once a fixed duration
has elapsed after the entry's last read or write access.
<p>When {@code duration} is zero, elements can be successfully added to the map, but are
evicted immediately. This has a very similar effect to invoking {@link #maximumSize
maximumSize}{@code (0)}. It can be useful in testing, or to disable caching temporarily without
a code change.
<p>Expired entries may be counted by {@link Map#size}, but will never be visible to read or
write operations. Expired entries are currently cleaned up during write operations, or during
occasional read operations in the absense of writes; though this behavior may change in the
future.
@param duration the length of time after an entry is last accessed that it should be
automatically removed
@param unit the unit that {@code duration} is expressed in
@throws IllegalArgumentException if {@code duration} is negative
@throws IllegalStateException if the time to idle or time to live was already set
@deprecated Caching functionality in {@code MapMaker} has been moved to
{@link com.google.common.cache.CacheBuilder}, with {@link #expireAfterAccess} being
replaced by {@link com.google.common.cache.CacheBuilder#expireAfterAccess}. Note that
{@code CacheBuilder} is simply an enhanced API for an implementation which was branched
from {@code MapMaker}. | [
"Specifies",
"that",
"each",
"entry",
"should",
"be",
"automatically",
"removed",
"from",
"the",
"map",
"once",
"a",
"fixed",
"duration",
"has",
"elapsed",
"after",
"the",
"entry",
"s",
"last",
"read",
"or",
"write",
"access",
"."
] | train | https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/collect/MapMaker.java#L427-L439 |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroReader.java | SynchroReader.processResourceAssignment | private void processResourceAssignment(Task task, MapRow row)
{
Resource resource = m_resourceMap.get(row.getUUID("RESOURCE_UUID"));
task.addResourceAssignment(resource);
} | java | private void processResourceAssignment(Task task, MapRow row)
{
Resource resource = m_resourceMap.get(row.getUUID("RESOURCE_UUID"));
task.addResourceAssignment(resource);
} | [
"private",
"void",
"processResourceAssignment",
"(",
"Task",
"task",
",",
"MapRow",
"row",
")",
"{",
"Resource",
"resource",
"=",
"m_resourceMap",
".",
"get",
"(",
"row",
".",
"getUUID",
"(",
"\"RESOURCE_UUID\"",
")",
")",
";",
"task",
".",
"addResourceAssignm... | Extract data for a single resource assignment.
@param task parent task
@param row Synchro resource assignment | [
"Extract",
"data",
"for",
"a",
"single",
"resource",
"assignment",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L425-L429 |
jhunters/jprotobuf | v3/src/main/java/com/baidu/bjf/remoting/protobuf/IDLProxyObject.java | IDLProxyObject.setField | private void setField(Object value, Object object, Field f) {
f.setAccessible(true);
Object valueToSet = value;
try {
// check if field type is enum
if (Enum.class.isAssignableFrom(f.getType())) {
Enum v = Enum.valueOf((Class<Enum>) f.getType(), String.valueOf(value));
valueToSet = v;
}
f.set(object, valueToSet);
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
} | java | private void setField(Object value, Object object, Field f) {
f.setAccessible(true);
Object valueToSet = value;
try {
// check if field type is enum
if (Enum.class.isAssignableFrom(f.getType())) {
Enum v = Enum.valueOf((Class<Enum>) f.getType(), String.valueOf(value));
valueToSet = v;
}
f.set(object, valueToSet);
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
} | [
"private",
"void",
"setField",
"(",
"Object",
"value",
",",
"Object",
"object",
",",
"Field",
"f",
")",
"{",
"f",
".",
"setAccessible",
"(",
"true",
")",
";",
"Object",
"valueToSet",
"=",
"value",
";",
"try",
"{",
"// check if field type is enum\r",
"if",
... | Sets the field.
@param value the value
@param object the object
@param f the f
@throws SecurityException the security exception
@throws IllegalArgumentException the illegal argument exception | [
"Sets",
"the",
"field",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/IDLProxyObject.java#L209-L223 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyBuilder.java | BiologicalAssemblyBuilder.addChainMultiModel | private void addChainMultiModel(Structure s, Chain newChain, String transformId) {
// multi-model bioassembly
if ( modelIndex.size() == 0)
modelIndex.add("PLACEHOLDER FOR ASYM UNIT");
int modelCount = modelIndex.indexOf(transformId);
if ( modelCount == -1) {
modelIndex.add(transformId);
modelCount = modelIndex.indexOf(transformId);
}
if (modelCount == 0) {
s.addChain(newChain);
} else if (modelCount > s.nrModels()) {
List<Chain> newModel = new ArrayList<>();
newModel.add(newChain);
s.addModel(newModel);
} else {
s.addChain(newChain, modelCount-1);
}
} | java | private void addChainMultiModel(Structure s, Chain newChain, String transformId) {
// multi-model bioassembly
if ( modelIndex.size() == 0)
modelIndex.add("PLACEHOLDER FOR ASYM UNIT");
int modelCount = modelIndex.indexOf(transformId);
if ( modelCount == -1) {
modelIndex.add(transformId);
modelCount = modelIndex.indexOf(transformId);
}
if (modelCount == 0) {
s.addChain(newChain);
} else if (modelCount > s.nrModels()) {
List<Chain> newModel = new ArrayList<>();
newModel.add(newChain);
s.addModel(newModel);
} else {
s.addChain(newChain, modelCount-1);
}
} | [
"private",
"void",
"addChainMultiModel",
"(",
"Structure",
"s",
",",
"Chain",
"newChain",
",",
"String",
"transformId",
")",
"{",
"// multi-model bioassembly",
"if",
"(",
"modelIndex",
".",
"size",
"(",
")",
"==",
"0",
")",
"modelIndex",
".",
"add",
"(",
"\"... | Adds a chain to the given structure to form a biological assembly,
adding the symmetry expanded chains as new models per transformId.
@param s
@param newChain
@param transformId | [
"Adds",
"a",
"chain",
"to",
"the",
"given",
"structure",
"to",
"form",
"a",
"biological",
"assembly",
"adding",
"the",
"symmetry",
"expanded",
"chains",
"as",
"new",
"models",
"per",
"transformId",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyBuilder.java#L202-L225 |
kite-sdk/kite | kite-data/kite-data-hive/src/main/java/org/kitesdk/data/spi/hive/HiveUtils.java | HiveUtils.pathForDataset | static Path pathForDataset(Path root, String namespace, String name) {
Preconditions.checkNotNull(namespace, "Namespace cannot be null");
Preconditions.checkNotNull(name, "Dataset name cannot be null");
// Why replace '.' here? Is this a namespacing hack?
return new Path(root, new Path(namespace, name.replace('.', Path.SEPARATOR_CHAR)));
} | java | static Path pathForDataset(Path root, String namespace, String name) {
Preconditions.checkNotNull(namespace, "Namespace cannot be null");
Preconditions.checkNotNull(name, "Dataset name cannot be null");
// Why replace '.' here? Is this a namespacing hack?
return new Path(root, new Path(namespace, name.replace('.', Path.SEPARATOR_CHAR)));
} | [
"static",
"Path",
"pathForDataset",
"(",
"Path",
"root",
",",
"String",
"namespace",
",",
"String",
"name",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"namespace",
",",
"\"Namespace cannot be null\"",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
... | Returns the correct dataset path for the given name and root directory.
@param root A Path
@param namespace A String namespace, or logical group
@param name A String dataset name
@return the correct dataset Path | [
"Returns",
"the",
"correct",
"dataset",
"path",
"for",
"the",
"given",
"name",
"and",
"root",
"directory",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hive/src/main/java/org/kitesdk/data/spi/hive/HiveUtils.java#L392-L398 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java | Provider.putService | protected synchronized void putService(Service s) {
check("putProviderProperty." + name);
// if (debug != null) {
// debug.println(name + ".putService(): " + s);
// }
if (s == null) {
throw new NullPointerException();
}
if (s.getProvider() != this) {
throw new IllegalArgumentException
("service.getProvider() must match this Provider object");
}
if (serviceMap == null) {
serviceMap = new LinkedHashMap<ServiceKey,Service>();
}
servicesChanged = true;
String type = s.getType();
String algorithm = s.getAlgorithm();
ServiceKey key = new ServiceKey(type, algorithm, true);
// remove existing service
implRemoveService(serviceMap.get(key));
serviceMap.put(key, s);
for (String alias : s.getAliases()) {
serviceMap.put(new ServiceKey(type, alias, true), s);
}
putPropertyStrings(s);
} | java | protected synchronized void putService(Service s) {
check("putProviderProperty." + name);
// if (debug != null) {
// debug.println(name + ".putService(): " + s);
// }
if (s == null) {
throw new NullPointerException();
}
if (s.getProvider() != this) {
throw new IllegalArgumentException
("service.getProvider() must match this Provider object");
}
if (serviceMap == null) {
serviceMap = new LinkedHashMap<ServiceKey,Service>();
}
servicesChanged = true;
String type = s.getType();
String algorithm = s.getAlgorithm();
ServiceKey key = new ServiceKey(type, algorithm, true);
// remove existing service
implRemoveService(serviceMap.get(key));
serviceMap.put(key, s);
for (String alias : s.getAliases()) {
serviceMap.put(new ServiceKey(type, alias, true), s);
}
putPropertyStrings(s);
} | [
"protected",
"synchronized",
"void",
"putService",
"(",
"Service",
"s",
")",
"{",
"check",
"(",
"\"putProviderProperty.\"",
"+",
"name",
")",
";",
"// if (debug != null) {",
"// debug.println(name + \".putService(): \" + s);",
"// }",
"if",
"(",
"s"... | Add a service. If a service of the same type with the same algorithm
name exists and it was added using {@link #putService putService()},
it is replaced by the new service.
This method also places information about this service
in the provider's Hashtable values in the format described in the
<a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/crypto/CryptoSpec.html">
Java Cryptography Architecture API Specification & Reference </a>.
<p>Also, if there is a security manager, its
<code>checkSecurityAccess</code> method is called with the string
<code>"putProviderProperty."+name</code>, where <code>name</code> is
the provider name, to see if it's ok to set this provider's property
values. If the default implementation of <code>checkSecurityAccess</code>
is used (that is, that method is not overriden), then this results in
a call to the security manager's <code>checkPermission</code> method with
a <code>SecurityPermission("putProviderProperty."+name)</code>
permission.
@param s the Service to add
@throws SecurityException
if a security manager exists and its <code>{@link
java.lang.SecurityManager#checkSecurityAccess}</code> method denies
access to set property values.
@throws NullPointerException if s is null
@since 1.5 | [
"Add",
"a",
"service",
".",
"If",
"a",
"service",
"of",
"the",
"same",
"type",
"with",
"the",
"same",
"algorithm",
"name",
"exists",
"and",
"it",
"was",
"added",
"using",
"{",
"@link",
"#putService",
"putService",
"()",
"}",
"it",
"is",
"replaced",
"by",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java#L792-L818 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java | FlowController.sendError | protected void sendError( String errText, HttpServletResponse response )
throws IOException
{
sendError( errText, null, response );
} | java | protected void sendError( String errText, HttpServletResponse response )
throws IOException
{
sendError( errText, null, response );
} | [
"protected",
"void",
"sendError",
"(",
"String",
"errText",
",",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"sendError",
"(",
"errText",
",",
"null",
",",
"response",
")",
";",
"}"
] | Send a Page Flow error to the browser.
@deprecated Use {@link FlowController#sendError(String, HttpServletRequest, HttpServletResponse)} instead.
@param errText the error message to display.
@param response the current HttpServletResponse. | [
"Send",
"a",
"Page",
"Flow",
"error",
"to",
"the",
"browser",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L228-L232 |
voldemort/voldemort | src/java/voldemort/store/stats/ClientSocketStats.java | ClientSocketStats.recordAsyncOpTimeNs | public void recordAsyncOpTimeNs(SocketDestination dest, long opTimeNs) {
if(dest != null) {
getOrCreateNodeStats(dest).recordAsyncOpTimeNs(null, opTimeNs);
recordAsyncOpTimeNs(null, opTimeNs);
} else {
this.asynOpTimeRequestCounter.addRequest(opTimeNs);
}
} | java | public void recordAsyncOpTimeNs(SocketDestination dest, long opTimeNs) {
if(dest != null) {
getOrCreateNodeStats(dest).recordAsyncOpTimeNs(null, opTimeNs);
recordAsyncOpTimeNs(null, opTimeNs);
} else {
this.asynOpTimeRequestCounter.addRequest(opTimeNs);
}
} | [
"public",
"void",
"recordAsyncOpTimeNs",
"(",
"SocketDestination",
"dest",
",",
"long",
"opTimeNs",
")",
"{",
"if",
"(",
"dest",
"!=",
"null",
")",
"{",
"getOrCreateNodeStats",
"(",
"dest",
")",
".",
"recordAsyncOpTimeNs",
"(",
"null",
",",
"opTimeNs",
")",
... | Record operation for async ops time
@param dest Destination of the socket to connect to. Will actually record
if null. Otherwise will call this on self and corresponding child
with this param null.
@param opTimeUs The number of us for the op to finish | [
"Record",
"operation",
"for",
"async",
"ops",
"time"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/stats/ClientSocketStats.java#L230-L237 |
Azure/azure-sdk-for-java | applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/QuerysImpl.java | QuerysImpl.executeAsync | public ServiceFuture<QueryResults> executeAsync(String appId, QueryBody body, final ServiceCallback<QueryResults> serviceCallback) {
return ServiceFuture.fromResponse(executeWithServiceResponseAsync(appId, body), serviceCallback);
} | java | public ServiceFuture<QueryResults> executeAsync(String appId, QueryBody body, final ServiceCallback<QueryResults> serviceCallback) {
return ServiceFuture.fromResponse(executeWithServiceResponseAsync(appId, body), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"QueryResults",
">",
"executeAsync",
"(",
"String",
"appId",
",",
"QueryBody",
"body",
",",
"final",
"ServiceCallback",
"<",
"QueryResults",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromResponse",
"(",
"exe... | Execute an Analytics query.
Executes an Analytics query for data. [Here](https://dev.applicationinsights.io/documentation/Using-the-API/Query) is an example for using POST with an Analytics query.
@param appId ID of the application. This is Application ID from the API Access settings blade in the Azure portal.
@param body The Analytics query. Learn more about the [Analytics query syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/)
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Execute",
"an",
"Analytics",
"query",
".",
"Executes",
"an",
"Analytics",
"query",
"for",
"data",
".",
"[",
"Here",
"]",
"(",
"https",
":",
"//",
"dev",
".",
"applicationinsights",
".",
"io",
"/",
"documentation",
"/",
"Using",
"-",
"the",
"-",
"API",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/QuerysImpl.java#L89-L91 |
vlingo/vlingo-actors | src/main/java/io/vlingo/actors/Stage.java | Stage.allocateAddress | private Address allocateAddress(final Definition definition, final Address maybeAddress) {
final Address address = maybeAddress != null ?
maybeAddress : world.addressFactory().uniqueWith(definition.actorName());
return address;
} | java | private Address allocateAddress(final Definition definition, final Address maybeAddress) {
final Address address = maybeAddress != null ?
maybeAddress : world.addressFactory().uniqueWith(definition.actorName());
return address;
} | [
"private",
"Address",
"allocateAddress",
"(",
"final",
"Definition",
"definition",
",",
"final",
"Address",
"maybeAddress",
")",
"{",
"final",
"Address",
"address",
"=",
"maybeAddress",
"!=",
"null",
"?",
"maybeAddress",
":",
"world",
".",
"addressFactory",
"(",
... | Answers an Address for an Actor. If maybeAddress is allocated answer it; otherwise
answer a newly allocated Address. (INTERNAL ONLY)
@param definition the Definition of the newly created Actor
@param maybeAddress the possible Address
@return Address | [
"Answers",
"an",
"Address",
"for",
"an",
"Actor",
".",
"If",
"maybeAddress",
"is",
"allocated",
"answer",
"it",
";",
"otherwise",
"answer",
"a",
"newly",
"allocated",
"Address",
".",
"(",
"INTERNAL",
"ONLY",
")"
] | train | https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/Stage.java#L559-L563 |
apache/incubator-atlas | repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java | DeleteHandler.deleteTypeVertex | protected void deleteTypeVertex(AtlasVertex instanceVertex, DataTypes.TypeCategory typeCategory, boolean force) throws AtlasException {
switch (typeCategory) {
case STRUCT:
case TRAIT:
deleteTypeVertex(instanceVertex, force);
break;
case CLASS:
deleteEntities(Collections.singletonList(instanceVertex));
break;
default:
throw new IllegalStateException("Type category " + typeCategory + " not handled");
}
} | java | protected void deleteTypeVertex(AtlasVertex instanceVertex, DataTypes.TypeCategory typeCategory, boolean force) throws AtlasException {
switch (typeCategory) {
case STRUCT:
case TRAIT:
deleteTypeVertex(instanceVertex, force);
break;
case CLASS:
deleteEntities(Collections.singletonList(instanceVertex));
break;
default:
throw new IllegalStateException("Type category " + typeCategory + " not handled");
}
} | [
"protected",
"void",
"deleteTypeVertex",
"(",
"AtlasVertex",
"instanceVertex",
",",
"DataTypes",
".",
"TypeCategory",
"typeCategory",
",",
"boolean",
"force",
")",
"throws",
"AtlasException",
"{",
"switch",
"(",
"typeCategory",
")",
"{",
"case",
"STRUCT",
":",
"ca... | Deletes a type vertex - can be entity(class type) or just vertex(struct/trait type)
@param instanceVertex
@param typeCategory
@throws AtlasException | [
"Deletes",
"a",
"type",
"vertex",
"-",
"can",
"be",
"entity",
"(",
"class",
"type",
")",
"or",
"just",
"vertex",
"(",
"struct",
"/",
"trait",
"type",
")"
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java#L116-L130 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenPowerMethod_DDRM.java | EigenPowerMethod_DDRM.computeShiftDirect | public boolean computeShiftDirect(DMatrixRMaj A , double alpha) {
SpecializedOps_DDRM.addIdentity(A,B,-alpha);
return computeDirect(B);
} | java | public boolean computeShiftDirect(DMatrixRMaj A , double alpha) {
SpecializedOps_DDRM.addIdentity(A,B,-alpha);
return computeDirect(B);
} | [
"public",
"boolean",
"computeShiftDirect",
"(",
"DMatrixRMaj",
"A",
",",
"double",
"alpha",
")",
"{",
"SpecializedOps_DDRM",
".",
"addIdentity",
"(",
"A",
",",
"B",
",",
"-",
"alpha",
")",
";",
"return",
"computeDirect",
"(",
"B",
")",
";",
"}"
] | Computes the most dominant eigen vector of A using a shifted matrix.
The shifted matrix is defined as <b>B = A - αI</b> and can converge faster
if α is chosen wisely. In general it is easier to choose a value for α
that will converge faster with the shift-invert strategy than this one.
@param A The matrix.
@param alpha Shifting factor.
@return If it converged or not. | [
"Computes",
"the",
"most",
"dominant",
"eigen",
"vector",
"of",
"A",
"using",
"a",
"shifted",
"matrix",
".",
"The",
"shifted",
"matrix",
"is",
"defined",
"as",
"<b",
">",
"B",
"=",
"A",
"-",
"&alpha",
";",
"I<",
"/",
"b",
">",
"and",
"can",
"converge... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenPowerMethod_DDRM.java#L180-L184 |
alkacon/opencms-core | src/org/opencms/gwt/shared/property/CmsClientTemplateBean.java | CmsClientTemplateBean.getNullTemplate | public static CmsClientTemplateBean getNullTemplate() {
String imagePath = "/system/workplace/resources/commons/notemplate.png";
CmsClientTemplateBean result = new CmsClientTemplateBean("No template", "", "", imagePath);
result.setShowWeakText(true);
return result;
} | java | public static CmsClientTemplateBean getNullTemplate() {
String imagePath = "/system/workplace/resources/commons/notemplate.png";
CmsClientTemplateBean result = new CmsClientTemplateBean("No template", "", "", imagePath);
result.setShowWeakText(true);
return result;
} | [
"public",
"static",
"CmsClientTemplateBean",
"getNullTemplate",
"(",
")",
"{",
"String",
"imagePath",
"=",
"\"/system/workplace/resources/commons/notemplate.png\"",
";",
"CmsClientTemplateBean",
"result",
"=",
"new",
"CmsClientTemplateBean",
"(",
"\"No template\"",
",",
"\"\"... | Returns a dummy template object which represents an empty selection.<p>
@return a dummy template object | [
"Returns",
"a",
"dummy",
"template",
"object",
"which",
"represents",
"an",
"empty",
"selection",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/shared/property/CmsClientTemplateBean.java#L83-L89 |
hortonworks/dstream | dstream-api/src/main/java/io/dstream/DStreamOperation.java | DStreamOperation.setStreamsCombiner | void setStreamsCombiner(String operationName, AbstractStreamMergingFunction streamsCombiner) {
this.operationNames.add(operationName);
this.streamOperationFunction = streamsCombiner;
} | java | void setStreamsCombiner(String operationName, AbstractStreamMergingFunction streamsCombiner) {
this.operationNames.add(operationName);
this.streamOperationFunction = streamsCombiner;
} | [
"void",
"setStreamsCombiner",
"(",
"String",
"operationName",
",",
"AbstractStreamMergingFunction",
"streamsCombiner",
")",
"{",
"this",
".",
"operationNames",
".",
"add",
"(",
"operationName",
")",
";",
"this",
".",
"streamOperationFunction",
"=",
"streamsCombiner",
... | Sets the given instance of {@link AbstractStreamMergingFunction} as the
function of this {@link DStreamOperation}. | [
"Sets",
"the",
"given",
"instance",
"of",
"{"
] | train | https://github.com/hortonworks/dstream/blob/3a106c0f14725b028fe7fe2dbc660406d9a5f142/dstream-api/src/main/java/io/dstream/DStreamOperation.java#L199-L202 |
MaxLeap/SDK-CloudCode-Java | cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java | WebUtils.doRequestWithUrl | public static String doRequestWithUrl(String url, String method, Map<String, String> header, Map<String, String> params, String charset) throws IOException {
HttpURLConnection conn = null;
String rsp = null;
try {
String ctype = "application/json";
String query = buildQuery(params, charset);
try {
conn = getConnection(buildGetUrl(url, query), method, header, ctype);
} catch (IOException e) {
throw e;
}
try {
rsp = getResponseAsString(conn);
} catch (IOException e) {
throw e;
}
} finally {
if (conn != null) {
conn.disconnect();
}
}
return rsp;
} | java | public static String doRequestWithUrl(String url, String method, Map<String, String> header, Map<String, String> params, String charset) throws IOException {
HttpURLConnection conn = null;
String rsp = null;
try {
String ctype = "application/json";
String query = buildQuery(params, charset);
try {
conn = getConnection(buildGetUrl(url, query), method, header, ctype);
} catch (IOException e) {
throw e;
}
try {
rsp = getResponseAsString(conn);
} catch (IOException e) {
throw e;
}
} finally {
if (conn != null) {
conn.disconnect();
}
}
return rsp;
} | [
"public",
"static",
"String",
"doRequestWithUrl",
"(",
"String",
"url",
",",
"String",
"method",
",",
"Map",
"<",
"String",
",",
"String",
">",
"header",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
",",
"String",
"charset",
")",
"throws",
"I... | 执行HTTP GET/DELETE请求。
@param url 请求地址
@param params 请求参数
@param charset 字符集,如UTF-8, GBK, GB2312
@return 响应字符串
@throws IOException | [
"执行HTTP",
"GET",
"/",
"DELETE请求。"
] | train | https://github.com/MaxLeap/SDK-CloudCode-Java/blob/756064c65dd613919c377bf136cf8710c7507968/cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java#L164-L190 |
alkacon/opencms-core | src/org/opencms/ui/apps/logfile/CmsLogChannelTable.java | CmsLogChannelTable.filterTable | @SuppressWarnings("unchecked")
public void filterTable(String search) {
m_container.removeAllContainerFilters();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(search)) {
m_container.addContainerFilter(
new Or(
new SimpleStringFilter(TableColumn.Channel, search, true, false),
new SimpleStringFilter(TableColumn.ParentChannel, search, true, false),
new SimpleStringFilter(TableColumn.File, search, true, false)));
}
if ((getValue() != null) & !((Set<Logger>)getValue()).isEmpty()) {
setCurrentPageFirstItemId(((Set<Logger>)getValue()).iterator().next());
}
} | java | @SuppressWarnings("unchecked")
public void filterTable(String search) {
m_container.removeAllContainerFilters();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(search)) {
m_container.addContainerFilter(
new Or(
new SimpleStringFilter(TableColumn.Channel, search, true, false),
new SimpleStringFilter(TableColumn.ParentChannel, search, true, false),
new SimpleStringFilter(TableColumn.File, search, true, false)));
}
if ((getValue() != null) & !((Set<Logger>)getValue()).isEmpty()) {
setCurrentPageFirstItemId(((Set<Logger>)getValue()).iterator().next());
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"filterTable",
"(",
"String",
"search",
")",
"{",
"m_container",
".",
"removeAllContainerFilters",
"(",
")",
";",
"if",
"(",
"CmsStringUtil",
".",
"isNotEmptyOrWhitespaceOnly",
"(",
"search",
")... | Filters the table according to given search string.<p>
@param search string to be looked for. | [
"Filters",
"the",
"table",
"according",
"to",
"given",
"search",
"string",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/logfile/CmsLogChannelTable.java#L391-L405 |
wcm-io-caravan/caravan-hal | docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java | GenerateHalDocsJsonMojo.hasAnnotation | private boolean hasAnnotation(JavaAnnotatedElement clazz, Class<? extends Annotation> annotationClazz) {
return clazz.getAnnotations().stream()
.filter(item -> item.getType().isA(annotationClazz.getName()))
.count() > 0;
} | java | private boolean hasAnnotation(JavaAnnotatedElement clazz, Class<? extends Annotation> annotationClazz) {
return clazz.getAnnotations().stream()
.filter(item -> item.getType().isA(annotationClazz.getName()))
.count() > 0;
} | [
"private",
"boolean",
"hasAnnotation",
"(",
"JavaAnnotatedElement",
"clazz",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClazz",
")",
"{",
"return",
"clazz",
".",
"getAnnotations",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"... | Checks if the given element has an annotation set.
@param clazz QDox class
@param annotationClazz Annotation class
@return true if annotation is present | [
"Checks",
"if",
"the",
"given",
"element",
"has",
"an",
"annotation",
"set",
"."
] | train | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java#L315-L319 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toByte | public static Byte toByte(Object o, Byte defaultValue) {
if (o instanceof Byte) return (Byte) o;
if (defaultValue != null) return new Byte(toByteValue(o, defaultValue.byteValue()));
byte res = toByteValue(o, Byte.MIN_VALUE);
if (res == Byte.MIN_VALUE) return defaultValue;
return new Byte(res);
} | java | public static Byte toByte(Object o, Byte defaultValue) {
if (o instanceof Byte) return (Byte) o;
if (defaultValue != null) return new Byte(toByteValue(o, defaultValue.byteValue()));
byte res = toByteValue(o, Byte.MIN_VALUE);
if (res == Byte.MIN_VALUE) return defaultValue;
return new Byte(res);
} | [
"public",
"static",
"Byte",
"toByte",
"(",
"Object",
"o",
",",
"Byte",
"defaultValue",
")",
"{",
"if",
"(",
"o",
"instanceof",
"Byte",
")",
"return",
"(",
"Byte",
")",
"o",
";",
"if",
"(",
"defaultValue",
"!=",
"null",
")",
"return",
"new",
"Byte",
"... | cast a Object to a Byte Object(reference type)
@param o Object to cast
@param defaultValue
@return casted Byte Object | [
"cast",
"a",
"Object",
"to",
"a",
"Byte",
"Object",
"(",
"reference",
"type",
")"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L1338-L1344 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java | FailoverGroupsInner.listByServerAsync | public Observable<Page<FailoverGroupInner>> listByServerAsync(final String resourceGroupName, final String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName)
.map(new Func1<ServiceResponse<Page<FailoverGroupInner>>, Page<FailoverGroupInner>>() {
@Override
public Page<FailoverGroupInner> call(ServiceResponse<Page<FailoverGroupInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<FailoverGroupInner>> listByServerAsync(final String resourceGroupName, final String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName)
.map(new Func1<ServiceResponse<Page<FailoverGroupInner>>, Page<FailoverGroupInner>>() {
@Override
public Page<FailoverGroupInner> call(ServiceResponse<Page<FailoverGroupInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"FailoverGroupInner",
">",
">",
"listByServerAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serverName",
")",
"{",
"return",
"listByServerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Lists the failover groups in a server.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server containing the failover group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<FailoverGroupInner> object | [
"Lists",
"the",
"failover",
"groups",
"in",
"a",
"server",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java#L805-L813 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.