repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
ironjacamar/ironjacamar | web/src/main/java/org/ironjacamar/web/SecurityActions.java | SecurityActions.createWARClassLoader | static WARClassLoader createWARClassLoader(final Kernel kernel, final ClassLoader parent)
{
return AccessController.doPrivileged(new PrivilegedAction<WARClassLoader>()
{
public WARClassLoader run()
{
return new WARClassLoader(kernel, parent);
}
});
} | java | static WARClassLoader createWARClassLoader(final Kernel kernel, final ClassLoader parent)
{
return AccessController.doPrivileged(new PrivilegedAction<WARClassLoader>()
{
public WARClassLoader run()
{
return new WARClassLoader(kernel, parent);
}
});
} | [
"static",
"WARClassLoader",
"createWARClassLoader",
"(",
"final",
"Kernel",
"kernel",
",",
"final",
"ClassLoader",
"parent",
")",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"WARClassLoader",
">",
"(",
")",
"{",
"pu... | Create a WARClassLoader
@param kernel The kernel
@param parent The parent class loader
@return The class loader | [
"Create",
"a",
"WARClassLoader"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/web/src/main/java/org/ironjacamar/web/SecurityActions.java#L135-L144 |
gresrun/jesque | src/main/java/net/greghaines/jesque/utils/PoolUtils.java | PoolUtils.createJedisPool | public static Pool<Jedis> createJedisPool(final Config jesqueConfig, final GenericObjectPoolConfig poolConfig) {
if (jesqueConfig == null) {
throw new IllegalArgumentException("jesqueConfig must not be null");
}
if (poolConfig == null) {
throw new IllegalArgumentException("poolConfig must not be null");
}
if (jesqueConfig.getMasterName() != null && !"".equals(jesqueConfig.getMasterName())
&& jesqueConfig.getSentinels() != null && jesqueConfig.getSentinels().size() > 0) {
return new JedisSentinelPool(jesqueConfig.getMasterName(), jesqueConfig.getSentinels(), poolConfig,
jesqueConfig.getTimeout(), jesqueConfig.getPassword(), jesqueConfig.getDatabase());
} else {
return new JedisPool(poolConfig, jesqueConfig.getHost(), jesqueConfig.getPort(),
jesqueConfig.getTimeout(), jesqueConfig.getPassword(), jesqueConfig.getDatabase());
}
} | java | public static Pool<Jedis> createJedisPool(final Config jesqueConfig, final GenericObjectPoolConfig poolConfig) {
if (jesqueConfig == null) {
throw new IllegalArgumentException("jesqueConfig must not be null");
}
if (poolConfig == null) {
throw new IllegalArgumentException("poolConfig must not be null");
}
if (jesqueConfig.getMasterName() != null && !"".equals(jesqueConfig.getMasterName())
&& jesqueConfig.getSentinels() != null && jesqueConfig.getSentinels().size() > 0) {
return new JedisSentinelPool(jesqueConfig.getMasterName(), jesqueConfig.getSentinels(), poolConfig,
jesqueConfig.getTimeout(), jesqueConfig.getPassword(), jesqueConfig.getDatabase());
} else {
return new JedisPool(poolConfig, jesqueConfig.getHost(), jesqueConfig.getPort(),
jesqueConfig.getTimeout(), jesqueConfig.getPassword(), jesqueConfig.getDatabase());
}
} | [
"public",
"static",
"Pool",
"<",
"Jedis",
">",
"createJedisPool",
"(",
"final",
"Config",
"jesqueConfig",
",",
"final",
"GenericObjectPoolConfig",
"poolConfig",
")",
"{",
"if",
"(",
"jesqueConfig",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException"... | A simple helper method that creates a pool of connections to Redis using
the supplied configurations.
@param jesqueConfig the config used to create the pooled Jedis connections
@param poolConfig the config used to create the pool
@return a configured Pool of Jedis connections | [
"A",
"simple",
"helper",
"method",
"that",
"creates",
"a",
"pool",
"of",
"connections",
"to",
"Redis",
"using",
"the",
"supplied",
"configurations",
"."
] | train | https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/utils/PoolUtils.java#L114-L129 |
infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/BaseAsyncInterceptor.java | BaseAsyncInterceptor.asyncInvokeNext | public final Object asyncInvokeNext(InvocationContext ctx, VisitableCommand command,
Collection<? extends CompletionStage<?>> delays) {
if (delays == null || delays.isEmpty()) {
return invokeNext(ctx, command);
} else if (delays.size() == 1) {
return asyncInvokeNext(ctx, command, delays.iterator().next());
} else {
CompletableFuture<Void> delay = CompletableFuture.allOf(delays.stream()
.map(CompletionStage::toCompletableFuture)
.toArray(CompletableFuture[]::new));
return asyncInvokeNext(ctx, command, delay);
}
} | java | public final Object asyncInvokeNext(InvocationContext ctx, VisitableCommand command,
Collection<? extends CompletionStage<?>> delays) {
if (delays == null || delays.isEmpty()) {
return invokeNext(ctx, command);
} else if (delays.size() == 1) {
return asyncInvokeNext(ctx, command, delays.iterator().next());
} else {
CompletableFuture<Void> delay = CompletableFuture.allOf(delays.stream()
.map(CompletionStage::toCompletableFuture)
.toArray(CompletableFuture[]::new));
return asyncInvokeNext(ctx, command, delay);
}
} | [
"public",
"final",
"Object",
"asyncInvokeNext",
"(",
"InvocationContext",
"ctx",
",",
"VisitableCommand",
"command",
",",
"Collection",
"<",
"?",
"extends",
"CompletionStage",
"<",
"?",
">",
">",
"delays",
")",
"{",
"if",
"(",
"delays",
"==",
"null",
"||",
"... | Suspend invocation until all {@code delays} complete, then if successful invoke the next interceptor.
If the list is empty or null, invoke the next interceptor immediately.
<p>If any of {@code delays} completes exceptionally, skip the next interceptor and continue with the exception.</p>
<p>You need to wrap the result with {@link #makeStage(Object)} if you need to add another handler.</p> | [
"Suspend",
"invocation",
"until",
"all",
"{",
"@code",
"delays",
"}",
"complete",
"then",
"if",
"successful",
"invoke",
"the",
"next",
"interceptor",
".",
"If",
"the",
"list",
"is",
"empty",
"or",
"null",
"invoke",
"the",
"next",
"interceptor",
"immediately",
... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/BaseAsyncInterceptor.java#L254-L266 |
validator/validator | src/nu/validator/xml/PrudentHttpEntityResolver.java | PrudentHttpEntityResolver.setParams | public static void setParams(int connectionTimeout, int socketTimeout,
int maxRequests) {
PrudentHttpEntityResolver.maxRequests = maxRequests;
PoolingHttpClientConnectionManager phcConnMgr;
Registry<ConnectionSocketFactory> registry = //
RegistryBuilder.<ConnectionSocketFactory> create() //
.register("http", PlainConnectionSocketFactory.getSocketFactory()) //
.register("https", SSLConnectionSocketFactory.getSocketFactory()) //
.build();
HttpClientBuilder builder = HttpClients.custom().useSystemProperties();
builder.setRedirectStrategy(new LaxRedirectStrategy());
builder.setMaxConnPerRoute(maxRequests);
builder.setMaxConnTotal(
Integer.parseInt(System.getProperty("nu.validator.servlet.max-total-connections","200")));
if ("true".equals(System.getProperty(
"nu.validator.xml.promiscuous-ssl", "true"))) { //
try {
SSLContext promiscuousSSLContext = new SSLContextBuilder() //
.loadTrustMaterial(null, new TrustStrategy() {
@Override
public boolean isTrusted(X509Certificate[] arg0, String arg1)
throws CertificateException {
return true;
}
}).build();
builder.setSslcontext(promiscuousSSLContext);
HostnameVerifier verifier = //
SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
SSLConnectionSocketFactory promiscuousSSLConnSocketFactory = //
new SSLConnectionSocketFactory(promiscuousSSLContext, verifier);
registry = RegistryBuilder.<ConnectionSocketFactory> create() //
.register("https", promiscuousSSLConnSocketFactory) //
.register("http",
PlainConnectionSocketFactory.getSocketFactory()) //
.build();
} catch (KeyManagementException | KeyStoreException
| NoSuchAlgorithmException | NumberFormatException e) {
e.printStackTrace();
}
}
phcConnMgr = new PoolingHttpClientConnectionManager(registry);
phcConnMgr.setDefaultMaxPerRoute(maxRequests);
phcConnMgr.setMaxTotal(200);
builder.setConnectionManager(phcConnMgr);
RequestConfig.Builder config = RequestConfig.custom();
config.setCircularRedirectsAllowed(true);
config.setMaxRedirects(
Integer.parseInt(System.getProperty("nu.validator.servlet.max-redirects","20")));
config.setConnectTimeout(connectionTimeout);
config.setCookieSpec(CookieSpecs.BEST_MATCH);
config.setSocketTimeout(socketTimeout);
config.setCookieSpec(CookieSpecs.IGNORE_COOKIES);
client = builder.setDefaultRequestConfig(config.build()).build();
} | java | public static void setParams(int connectionTimeout, int socketTimeout,
int maxRequests) {
PrudentHttpEntityResolver.maxRequests = maxRequests;
PoolingHttpClientConnectionManager phcConnMgr;
Registry<ConnectionSocketFactory> registry = //
RegistryBuilder.<ConnectionSocketFactory> create() //
.register("http", PlainConnectionSocketFactory.getSocketFactory()) //
.register("https", SSLConnectionSocketFactory.getSocketFactory()) //
.build();
HttpClientBuilder builder = HttpClients.custom().useSystemProperties();
builder.setRedirectStrategy(new LaxRedirectStrategy());
builder.setMaxConnPerRoute(maxRequests);
builder.setMaxConnTotal(
Integer.parseInt(System.getProperty("nu.validator.servlet.max-total-connections","200")));
if ("true".equals(System.getProperty(
"nu.validator.xml.promiscuous-ssl", "true"))) { //
try {
SSLContext promiscuousSSLContext = new SSLContextBuilder() //
.loadTrustMaterial(null, new TrustStrategy() {
@Override
public boolean isTrusted(X509Certificate[] arg0, String arg1)
throws CertificateException {
return true;
}
}).build();
builder.setSslcontext(promiscuousSSLContext);
HostnameVerifier verifier = //
SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
SSLConnectionSocketFactory promiscuousSSLConnSocketFactory = //
new SSLConnectionSocketFactory(promiscuousSSLContext, verifier);
registry = RegistryBuilder.<ConnectionSocketFactory> create() //
.register("https", promiscuousSSLConnSocketFactory) //
.register("http",
PlainConnectionSocketFactory.getSocketFactory()) //
.build();
} catch (KeyManagementException | KeyStoreException
| NoSuchAlgorithmException | NumberFormatException e) {
e.printStackTrace();
}
}
phcConnMgr = new PoolingHttpClientConnectionManager(registry);
phcConnMgr.setDefaultMaxPerRoute(maxRequests);
phcConnMgr.setMaxTotal(200);
builder.setConnectionManager(phcConnMgr);
RequestConfig.Builder config = RequestConfig.custom();
config.setCircularRedirectsAllowed(true);
config.setMaxRedirects(
Integer.parseInt(System.getProperty("nu.validator.servlet.max-redirects","20")));
config.setConnectTimeout(connectionTimeout);
config.setCookieSpec(CookieSpecs.BEST_MATCH);
config.setSocketTimeout(socketTimeout);
config.setCookieSpec(CookieSpecs.IGNORE_COOKIES);
client = builder.setDefaultRequestConfig(config.build()).build();
} | [
"public",
"static",
"void",
"setParams",
"(",
"int",
"connectionTimeout",
",",
"int",
"socketTimeout",
",",
"int",
"maxRequests",
")",
"{",
"PrudentHttpEntityResolver",
".",
"maxRequests",
"=",
"maxRequests",
";",
"PoolingHttpClientConnectionManager",
"phcConnMgr",
";",... | Sets the timeouts of the HTTP client.
@param connectionTimeout
timeout until connection established in milliseconds. Zero
means no timeout.
@param socketTimeout
timeout for waiting for data in milliseconds. Zero means no
timeout.
@param maxRequests
maximum number of connections to a particular host | [
"Sets",
"the",
"timeouts",
"of",
"the",
"HTTP",
"client",
"."
] | train | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/xml/PrudentHttpEntityResolver.java#L128-L181 |
couchbase/couchbase-lite-java-core | src/main/java/com/couchbase/lite/util/Utils.java | Utils.isEqual | public static boolean isEqual(Object obj1, Object obj2) {
if (obj1 != null) {
return (obj2 != null) && obj1.equals(obj2);
} else {
return obj2 == null;
}
} | java | public static boolean isEqual(Object obj1, Object obj2) {
if (obj1 != null) {
return (obj2 != null) && obj1.equals(obj2);
} else {
return obj2 == null;
}
} | [
"public",
"static",
"boolean",
"isEqual",
"(",
"Object",
"obj1",
",",
"Object",
"obj2",
")",
"{",
"if",
"(",
"obj1",
"!=",
"null",
")",
"{",
"return",
"(",
"obj2",
"!=",
"null",
")",
"&&",
"obj1",
".",
"equals",
"(",
"obj2",
")",
";",
"}",
"else",
... | Like equals, but works even if either/both are null
@param obj1 object1 being compared
@param obj2 object2 being compared
@return true if both are non-null and obj1.equals(obj2), or true if both are null.
otherwise return false. | [
"Like",
"equals",
"but",
"works",
"even",
"if",
"either",
"/",
"both",
"are",
"null"
] | train | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/util/Utils.java#L50-L56 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/RangeUtils.java | RangeUtils.getLongRanges | public static List<Range<Long>> getLongRanges(final Long from, final Long to, final int step)
throws InvalidRangeException {
if (from > to) {
throw buildInvalidRangeException(from, to);
}
ArrayList<Range<Long>> list = newArrayList();
if (step >= to - from) {
list.add(Range.getInstance(from, to));
} else {
for (Long currentSpan = from; currentSpan <= to; ) {
Long lowerBound = currentSpan;
Long tempUpperBound = currentSpan + (step > 1 ? step - 1 : 0);
Long upperBound = tempUpperBound > to ? to : tempUpperBound;
list.add(Range.getInstance(lowerBound, upperBound));
currentSpan += step > 0 ? step : 1;
}
}
return list;
} | java | public static List<Range<Long>> getLongRanges(final Long from, final Long to, final int step)
throws InvalidRangeException {
if (from > to) {
throw buildInvalidRangeException(from, to);
}
ArrayList<Range<Long>> list = newArrayList();
if (step >= to - from) {
list.add(Range.getInstance(from, to));
} else {
for (Long currentSpan = from; currentSpan <= to; ) {
Long lowerBound = currentSpan;
Long tempUpperBound = currentSpan + (step > 1 ? step - 1 : 0);
Long upperBound = tempUpperBound > to ? to : tempUpperBound;
list.add(Range.getInstance(lowerBound, upperBound));
currentSpan += step > 0 ? step : 1;
}
}
return list;
} | [
"public",
"static",
"List",
"<",
"Range",
"<",
"Long",
">",
">",
"getLongRanges",
"(",
"final",
"Long",
"from",
",",
"final",
"Long",
"to",
",",
"final",
"int",
"step",
")",
"throws",
"InvalidRangeException",
"{",
"if",
"(",
"from",
">",
"to",
")",
"{"... | Returns Range<Long> list between given from and to by step.The
minimum step is 1.<br/>
e.g:<br/>
[from:0,to:3,step:1] => [[0-0],[1-1],[2-2],[3-3]]<br/>
[from:0,to:7,step:2] => [[0-1],[2-3],[4-5],[6-7]]<br/>
[from:0,to:7,step:3] => [[0-2],[3-5],[6-7]]<br/>
@param from the range from.
@param to the range to.
@param step the range granulation.
@return a Range<Long> list between given from and to by step. | [
"Returns",
"Range<",
";",
"Long>",
";",
"list",
"between",
"given",
"from",
"and",
"to",
"by",
"step",
".",
"The",
"minimum",
"step",
"is",
"1",
".",
"<br",
"/",
">",
"e",
".",
"g",
":",
"<br",
"/",
">",
" ",
";",
" ",
";",
" ",
"... | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/RangeUtils.java#L122-L141 |
calimero-project/calimero-core | src/tuwien/auto/calimero/knxnetip/servicetype/TunnelingFeature.java | TunnelingFeature.newSet | public static TunnelingFeature newSet(final int channelId, final int seq, final InterfaceFeature featureId,
final byte... featureValue) {
return new TunnelingFeature(KNXnetIPHeader.TunnelingFeatureSet, channelId, seq, featureId, Success, featureValue);
} | java | public static TunnelingFeature newSet(final int channelId, final int seq, final InterfaceFeature featureId,
final byte... featureValue) {
return new TunnelingFeature(KNXnetIPHeader.TunnelingFeatureSet, channelId, seq, featureId, Success, featureValue);
} | [
"public",
"static",
"TunnelingFeature",
"newSet",
"(",
"final",
"int",
"channelId",
",",
"final",
"int",
"seq",
",",
"final",
"InterfaceFeature",
"featureId",
",",
"final",
"byte",
"...",
"featureValue",
")",
"{",
"return",
"new",
"TunnelingFeature",
"(",
"KNXne... | Creates a new tunneling feature-set service.
@param channelId tunneling connection channel identifier
@param seq tunneling connection send sequence number
@param featureId interface feature which value should be set
@param featureValue feature value to set
@return new tunneling feature-set service | [
"Creates",
"a",
"new",
"tunneling",
"feature",
"-",
"set",
"service",
"."
] | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/knxnetip/servicetype/TunnelingFeature.java#L110-L113 |
jblas-project/jblas | src/main/java/org/jblas/Singular.java | Singular.SVDValues | public static DoubleMatrix SVDValues(DoubleMatrix A) {
int m = A.rows;
int n = A.columns;
DoubleMatrix S = new DoubleMatrix(min(m, n));
int info = NativeBlas.dgesvd('N', 'N', m, n, A.dup().data, 0, m, S.data, 0, null, 0, 1, null, 0, 1);
if (info > 0) {
throw new LapackConvergenceException("GESVD", info + " superdiagonals of an intermediate bidiagonal form failed to converge.");
}
return S;
} | java | public static DoubleMatrix SVDValues(DoubleMatrix A) {
int m = A.rows;
int n = A.columns;
DoubleMatrix S = new DoubleMatrix(min(m, n));
int info = NativeBlas.dgesvd('N', 'N', m, n, A.dup().data, 0, m, S.data, 0, null, 0, 1, null, 0, 1);
if (info > 0) {
throw new LapackConvergenceException("GESVD", info + " superdiagonals of an intermediate bidiagonal form failed to converge.");
}
return S;
} | [
"public",
"static",
"DoubleMatrix",
"SVDValues",
"(",
"DoubleMatrix",
"A",
")",
"{",
"int",
"m",
"=",
"A",
".",
"rows",
";",
"int",
"n",
"=",
"A",
".",
"columns",
";",
"DoubleMatrix",
"S",
"=",
"new",
"DoubleMatrix",
"(",
"min",
"(",
"m",
",",
"n",
... | Compute the singular values of a matrix.
@param A DoubleMatrix of dimension m * n
@return A min(m, n) vector of singular values. | [
"Compute",
"the",
"singular",
"values",
"of",
"a",
"matrix",
"."
] | train | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/Singular.java#L120-L132 |
infinispan/infinispan | core/src/main/java/org/infinispan/partitionhandling/impl/PreferAvailabilityStrategy.java | PreferAvailabilityStrategy.computePreferredTopology | public CacheTopology computePreferredTopology(Map<Address, CacheStatusResponse> statusResponseMap) {
List<Partition> partitions = computePartitions(statusResponseMap, "");
return partitions.size() != 0 ? selectPreferredPartition(partitions).topology : null;
} | java | public CacheTopology computePreferredTopology(Map<Address, CacheStatusResponse> statusResponseMap) {
List<Partition> partitions = computePartitions(statusResponseMap, "");
return partitions.size() != 0 ? selectPreferredPartition(partitions).topology : null;
} | [
"public",
"CacheTopology",
"computePreferredTopology",
"(",
"Map",
"<",
"Address",
",",
"CacheStatusResponse",
">",
"statusResponseMap",
")",
"{",
"List",
"<",
"Partition",
">",
"partitions",
"=",
"computePartitions",
"(",
"statusResponseMap",
",",
"\"\"",
")",
";",... | Ignore the AvailabilityStrategyContext and only compute the preferred topology for testing.
@return The preferred topology, or {@code null} if there is no preferred topology. | [
"Ignore",
"the",
"AvailabilityStrategyContext",
"and",
"only",
"compute",
"the",
"preferred",
"topology",
"for",
"testing",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/partitionhandling/impl/PreferAvailabilityStrategy.java#L246-L250 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java | BuildTasksInner.beginDeleteAsync | public Observable<Void> beginDeleteAsync(String resourceGroupName, String registryName, String buildTaskName) {
return beginDeleteWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginDeleteAsync(String resourceGroupName, String registryName, String buildTaskName) {
return beginDeleteWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginDeleteAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"buildTaskName",
")",
"{",
"return",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
","... | Deletes a specified build task.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildTaskName The name of the container registry build task.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Deletes",
"a",
"specified",
"build",
"task",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java#L739-L746 |
lucee/Lucee | core/src/main/java/lucee/runtime/functions/decision/IsValid.java | IsValid.call | public static boolean call(PageContext pc, String type, Object value, Object objPattern) throws PageException {
type = type.trim();
if (!"regex".equalsIgnoreCase(type) && !"regular_expression".equalsIgnoreCase(type))
throw new FunctionException(pc, "isValid", 1, "type", "wrong attribute count for type [" + type + "]");
return regex(Caster.toString(value, null), Caster.toString(objPattern));
} | java | public static boolean call(PageContext pc, String type, Object value, Object objPattern) throws PageException {
type = type.trim();
if (!"regex".equalsIgnoreCase(type) && !"regular_expression".equalsIgnoreCase(type))
throw new FunctionException(pc, "isValid", 1, "type", "wrong attribute count for type [" + type + "]");
return regex(Caster.toString(value, null), Caster.toString(objPattern));
} | [
"public",
"static",
"boolean",
"call",
"(",
"PageContext",
"pc",
",",
"String",
"type",
",",
"Object",
"value",
",",
"Object",
"objPattern",
")",
"throws",
"PageException",
"{",
"type",
"=",
"type",
".",
"trim",
"(",
")",
";",
"if",
"(",
"!",
"\"regex\""... | regex check
@param pc
@param type
@param value
@param objPattern
@return
@throws PageException | [
"regex",
"check"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/functions/decision/IsValid.java#L67-L74 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_service_serviceName_voiceConsumption_consumptionId_callDiagnostics_GET | public OvhCallDiagnostics billingAccount_service_serviceName_voiceConsumption_consumptionId_callDiagnostics_GET(String billingAccount, String serviceName, Long consumptionId) throws IOException {
String qPath = "/telephony/{billingAccount}/service/{serviceName}/voiceConsumption/{consumptionId}/callDiagnostics";
StringBuilder sb = path(qPath, billingAccount, serviceName, consumptionId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCallDiagnostics.class);
} | java | public OvhCallDiagnostics billingAccount_service_serviceName_voiceConsumption_consumptionId_callDiagnostics_GET(String billingAccount, String serviceName, Long consumptionId) throws IOException {
String qPath = "/telephony/{billingAccount}/service/{serviceName}/voiceConsumption/{consumptionId}/callDiagnostics";
StringBuilder sb = path(qPath, billingAccount, serviceName, consumptionId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCallDiagnostics.class);
} | [
"public",
"OvhCallDiagnostics",
"billingAccount_service_serviceName_voiceConsumption_consumptionId_callDiagnostics_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"consumptionId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/t... | Get this object properties
REST: GET /telephony/{billingAccount}/service/{serviceName}/voiceConsumption/{consumptionId}/callDiagnostics
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param consumptionId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3760-L3765 |
springfox/springfox | springfox-core/src/main/java/springfox/documentation/schema/AlternateTypeRule.java | AlternateTypeRule.alternateFor | public ResolvedType alternateFor(ResolvedType type) {
if (appliesTo(type)) {
if (hasWildcards(original)) {
return replaceWildcardsFrom(WildcardType.collectReplaceables(type, original), alternate);
} else {
return alternate;
}
}
return type;
} | java | public ResolvedType alternateFor(ResolvedType type) {
if (appliesTo(type)) {
if (hasWildcards(original)) {
return replaceWildcardsFrom(WildcardType.collectReplaceables(type, original), alternate);
} else {
return alternate;
}
}
return type;
} | [
"public",
"ResolvedType",
"alternateFor",
"(",
"ResolvedType",
"type",
")",
"{",
"if",
"(",
"appliesTo",
"(",
"type",
")",
")",
"{",
"if",
"(",
"hasWildcards",
"(",
"original",
")",
")",
"{",
"return",
"replaceWildcardsFrom",
"(",
"WildcardType",
".",
"colle... | Provides alternate for supplier type.
@param type the type
@return the alternate for the type | [
"Provides",
"alternate",
"for",
"supplier",
"type",
"."
] | train | https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-core/src/main/java/springfox/documentation/schema/AlternateTypeRule.java#L61-L70 |
aws/aws-sdk-java | aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/App.java | App.withAttributes | public App withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public App withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"App",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The stack attributes.
</p>
@param attributes
The stack attributes.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"stack",
"attributes",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/App.java#L725-L728 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierDatabase.java | TypeQualifierDatabase.setParameter | public void setParameter(MethodDescriptor methodDesc, int param, TypeQualifierValue<?> tqv, TypeQualifierAnnotation tqa) {
Map<TypeQualifierValue<?>, TypeQualifierAnnotation> map = parameterMap.get(methodDesc, param);
if (map == null) {
map = new HashMap<>();
parameterMap.put(methodDesc, param, map);
}
map.put(tqv, tqa);
if (DEBUG) {
System.out.println("tqdb: " + methodDesc + " parameter " + param + " for " + tqv + " ==> " + tqa);
}
} | java | public void setParameter(MethodDescriptor methodDesc, int param, TypeQualifierValue<?> tqv, TypeQualifierAnnotation tqa) {
Map<TypeQualifierValue<?>, TypeQualifierAnnotation> map = parameterMap.get(methodDesc, param);
if (map == null) {
map = new HashMap<>();
parameterMap.put(methodDesc, param, map);
}
map.put(tqv, tqa);
if (DEBUG) {
System.out.println("tqdb: " + methodDesc + " parameter " + param + " for " + tqv + " ==> " + tqa);
}
} | [
"public",
"void",
"setParameter",
"(",
"MethodDescriptor",
"methodDesc",
",",
"int",
"param",
",",
"TypeQualifierValue",
"<",
"?",
">",
"tqv",
",",
"TypeQualifierAnnotation",
"tqa",
")",
"{",
"Map",
"<",
"TypeQualifierValue",
"<",
"?",
">",
",",
"TypeQualifierAn... | Set a TypeQualifierAnnotation on a method parameter.
@param methodDesc
the method
@param param
the parameter (0 == first parameter)
@param tqv
the type qualifier
@param tqa
the type qualifier annotation | [
"Set",
"a",
"TypeQualifierAnnotation",
"on",
"a",
"method",
"parameter",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierDatabase.java#L112-L123 |
jbundle/jbundle | base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XImageView.java | XImageView.printData | public boolean printData(PrintWriter out, int iPrintOptions)
{
boolean bFieldsFound = false;
String strFieldName = this.getScreenField().getSFieldParam();
String strFieldData = this.getZmlImagePath();
if (strFieldData == null)
strFieldData = HtmlConstants.ICON_DIR + "Noimage.gif";
strFieldData = Utility.encodeXML(strFieldData);
out.println(" " + Utility.startTag(strFieldName) + strFieldData + Utility.endTag(strFieldName));
return bFieldsFound;
} | java | public boolean printData(PrintWriter out, int iPrintOptions)
{
boolean bFieldsFound = false;
String strFieldName = this.getScreenField().getSFieldParam();
String strFieldData = this.getZmlImagePath();
if (strFieldData == null)
strFieldData = HtmlConstants.ICON_DIR + "Noimage.gif";
strFieldData = Utility.encodeXML(strFieldData);
out.println(" " + Utility.startTag(strFieldName) + strFieldData + Utility.endTag(strFieldName));
return bFieldsFound;
} | [
"public",
"boolean",
"printData",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"boolean",
"bFieldsFound",
"=",
"false",
";",
"String",
"strFieldName",
"=",
"this",
".",
"getScreenField",
"(",
")",
".",
"getSFieldParam",
"(",
")",
";",
"S... | Print this field's data in XML format.
@return true if default params were found for this form.
@param out The http output stream.
@exception DBException File exception. | [
"Print",
"this",
"field",
"s",
"data",
"in",
"XML",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XImageView.java#L74-L84 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyStaticMethods.java | DefaultGroovyStaticMethods.getBundle | public static ResourceBundle getBundle(ResourceBundle self, String bundleName, Locale locale) {
Class c = ReflectionUtils.getCallingClass();
ClassLoader targetCL = c != null ? c.getClassLoader() : null;
if (targetCL == null) targetCL = ClassLoader.getSystemClassLoader();
return ResourceBundle.getBundle(bundleName, locale, targetCL);
} | java | public static ResourceBundle getBundle(ResourceBundle self, String bundleName, Locale locale) {
Class c = ReflectionUtils.getCallingClass();
ClassLoader targetCL = c != null ? c.getClassLoader() : null;
if (targetCL == null) targetCL = ClassLoader.getSystemClassLoader();
return ResourceBundle.getBundle(bundleName, locale, targetCL);
} | [
"public",
"static",
"ResourceBundle",
"getBundle",
"(",
"ResourceBundle",
"self",
",",
"String",
"bundleName",
",",
"Locale",
"locale",
")",
"{",
"Class",
"c",
"=",
"ReflectionUtils",
".",
"getCallingClass",
"(",
")",
";",
"ClassLoader",
"targetCL",
"=",
"c",
... | Works exactly like ResourceBundle.getBundle(String, Locale). This is needed
because the java method depends on a particular stack configuration that
is not guaranteed in Groovy when calling the Java method.
@param self placeholder variable used by Groovy categories; ignored for default static methods
@param bundleName the name of the bundle.
@param locale the specific locale
@return the resource bundle
@see java.util.ResourceBundle#getBundle(java.lang.String, java.util.Locale)
@since 1.6.0 | [
"Works",
"exactly",
"like",
"ResourceBundle",
".",
"getBundle",
"(",
"String",
"Locale",
")",
".",
"This",
"is",
"needed",
"because",
"the",
"java",
"method",
"depends",
"on",
"a",
"particular",
"stack",
"configuration",
"that",
"is",
"not",
"guaranteed",
"in"... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyStaticMethods.java#L208-L213 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseSgpsvInterleavedBatch_bufferSizeExt | public static int cusparseSgpsvInterleavedBatch_bufferSizeExt(
cusparseHandle handle,
int algo,
int m,
Pointer ds,
Pointer dl,
Pointer d,
Pointer du,
Pointer dw,
Pointer x,
int batchCount,
long[] pBufferSizeInBytes)
{
return checkResult(cusparseSgpsvInterleavedBatch_bufferSizeExtNative(handle, algo, m, ds, dl, d, du, dw, x, batchCount, pBufferSizeInBytes));
} | java | public static int cusparseSgpsvInterleavedBatch_bufferSizeExt(
cusparseHandle handle,
int algo,
int m,
Pointer ds,
Pointer dl,
Pointer d,
Pointer du,
Pointer dw,
Pointer x,
int batchCount,
long[] pBufferSizeInBytes)
{
return checkResult(cusparseSgpsvInterleavedBatch_bufferSizeExtNative(handle, algo, m, ds, dl, d, du, dw, x, batchCount, pBufferSizeInBytes));
} | [
"public",
"static",
"int",
"cusparseSgpsvInterleavedBatch_bufferSizeExt",
"(",
"cusparseHandle",
"handle",
",",
"int",
"algo",
",",
"int",
"m",
",",
"Pointer",
"ds",
",",
"Pointer",
"dl",
",",
"Pointer",
"d",
",",
"Pointer",
"du",
",",
"Pointer",
"dw",
",",
... | <pre>
Description: Solution of pentadiagonal linear system A * X = B,
with multiple right-hand-sides. The coefficient matrix A is
composed of lower (ds, dl), main (d) and upper (du, dw) diagonals, and
the right-hand-sides B are overwritten with the solution X.
</pre> | [
"<pre",
">",
"Description",
":",
"Solution",
"of",
"pentadiagonal",
"linear",
"system",
"A",
"*",
"X",
"=",
"B",
"with",
"multiple",
"right",
"-",
"hand",
"-",
"sides",
".",
"The",
"coefficient",
"matrix",
"A",
"is",
"composed",
"of",
"lower",
"(",
"ds",... | train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L9119-L9133 |
PuyallupFoursquare/ccb-api-client-java | src/main/java/com/p4square/ccbapi/model/GetIndividualProfilesRequest.java | GetIndividualProfilesRequest.withMICR | public GetIndividualProfilesRequest withMICR(final String routingNumber, final String accountNumber) {
this.routingNumber = routingNumber;
this.accountNumber = accountNumber;
return this;
} | java | public GetIndividualProfilesRequest withMICR(final String routingNumber, final String accountNumber) {
this.routingNumber = routingNumber;
this.accountNumber = accountNumber;
return this;
} | [
"public",
"GetIndividualProfilesRequest",
"withMICR",
"(",
"final",
"String",
"routingNumber",
",",
"final",
"String",
"accountNumber",
")",
"{",
"this",
".",
"routingNumber",
"=",
"routingNumber",
";",
"this",
".",
"accountNumber",
"=",
"accountNumber",
";",
"retur... | Request the IndividualProfile for the given bank account information.
This option is mutually exclusive with {@link #withIndividualId(int)}
and {@link #withLoginPassword(String, char[])}.
@param routingNumber The individual's bank routing number.
@param accountNumber The individual's bank account number.
@return this. | [
"Request",
"the",
"IndividualProfile",
"for",
"the",
"given",
"bank",
"account",
"information",
"."
] | train | https://github.com/PuyallupFoursquare/ccb-api-client-java/blob/54a7a3184dc565fe513aa520e1344b2303ea6834/src/main/java/com/p4square/ccbapi/model/GetIndividualProfilesRequest.java#L92-L96 |
cdk/cdk | tool/charges/src/main/java/org/openscience/cdk/charges/GasteigerPEPEPartialCharges.java | GasteigerPEPEPartialCharges.getElectrostaticPotentialN | private double getElectrostaticPotentialN(IAtomContainer ac, int atom1, double[] ds) {
// double CoulombForceConstant = 1/(4*Math.PI*8.81/*Math.pow(10, -12)*/);
double CoulombForceConstant = 0.048;
double sum = 0.0;
try {
if (factory == null)
factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/jmol_atomtypes.txt",
ac.getBuilder());
List<IAtom> atoms = ac.getConnectedAtomsList(ac.getAtom(atom1));
for (IAtom atom : atoms) {
double covalentradius = 0;
String symbol = atom.getSymbol();
IAtomType type = factory.getAtomType(symbol);
covalentradius = type.getCovalentRadius();
double charge = ds[STEP_SIZE * atom1 + atom1 + 5];
logger.debug("sum_(" + sum + ") = CFC(" + CoulombForceConstant + ")*charge(" + charge + "/ret("
+ covalentradius);
sum += CoulombForceConstant * charge / (covalentradius * covalentradius);
}
} catch (CDKException e) {
logger.debug(e);
}
return sum;
} | java | private double getElectrostaticPotentialN(IAtomContainer ac, int atom1, double[] ds) {
// double CoulombForceConstant = 1/(4*Math.PI*8.81/*Math.pow(10, -12)*/);
double CoulombForceConstant = 0.048;
double sum = 0.0;
try {
if (factory == null)
factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/jmol_atomtypes.txt",
ac.getBuilder());
List<IAtom> atoms = ac.getConnectedAtomsList(ac.getAtom(atom1));
for (IAtom atom : atoms) {
double covalentradius = 0;
String symbol = atom.getSymbol();
IAtomType type = factory.getAtomType(symbol);
covalentradius = type.getCovalentRadius();
double charge = ds[STEP_SIZE * atom1 + atom1 + 5];
logger.debug("sum_(" + sum + ") = CFC(" + CoulombForceConstant + ")*charge(" + charge + "/ret("
+ covalentradius);
sum += CoulombForceConstant * charge / (covalentradius * covalentradius);
}
} catch (CDKException e) {
logger.debug(e);
}
return sum;
} | [
"private",
"double",
"getElectrostaticPotentialN",
"(",
"IAtomContainer",
"ac",
",",
"int",
"atom1",
",",
"double",
"[",
"]",
"ds",
")",
"{",
"//\t\tdouble CoulombForceConstant = 1/(4*Math.PI*8.81/*Math.pow(10, -12)*/);",
"double",
"CoulombForceConstant",
"=",
"0.048",
";",... | get the electrostatic potential of the neighbours of a atom.
@param ac The IAtomContainer to study
@param ds
@param atom1 The position of the IAtom to study
@return The sum of electrostatic potential of the neighbours | [
"get",
"the",
"electrostatic",
"potential",
"of",
"the",
"neighbours",
"of",
"a",
"atom",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/charges/src/main/java/org/openscience/cdk/charges/GasteigerPEPEPartialCharges.java#L594-L621 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/cellprocessor/constraint/StrNotNullOrEmpty.java | StrNotNullOrEmpty.execute | public Object execute(final Object value, final CsvContext context) {
if (value == null){
throw new SuperCsvConstraintViolationException("the String should not be null", context, this);
}
if( value instanceof String ) {
final String stringValue = (String) value;
if( stringValue.length() == 0 ) {
throw new SuperCsvConstraintViolationException("the String should not be empty", context, this);
}
} else {
throw new SuperCsvCellProcessorException(String.class, value, context, this);
}
return next.execute(value, context);
} | java | public Object execute(final Object value, final CsvContext context) {
if (value == null){
throw new SuperCsvConstraintViolationException("the String should not be null", context, this);
}
if( value instanceof String ) {
final String stringValue = (String) value;
if( stringValue.length() == 0 ) {
throw new SuperCsvConstraintViolationException("the String should not be empty", context, this);
}
} else {
throw new SuperCsvCellProcessorException(String.class, value, context, this);
}
return next.execute(value, context);
} | [
"public",
"Object",
"execute",
"(",
"final",
"Object",
"value",
",",
"final",
"CsvContext",
"context",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"SuperCsvConstraintViolationException",
"(",
"\"the String should not be null\"",
",",
"con... | {@inheritDoc}
@throws SuperCsvCellProcessorException
if value is null or isn't a String
@throws SuperCsvConstraintViolationException
if value is an empty String | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/StrNotNullOrEmpty.java#L68-L83 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java | VirtualMachinesInner.beginRunCommand | public RunCommandResultInner beginRunCommand(String resourceGroupName, String vmName, RunCommandInput parameters) {
return beginRunCommandWithServiceResponseAsync(resourceGroupName, vmName, parameters).toBlocking().single().body();
} | java | public RunCommandResultInner beginRunCommand(String resourceGroupName, String vmName, RunCommandInput parameters) {
return beginRunCommandWithServiceResponseAsync(resourceGroupName, vmName, parameters).toBlocking().single().body();
} | [
"public",
"RunCommandResultInner",
"beginRunCommand",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmName",
",",
"RunCommandInput",
"parameters",
")",
"{",
"return",
"beginRunCommandWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmName",
",",
"parameters"... | Run command on the VM.
@param resourceGroupName The name of the resource group.
@param vmName The name of the virtual machine.
@param parameters Parameters supplied to the Run command operation.
@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 RunCommandResultInner object if successful. | [
"Run",
"command",
"on",
"the",
"VM",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L2703-L2705 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/log/InMemoryLogger.java | InMemoryLogger.createLogMessage | @Nullable
@OverrideOnDemand
protected LogMessage createLogMessage (@Nonnull final IErrorLevel eErrorLevel,
@Nonnull final Serializable aMsg,
@Nullable final Throwable t)
{
return new LogMessage (eErrorLevel, aMsg, t);
} | java | @Nullable
@OverrideOnDemand
protected LogMessage createLogMessage (@Nonnull final IErrorLevel eErrorLevel,
@Nonnull final Serializable aMsg,
@Nullable final Throwable t)
{
return new LogMessage (eErrorLevel, aMsg, t);
} | [
"@",
"Nullable",
"@",
"OverrideOnDemand",
"protected",
"LogMessage",
"createLogMessage",
"(",
"@",
"Nonnull",
"final",
"IErrorLevel",
"eErrorLevel",
",",
"@",
"Nonnull",
"final",
"Serializable",
"aMsg",
",",
"@",
"Nullable",
"final",
"Throwable",
"t",
")",
"{",
... | Override this method to create a different LogMessage object or to filter
certain log messages.
@param eErrorLevel
Error level. Never <code>null</code>.
@param aMsg
The message object. Never <code>null</code>.
@param t
An optional exception. May be <code>null</code>.
@return The returned value. May be <code>null</code> in which case the
message will not be logged. | [
"Override",
"this",
"method",
"to",
"create",
"a",
"different",
"LogMessage",
"object",
"or",
"to",
"filter",
"certain",
"log",
"messages",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/log/InMemoryLogger.java#L63-L70 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/Convert.java | Convert.convertByClassName | @SuppressWarnings("unchecked")
public static <T> T convertByClassName(String className, Object value) throws ConvertException{
return (T) convert(ClassUtil.loadClass(className), value);
} | java | @SuppressWarnings("unchecked")
public static <T> T convertByClassName(String className, Object value) throws ConvertException{
return (T) convert(ClassUtil.loadClass(className), value);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"convertByClassName",
"(",
"String",
"className",
",",
"Object",
"value",
")",
"throws",
"ConvertException",
"{",
"return",
"(",
"T",
")",
"convert",
"(",
"ClassUtil",
... | 转换值为指定类型,类型采用字符串表示
@param <T> 目标类型
@param className 类的字符串表示
@param value 值
@return 转换后的值
@since 4.0.7
@throws ConvertException 转换器不存在 | [
"转换值为指定类型,类型采用字符串表示"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L539-L542 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/PriceListUrl.java | PriceListUrl.getResolvedPriceListUrl | public static MozuUrl getResolvedPriceListUrl(Integer customerAccountId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/storefront/pricelists/resolved?customerAccountId={customerAccountId}&responseFields={responseFields}");
formatter.formatUrl("customerAccountId", customerAccountId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getResolvedPriceListUrl(Integer customerAccountId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/storefront/pricelists/resolved?customerAccountId={customerAccountId}&responseFields={responseFields}");
formatter.formatUrl("customerAccountId", customerAccountId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getResolvedPriceListUrl",
"(",
"Integer",
"customerAccountId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/storefront/pricelists/resolved?customerAccountId={custo... | Get Resource Url for GetResolvedPriceList
@param customerAccountId The unique identifier of the customer account for which to retrieve wish lists.
@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",
"GetResolvedPriceList"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/PriceListUrl.java#L36-L42 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.describeImageAsync | public Observable<ImageDescription> describeImageAsync(String url, DescribeImageOptionalParameter describeImageOptionalParameter) {
return describeImageWithServiceResponseAsync(url, describeImageOptionalParameter).map(new Func1<ServiceResponse<ImageDescription>, ImageDescription>() {
@Override
public ImageDescription call(ServiceResponse<ImageDescription> response) {
return response.body();
}
});
} | java | public Observable<ImageDescription> describeImageAsync(String url, DescribeImageOptionalParameter describeImageOptionalParameter) {
return describeImageWithServiceResponseAsync(url, describeImageOptionalParameter).map(new Func1<ServiceResponse<ImageDescription>, ImageDescription>() {
@Override
public ImageDescription call(ServiceResponse<ImageDescription> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImageDescription",
">",
"describeImageAsync",
"(",
"String",
"url",
",",
"DescribeImageOptionalParameter",
"describeImageOptionalParameter",
")",
"{",
"return",
"describeImageWithServiceResponseAsync",
"(",
"url",
",",
"describeImageOptionalParamet... | This operation generates a description of an image in human readable language with complete sentences. The description is based on a collection of content tags, which are also returned by the operation. More than one description can be generated for each image. Descriptions are ordered by their confidence score. All descriptions are in English. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL.A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
@param url Publicly reachable URL of an image
@param describeImageOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageDescription object | [
"This",
"operation",
"generates",
"a",
"description",
"of",
"an",
"image",
"in",
"human",
"readable",
"language",
"with",
"complete",
"sentences",
".",
"The",
"description",
"is",
"based",
"on",
"a",
"collection",
"of",
"content",
"tags",
"which",
"are",
"also... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L1762-L1769 |
Comcast/jrugged | jrugged-spring/src/main/java/org/fishwife/jrugged/spring/jmx/MBeanOperationInvoker.java | MBeanOperationInvoker.invokeOperation | public Object invokeOperation(Map<String, String[]> parameterMap) throws JMException {
MBeanParameterInfo[] parameterInfoArray = operationInfo.getSignature();
Object[] values = new Object[parameterInfoArray.length];
String[] types = new String[parameterInfoArray.length];
MBeanValueConverter valueConverter = createMBeanValueConverter(parameterMap);
for (int parameterNum = 0; parameterNum < parameterInfoArray.length; parameterNum++) {
MBeanParameterInfo parameterInfo = parameterInfoArray[parameterNum];
String type = parameterInfo.getType();
types[parameterNum] = type;
values[parameterNum] = valueConverter.convertParameterValue(parameterInfo.getName(), type);
}
return mBeanServer.invoke(objectName, operationInfo.getName(), values, types);
} | java | public Object invokeOperation(Map<String, String[]> parameterMap) throws JMException {
MBeanParameterInfo[] parameterInfoArray = operationInfo.getSignature();
Object[] values = new Object[parameterInfoArray.length];
String[] types = new String[parameterInfoArray.length];
MBeanValueConverter valueConverter = createMBeanValueConverter(parameterMap);
for (int parameterNum = 0; parameterNum < parameterInfoArray.length; parameterNum++) {
MBeanParameterInfo parameterInfo = parameterInfoArray[parameterNum];
String type = parameterInfo.getType();
types[parameterNum] = type;
values[parameterNum] = valueConverter.convertParameterValue(parameterInfo.getName(), type);
}
return mBeanServer.invoke(objectName, operationInfo.getName(), values, types);
} | [
"public",
"Object",
"invokeOperation",
"(",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"parameterMap",
")",
"throws",
"JMException",
"{",
"MBeanParameterInfo",
"[",
"]",
"parameterInfoArray",
"=",
"operationInfo",
".",
"getSignature",
"(",
")",
";",
"... | Invoke the operation.
@param parameterMap the {@link Map} of parameter names to value arrays.
@return the {@link Object} return value from the operation.
@throws JMException Java Management Exception | [
"Invoke",
"the",
"operation",
"."
] | train | https://github.com/Comcast/jrugged/blob/b6a5147c68ee733faf5616d49800abcbba67afe9/jrugged-spring/src/main/java/org/fishwife/jrugged/spring/jmx/MBeanOperationInvoker.java#L52-L68 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/returns/OrderNoteUrl.java | OrderNoteUrl.getReturnNoteUrl | public static MozuUrl getReturnNoteUrl(String noteId, String responseFields, String returnId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/returns/{returnId}/notes/{noteId}?responseFields={responseFields}");
formatter.formatUrl("noteId", noteId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("returnId", returnId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getReturnNoteUrl(String noteId, String responseFields, String returnId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/returns/{returnId}/notes/{noteId}?responseFields={responseFields}");
formatter.formatUrl("noteId", noteId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("returnId", returnId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getReturnNoteUrl",
"(",
"String",
"noteId",
",",
"String",
"responseFields",
",",
"String",
"returnId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/returns/{returnId}/notes/{noteId}?responseFields=... | Get Resource Url for GetReturnNote
@param noteId Unique identifier of a particular note to retrieve.
@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.
@param returnId Unique identifier of the return whose items you want to get.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetReturnNote"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/returns/OrderNoteUrl.java#L35-L42 |
vlingo/vlingo-http | src/main/java/io/vlingo/http/Body.java | Body.from | public static Body from(final ByteBuffer body, final Encoding encoding) {
switch (encoding) {
case Base64:
return new Body(bytesToBase64(bufferToArray(body)));
case UTF8:
return new Body(bytesToUTF8(bufferToArray(body)));
}
throw new IllegalArgumentException("Unmapped encoding: " + encoding);
} | java | public static Body from(final ByteBuffer body, final Encoding encoding) {
switch (encoding) {
case Base64:
return new Body(bytesToBase64(bufferToArray(body)));
case UTF8:
return new Body(bytesToUTF8(bufferToArray(body)));
}
throw new IllegalArgumentException("Unmapped encoding: " + encoding);
} | [
"public",
"static",
"Body",
"from",
"(",
"final",
"ByteBuffer",
"body",
",",
"final",
"Encoding",
"encoding",
")",
"{",
"switch",
"(",
"encoding",
")",
"{",
"case",
"Base64",
":",
"return",
"new",
"Body",
"(",
"bytesToBase64",
"(",
"bufferToArray",
"(",
"b... | Answer a new {@code Body} with binary content using {@code encoding}.
@param body the ByteBuffer content
@param encoding the Encoding to use
@return Body | [
"Answer",
"a",
"new",
"{"
] | train | https://github.com/vlingo/vlingo-http/blob/746065fb1eaf1609c550ae45e96e3dbb9bfa37a2/src/main/java/io/vlingo/http/Body.java#L56-L64 |
geomajas/geomajas-project-server | common-servlet/src/main/java/org/geomajas/servlet/CacheFilter.java | CacheFilter.checkSuffixes | public boolean checkSuffixes(String uri, String[] patterns) {
for (String pattern : patterns) {
if (pattern.length() > 0) {
if (uri.endsWith(pattern)) {
return true;
}
}
}
return false;
} | java | public boolean checkSuffixes(String uri, String[] patterns) {
for (String pattern : patterns) {
if (pattern.length() > 0) {
if (uri.endsWith(pattern)) {
return true;
}
}
}
return false;
} | [
"public",
"boolean",
"checkSuffixes",
"(",
"String",
"uri",
",",
"String",
"[",
"]",
"patterns",
")",
"{",
"for",
"(",
"String",
"pattern",
":",
"patterns",
")",
"{",
"if",
"(",
"pattern",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"ur... | Check whether the URL end with one of the given suffixes.
@param uri URI
@param patterns possible suffixes
@return true when URL ends with one of the suffixes | [
"Check",
"whether",
"the",
"URL",
"end",
"with",
"one",
"of",
"the",
"given",
"suffixes",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/common-servlet/src/main/java/org/geomajas/servlet/CacheFilter.java#L263-L272 |
PinaeOS/nala | src/main/java/org/pinae/nala/xb/util/ResourceWriter.java | ResourceWriter.writeToFile | public void writeToFile(StringBuffer content, String filename) throws NoSuchPathException, IOException{
try {
FileWriter input = new FileWriter(filename);
input.write(content.toString(), 0, content.length());
input.flush();
input.close();
} catch (FileNotFoundException e) {
throw new NoSuchPathException(e);
}
} | java | public void writeToFile(StringBuffer content, String filename) throws NoSuchPathException, IOException{
try {
FileWriter input = new FileWriter(filename);
input.write(content.toString(), 0, content.length());
input.flush();
input.close();
} catch (FileNotFoundException e) {
throw new NoSuchPathException(e);
}
} | [
"public",
"void",
"writeToFile",
"(",
"StringBuffer",
"content",
",",
"String",
"filename",
")",
"throws",
"NoSuchPathException",
",",
"IOException",
"{",
"try",
"{",
"FileWriter",
"input",
"=",
"new",
"FileWriter",
"(",
"filename",
")",
";",
"input",
".",
"wr... | 将XML内容写入文件
@param content XML内容
@param filename 需要写入的文件
@throws NoSuchPathException 写入文件时, 无法发现路径引发的异常
@throws IOException 文件写入异常 | [
"将XML内容写入文件"
] | train | https://github.com/PinaeOS/nala/blob/2047ade4af197cec938278d300d111ea94af6fbf/src/main/java/org/pinae/nala/xb/util/ResourceWriter.java#L29-L38 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/CharSequences.java | CharSequences.compare | @Deprecated
public static int compare(CharSequence a, CharSequence b) {
int alength = a.length();
int blength = b.length();
int min = alength <= blength ? alength : blength;
for (int i = 0; i < min; ++i) {
int diff = a.charAt(i) - b.charAt(i);
if (diff != 0) {
return diff;
}
}
return alength - blength;
} | java | @Deprecated
public static int compare(CharSequence a, CharSequence b) {
int alength = a.length();
int blength = b.length();
int min = alength <= blength ? alength : blength;
for (int i = 0; i < min; ++i) {
int diff = a.charAt(i) - b.charAt(i);
if (diff != 0) {
return diff;
}
}
return alength - blength;
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"compare",
"(",
"CharSequence",
"a",
",",
"CharSequence",
"b",
")",
"{",
"int",
"alength",
"=",
"a",
".",
"length",
"(",
")",
";",
"int",
"blength",
"=",
"b",
".",
"length",
"(",
")",
";",
"int",
"min",
... | Utility for comparing the contents of CharSequences
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Utility",
"for",
"comparing",
"the",
"contents",
"of",
"CharSequences"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/CharSequences.java#L219-L231 |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.or | private WyalFile.Stmt or(WyalFile.Stmt lhs, WyalFile.Stmt rhs) {
if (lhs == null) {
return rhs;
} else if (rhs == null) {
return rhs;
} else {
WyalFile.Stmt.Block lhsBlock = new WyalFile.Stmt.Block(lhs);
WyalFile.Stmt.Block rhsBlock = new WyalFile.Stmt.Block(rhs);
return new WyalFile.Stmt.CaseOf(lhsBlock, rhsBlock);
}
} | java | private WyalFile.Stmt or(WyalFile.Stmt lhs, WyalFile.Stmt rhs) {
if (lhs == null) {
return rhs;
} else if (rhs == null) {
return rhs;
} else {
WyalFile.Stmt.Block lhsBlock = new WyalFile.Stmt.Block(lhs);
WyalFile.Stmt.Block rhsBlock = new WyalFile.Stmt.Block(rhs);
return new WyalFile.Stmt.CaseOf(lhsBlock, rhsBlock);
}
} | [
"private",
"WyalFile",
".",
"Stmt",
"or",
"(",
"WyalFile",
".",
"Stmt",
"lhs",
",",
"WyalFile",
".",
"Stmt",
"rhs",
")",
"{",
"if",
"(",
"lhs",
"==",
"null",
")",
"{",
"return",
"rhs",
";",
"}",
"else",
"if",
"(",
"rhs",
"==",
"null",
")",
"{",
... | Construct a disjunct of two expressions
@param lhs
@param rhs
@return | [
"Construct",
"a",
"disjunct",
"of",
"two",
"expressions"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1765-L1775 |
samskivert/pythagoras | src/main/java/pythagoras/d/Arc.java | Arc.setArc | public void setArc (IRectangle rect, double start, double extent, int type) {
setArc(rect.x(), rect.y(), rect.width(), rect.height(), start, extent, type);
} | java | public void setArc (IRectangle rect, double start, double extent, int type) {
setArc(rect.x(), rect.y(), rect.width(), rect.height(), start, extent, type);
} | [
"public",
"void",
"setArc",
"(",
"IRectangle",
"rect",
",",
"double",
"start",
",",
"double",
"extent",
",",
"int",
"type",
")",
"{",
"setArc",
"(",
"rect",
".",
"x",
"(",
")",
",",
"rect",
".",
"y",
"(",
")",
",",
"rect",
".",
"width",
"(",
")",... | Sets the location, size, angular extents, and closure type of this arc to the specified
values. | [
"Sets",
"the",
"location",
"size",
"angular",
"extents",
"and",
"closure",
"type",
"of",
"this",
"arc",
"to",
"the",
"specified",
"values",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Arc.java#L151-L153 |
geomajas/geomajas-project-server | api/src/main/java/org/geomajas/layer/feature/attribute/ManyToOneAttribute.java | ManyToOneAttribute.setImageUrlAttribute | public void setImageUrlAttribute(String name, String value) {
ensureValue();
Attribute attribute = new ImageUrlAttribute(value);
attribute.setEditable(isEditable(name));
getValue().getAllAttributes().put(name, attribute);
} | java | public void setImageUrlAttribute(String name, String value) {
ensureValue();
Attribute attribute = new ImageUrlAttribute(value);
attribute.setEditable(isEditable(name));
getValue().getAllAttributes().put(name, attribute);
} | [
"public",
"void",
"setImageUrlAttribute",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"ensureValue",
"(",
")",
";",
"Attribute",
"attribute",
"=",
"new",
"ImageUrlAttribute",
"(",
"value",
")",
";",
"attribute",
".",
"setEditable",
"(",
"isEditabl... | Sets the specified image URL attribute to the specified value.
@param name name of the attribute
@param value value of the attribute
@since 1.9.0 | [
"Sets",
"the",
"specified",
"image",
"URL",
"attribute",
"to",
"the",
"specified",
"value",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/ManyToOneAttribute.java#L188-L193 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/Cache.java | Cache.findDontPinNAdjustPinCount | @Override
public Object findDontPinNAdjustPinCount(Object key, int adjustPinCount)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "findDontPinNAdjustPinCount", key +
", adujust pin count=" + adjustPinCount);
Bucket bucket = getBucketForKey(key);
Object object = null;
if (bucket != null) // d739870
{
synchronized (bucket)
{
Element element = bucket.findByKey(key);
if (element != null)
{
// Touch the LRU flag; since an object cannot be evicted when
// pinned, this is the only time when we bother to set the
// flag
element.accessedSweep = numSweeps;
object = element.object;
element.pinned += adjustPinCount;
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "findDontPinNAdjustPinCount", object);
return object;
} | java | @Override
public Object findDontPinNAdjustPinCount(Object key, int adjustPinCount)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "findDontPinNAdjustPinCount", key +
", adujust pin count=" + adjustPinCount);
Bucket bucket = getBucketForKey(key);
Object object = null;
if (bucket != null) // d739870
{
synchronized (bucket)
{
Element element = bucket.findByKey(key);
if (element != null)
{
// Touch the LRU flag; since an object cannot be evicted when
// pinned, this is the only time when we bother to set the
// flag
element.accessedSweep = numSweeps;
object = element.object;
element.pinned += adjustPinCount;
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "findDontPinNAdjustPinCount", object);
return object;
} | [
"@",
"Override",
"public",
"Object",
"findDontPinNAdjustPinCount",
"(",
"Object",
"key",
",",
"int",
"adjustPinCount",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"... | Return element for the given key but do not pin the element. In addition,
if object is found, add adjustPinCount to the pinned state. <p>
Note: This method is added to support the scenario in the activation
strategy classes that multiple cache.unpin() are called immediately
after the find() operation to negate the pin operation from the
find() as well as other unpin requires to unwind the other pin
operation initiated from transaction and/or activation operation.
This is mainly designed for performance. Typically this will save
about between 75 to 428 instructions or even more depending on
the hashcode implementation of the key object. <p>
@param key key for the object to locate in the cache.
@param adjustPinCount additional pin adjustment count.
@return the object from the cache, or null if there is no object
associated with the key in the cache.
<p>
@see Cache#pin
@see Cache#unpin | [
"Return",
"element",
"for",
"the",
"given",
"key",
"but",
"do",
"not",
"pin",
"the",
"element",
".",
"In",
"addition",
"if",
"object",
"is",
"found",
"add",
"adjustPinCount",
"to",
"the",
"pinned",
"state",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/Cache.java#L339-L371 |
paymill/paymill-java | src/main/java/com/paymill/services/SubscriptionService.java | SubscriptionService.endTrialAt | public Subscription endTrialAt( Subscription subscription, Date date ) {
ParameterMap<String, String> params = new ParameterMap<String, String>();
params.add( "trial_end", String.valueOf( date.getTime() / 1000 ) );
return RestfulUtils.update( SubscriptionService.PATH, subscription, params, false, Subscription.class, super.httpClient );
} | java | public Subscription endTrialAt( Subscription subscription, Date date ) {
ParameterMap<String, String> params = new ParameterMap<String, String>();
params.add( "trial_end", String.valueOf( date.getTime() / 1000 ) );
return RestfulUtils.update( SubscriptionService.PATH, subscription, params, false, Subscription.class, super.httpClient );
} | [
"public",
"Subscription",
"endTrialAt",
"(",
"Subscription",
"subscription",
",",
"Date",
"date",
")",
"{",
"ParameterMap",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"ParameterMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"params",
... | Stop the trial period of a subscription on a specific date.
@param subscription the subscription.
@param date the date, on which the subscription should end.
@return the updated subscription. | [
"Stop",
"the",
"trial",
"period",
"of",
"a",
"subscription",
"on",
"a",
"specific",
"date",
"."
] | train | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/SubscriptionService.java#L527-L531 |
ButterFaces/ButterFaces | components/src/main/java/org/butterfaces/model/table/json/JsonToModelConverter.java | JsonToModelConverter.convertTableColumnVisibility | public TableColumnVisibility convertTableColumnVisibility(final String tableIdentifier, final String json) {
final String[] split = this.splitColumns(json);
final List<String> visibleColumns = new ArrayList<>();
final List<String> invisibleColumns = new ArrayList<>();
for (String column : split) {
final String[] attribute = this.splitAttributes(column);
final String identifier = attribute[0].split(":")[1];
final String visible = attribute[1].split(":")[1];
if (Boolean.valueOf(visible)) {
visibleColumns.add(identifier);
} else {
invisibleColumns.add(identifier);
}
}
return new TableColumnVisibility(tableIdentifier, visibleColumns, invisibleColumns);
} | java | public TableColumnVisibility convertTableColumnVisibility(final String tableIdentifier, final String json) {
final String[] split = this.splitColumns(json);
final List<String> visibleColumns = new ArrayList<>();
final List<String> invisibleColumns = new ArrayList<>();
for (String column : split) {
final String[] attribute = this.splitAttributes(column);
final String identifier = attribute[0].split(":")[1];
final String visible = attribute[1].split(":")[1];
if (Boolean.valueOf(visible)) {
visibleColumns.add(identifier);
} else {
invisibleColumns.add(identifier);
}
}
return new TableColumnVisibility(tableIdentifier, visibleColumns, invisibleColumns);
} | [
"public",
"TableColumnVisibility",
"convertTableColumnVisibility",
"(",
"final",
"String",
"tableIdentifier",
",",
"final",
"String",
"json",
")",
"{",
"final",
"String",
"[",
"]",
"split",
"=",
"this",
".",
"splitColumns",
"(",
"json",
")",
";",
"final",
"List"... | Converts given json string to {@link TableColumnVisibility} used by {@link TableColumnVisibilityModel}.
@param tableIdentifier an application unique table identifier.
@param json string to convert to {@link TableColumnVisibility}.
@return the converted {@link TableColumnVisibility}. | [
"Converts",
"given",
"json",
"string",
"to",
"{",
"@link",
"TableColumnVisibility",
"}",
"used",
"by",
"{",
"@link",
"TableColumnVisibilityModel",
"}",
"."
] | train | https://github.com/ButterFaces/ButterFaces/blob/e8c2bb340c89dcdbac409fcfc7a2a0e07f2462fc/components/src/main/java/org/butterfaces/model/table/json/JsonToModelConverter.java#L25-L44 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/util/StringUtils.java | StringUtils.newStringUtf8 | public static String newStringUtf8(byte[] bytes) {
if (bytes == null) {
return null;
}
return new String(bytes, StandardCharsets.UTF_8);
} | java | public static String newStringUtf8(byte[] bytes) {
if (bytes == null) {
return null;
}
return new String(bytes, StandardCharsets.UTF_8);
} | [
"public",
"static",
"String",
"newStringUtf8",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"if",
"(",
"bytes",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"String",
"(",
"bytes",
",",
"StandardCharsets",
".",
"UTF_8",
")",
";",
... | Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-8
charset.
@param bytes The bytes to be decoded into characters
@return A new <code>String</code> decoded from the specified array of bytes using the UTF-8
charset, or <code>null</code> if the input byte array was <code>null</code>.
@throws IllegalStateException Thrown when a {@link UnsupportedEncodingException} is caught,
which should never happen since the charset is required.
@since 1.8 | [
"Constructs",
"a",
"new",
"<code",
">",
"String<",
"/",
"code",
">",
"by",
"decoding",
"the",
"specified",
"array",
"of",
"bytes",
"using",
"the",
"UTF",
"-",
"8",
"charset",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/StringUtils.java#L65-L70 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toFloat | public static Float toFloat(Object o, Float defaultValue) {
if (o instanceof Float) return (Float) o;
if (defaultValue != null) return new Float(toFloatValue(o, defaultValue.floatValue()));
float res = toFloatValue(o, Float.MIN_VALUE);
if (res == Float.MIN_VALUE) return defaultValue;
return new Float(res);
} | java | public static Float toFloat(Object o, Float defaultValue) {
if (o instanceof Float) return (Float) o;
if (defaultValue != null) return new Float(toFloatValue(o, defaultValue.floatValue()));
float res = toFloatValue(o, Float.MIN_VALUE);
if (res == Float.MIN_VALUE) return defaultValue;
return new Float(res);
} | [
"public",
"static",
"Float",
"toFloat",
"(",
"Object",
"o",
",",
"Float",
"defaultValue",
")",
"{",
"if",
"(",
"o",
"instanceof",
"Float",
")",
"return",
"(",
"Float",
")",
"o",
";",
"if",
"(",
"defaultValue",
"!=",
"null",
")",
"return",
"new",
"Float... | cast a Object to a Float Object(reference type)
@param o Object to cast
@param defaultValue
@return casted Float Object | [
"cast",
"a",
"Object",
"to",
"a",
"Float",
"Object",
"(",
"reference",
"type",
")"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L1615-L1622 |
google/error-prone | check_api/src/main/java/com/google/errorprone/matchers/Matchers.java | Matchers.inSynchronized | public static final <T extends Tree> Matcher<T> inSynchronized() {
return new Matcher<T>() {
@Override
public boolean matches(T tree, VisitorState state) {
SynchronizedTree synchronizedTree =
ASTHelpers.findEnclosingNode(state.getPath(), SynchronizedTree.class);
if (synchronizedTree != null) {
return true;
}
MethodTree methodTree = ASTHelpers.findEnclosingNode(state.getPath(), MethodTree.class);
return methodTree != null
&& methodTree.getModifiers().getFlags().contains(Modifier.SYNCHRONIZED);
}
};
} | java | public static final <T extends Tree> Matcher<T> inSynchronized() {
return new Matcher<T>() {
@Override
public boolean matches(T tree, VisitorState state) {
SynchronizedTree synchronizedTree =
ASTHelpers.findEnclosingNode(state.getPath(), SynchronizedTree.class);
if (synchronizedTree != null) {
return true;
}
MethodTree methodTree = ASTHelpers.findEnclosingNode(state.getPath(), MethodTree.class);
return methodTree != null
&& methodTree.getModifiers().getFlags().contains(Modifier.SYNCHRONIZED);
}
};
} | [
"public",
"static",
"final",
"<",
"T",
"extends",
"Tree",
">",
"Matcher",
"<",
"T",
">",
"inSynchronized",
"(",
")",
"{",
"return",
"new",
"Matcher",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"T",
"tree",
","... | Matches if this Tree is enclosed by either a synchronized block or a synchronized method. | [
"Matches",
"if",
"this",
"Tree",
"is",
"enclosed",
"by",
"either",
"a",
"synchronized",
"block",
"or",
"a",
"synchronized",
"method",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L1255-L1270 |
lessthanoptimal/ejml | examples/src/org/ejml/example/LevenbergMarquardt.java | LevenbergMarquardt.configure | protected void configure(ResidualFunction function , int numParam )
{
this.function = function;
int numFunctions = function.numFunctions();
// reshaping a matrix means that new memory is only declared when needed
candidateParameters.reshape(numParam,1);
g.reshape(numParam,1);
H.reshape(numParam,numParam);
negativeStep.reshape(numParam,1);
// Normally these variables are thought of as row vectors, but it works out easier if they are column
temp0.reshape(numFunctions,1);
temp1.reshape(numFunctions,1);
residuals.reshape(numFunctions,1);
jacobian.reshape(numFunctions,numParam);
} | java | protected void configure(ResidualFunction function , int numParam )
{
this.function = function;
int numFunctions = function.numFunctions();
// reshaping a matrix means that new memory is only declared when needed
candidateParameters.reshape(numParam,1);
g.reshape(numParam,1);
H.reshape(numParam,numParam);
negativeStep.reshape(numParam,1);
// Normally these variables are thought of as row vectors, but it works out easier if they are column
temp0.reshape(numFunctions,1);
temp1.reshape(numFunctions,1);
residuals.reshape(numFunctions,1);
jacobian.reshape(numFunctions,numParam);
} | [
"protected",
"void",
"configure",
"(",
"ResidualFunction",
"function",
",",
"int",
"numParam",
")",
"{",
"this",
".",
"function",
"=",
"function",
";",
"int",
"numFunctions",
"=",
"function",
".",
"numFunctions",
"(",
")",
";",
"// reshaping a matrix means that ne... | Performs sanity checks on the input data and reshapes internal matrices. By reshaping
a matrix it will only declare new memory when needed. | [
"Performs",
"sanity",
"checks",
"on",
"the",
"input",
"data",
"and",
"reshapes",
"internal",
"matrices",
".",
"By",
"reshaping",
"a",
"matrix",
"it",
"will",
"only",
"declare",
"new",
"memory",
"when",
"needed",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/LevenbergMarquardt.java#L193-L209 |
motown-io/motown | ocpp/view-model/src/main/java/io/motown/ocpp/viewmodel/domain/DomainService.java | DomainService.startTransactionNoAuthorize | public void startTransactionNoAuthorize(ChargingStationId chargingStationId, TransactionId transactionId,
StartTransactionInfo startTransactionInfo, AddOnIdentity addOnIdentity) {
IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity());
StartTransactionCommand command = new StartTransactionCommand(chargingStationId, transactionId, startTransactionInfo, identityContext);
commandGateway.send(command);
} | java | public void startTransactionNoAuthorize(ChargingStationId chargingStationId, TransactionId transactionId,
StartTransactionInfo startTransactionInfo, AddOnIdentity addOnIdentity) {
IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity());
StartTransactionCommand command = new StartTransactionCommand(chargingStationId, transactionId, startTransactionInfo, identityContext);
commandGateway.send(command);
} | [
"public",
"void",
"startTransactionNoAuthorize",
"(",
"ChargingStationId",
"chargingStationId",
",",
"TransactionId",
"transactionId",
",",
"StartTransactionInfo",
"startTransactionInfo",
",",
"AddOnIdentity",
"addOnIdentity",
")",
"{",
"IdentityContext",
"identityContext",
"="... | Initiates a StartTransactionCommand without authorizing the identification. Normally this method is called by the
futureEventCallback of {@link #startTransaction}.
@param chargingStationId charging station identifier.
@param transactionId transaction identifier.
@param startTransactionInfo information about the started transaction.
@param addOnIdentity add on identifier. | [
"Initiates",
"a",
"StartTransactionCommand",
"without",
"authorizing",
"the",
"identification",
".",
"Normally",
"this",
"method",
"is",
"called",
"by",
"the",
"futureEventCallback",
"of",
"{",
"@link",
"#startTransaction",
"}",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpp/view-model/src/main/java/io/motown/ocpp/viewmodel/domain/DomainService.java#L199-L205 |
mozilla/rhino | src/org/mozilla/javascript/ScriptableObject.java | ScriptableObject.associateValue | public synchronized final Object associateValue(Object key, Object value)
{
if (value == null) throw new IllegalArgumentException();
Map<Object,Object> h = associatedValues;
if (h == null) {
h = new HashMap<Object,Object>();
associatedValues = h;
}
return Kit.initHash(h, key, value);
} | java | public synchronized final Object associateValue(Object key, Object value)
{
if (value == null) throw new IllegalArgumentException();
Map<Object,Object> h = associatedValues;
if (h == null) {
h = new HashMap<Object,Object>();
associatedValues = h;
}
return Kit.initHash(h, key, value);
} | [
"public",
"synchronized",
"final",
"Object",
"associateValue",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"Map",
"<",
"Object",
",",
"Object",
">... | Associate arbitrary application-specific value with this object.
Value can only be associated with the given object and key only once.
The method ignores any subsequent attempts to change the already
associated value.
<p> The associated values are not serialized.
@param key key object to select particular value.
@param value the value to associate
@return the passed value if the method is called first time for the
given key or old value for any subsequent calls.
@see #getAssociatedValue(Object key) | [
"Associate",
"arbitrary",
"application",
"-",
"specific",
"value",
"with",
"this",
"object",
".",
"Value",
"can",
"only",
"be",
"associated",
"with",
"the",
"given",
"object",
"and",
"key",
"only",
"once",
".",
"The",
"method",
"ignores",
"any",
"subsequent",
... | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L2782-L2791 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java | CommercePriceListPersistenceImpl.removeByLtD_S | @Override
public void removeByLtD_S(Date displayDate, int status) {
for (CommercePriceList commercePriceList : findByLtD_S(displayDate,
status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commercePriceList);
}
} | java | @Override
public void removeByLtD_S(Date displayDate, int status) {
for (CommercePriceList commercePriceList : findByLtD_S(displayDate,
status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commercePriceList);
}
} | [
"@",
"Override",
"public",
"void",
"removeByLtD_S",
"(",
"Date",
"displayDate",
",",
"int",
"status",
")",
"{",
"for",
"(",
"CommercePriceList",
"commercePriceList",
":",
"findByLtD_S",
"(",
"displayDate",
",",
"status",
",",
"QueryUtil",
".",
"ALL_POS",
",",
... | Removes all the commerce price lists where displayDate < ? and status = ? from the database.
@param displayDate the display date
@param status the status | [
"Removes",
"all",
"the",
"commerce",
"price",
"lists",
"where",
"displayDate",
"<",
";",
"?",
";",
"and",
"status",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java#L4821-L4827 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuStringUtil.java | GosuStringUtil.containsAny | public static boolean containsAny(String str, String searchChars) {
if (searchChars == null) {
return false;
}
return containsAny(str, searchChars.toCharArray());
} | java | public static boolean containsAny(String str, String searchChars) {
if (searchChars == null) {
return false;
}
return containsAny(str, searchChars.toCharArray());
} | [
"public",
"static",
"boolean",
"containsAny",
"(",
"String",
"str",
",",
"String",
"searchChars",
")",
"{",
"if",
"(",
"searchChars",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"containsAny",
"(",
"str",
",",
"searchChars",
".",
"toChar... | <p>
Checks if the String contains any character in the given set of characters.
</p>
<p>
A <code>null</code> String will return <code>false</code>. A <code>null</code> search string will return
<code>false</code>.
</p>
<pre>
GosuStringUtil.containsAny(null, *) = false
GosuStringUtil.containsAny("", *) = false
GosuStringUtil.containsAny(*, null) = false
GosuStringUtil.containsAny(*, "") = false
GosuStringUtil.containsAny("zzabyycdxx", "za") = true
GosuStringUtil.containsAny("zzabyycdxx", "by") = true
GosuStringUtil.containsAny("aba","z") = false
</pre>
@param str
the String to check, may be null
@param searchChars
the chars to search for, may be null
@return the <code>true</code> if any of the chars are found, <code>false</code> if no match or null input
@since 2.4 | [
"<p",
">",
"Checks",
"if",
"the",
"String",
"contains",
"any",
"character",
"in",
"the",
"given",
"set",
"of",
"characters",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L1178-L1183 |
marvinlabs/android-intents | library/src/main/java/com/marvinlabs/intents/EmailIntents.java | EmailIntents.newEmailIntent | public static Intent newEmailIntent(String[] addresses, String subject, String body, Uri attachment) {
Intent intent = new Intent(Intent.ACTION_SEND);
if (addresses != null) intent.putExtra(Intent.EXTRA_EMAIL, addresses);
if (body != null) intent.putExtra(Intent.EXTRA_TEXT, body);
if (subject != null) intent.putExtra(Intent.EXTRA_SUBJECT, subject);
if (attachment != null) intent.putExtra(Intent.EXTRA_STREAM, attachment);
intent.setType(MIME_TYPE_EMAIL);
return intent;
} | java | public static Intent newEmailIntent(String[] addresses, String subject, String body, Uri attachment) {
Intent intent = new Intent(Intent.ACTION_SEND);
if (addresses != null) intent.putExtra(Intent.EXTRA_EMAIL, addresses);
if (body != null) intent.putExtra(Intent.EXTRA_TEXT, body);
if (subject != null) intent.putExtra(Intent.EXTRA_SUBJECT, subject);
if (attachment != null) intent.putExtra(Intent.EXTRA_STREAM, attachment);
intent.setType(MIME_TYPE_EMAIL);
return intent;
} | [
"public",
"static",
"Intent",
"newEmailIntent",
"(",
"String",
"[",
"]",
"addresses",
",",
"String",
"subject",
",",
"String",
"body",
",",
"Uri",
"attachment",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"Intent",
".",
"ACTION_SEND",
")",
";"... | Create an intent to send an email with an attachment
@param addresses The recipients addresses (or null if not specified)
@param subject The subject of the email (or null if not specified)
@param body The body of the email (or null if not specified)
@param attachment The URI of a file to attach to the email. Note that the URI must point to a location the email
application is allowed to read and has permissions to access.
@return the intent | [
"Create",
"an",
"intent",
"to",
"send",
"an",
"email",
"with",
"an",
"attachment"
] | train | https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/EmailIntents.java#L65-L74 |
rundeck/rundeck | core/src/main/java/com/dtolabs/utils/Mapper.java | Mapper.beanMap | public static Collection beanMap(String property, Collection c, boolean includeNull) {
return beanMap(property, c.iterator(), includeNull);
} | java | public static Collection beanMap(String property, Collection c, boolean includeNull) {
return beanMap(property, c.iterator(), includeNull);
} | [
"public",
"static",
"Collection",
"beanMap",
"(",
"String",
"property",
",",
"Collection",
"c",
",",
"boolean",
"includeNull",
")",
"{",
"return",
"beanMap",
"(",
"property",
",",
"c",
".",
"iterator",
"(",
")",
",",
"includeNull",
")",
";",
"}"
] | Map dynamically using a bean property name.
@param property the name of a bean property
@param c an Collection of objects
@param includeNull true to include null results in the response
@return collection
@throws ClassCastException if there is an error invoking the method on any object. | [
"Map",
"dynamically",
"using",
"a",
"bean",
"property",
"name",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Mapper.java#L687-L689 |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/hazelcast/MemberTasks.java | MemberTasks.executeOptimistic | public static <T> Collection<MemberResponse<T>> executeOptimistic(IExecutorService execSvc, Set<Member> members, Callable<T> callable) {
return executeOptimistic(execSvc, members, callable, 60, TimeUnit.SECONDS);
} | java | public static <T> Collection<MemberResponse<T>> executeOptimistic(IExecutorService execSvc, Set<Member> members, Callable<T> callable) {
return executeOptimistic(execSvc, members, callable, 60, TimeUnit.SECONDS);
} | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"MemberResponse",
"<",
"T",
">",
">",
"executeOptimistic",
"(",
"IExecutorService",
"execSvc",
",",
"Set",
"<",
"Member",
">",
"members",
",",
"Callable",
"<",
"T",
">",
"callable",
")",
"{",
"return",
... | Will wait a maximum of 1 minute for each node to response with their result. If an error occurs on any
member, we will always attempt to continue execution and collect as many results as possible.
@param execSvc
@param members
@param callable
@return | [
"Will",
"wait",
"a",
"maximum",
"of",
"1",
"minute",
"for",
"each",
"node",
"to",
"response",
"with",
"their",
"result",
".",
"If",
"an",
"error",
"occurs",
"on",
"any",
"member",
"we",
"will",
"always",
"attempt",
"to",
"continue",
"execution",
"and",
"... | train | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/hazelcast/MemberTasks.java#L53-L55 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.markInvoiceFailed | public InvoiceCollection markInvoiceFailed(final String invoiceId) {
return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/mark_failed", null, InvoiceCollection.class);
} | java | public InvoiceCollection markInvoiceFailed(final String invoiceId) {
return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/mark_failed", null, InvoiceCollection.class);
} | [
"public",
"InvoiceCollection",
"markInvoiceFailed",
"(",
"final",
"String",
"invoiceId",
")",
"{",
"return",
"doPUT",
"(",
"Invoices",
".",
"INVOICES_RESOURCE",
"+",
"\"/\"",
"+",
"invoiceId",
"+",
"\"/mark_failed\"",
",",
"null",
",",
"InvoiceCollection",
".",
"c... | Mark an invoice as failed collection
@param invoiceId String Recurly Invoice ID | [
"Mark",
"an",
"invoice",
"as",
"failed",
"collection"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1301-L1303 |
mongodb/stitch-android-sdk | core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java | CoreRemoteMongoCollectionImpl.findOne | public DocumentT findOne(final Bson filter, final RemoteFindOptions options) {
return executeFindOne(filter, options, documentClass);
} | java | public DocumentT findOne(final Bson filter, final RemoteFindOptions options) {
return executeFindOne(filter, options, documentClass);
} | [
"public",
"DocumentT",
"findOne",
"(",
"final",
"Bson",
"filter",
",",
"final",
"RemoteFindOptions",
"options",
")",
"{",
"return",
"executeFindOne",
"(",
"filter",
",",
"options",
",",
"documentClass",
")",
";",
"}"
] | Finds a document in the collection.
@param filter the query filter
@param options A RemoteFindOptions struct
@return the resulting document | [
"Finds",
"a",
"document",
"in",
"the",
"collection",
"."
] | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java#L217-L219 |
jglobus/JGlobus | axis/src/main/java/org/globus/axis/transport/HTTPUtils.java | HTTPUtils.setDisableChunking | public static void setDisableChunking(Stub stub, boolean disable) {
stub._setProperty(DISABLE_CHUNKING,
(disable)
? Boolean.TRUE
: Boolean.FALSE);
Hashtable headers = getRequestHeaders(stub);
headers.put(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED,
(disable) ? "false" : "true");
} | java | public static void setDisableChunking(Stub stub, boolean disable) {
stub._setProperty(DISABLE_CHUNKING,
(disable)
? Boolean.TRUE
: Boolean.FALSE);
Hashtable headers = getRequestHeaders(stub);
headers.put(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED,
(disable) ? "false" : "true");
} | [
"public",
"static",
"void",
"setDisableChunking",
"(",
"Stub",
"stub",
",",
"boolean",
"disable",
")",
"{",
"stub",
".",
"_setProperty",
"(",
"DISABLE_CHUNKING",
",",
"(",
"disable",
")",
"?",
"Boolean",
".",
"TRUE",
":",
"Boolean",
".",
"FALSE",
")",
";",... | Sets on option on the stub to use to disable chunking
(only if used with HTTP 1.1).
@param stub The stub to set the property on
@param disable If true, chunking will be disabled. Otherwise chunking
will be performed (if HTTP 1.1 will be used). | [
"Sets",
"on",
"option",
"on",
"the",
"stub",
"to",
"use",
"to",
"disable",
"chunking",
"(",
"only",
"if",
"used",
"with",
"HTTP",
"1",
".",
"1",
")",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/axis/src/main/java/org/globus/axis/transport/HTTPUtils.java#L108-L116 |
javamelody/javamelody | javamelody-core/src/main/java/net/bull/javamelody/Main.java | Main.extractFromJar | private static File extractFromJar(String resource, String fileName, String suffix)
throws IOException {
final URL res = Main.class.getResource(resource);
// put this jar in a file system so that we can load jars from there
final File tmp;
try {
tmp = File.createTempFile(fileName, suffix);
} catch (final IOException e) {
final String tmpdir = System.getProperty("java.io.tmpdir");
throw new IllegalStateException(
"JavaMelody has failed to create a temporary file in " + tmpdir, e);
}
final InputStream is = res.openStream();
try {
final OutputStream os = new FileOutputStream(tmp);
try {
copyStream(is, os);
} finally {
os.close();
}
} finally {
is.close();
}
tmp.deleteOnExit();
return tmp;
} | java | private static File extractFromJar(String resource, String fileName, String suffix)
throws IOException {
final URL res = Main.class.getResource(resource);
// put this jar in a file system so that we can load jars from there
final File tmp;
try {
tmp = File.createTempFile(fileName, suffix);
} catch (final IOException e) {
final String tmpdir = System.getProperty("java.io.tmpdir");
throw new IllegalStateException(
"JavaMelody has failed to create a temporary file in " + tmpdir, e);
}
final InputStream is = res.openStream();
try {
final OutputStream os = new FileOutputStream(tmp);
try {
copyStream(is, os);
} finally {
os.close();
}
} finally {
is.close();
}
tmp.deleteOnExit();
return tmp;
} | [
"private",
"static",
"File",
"extractFromJar",
"(",
"String",
"resource",
",",
"String",
"fileName",
",",
"String",
"suffix",
")",
"throws",
"IOException",
"{",
"final",
"URL",
"res",
"=",
"Main",
".",
"class",
".",
"getResource",
"(",
"resource",
")",
";",
... | Extract a resource from jar, mark it for deletion upon exit, and return its location. | [
"Extract",
"a",
"resource",
"from",
"jar",
"mark",
"it",
"for",
"deletion",
"upon",
"exit",
"and",
"return",
"its",
"location",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/Main.java#L256-L282 |
google/flogger | api/src/main/java/com/google/common/flogger/util/FastStackGetter.java | FastStackGetter.getStackTraceElement | public StackTraceElement getStackTraceElement(Throwable throwable, int n) {
try {
return (StackTraceElement) getElementMethod.invoke(javaLangAccess, throwable, n);
} catch (InvocationTargetException e) {
// The only case we should expect to see here normally is a wrapped IndexOutOfBoundsException.
if (e.getCause() instanceof RuntimeException) {
throw (RuntimeException) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
}
// This should not be possible because the getStackTraceElement() method does not declare
// any checked exceptions (though APIs may change over time).
throw new RuntimeException(e.getCause());
} catch (IllegalAccessException e) {
// This should never happen because the method has been successfully invoked once already.
throw new AssertionError(e);
}
} | java | public StackTraceElement getStackTraceElement(Throwable throwable, int n) {
try {
return (StackTraceElement) getElementMethod.invoke(javaLangAccess, throwable, n);
} catch (InvocationTargetException e) {
// The only case we should expect to see here normally is a wrapped IndexOutOfBoundsException.
if (e.getCause() instanceof RuntimeException) {
throw (RuntimeException) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
}
// This should not be possible because the getStackTraceElement() method does not declare
// any checked exceptions (though APIs may change over time).
throw new RuntimeException(e.getCause());
} catch (IllegalAccessException e) {
// This should never happen because the method has been successfully invoked once already.
throw new AssertionError(e);
}
} | [
"public",
"StackTraceElement",
"getStackTraceElement",
"(",
"Throwable",
"throwable",
",",
"int",
"n",
")",
"{",
"try",
"{",
"return",
"(",
"StackTraceElement",
")",
"getElementMethod",
".",
"invoke",
"(",
"javaLangAccess",
",",
"throwable",
",",
"n",
")",
";",
... | Mimics a direct call to {@code getStackTraceElement()} on the JavaLangAccess interface without
requiring the Java runtime to directly reference the method (which may not exist on some
JVMs). | [
"Mimics",
"a",
"direct",
"call",
"to",
"{"
] | train | https://github.com/google/flogger/blob/a164967a93a9f4ce92f34319fc0cc7c91a57321c/api/src/main/java/com/google/common/flogger/util/FastStackGetter.java#L84-L101 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/svg/inkscape/Util.java | Util.getNonGeometricData | static NonGeometricData getNonGeometricData(Element element) {
String meta = getMetaData(element);
NonGeometricData data = new InkscapeNonGeometricData(meta, element);
data.addAttribute(NonGeometricData.ID, element.getAttribute("id"));
data.addAttribute(NonGeometricData.FILL, getStyle(element, NonGeometricData.FILL));
data.addAttribute(NonGeometricData.STROKE, getStyle(element, NonGeometricData.STROKE));
data.addAttribute(NonGeometricData.OPACITY, getStyle(element, NonGeometricData.OPACITY));
data.addAttribute(NonGeometricData.STROKE_DASHARRAY, getStyle(element, NonGeometricData.STROKE_DASHARRAY));
data.addAttribute(NonGeometricData.STROKE_DASHOFFSET, getStyle(element, NonGeometricData.STROKE_DASHOFFSET));
data.addAttribute(NonGeometricData.STROKE_MITERLIMIT, getStyle(element, NonGeometricData.STROKE_MITERLIMIT));
data.addAttribute(NonGeometricData.STROKE_OPACITY, getStyle(element, NonGeometricData.STROKE_OPACITY));
data.addAttribute(NonGeometricData.STROKE_WIDTH, getStyle(element, NonGeometricData.STROKE_WIDTH));
return data;
} | java | static NonGeometricData getNonGeometricData(Element element) {
String meta = getMetaData(element);
NonGeometricData data = new InkscapeNonGeometricData(meta, element);
data.addAttribute(NonGeometricData.ID, element.getAttribute("id"));
data.addAttribute(NonGeometricData.FILL, getStyle(element, NonGeometricData.FILL));
data.addAttribute(NonGeometricData.STROKE, getStyle(element, NonGeometricData.STROKE));
data.addAttribute(NonGeometricData.OPACITY, getStyle(element, NonGeometricData.OPACITY));
data.addAttribute(NonGeometricData.STROKE_DASHARRAY, getStyle(element, NonGeometricData.STROKE_DASHARRAY));
data.addAttribute(NonGeometricData.STROKE_DASHOFFSET, getStyle(element, NonGeometricData.STROKE_DASHOFFSET));
data.addAttribute(NonGeometricData.STROKE_MITERLIMIT, getStyle(element, NonGeometricData.STROKE_MITERLIMIT));
data.addAttribute(NonGeometricData.STROKE_OPACITY, getStyle(element, NonGeometricData.STROKE_OPACITY));
data.addAttribute(NonGeometricData.STROKE_WIDTH, getStyle(element, NonGeometricData.STROKE_WIDTH));
return data;
} | [
"static",
"NonGeometricData",
"getNonGeometricData",
"(",
"Element",
"element",
")",
"{",
"String",
"meta",
"=",
"getMetaData",
"(",
"element",
")",
";",
"NonGeometricData",
"data",
"=",
"new",
"InkscapeNonGeometricData",
"(",
"meta",
",",
"element",
")",
";",
"... | Get the non-geometric data information from an XML element
@param element The element to be processed
@return The non-geometric data (i.e. stroke, fill, etc) | [
"Get",
"the",
"non",
"-",
"geometric",
"data",
"information",
"from",
"an",
"XML",
"element"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/svg/inkscape/Util.java#L29-L44 |
OpenLiberty/open-liberty | dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/ExecutorServiceImpl.java | ExecutorServiceImpl.createExecutor | private synchronized void createExecutor() {
if (componentConfig == null) {
// this is a completely normal occurrence and can happen if a ThreadFactory is bound prior to
// component activation... the proper thing to do is to do nothing and wait for activation
return;
}
if (threadPoolController != null)
threadPoolController.deactivate();
ThreadPoolExecutor oldPool = threadPool;
poolName = (String) componentConfig.get("name");
String threadGroupName = poolName + " Thread Group";
int coreThreads = Integer.parseInt(String.valueOf(componentConfig.get("coreThreads")));
int maxThreads = Integer.parseInt(String.valueOf(componentConfig.get("maxThreads")));
if (maxThreads <= 0) {
maxThreads = Integer.MAX_VALUE;
}
if (coreThreads < 0) {
coreThreads = 2 * CpuInfo.getAvailableProcessors();
}
// Make sure coreThreads is not bigger than maxThreads, subject to MINIMUM_POOL_SIZE limit
coreThreads = Math.max(MINIMUM_POOL_SIZE, Math.min(coreThreads, maxThreads));
// ... and then make sure maxThreads is not smaller than coreThreads ...
maxThreads = Math.max(coreThreads, maxThreads);
BlockingQueue<Runnable> workQueue = new BoundedBuffer<Runnable>(java.lang.Runnable.class, 1000, 1000);
RejectedExecutionHandler rejectedExecutionHandler = new ExpandPolicy(workQueue, this);
threadPool = new ThreadPoolExecutor(coreThreads, maxThreads, 0, TimeUnit.MILLISECONDS, workQueue, threadFactory != null ? threadFactory : new ThreadFactoryImpl(poolName, threadGroupName), rejectedExecutionHandler);
threadPoolController = new ThreadPoolController(this, threadPool);
if (oldPool != null) {
softShutdown(oldPool);
}
} | java | private synchronized void createExecutor() {
if (componentConfig == null) {
// this is a completely normal occurrence and can happen if a ThreadFactory is bound prior to
// component activation... the proper thing to do is to do nothing and wait for activation
return;
}
if (threadPoolController != null)
threadPoolController.deactivate();
ThreadPoolExecutor oldPool = threadPool;
poolName = (String) componentConfig.get("name");
String threadGroupName = poolName + " Thread Group";
int coreThreads = Integer.parseInt(String.valueOf(componentConfig.get("coreThreads")));
int maxThreads = Integer.parseInt(String.valueOf(componentConfig.get("maxThreads")));
if (maxThreads <= 0) {
maxThreads = Integer.MAX_VALUE;
}
if (coreThreads < 0) {
coreThreads = 2 * CpuInfo.getAvailableProcessors();
}
// Make sure coreThreads is not bigger than maxThreads, subject to MINIMUM_POOL_SIZE limit
coreThreads = Math.max(MINIMUM_POOL_SIZE, Math.min(coreThreads, maxThreads));
// ... and then make sure maxThreads is not smaller than coreThreads ...
maxThreads = Math.max(coreThreads, maxThreads);
BlockingQueue<Runnable> workQueue = new BoundedBuffer<Runnable>(java.lang.Runnable.class, 1000, 1000);
RejectedExecutionHandler rejectedExecutionHandler = new ExpandPolicy(workQueue, this);
threadPool = new ThreadPoolExecutor(coreThreads, maxThreads, 0, TimeUnit.MILLISECONDS, workQueue, threadFactory != null ? threadFactory : new ThreadFactoryImpl(poolName, threadGroupName), rejectedExecutionHandler);
threadPoolController = new ThreadPoolController(this, threadPool);
if (oldPool != null) {
softShutdown(oldPool);
}
} | [
"private",
"synchronized",
"void",
"createExecutor",
"(",
")",
"{",
"if",
"(",
"componentConfig",
"==",
"null",
")",
"{",
"// this is a completely normal occurrence and can happen if a ThreadFactory is bound prior to",
"// component activation... the proper thing to do is to do nothin... | Create a thread pool executor with the configured attributes from this
component config. | [
"Create",
"a",
"thread",
"pool",
"executor",
"with",
"the",
"configured",
"attributes",
"from",
"this",
"component",
"config",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/ExecutorServiceImpl.java#L177-L219 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/transform/XmlResponsesSaxParser.java | XmlResponsesSaxParser.parseListObjectsV2Response | public ListObjectsV2Handler parseListObjectsV2Response(InputStream inputStream, final boolean shouldSDKDecodeResponse)
throws IOException {
ListObjectsV2Handler handler = new ListObjectsV2Handler(shouldSDKDecodeResponse);
parseXmlInputStream(handler, sanitizeXmlDocument(handler, inputStream));
return handler;
} | java | public ListObjectsV2Handler parseListObjectsV2Response(InputStream inputStream, final boolean shouldSDKDecodeResponse)
throws IOException {
ListObjectsV2Handler handler = new ListObjectsV2Handler(shouldSDKDecodeResponse);
parseXmlInputStream(handler, sanitizeXmlDocument(handler, inputStream));
return handler;
} | [
"public",
"ListObjectsV2Handler",
"parseListObjectsV2Response",
"(",
"InputStream",
"inputStream",
",",
"final",
"boolean",
"shouldSDKDecodeResponse",
")",
"throws",
"IOException",
"{",
"ListObjectsV2Handler",
"handler",
"=",
"new",
"ListObjectsV2Handler",
"(",
"shouldSDKDeco... | Parses a ListBucketV2 response XML document from an input stream.
@param inputStream
XML data input stream.
@return the XML handler object populated with data parsed from the XML
stream.
@throws SdkClientException | [
"Parses",
"a",
"ListBucketV2",
"response",
"XML",
"document",
"from",
"an",
"input",
"stream",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/transform/XmlResponsesSaxParser.java#L336-L342 |
jalkanen/speed4j | src/main/java/com/ecyrd/speed4j/util/Percentile.java | Percentile.evaluate | public double evaluate(final double[] values, final int begin,
final int length, final double p) {
test(values, begin, length);
if ((p > 100) || (p <= 0)) {
throw new IllegalArgumentException("invalid quantile value: " + p);
}
if (length == 0) {
return Double.NaN;
}
if (length == 1) {
return values[begin]; // always return single value for n = 1
}
// Sort array
double[] sorted = new double[length];
System.arraycopy(values, begin, sorted, 0, length);
Arrays.sort(sorted);
return evaluateSorted( sorted, p );
} | java | public double evaluate(final double[] values, final int begin,
final int length, final double p) {
test(values, begin, length);
if ((p > 100) || (p <= 0)) {
throw new IllegalArgumentException("invalid quantile value: " + p);
}
if (length == 0) {
return Double.NaN;
}
if (length == 1) {
return values[begin]; // always return single value for n = 1
}
// Sort array
double[] sorted = new double[length];
System.arraycopy(values, begin, sorted, 0, length);
Arrays.sort(sorted);
return evaluateSorted( sorted, p );
} | [
"public",
"double",
"evaluate",
"(",
"final",
"double",
"[",
"]",
"values",
",",
"final",
"int",
"begin",
",",
"final",
"int",
"length",
",",
"final",
"double",
"p",
")",
"{",
"test",
"(",
"values",
",",
"begin",
",",
"length",
")",
";",
"if",
"(",
... | Returns an estimate of the <code>p</code>th percentile of the values
in the <code>values</code> array, starting with the element in (0-based)
position <code>begin</code> in the array and including <code>length</code>
values.
<p>
Calls to this method do not modify the internal <code>quantile</code>
state of this statistic.
<p>
<ul>
<li>Returns <code>Double.NaN</code> if <code>length = 0</code></li>
<li>Returns (for any value of <code>p</code>) <code>values[begin]</code>
if <code>length = 1 </code></li>
<li>Throws <code>IllegalArgumentException</code> if <code>values</code>
is null , <code>begin</code> or <code>length</code> is invalid, or
<code>p</code> is not a valid quantile value</li>
</ul>
<p>
See {@link Percentile} for a description of the percentile estimation
algorithm used.
@param values array of input values
@param p the percentile to compute
@param begin the first (0-based) element to include in the computation
@param length the number of array elements to include
@return the percentile value
@throws IllegalArgumentException if the parameters are not valid or the
input array is null | [
"Returns",
"an",
"estimate",
"of",
"the",
"<code",
">",
"p<",
"/",
"code",
">",
"th",
"percentile",
"of",
"the",
"values",
"in",
"the",
"<code",
">",
"values<",
"/",
"code",
">",
"array",
"starting",
"with",
"the",
"element",
"in",
"(",
"0",
"-",
"ba... | train | https://github.com/jalkanen/speed4j/blob/1d2db9c9b9def869c25fedb9bbd7cf95c39023bd/src/main/java/com/ecyrd/speed4j/util/Percentile.java#L189-L210 |
threerings/nenya | core/src/main/java/com/threerings/chat/ComicChatOverlay.java | ComicChatOverlay.positionRectIdeally | protected void positionRectIdeally (Rectangle r, int type, Point speaker)
{
if (speaker != null) {
// center it on top of the speaker (it'll be moved..)
r.setLocation(speaker.x - (r.width / 2),
speaker.y - (r.height / 2));
return;
}
// otherwise we have different areas for different types
Rectangle vbounds = _target.getViewBounds();
switch (ChatLogic.placeOf(type)) {
case ChatLogic.INFO:
case ChatLogic.ATTENTION:
// upper left
r.setLocation(vbounds.x + BUBBLE_SPACING,
vbounds.y + BUBBLE_SPACING);
return;
case ChatLogic.PLACE:
log.warning("Got to a place where I shouldn't get!");
break; // fall through
}
// put it in the center..
log.debug("Unhandled chat type in getLocation()", "type", type);
r.setLocation((vbounds.width - r.width) / 2,
(vbounds.height - r.height) / 2);
} | java | protected void positionRectIdeally (Rectangle r, int type, Point speaker)
{
if (speaker != null) {
// center it on top of the speaker (it'll be moved..)
r.setLocation(speaker.x - (r.width / 2),
speaker.y - (r.height / 2));
return;
}
// otherwise we have different areas for different types
Rectangle vbounds = _target.getViewBounds();
switch (ChatLogic.placeOf(type)) {
case ChatLogic.INFO:
case ChatLogic.ATTENTION:
// upper left
r.setLocation(vbounds.x + BUBBLE_SPACING,
vbounds.y + BUBBLE_SPACING);
return;
case ChatLogic.PLACE:
log.warning("Got to a place where I shouldn't get!");
break; // fall through
}
// put it in the center..
log.debug("Unhandled chat type in getLocation()", "type", type);
r.setLocation((vbounds.width - r.width) / 2,
(vbounds.height - r.height) / 2);
} | [
"protected",
"void",
"positionRectIdeally",
"(",
"Rectangle",
"r",
",",
"int",
"type",
",",
"Point",
"speaker",
")",
"{",
"if",
"(",
"speaker",
"!=",
"null",
")",
"{",
"// center it on top of the speaker (it'll be moved..)",
"r",
".",
"setLocation",
"(",
"speaker"... | Position the rectangle in its ideal location given the type and speaker positon (which may
be null). | [
"Position",
"the",
"rectangle",
"in",
"its",
"ideal",
"location",
"given",
"the",
"type",
"and",
"speaker",
"positon",
"(",
"which",
"may",
"be",
"null",
")",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/ComicChatOverlay.java#L406-L434 |
cdk/cdk | display/renderextra/src/main/java/org/openscience/cdk/renderer/generators/HighlightGenerator.java | HighlightGenerator.createAtomHighlight | private static Shape createAtomHighlight(IAtom atom, double radius) {
double x = atom.getPoint2d().x;
double y = atom.getPoint2d().y;
return new RoundRectangle2D.Double(x - radius, y - radius, 2 * radius, 2 * radius, 2 * radius, 2 * radius);
} | java | private static Shape createAtomHighlight(IAtom atom, double radius) {
double x = atom.getPoint2d().x;
double y = atom.getPoint2d().y;
return new RoundRectangle2D.Double(x - radius, y - radius, 2 * radius, 2 * radius, 2 * radius, 2 * radius);
} | [
"private",
"static",
"Shape",
"createAtomHighlight",
"(",
"IAtom",
"atom",
",",
"double",
"radius",
")",
"{",
"double",
"x",
"=",
"atom",
".",
"getPoint2d",
"(",
")",
".",
"x",
";",
"double",
"y",
"=",
"atom",
".",
"getPoint2d",
"(",
")",
".",
"y",
"... | Create the shape which will highlight the provided atom.
@param atom the atom to highlight
@param radius the specified radius
@return the shape which will highlight the atom | [
"Create",
"the",
"shape",
"which",
"will",
"highlight",
"the",
"provided",
"atom",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderextra/src/main/java/org/openscience/cdk/renderer/generators/HighlightGenerator.java#L190-L195 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java | SerializationUtils.fromByteArrayKryo | @SuppressWarnings("unchecked")
public static <T> T fromByteArrayKryo(byte[] data, Class<T> clazz, ClassLoader classLoader) {
if (data == null) {
return null;
}
Kryo kryo = kryoPool.obtain();
try {
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
if (classLoader != null) {
Thread.currentThread().setContextClassLoader(classLoader);
}
try {
Input input = kryoInputPool.obtain();
try {
kryo.setClassLoader(classLoader != null ? classLoader : oldClassLoader);
input.setInputStream(new ByteArrayInputStream(data));
Object obj = kryo.readClassAndObject(input);
input.close();
return obj != null && clazz.isAssignableFrom(obj.getClass()) ? (T) obj : null;
} finally {
kryoInputPool.free(input);
}
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
} finally {
kryoPool.free(kryo);
}
} | java | @SuppressWarnings("unchecked")
public static <T> T fromByteArrayKryo(byte[] data, Class<T> clazz, ClassLoader classLoader) {
if (data == null) {
return null;
}
Kryo kryo = kryoPool.obtain();
try {
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
if (classLoader != null) {
Thread.currentThread().setContextClassLoader(classLoader);
}
try {
Input input = kryoInputPool.obtain();
try {
kryo.setClassLoader(classLoader != null ? classLoader : oldClassLoader);
input.setInputStream(new ByteArrayInputStream(data));
Object obj = kryo.readClassAndObject(input);
input.close();
return obj != null && clazz.isAssignableFrom(obj.getClass()) ? (T) obj : null;
} finally {
kryoInputPool.free(input);
}
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
} finally {
kryoPool.free(kryo);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"fromByteArrayKryo",
"(",
"byte",
"[",
"]",
"data",
",",
"Class",
"<",
"T",
">",
"clazz",
",",
"ClassLoader",
"classLoader",
")",
"{",
"if",
"(",
"data",
"==",
... | Deserialize a byte array back to an object, with custom class loader.
<p>
This method uses Kryo lib.
</p>
@param data
@param clazz
@param classLoader
@return | [
"Deserialize",
"a",
"byte",
"array",
"back",
"to",
"an",
"object",
"with",
"custom",
"class",
"loader",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java#L299-L327 |
motown-io/motown | chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java | DomainService.updateChargingStationType | public ChargingStationType updateChargingStationType(Long id, ChargingStationType chargingStationType) {
chargingStationType.setId(id);
return chargingStationTypeRepository.createOrUpdate(chargingStationType);
} | java | public ChargingStationType updateChargingStationType(Long id, ChargingStationType chargingStationType) {
chargingStationType.setId(id);
return chargingStationTypeRepository.createOrUpdate(chargingStationType);
} | [
"public",
"ChargingStationType",
"updateChargingStationType",
"(",
"Long",
"id",
",",
"ChargingStationType",
"chargingStationType",
")",
"{",
"chargingStationType",
".",
"setId",
"(",
"id",
")",
";",
"return",
"chargingStationTypeRepository",
".",
"createOrUpdate",
"(",
... | Update a charging station type.
@param id the id of the entity to find.
@param chargingStationType the payload from the request. | [
"Update",
"a",
"charging",
"station",
"type",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java#L131-L134 |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/mapped/MappedQueryForFieldEq.java | MappedQueryForFieldEq.execute | public T execute(DatabaseConnection databaseConnection, ID id, ObjectCache objectCache) throws SQLException {
if (objectCache != null) {
T result = objectCache.get(clazz, id);
if (result != null) {
return result;
}
}
Object[] args = new Object[] { convertIdToFieldObject(id) };
// @SuppressWarnings("unchecked")
Object result = databaseConnection.queryForOne(statement, args, argFieldTypes, this, objectCache);
if (result == null) {
logger.debug("{} using '{}' and {} args, got no results", label, statement, args.length);
} else if (result == DatabaseConnection.MORE_THAN_ONE) {
logger.error("{} using '{}' and {} args, got >1 results", label, statement, args.length);
logArgs(args);
throw new SQLException(label + " got more than 1 result: " + statement);
} else {
logger.debug("{} using '{}' and {} args, got 1 result", label, statement, args.length);
}
logArgs(args);
@SuppressWarnings("unchecked")
T castResult = (T) result;
return castResult;
} | java | public T execute(DatabaseConnection databaseConnection, ID id, ObjectCache objectCache) throws SQLException {
if (objectCache != null) {
T result = objectCache.get(clazz, id);
if (result != null) {
return result;
}
}
Object[] args = new Object[] { convertIdToFieldObject(id) };
// @SuppressWarnings("unchecked")
Object result = databaseConnection.queryForOne(statement, args, argFieldTypes, this, objectCache);
if (result == null) {
logger.debug("{} using '{}' and {} args, got no results", label, statement, args.length);
} else if (result == DatabaseConnection.MORE_THAN_ONE) {
logger.error("{} using '{}' and {} args, got >1 results", label, statement, args.length);
logArgs(args);
throw new SQLException(label + " got more than 1 result: " + statement);
} else {
logger.debug("{} using '{}' and {} args, got 1 result", label, statement, args.length);
}
logArgs(args);
@SuppressWarnings("unchecked")
T castResult = (T) result;
return castResult;
} | [
"public",
"T",
"execute",
"(",
"DatabaseConnection",
"databaseConnection",
",",
"ID",
"id",
",",
"ObjectCache",
"objectCache",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"objectCache",
"!=",
"null",
")",
"{",
"T",
"result",
"=",
"objectCache",
".",
"get",
... | Query for an object in the database which matches the id argument. | [
"Query",
"for",
"an",
"object",
"in",
"the",
"database",
"which",
"matches",
"the",
"id",
"argument",
"."
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/mapped/MappedQueryForFieldEq.java#L30-L53 |
sarxos/v4l4j | src/main/java/au/edu/jcu/v4l4j/DeviceInfo.java | DeviceInfo.listIntervals | public synchronized FrameInterval listIntervals(ImageFormat imf,
int width, int height){
checkRelease();
return doListIntervals(object, imf.getIndex(), width, height);
} | java | public synchronized FrameInterval listIntervals(ImageFormat imf,
int width, int height){
checkRelease();
return doListIntervals(object, imf.getIndex(), width, height);
} | [
"public",
"synchronized",
"FrameInterval",
"listIntervals",
"(",
"ImageFormat",
"imf",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"checkRelease",
"(",
")",
";",
"return",
"doListIntervals",
"(",
"object",
",",
"imf",
".",
"getIndex",
"(",
")",
",",... | This method returns a {@link FrameInterval} object containing information
about the supported frame intervals for capture at the given resolution
and image format. <b>Note that the returned {@link FrameInterval} object
could have its type set to {@link FrameInterval.Type#UNSUPPORTED} if the
driver does not support frame interval enumeration OR if the device is
currently being used by another application and frame intervals cannot
be enumerated at this time.</b><br>Frame interval information can also
be obtained through {@link ResolutionInfo} objects, attached to each
{@link ImageFormat}. See {@link #getFormatList()}.
@return a {@link FrameInterval} object containing information about
the supported frame intervals
@param imf the capture image format for which the frame intervals should
be enumerated
@param width the capture width for which the frame intervals should be
enumerated
@param height the capture height for which the frame intervals should be
enumerated
@throws StateException if the associated VideoDevice has been released | [
"This",
"method",
"returns",
"a",
"{"
] | train | https://github.com/sarxos/v4l4j/blob/4fc0eec2c3a1a4260593f6ac03b7a8013e3804c9/src/main/java/au/edu/jcu/v4l4j/DeviceInfo.java#L237-L241 |
xwiki/xwiki-rendering | xwiki-rendering-xml/src/main/java/org/xwiki/rendering/renderer/printer/XMLWikiPrinter.java | XMLWikiPrinter.printXMLElement | public void printXMLElement(String name, Map<String, String> attributes)
{
Element element = new DefaultElement(name);
if (attributes != null && !attributes.isEmpty()) {
for (Map.Entry<String, String> entry : attributes.entrySet()) {
element.addAttribute(entry.getKey(), entry.getValue());
}
}
try {
this.xmlWriter.write(element);
} catch (IOException e) {
// TODO: add error log here
}
} | java | public void printXMLElement(String name, Map<String, String> attributes)
{
Element element = new DefaultElement(name);
if (attributes != null && !attributes.isEmpty()) {
for (Map.Entry<String, String> entry : attributes.entrySet()) {
element.addAttribute(entry.getKey(), entry.getValue());
}
}
try {
this.xmlWriter.write(element);
} catch (IOException e) {
// TODO: add error log here
}
} | [
"public",
"void",
"printXMLElement",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"Element",
"element",
"=",
"new",
"DefaultElement",
"(",
"name",
")",
";",
"if",
"(",
"attributes",
"!=",
"null",
"&&",
"!"... | Print the xml element. In the form {@code <name att1="value1" att2="value2"/>}.
@param name the xml element to print
@param attributes the xml attributes of the element to print | [
"Print",
"the",
"xml",
"element",
".",
"In",
"the",
"form",
"{",
"@code",
"<name",
"att1",
"=",
"value1",
"att2",
"=",
"value2",
"/",
">",
"}",
"."
] | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-xml/src/main/java/org/xwiki/rendering/renderer/printer/XMLWikiPrinter.java#L122-L137 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java | PrepareRequestInterceptor.addEntitySelector | private void addEntitySelector(Map<String, String> requestParameters, StringBuilder uri) {
if (StringUtils.hasText(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_SELECTOR))) {
uri.append("/").append(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_SELECTOR));
}
} | java | private void addEntitySelector(Map<String, String> requestParameters, StringBuilder uri) {
if (StringUtils.hasText(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_SELECTOR))) {
uri.append("/").append(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_SELECTOR));
}
} | [
"private",
"void",
"addEntitySelector",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"requestParameters",
",",
"StringBuilder",
"uri",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"requestParameters",
".",
"get",
"(",
"RequestElements",
".",
"REQ... | adding additional selector in the URI, which is required for READ operation
Main purpose is to select or modify requested resource with well-defined keyword
@param requestParameters
@param uri | [
"adding",
"additional",
"selector",
"in",
"the",
"URI",
"which",
"is",
"required",
"for",
"READ",
"operation",
"Main",
"purpose",
"is",
"to",
"select",
"or",
"modify",
"requested",
"resource",
"with",
"well",
"-",
"defined",
"keyword"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java#L348-L352 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/GIntegralImageOps.java | GIntegralImageOps.block_zero | public static <T extends ImageGray<T>>
double block_zero( T integral , int x0 , int y0 , int x1 , int y1 )
{
if( integral instanceof GrayF32) {
return IntegralImageOps.block_zero((GrayF32)integral,x0,y0,x1,y1);
} else if( integral instanceof GrayF64) {
return IntegralImageOps.block_zero((GrayF64)integral,x0,y0,x1,y1);
} else if( integral instanceof GrayS32) {
return IntegralImageOps.block_zero((GrayS32)integral,x0,y0,x1,y1);
} else if( integral instanceof GrayS64) {
return IntegralImageOps.block_zero((GrayS64)integral,x0,y0,x1,y1);
} else {
throw new IllegalArgumentException("Unknown input type");
}
} | java | public static <T extends ImageGray<T>>
double block_zero( T integral , int x0 , int y0 , int x1 , int y1 )
{
if( integral instanceof GrayF32) {
return IntegralImageOps.block_zero((GrayF32)integral,x0,y0,x1,y1);
} else if( integral instanceof GrayF64) {
return IntegralImageOps.block_zero((GrayF64)integral,x0,y0,x1,y1);
} else if( integral instanceof GrayS32) {
return IntegralImageOps.block_zero((GrayS32)integral,x0,y0,x1,y1);
} else if( integral instanceof GrayS64) {
return IntegralImageOps.block_zero((GrayS64)integral,x0,y0,x1,y1);
} else {
throw new IllegalArgumentException("Unknown input type");
}
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
">",
"double",
"block_zero",
"(",
"T",
"integral",
",",
"int",
"x0",
",",
"int",
"y0",
",",
"int",
"x1",
",",
"int",
"y1",
")",
"{",
"if",
"(",
"integral",
"instanceof",
"GrayF32",
... | <p>
Computes the value of a block inside an integral image and treats pixels outside of the
image as zero. The block is defined as follows: x0 < x ≤ x1 and y0 < y ≤ y1.
</p>
@param integral Integral image.
@param x0 Lower bound of the block. Exclusive.
@param y0 Lower bound of the block. Exclusive.
@param x1 Upper bound of the block. Inclusive.
@param y1 Upper bound of the block. Inclusive.
@return Value inside the block. | [
"<p",
">",
"Computes",
"the",
"value",
"of",
"a",
"block",
"inside",
"an",
"integral",
"image",
"and",
"treats",
"pixels",
"outside",
"of",
"the",
"image",
"as",
"zero",
".",
"The",
"block",
"is",
"defined",
"as",
"follows",
":",
"x0",
"<",
";",
"x",... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/GIntegralImageOps.java#L162-L176 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/asm/AsmUtils.java | AsmUtils.ldcInsnEqual | public static boolean ldcInsnEqual(LdcInsnNode insn1, LdcInsnNode insn2)
{
if (insn1.cst.equals("~") || insn2.cst.equals("~"))
return true;
return insn1.cst.equals(insn2.cst);
} | java | public static boolean ldcInsnEqual(LdcInsnNode insn1, LdcInsnNode insn2)
{
if (insn1.cst.equals("~") || insn2.cst.equals("~"))
return true;
return insn1.cst.equals(insn2.cst);
} | [
"public",
"static",
"boolean",
"ldcInsnEqual",
"(",
"LdcInsnNode",
"insn1",
",",
"LdcInsnNode",
"insn2",
")",
"{",
"if",
"(",
"insn1",
".",
"cst",
".",
"equals",
"(",
"\"~\"",
")",
"||",
"insn2",
".",
"cst",
".",
"equals",
"(",
"\"~\"",
")",
")",
"retu... | Checks if two {@link LdcInsnNode} are equals.
@param insn1 the insn1
@param insn2 the insn2
@return true, if successful | [
"Checks",
"if",
"two",
"{",
"@link",
"LdcInsnNode",
"}",
"are",
"equals",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/asm/AsmUtils.java#L219-L225 |
joniles/mpxj | src/main/java/net/sf/mpxj/Task.java | Task.setDuration | public void setDuration(int index, Duration value)
{
set(selectField(TaskFieldLists.CUSTOM_DURATION, index), value);
} | java | public void setDuration(int index, Duration value)
{
set(selectField(TaskFieldLists.CUSTOM_DURATION, index), value);
} | [
"public",
"void",
"setDuration",
"(",
"int",
"index",
",",
"Duration",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"TaskFieldLists",
".",
"CUSTOM_DURATION",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] | Set a duration value.
@param index duration index (1-10)
@param value duration value | [
"Set",
"a",
"duration",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L1954-L1957 |
mapsforge/mapsforge | mapsforge-map/src/main/java/org/mapsforge/map/datastore/MapDataStore.java | MapDataStore.readPoiData | public MapReadResult readPoiData(Tile upperLeft, Tile lowerRight) {
if (upperLeft.tileX > lowerRight.tileX || upperLeft.tileY > lowerRight.tileY) {
new IllegalArgumentException("upperLeft tile must be above and left of lowerRight tile");
}
MapReadResult result = new MapReadResult();
for (int x = upperLeft.tileX; x <= lowerRight.tileX; x++) {
for (int y = upperLeft.tileY; y <= lowerRight.tileY; y++) {
Tile current = new Tile(x, y, upperLeft.zoomLevel, upperLeft.tileSize);
result.add(readPoiData(current), false);
}
}
return result;
} | java | public MapReadResult readPoiData(Tile upperLeft, Tile lowerRight) {
if (upperLeft.tileX > lowerRight.tileX || upperLeft.tileY > lowerRight.tileY) {
new IllegalArgumentException("upperLeft tile must be above and left of lowerRight tile");
}
MapReadResult result = new MapReadResult();
for (int x = upperLeft.tileX; x <= lowerRight.tileX; x++) {
for (int y = upperLeft.tileY; y <= lowerRight.tileY; y++) {
Tile current = new Tile(x, y, upperLeft.zoomLevel, upperLeft.tileSize);
result.add(readPoiData(current), false);
}
}
return result;
} | [
"public",
"MapReadResult",
"readPoiData",
"(",
"Tile",
"upperLeft",
",",
"Tile",
"lowerRight",
")",
"{",
"if",
"(",
"upperLeft",
".",
"tileX",
">",
"lowerRight",
".",
"tileX",
"||",
"upperLeft",
".",
"tileY",
">",
"lowerRight",
".",
"tileY",
")",
"{",
"new... | Reads POI data for an area defined by the tile in the upper left and the tile in
the lower right corner. The default implementation combines the results from
all tiles, a possibly inefficient solution.
Precondition: upperLeft.tileX <= lowerRight.tileX && upperLeft.tileY <= lowerRight.tileY
@param upperLeft tile that defines the upper left corner of the requested area.
@param lowerRight tile that defines the lower right corner of the requested area.
@return map data for the tile. | [
"Reads",
"POI",
"data",
"for",
"an",
"area",
"defined",
"by",
"the",
"tile",
"in",
"the",
"upper",
"left",
"and",
"the",
"tile",
"in",
"the",
"lower",
"right",
"corner",
".",
"The",
"default",
"implementation",
"combines",
"the",
"results",
"from",
"all",
... | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/datastore/MapDataStore.java#L206-L218 |
aragozin/jvm-tools | mxdump/src/main/java/org/gridkit/jvmtool/jackson/JsonGenerator.java | JsonGenerator.writeBooleanField | public final void writeBooleanField(String fieldName, boolean value)
throws IOException, JsonGenerationException
{
writeFieldName(fieldName);
writeBoolean(value);
} | java | public final void writeBooleanField(String fieldName, boolean value)
throws IOException, JsonGenerationException
{
writeFieldName(fieldName);
writeBoolean(value);
} | [
"public",
"final",
"void",
"writeBooleanField",
"(",
"String",
"fieldName",
",",
"boolean",
"value",
")",
"throws",
"IOException",
",",
"JsonGenerationException",
"{",
"writeFieldName",
"(",
"fieldName",
")",
";",
"writeBoolean",
"(",
"value",
")",
";",
"}"
] | Convenience method for outputting a field entry ("member")
that has a boolean value. Equivalent to:
<pre>
writeFieldName(fieldName);
writeBoolean(value);
</pre> | [
"Convenience",
"method",
"for",
"outputting",
"a",
"field",
"entry",
"(",
"member",
")",
"that",
"has",
"a",
"boolean",
"value",
".",
"Equivalent",
"to",
":",
"<pre",
">",
"writeFieldName",
"(",
"fieldName",
")",
";",
"writeBoolean",
"(",
"value",
")",
";"... | train | https://github.com/aragozin/jvm-tools/blob/d3a4d0c6a47fb9317f274988569655f30dcd2f76/mxdump/src/main/java/org/gridkit/jvmtool/jackson/JsonGenerator.java#L706-L711 |
jbundle/jbundle | main/db/src/main/java/org/jbundle/main/db/FolderField.java | FolderField.setupDefaultView | public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
Record record = this.getReferenceRecord(); // Get/make the record that describes the referenced class.
if (record != null)
return this.setupTableLookup(itsLocation, targetScreen, converter, iDisplayFieldDesc, record, record.getDefaultScreenKeyArea(), m_iDescription, true, false);
else
return super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
} | java | public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
Record record = this.getReferenceRecord(); // Get/make the record that describes the referenced class.
if (record != null)
return this.setupTableLookup(itsLocation, targetScreen, converter, iDisplayFieldDesc, record, record.getDefaultScreenKeyArea(), m_iDescription, true, false);
else
return super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
} | [
"public",
"ScreenComponent",
"setupDefaultView",
"(",
"ScreenLoc",
"itsLocation",
",",
"ComponentParent",
"targetScreen",
",",
"Convert",
"converter",
",",
"int",
"iDisplayFieldDesc",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"Record",
... | Set up the default screen control for this field.
@param itsLocation Location of this component on screen (ie., GridBagConstraint).
@param targetScreen Where to place this component (ie., Parent screen or GridBagLayout).
@param converter The converter to set the screenfield to.
@param iDisplayFieldDesc Display the label? (optional).
@param properties Extra properties
@return Return the component or ScreenField that is created for this field. | [
"Set",
"up",
"the",
"default",
"screen",
"control",
"for",
"this",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/db/FolderField.java#L72-L79 |
WolfgangFahl/Mediawiki-Japi | src/main/java/com/bitplan/mediawiki/japi/Mediawiki.java | Mediawiki.getActionResult | public Api getActionResult(String action, String params) throws Exception {
Api result = this.getActionResult(action, params, null, null);
return result;
} | java | public Api getActionResult(String action, String params) throws Exception {
Api result = this.getActionResult(action, params, null, null);
return result;
} | [
"public",
"Api",
"getActionResult",
"(",
"String",
"action",
",",
"String",
"params",
")",
"throws",
"Exception",
"{",
"Api",
"result",
"=",
"this",
".",
"getActionResult",
"(",
"action",
",",
"params",
",",
"null",
",",
"null",
")",
";",
"return",
"result... | get the result for the given action and query
@param action
@param params
@return the API result for the action
@throws Exception | [
"get",
"the",
"result",
"for",
"the",
"given",
"action",
"and",
"query"
] | train | https://github.com/WolfgangFahl/Mediawiki-Japi/blob/78d0177ebfe02eb05da5550839727861f1e888a5/src/main/java/com/bitplan/mediawiki/japi/Mediawiki.java#L481-L484 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Matth.java | Matth.saturatedMultiply | public static long saturatedMultiply(long a, long b) {
// see checkedMultiply for explanation
int leadingZeros = Long.numberOfLeadingZeros(a) + Long.numberOfLeadingZeros(~a) + Long.numberOfLeadingZeros(b) + Long.numberOfLeadingZeros(~b);
if (leadingZeros > Long.SIZE + 1) {
return a * b;
}
// the return value if we will overflow (which we calculate by overflowing a long :) )
long limit = Long.MAX_VALUE + ((a ^ b) >>> (Long.SIZE - 1));
if (leadingZeros < Long.SIZE | (a < 0 & b == Long.MIN_VALUE)) {
// overflow
return limit;
}
long result = a * b;
if (a == 0 || result / a == b) {
return result;
}
return limit;
} | java | public static long saturatedMultiply(long a, long b) {
// see checkedMultiply for explanation
int leadingZeros = Long.numberOfLeadingZeros(a) + Long.numberOfLeadingZeros(~a) + Long.numberOfLeadingZeros(b) + Long.numberOfLeadingZeros(~b);
if (leadingZeros > Long.SIZE + 1) {
return a * b;
}
// the return value if we will overflow (which we calculate by overflowing a long :) )
long limit = Long.MAX_VALUE + ((a ^ b) >>> (Long.SIZE - 1));
if (leadingZeros < Long.SIZE | (a < 0 & b == Long.MIN_VALUE)) {
// overflow
return limit;
}
long result = a * b;
if (a == 0 || result / a == b) {
return result;
}
return limit;
} | [
"public",
"static",
"long",
"saturatedMultiply",
"(",
"long",
"a",
",",
"long",
"b",
")",
"{",
"// see checkedMultiply for explanation\r",
"int",
"leadingZeros",
"=",
"Long",
".",
"numberOfLeadingZeros",
"(",
"a",
")",
"+",
"Long",
".",
"numberOfLeadingZeros",
"("... | Returns the product of {@code a} and {@code b} unless it would overflow or underflow in which
case {@code Long.MAX_VALUE} or {@code Long.MIN_VALUE} is returned, respectively.
@since 20.0 | [
"Returns",
"the",
"product",
"of",
"{",
"@code",
"a",
"}",
"and",
"{",
"@code",
"b",
"}",
"unless",
"it",
"would",
"overflow",
"or",
"underflow",
"in",
"which",
"case",
"{",
"@code",
"Long",
".",
"MAX_VALUE",
"}",
"or",
"{",
"@code",
"Long",
".",
"MI... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Matth.java#L1628-L1645 |
cdk/cdk | base/data/src/main/java/org/openscience/cdk/AtomContainerSet.java | AtomContainerSet.sortAtomContainers | @Override
public void sortAtomContainers(final Comparator<IAtomContainer> comparator) {
// need to use boxed primitives as we can't customise sorting of int primitives
Integer[] indexes = new Integer[atomContainerCount];
for (int i = 0; i < indexes.length; i++)
indexes[i] = i;
// proxy the index comparison to the atom container comparator
Arrays.sort(indexes, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return comparator.compare(atomContainers[o1], atomContainers[o2]);
}
});
// copy the original arrays (we could modify in place with swaps but this is cleaner)
IAtomContainer[] containersTmp = Arrays.copyOf(atomContainers, indexes.length);
Double[] multipliersTmp = Arrays.copyOf(multipliers, indexes.length);
// order the arrays based on the order of the indices
for (int i = 0; i < indexes.length; i++) {
atomContainers[i] = containersTmp[indexes[i]];
multipliers[i] = multipliersTmp[indexes[i]];
}
} | java | @Override
public void sortAtomContainers(final Comparator<IAtomContainer> comparator) {
// need to use boxed primitives as we can't customise sorting of int primitives
Integer[] indexes = new Integer[atomContainerCount];
for (int i = 0; i < indexes.length; i++)
indexes[i] = i;
// proxy the index comparison to the atom container comparator
Arrays.sort(indexes, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return comparator.compare(atomContainers[o1], atomContainers[o2]);
}
});
// copy the original arrays (we could modify in place with swaps but this is cleaner)
IAtomContainer[] containersTmp = Arrays.copyOf(atomContainers, indexes.length);
Double[] multipliersTmp = Arrays.copyOf(multipliers, indexes.length);
// order the arrays based on the order of the indices
for (int i = 0; i < indexes.length; i++) {
atomContainers[i] = containersTmp[indexes[i]];
multipliers[i] = multipliersTmp[indexes[i]];
}
} | [
"@",
"Override",
"public",
"void",
"sortAtomContainers",
"(",
"final",
"Comparator",
"<",
"IAtomContainer",
">",
"comparator",
")",
"{",
"// need to use boxed primitives as we can't customise sorting of int primitives",
"Integer",
"[",
"]",
"indexes",
"=",
"new",
"Integer",... | Sort the AtomContainers and multipliers using a provided Comparator.
@param comparator defines the sorting method | [
"Sort",
"the",
"AtomContainers",
"and",
"multipliers",
"using",
"a",
"provided",
"Comparator",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/data/src/main/java/org/openscience/cdk/AtomContainerSet.java#L412-L439 |
JakeWharton/ActionBarSherlock | actionbarsherlock/src/com/actionbarsherlock/internal/widget/IcsAdapterView.java | IcsAdapterView.performItemClick | public boolean performItemClick(View view, int position, long id) {
if (mOnItemClickListener != null) {
playSoundEffect(SoundEffectConstants.CLICK);
if (view != null) {
view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
}
mOnItemClickListener.onItemClick(/*this*/null, view, position, id);
return true;
}
return false;
} | java | public boolean performItemClick(View view, int position, long id) {
if (mOnItemClickListener != null) {
playSoundEffect(SoundEffectConstants.CLICK);
if (view != null) {
view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
}
mOnItemClickListener.onItemClick(/*this*/null, view, position, id);
return true;
}
return false;
} | [
"public",
"boolean",
"performItemClick",
"(",
"View",
"view",
",",
"int",
"position",
",",
"long",
"id",
")",
"{",
"if",
"(",
"mOnItemClickListener",
"!=",
"null",
")",
"{",
"playSoundEffect",
"(",
"SoundEffectConstants",
".",
"CLICK",
")",
";",
"if",
"(",
... | Call the OnItemClickListener, if it is defined.
@param view The view within the AdapterView that was clicked.
@param position The position of the view in the adapter.
@param id The row id of the item that was clicked.
@return True if there was an assigned OnItemClickListener that was
called, false otherwise is returned. | [
"Call",
"the",
"OnItemClickListener",
"if",
"it",
"is",
"defined",
"."
] | train | https://github.com/JakeWharton/ActionBarSherlock/blob/2c71339e756bcc0b1424c4525680549ba3a2dc97/actionbarsherlock/src/com/actionbarsherlock/internal/widget/IcsAdapterView.java#L266-L277 |
influxdata/influxdb-java | src/main/java/org/influxdb/impl/InfluxDBResultMapper.java | InfluxDBResultMapper.setFieldValue | <T> void setFieldValue(final T object, final Field field, final Object value, final TimeUnit precision)
throws IllegalArgumentException, IllegalAccessException {
if (value == null) {
return;
}
Class<?> fieldType = field.getType();
try {
if (!field.isAccessible()) {
field.setAccessible(true);
}
if (fieldValueModified(fieldType, field, object, value, precision)
|| fieldValueForPrimitivesModified(fieldType, field, object, value)
|| fieldValueForPrimitiveWrappersModified(fieldType, field, object, value)) {
return;
}
String msg = "Class '%s' field '%s' is from an unsupported type '%s'.";
throw new InfluxDBMapperException(
String.format(msg, object.getClass().getName(), field.getName(), field.getType()));
} catch (ClassCastException e) {
String msg = "Class '%s' field '%s' was defined with a different field type and caused a ClassCastException. "
+ "The correct type is '%s' (current field value: '%s').";
throw new InfluxDBMapperException(
String.format(msg, object.getClass().getName(), field.getName(), value.getClass().getName(), value));
}
} | java | <T> void setFieldValue(final T object, final Field field, final Object value, final TimeUnit precision)
throws IllegalArgumentException, IllegalAccessException {
if (value == null) {
return;
}
Class<?> fieldType = field.getType();
try {
if (!field.isAccessible()) {
field.setAccessible(true);
}
if (fieldValueModified(fieldType, field, object, value, precision)
|| fieldValueForPrimitivesModified(fieldType, field, object, value)
|| fieldValueForPrimitiveWrappersModified(fieldType, field, object, value)) {
return;
}
String msg = "Class '%s' field '%s' is from an unsupported type '%s'.";
throw new InfluxDBMapperException(
String.format(msg, object.getClass().getName(), field.getName(), field.getType()));
} catch (ClassCastException e) {
String msg = "Class '%s' field '%s' was defined with a different field type and caused a ClassCastException. "
+ "The correct type is '%s' (current field value: '%s').";
throw new InfluxDBMapperException(
String.format(msg, object.getClass().getName(), field.getName(), value.getClass().getName(), value));
}
} | [
"<",
"T",
">",
"void",
"setFieldValue",
"(",
"final",
"T",
"object",
",",
"final",
"Field",
"field",
",",
"final",
"Object",
"value",
",",
"final",
"TimeUnit",
"precision",
")",
"throws",
"IllegalArgumentException",
",",
"IllegalAccessException",
"{",
"if",
"(... | InfluxDB client returns any number as Double.
See https://github.com/influxdata/influxdb-java/issues/153#issuecomment-259681987
for more information.
@param object
@param field
@param value
@param precision
@throws IllegalArgumentException
@throws IllegalAccessException | [
"InfluxDB",
"client",
"returns",
"any",
"number",
"as",
"Double",
".",
"See",
"https",
":",
"//",
"github",
".",
"com",
"/",
"influxdata",
"/",
"influxdb",
"-",
"java",
"/",
"issues",
"/",
"153#issuecomment",
"-",
"259681987",
"for",
"more",
"information",
... | train | https://github.com/influxdata/influxdb-java/blob/8ae777f34aa2e598f609208cf4fa12d4642f83f5/src/main/java/org/influxdb/impl/InfluxDBResultMapper.java#L305-L329 |
kopihao/peasy-recyclerview | peasy-recyclerview/src/main/java/com/kopirealm/peasyrecyclerview/PeasyRecyclerView.java | PeasyRecyclerView.onBindViewHolder | private void onBindViewHolder(Context context, PeasyViewHolder holder, int position) {
if (holder == null) return;
try {
if (headerContent != null && holder.isHeaderView()) {
headerContent.onBindViewHolder(context, holder.asIs(PeasyHeaderViewHolder.class), position, getItem(position));
}
} catch (Exception ignored) {
}
try {
if (footerContent != null && holder.isFooterView()) {
footerContent.onBindViewHolder(context, holder.asIs(PeasyFooterViewHolder.class), position, getItem(position));
}
} catch (Exception ignored) {
}
onBindViewHolder(context, holder, position, getItem(position));
} | java | private void onBindViewHolder(Context context, PeasyViewHolder holder, int position) {
if (holder == null) return;
try {
if (headerContent != null && holder.isHeaderView()) {
headerContent.onBindViewHolder(context, holder.asIs(PeasyHeaderViewHolder.class), position, getItem(position));
}
} catch (Exception ignored) {
}
try {
if (footerContent != null && holder.isFooterView()) {
footerContent.onBindViewHolder(context, holder.asIs(PeasyFooterViewHolder.class), position, getItem(position));
}
} catch (Exception ignored) {
}
onBindViewHolder(context, holder, position, getItem(position));
} | [
"private",
"void",
"onBindViewHolder",
"(",
"Context",
"context",
",",
"PeasyViewHolder",
"holder",
",",
"int",
"position",
")",
"{",
"if",
"(",
"holder",
"==",
"null",
")",
"return",
";",
"try",
"{",
"if",
"(",
"headerContent",
"!=",
"null",
"&&",
"holder... | Enhanced Implementation Layer of {@link RecyclerView.Adapter#onBindViewHolder(RecyclerView.ViewHolder, int)}
@param holder PeasyViewHolder
@param position position | [
"Enhanced",
"Implementation",
"Layer",
"of",
"{",
"@link",
"RecyclerView",
".",
"Adapter#onBindViewHolder",
"(",
"RecyclerView",
".",
"ViewHolder",
"int",
")",
"}"
] | train | https://github.com/kopihao/peasy-recyclerview/blob/a26071849e5d5b5b1febe685f205558b49908f87/peasy-recyclerview/src/main/java/com/kopirealm/peasyrecyclerview/PeasyRecyclerView.java#L632-L647 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/MapPrinter.java | MapPrinter.setConfiguration | public final void setConfiguration(final URI newConfigFile, final byte[] configFileData)
throws IOException {
this.configFile = new File(newConfigFile);
this.configuration = this.configurationFactory
.getConfig(this.configFile, new ByteArrayInputStream(configFileData));
} | java | public final void setConfiguration(final URI newConfigFile, final byte[] configFileData)
throws IOException {
this.configFile = new File(newConfigFile);
this.configuration = this.configurationFactory
.getConfig(this.configFile, new ByteArrayInputStream(configFileData));
} | [
"public",
"final",
"void",
"setConfiguration",
"(",
"final",
"URI",
"newConfigFile",
",",
"final",
"byte",
"[",
"]",
"configFileData",
")",
"throws",
"IOException",
"{",
"this",
".",
"configFile",
"=",
"new",
"File",
"(",
"newConfigFile",
")",
";",
"this",
"... | Set the configuration file and update the configuration for this printer.
@param newConfigFile the file containing the new configuration.
@param configFileData the config file data. | [
"Set",
"the",
"configuration",
"file",
"and",
"update",
"the",
"configuration",
"for",
"this",
"printer",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/MapPrinter.java#L70-L75 |
tempodb/tempodb-java | src/main/java/com/tempodb/Filter.java | Filter.addAttribute | public synchronized Filter addAttribute(String key, String value) {
attributes.put(key, value);
return this;
} | java | public synchronized Filter addAttribute(String key, String value) {
attributes.put(key, value);
return this;
} | [
"public",
"synchronized",
"Filter",
"addAttribute",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"attributes",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds an attribute to the filter.
@param key The attribute key.
@param value The attribute value.
@return This filter
@since 1.0.0 | [
"Adds",
"an",
"attribute",
"to",
"the",
"filter",
"."
] | train | https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Filter.java#L139-L142 |
robocup-atan/atan | src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java | CommandFactory.addChangeViewCommand | public void addChangeViewCommand(ViewAngle angle, ViewQuality quality) {
StringBuilder buf = new StringBuilder();
buf.append("(change_view ");
switch (angle) {
case NARROW :
switch (quality) {
case HIGH :
buf.append("narrow high)");
break;
case LOW :
buf.append("narrow low)");
break;
}
break;
case NORMAL :
switch (quality) {
case HIGH :
buf.append("normal high)");
break;
case LOW :
buf.append("normal low)");
break;
}
break;
case WIDE :
switch (quality) {
case HIGH :
buf.append("wide high)");
break;
case LOW :
buf.append("wide low)");
break;
}
break;
}
fifo.add(fifo.size(), buf.toString());
} | java | public void addChangeViewCommand(ViewAngle angle, ViewQuality quality) {
StringBuilder buf = new StringBuilder();
buf.append("(change_view ");
switch (angle) {
case NARROW :
switch (quality) {
case HIGH :
buf.append("narrow high)");
break;
case LOW :
buf.append("narrow low)");
break;
}
break;
case NORMAL :
switch (quality) {
case HIGH :
buf.append("normal high)");
break;
case LOW :
buf.append("normal low)");
break;
}
break;
case WIDE :
switch (quality) {
case HIGH :
buf.append("wide high)");
break;
case LOW :
buf.append("wide low)");
break;
}
break;
}
fifo.add(fifo.size(), buf.toString());
} | [
"public",
"void",
"addChangeViewCommand",
"(",
"ViewAngle",
"angle",
",",
"ViewQuality",
"quality",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\"(change_view \"",
")",
";",
"switch",
"(",
"angle",
... | Changes the view parameters of the player. The amount and detail returned
by the visual sensor depends on the width of view and the quality. But
note that the frequency of sending information also depends on these
parameters. (eg. If you change the quality from high to low, the
frequency doubles, and the time between the two see sensors will be
cut in half).
@param angle Between NARROW, NORMAL or WIDE.
@param quality Between HIGH or LOW. | [
"Changes",
"the",
"view",
"parameters",
"of",
"the",
"player",
".",
"The",
"amount",
"and",
"detail",
"returned",
"by",
"the",
"visual",
"sensor",
"depends",
"on",
"the",
"width",
"of",
"view",
"and",
"the",
"quality",
".",
"But",
"note",
"that",
"the",
... | train | https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L144-L180 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.relativeEllipticalArc | public SVGPath relativeEllipticalArc(double rx, double ry, double ar, double la, double sp, double x, double y) {
return append(PATH_ARC_RELATIVE).append(rx).append(ry).append(ar).append(la).append(sp).append(x).append(y);
} | java | public SVGPath relativeEllipticalArc(double rx, double ry, double ar, double la, double sp, double x, double y) {
return append(PATH_ARC_RELATIVE).append(rx).append(ry).append(ar).append(la).append(sp).append(x).append(y);
} | [
"public",
"SVGPath",
"relativeEllipticalArc",
"(",
"double",
"rx",
",",
"double",
"ry",
",",
"double",
"ar",
",",
"double",
"la",
",",
"double",
"sp",
",",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"append",
"(",
"PATH_ARC_RELATIVE",
")",
".... | Elliptical arc curve to the given relative coordinates.
@param rx x radius
@param ry y radius
@param ar x-axis-rotation
@param la large arc flag, if angle >= 180 deg
@param sp sweep flag, if arc will be drawn in positive-angle direction
@param x new coordinates
@param y new coordinates | [
"Elliptical",
"arc",
"curve",
"to",
"the",
"given",
"relative",
"coordinates",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L591-L593 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java | PnPLepetitEPnP.adjustBetaSign | private double adjustBetaSign( double beta , List<Point3D_F64> nullPts ) {
if( beta == 0 )
return 0;
int N = alphas.numRows;
int positiveCount = 0;
for( int i = 0; i < N; i++ ) {
double z = 0;
for( int j = 0; j < numControl; j++ ) {
Point3D_F64 c = nullPts.get(j);
z += alphas.get(i,j)*c.z;
}
if( z > 0 )
positiveCount++;
}
if( positiveCount < N/2 )
beta *= -1;
return beta;
} | java | private double adjustBetaSign( double beta , List<Point3D_F64> nullPts ) {
if( beta == 0 )
return 0;
int N = alphas.numRows;
int positiveCount = 0;
for( int i = 0; i < N; i++ ) {
double z = 0;
for( int j = 0; j < numControl; j++ ) {
Point3D_F64 c = nullPts.get(j);
z += alphas.get(i,j)*c.z;
}
if( z > 0 )
positiveCount++;
}
if( positiveCount < N/2 )
beta *= -1;
return beta;
} | [
"private",
"double",
"adjustBetaSign",
"(",
"double",
"beta",
",",
"List",
"<",
"Point3D_F64",
">",
"nullPts",
")",
"{",
"if",
"(",
"beta",
"==",
"0",
")",
"return",
"0",
";",
"int",
"N",
"=",
"alphas",
".",
"numRows",
";",
"int",
"positiveCount",
"=",... | Use the positive depth constraint to determine the sign of beta | [
"Use",
"the",
"positive",
"depth",
"constraint",
"to",
"determine",
"the",
"sign",
"of",
"beta"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java#L519-L542 |
ysc/word | src/main/java/org/apdplat/word/vector/Word2Vector.java | Word2Vector.contextWord | private static void contextWord(String[] words, int index, int distance, String word, Map<String, List<ContextWord>> map){
String _word = null;
if(index > -1 && index < words.length){
_word = words[index];
}
if(_word != null && Utils.isChineseCharAndLengthAtLeastTwo(_word)){
addToMap(map, word, _word, distance);
}
} | java | private static void contextWord(String[] words, int index, int distance, String word, Map<String, List<ContextWord>> map){
String _word = null;
if(index > -1 && index < words.length){
_word = words[index];
}
if(_word != null && Utils.isChineseCharAndLengthAtLeastTwo(_word)){
addToMap(map, word, _word, distance);
}
} | [
"private",
"static",
"void",
"contextWord",
"(",
"String",
"[",
"]",
"words",
",",
"int",
"index",
",",
"int",
"distance",
",",
"String",
"word",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"ContextWord",
">",
">",
"map",
")",
"{",
"String",
"_word",
... | 计算词的相关词
@param words 词数组
@param index 相关词索引
@param distance 词距
@param word 核心词
@param map | [
"计算词的相关词"
] | train | https://github.com/ysc/word/blob/5e45607f4e97207f55d1e3bc561abda6b34f7c54/src/main/java/org/apdplat/word/vector/Word2Vector.java#L164-L172 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java | GoogleCloudStorageImpl.getBucket | private Bucket getBucket(String bucketName)
throws IOException {
logger.atFine().log("getBucket(%s)", bucketName);
checkArgument(!Strings.isNullOrEmpty(bucketName), "bucketName must not be null or empty");
Storage.Buckets.Get getBucket = configureRequest(gcs.buckets().get(bucketName), bucketName);
try {
return getBucket.execute();
} catch (IOException e) {
if (errorExtractor.itemNotFound(e)) {
logger.atFine().withCause(e).log("getBucket(%s): not found", bucketName);
return null;
}
throw new IOException("Error accessing Bucket " + bucketName, e);
}
} | java | private Bucket getBucket(String bucketName)
throws IOException {
logger.atFine().log("getBucket(%s)", bucketName);
checkArgument(!Strings.isNullOrEmpty(bucketName), "bucketName must not be null or empty");
Storage.Buckets.Get getBucket = configureRequest(gcs.buckets().get(bucketName), bucketName);
try {
return getBucket.execute();
} catch (IOException e) {
if (errorExtractor.itemNotFound(e)) {
logger.atFine().withCause(e).log("getBucket(%s): not found", bucketName);
return null;
}
throw new IOException("Error accessing Bucket " + bucketName, e);
}
} | [
"private",
"Bucket",
"getBucket",
"(",
"String",
"bucketName",
")",
"throws",
"IOException",
"{",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"getBucket(%s)\"",
",",
"bucketName",
")",
";",
"checkArgument",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
... | Gets the bucket with the given name.
@param bucketName name of the bucket to get
@return the bucket with the given name or null if bucket not found
@throws IOException if the bucket exists but cannot be accessed | [
"Gets",
"the",
"bucket",
"with",
"the",
"given",
"name",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java#L1789-L1803 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java | ThreadUtil.newExecutorByBlockingCoefficient | public static ThreadPoolExecutor newExecutorByBlockingCoefficient(float blockingCoefficient) {
if (blockingCoefficient >= 1 || blockingCoefficient < 0) {
throw new IllegalArgumentException("[blockingCoefficient] must between 0 and 1, or equals 0.");
}
// 最佳的线程数 = CPU可用核心数 / (1 - 阻塞系数)
int poolSize = (int) (Runtime.getRuntime().availableProcessors() / (1 - blockingCoefficient));
return ExecutorBuilder.create().setCorePoolSize(poolSize).setMaxPoolSize(poolSize).setKeepAliveTime(0L).build();
} | java | public static ThreadPoolExecutor newExecutorByBlockingCoefficient(float blockingCoefficient) {
if (blockingCoefficient >= 1 || blockingCoefficient < 0) {
throw new IllegalArgumentException("[blockingCoefficient] must between 0 and 1, or equals 0.");
}
// 最佳的线程数 = CPU可用核心数 / (1 - 阻塞系数)
int poolSize = (int) (Runtime.getRuntime().availableProcessors() / (1 - blockingCoefficient));
return ExecutorBuilder.create().setCorePoolSize(poolSize).setMaxPoolSize(poolSize).setKeepAliveTime(0L).build();
} | [
"public",
"static",
"ThreadPoolExecutor",
"newExecutorByBlockingCoefficient",
"(",
"float",
"blockingCoefficient",
")",
"{",
"if",
"(",
"blockingCoefficient",
">=",
"1",
"||",
"blockingCoefficient",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
... | 获得一个新的线程池<br>
传入阻塞系数,线程池的大小计算公式为:CPU可用核心数 / (1 - 阻塞因子)<br>
Blocking Coefficient(阻塞系数) = 阻塞时间/(阻塞时间+使用CPU的时间)<br>
计算密集型任务的阻塞系数为0,而IO密集型任务的阻塞系数则接近于1。
see: http://blog.csdn.net/partner4java/article/details/9417663
@param blockingCoefficient 阻塞系数,阻塞因子介于0~1之间的数,阻塞因子越大,线程池中的线程数越多。
@return {@link ThreadPoolExecutor}
@since 3.0.6 | [
"获得一个新的线程池<br",
">",
"传入阻塞系数,线程池的大小计算公式为:CPU可用核心数",
"/",
"(",
"1",
"-",
"阻塞因子",
")",
"<br",
">",
"Blocking",
"Coefficient",
"(",
"阻塞系数",
")",
"=",
"阻塞时间/(阻塞时间",
"+",
"使用CPU的时间)<br",
">",
"计算密集型任务的阻塞系数为0,而IO密集型任务的阻塞系数则接近于1。"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java#L75-L83 |
talenguyen/PrettySharedPreferences | prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java | PrettySharedPreferences.getFloatEditor | protected FloatEditor getFloatEditor(String key) {
TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key);
if (typeEditor == null) {
typeEditor = new FloatEditor(this, sharedPreferences, key);
TYPE_EDITOR_MAP.put(key, typeEditor);
} else if (!(typeEditor instanceof FloatEditor)) {
throw new IllegalArgumentException(String.format("key %s is already used for other type", key));
}
return (FloatEditor) typeEditor;
} | java | protected FloatEditor getFloatEditor(String key) {
TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key);
if (typeEditor == null) {
typeEditor = new FloatEditor(this, sharedPreferences, key);
TYPE_EDITOR_MAP.put(key, typeEditor);
} else if (!(typeEditor instanceof FloatEditor)) {
throw new IllegalArgumentException(String.format("key %s is already used for other type", key));
}
return (FloatEditor) typeEditor;
} | [
"protected",
"FloatEditor",
"getFloatEditor",
"(",
"String",
"key",
")",
"{",
"TypeEditor",
"typeEditor",
"=",
"TYPE_EDITOR_MAP",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"typeEditor",
"==",
"null",
")",
"{",
"typeEditor",
"=",
"new",
"FloatEditor",
"(",... | Call to get a {@link com.tale.prettysharedpreferences.FloatEditor} object for the specific
key. <code>NOTE:</code> There is a unique {@link com.tale.prettysharedpreferences.TypeEditor}
object for a unique key.
@param key The name of the preference.
@return {@link com.tale.prettysharedpreferences.FloatEditor} object to be store or retrieve
a {@link java.lang.Float} value. | [
"Call",
"to",
"get",
"a",
"{"
] | train | https://github.com/talenguyen/PrettySharedPreferences/blob/b97edf86c8fa65be2165f2cd790545c78c971c22/prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java#L110-L119 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java | RubyBundleAuditAnalyzer.createVulnerability | private Vulnerability createVulnerability(String parentName, Dependency dependency, String gem, String nextLine) throws CpeValidationException {
Vulnerability vulnerability = null;
if (null != dependency) {
final String version = nextLine.substring(VERSION.length());
dependency.addEvidence(EvidenceType.VERSION,
"bundler-audit",
"Version",
version,
Confidence.HIGHEST);
dependency.setVersion(version);
dependency.setName(gem);
try {
final PackageURL purl = PackageURLBuilder.aPackageURL().withType("gem").withName(dependency.getName())
.withVersion(dependency.getVersion()).build();
dependency.addSoftwareIdentifier(new PurlIdentifier(purl, Confidence.HIGHEST));
} catch (MalformedPackageURLException ex) {
LOGGER.debug("Unable to build package url for python", ex);
final GenericIdentifier id = new GenericIdentifier("gem:" + dependency.getName() + "@" + dependency.getVersion(),
Confidence.HIGHEST);
dependency.addSoftwareIdentifier(id);
}
vulnerability = new Vulnerability(); // don't add to dependency until we have name set later
final VulnerableSoftwareBuilder builder = new VulnerableSoftwareBuilder();
final VulnerableSoftware vs = builder.part(Part.APPLICATION)
.vendor(gem)
.product(String.format("%s_project", gem))
.version(version).build();
vulnerability.addVulnerableSoftware(vs);
vulnerability.setMatchedVulnerableSoftware(vs);
vulnerability.setCvssV2(new CvssV2(-1, "-", "-", "-", "-", "-", "-", "unknown"));
}
LOGGER.debug("bundle-audit ({}): {}", parentName, nextLine);
return vulnerability;
} | java | private Vulnerability createVulnerability(String parentName, Dependency dependency, String gem, String nextLine) throws CpeValidationException {
Vulnerability vulnerability = null;
if (null != dependency) {
final String version = nextLine.substring(VERSION.length());
dependency.addEvidence(EvidenceType.VERSION,
"bundler-audit",
"Version",
version,
Confidence.HIGHEST);
dependency.setVersion(version);
dependency.setName(gem);
try {
final PackageURL purl = PackageURLBuilder.aPackageURL().withType("gem").withName(dependency.getName())
.withVersion(dependency.getVersion()).build();
dependency.addSoftwareIdentifier(new PurlIdentifier(purl, Confidence.HIGHEST));
} catch (MalformedPackageURLException ex) {
LOGGER.debug("Unable to build package url for python", ex);
final GenericIdentifier id = new GenericIdentifier("gem:" + dependency.getName() + "@" + dependency.getVersion(),
Confidence.HIGHEST);
dependency.addSoftwareIdentifier(id);
}
vulnerability = new Vulnerability(); // don't add to dependency until we have name set later
final VulnerableSoftwareBuilder builder = new VulnerableSoftwareBuilder();
final VulnerableSoftware vs = builder.part(Part.APPLICATION)
.vendor(gem)
.product(String.format("%s_project", gem))
.version(version).build();
vulnerability.addVulnerableSoftware(vs);
vulnerability.setMatchedVulnerableSoftware(vs);
vulnerability.setCvssV2(new CvssV2(-1, "-", "-", "-", "-", "-", "-", "unknown"));
}
LOGGER.debug("bundle-audit ({}): {}", parentName, nextLine);
return vulnerability;
} | [
"private",
"Vulnerability",
"createVulnerability",
"(",
"String",
"parentName",
",",
"Dependency",
"dependency",
",",
"String",
"gem",
",",
"String",
"nextLine",
")",
"throws",
"CpeValidationException",
"{",
"Vulnerability",
"vulnerability",
"=",
"null",
";",
"if",
... | Creates a vulnerability.
@param parentName the parent name
@param dependency the dependency
@param gem the gem name
@param nextLine the line to parse
@return the vulnerability
@throws CpeValidationException thrown if there is an error building the
CPE vulnerability object | [
"Creates",
"a",
"vulnerability",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java#L461-L495 |
stevespringett/Alpine | alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java | LdapConnectionWrapper.getAttribute | public String getAttribute(final Attributes attributes, final String attributeName) throws NamingException {
if (attributes == null || attributes.size() == 0) {
return null;
} else {
final Attribute attribute = attributes.get(attributeName);
if (attribute != null) {
final Object o = attribute.get();
if (o instanceof String) {
return (String) attribute.get();
}
}
}
return null;
} | java | public String getAttribute(final Attributes attributes, final String attributeName) throws NamingException {
if (attributes == null || attributes.size() == 0) {
return null;
} else {
final Attribute attribute = attributes.get(attributeName);
if (attribute != null) {
final Object o = attribute.get();
if (o instanceof String) {
return (String) attribute.get();
}
}
}
return null;
} | [
"public",
"String",
"getAttribute",
"(",
"final",
"Attributes",
"attributes",
",",
"final",
"String",
"attributeName",
")",
"throws",
"NamingException",
"{",
"if",
"(",
"attributes",
"==",
"null",
"||",
"attributes",
".",
"size",
"(",
")",
"==",
"0",
")",
"{... | Retrieves an attribute by its name.
@param attributes the list of attributes to query on
@param attributeName the name of the attribute to return
@return the value of the attribute, or null if not found
@throws NamingException if an exception is thrown
@since 1.4.0 | [
"Retrieves",
"an",
"attribute",
"by",
"its",
"name",
"."
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java#L250-L263 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java | AbstractJsonDeserializer.getStringParam | protected String getStringParam(String paramName, String errorMessage, Map<String, Object> mapToUse)
throws IOException {
return getTypedParam(paramName, errorMessage, String.class, mapToUse);
} | java | protected String getStringParam(String paramName, String errorMessage, Map<String, Object> mapToUse)
throws IOException {
return getTypedParam(paramName, errorMessage, String.class, mapToUse);
} | [
"protected",
"String",
"getStringParam",
"(",
"String",
"paramName",
",",
"String",
"errorMessage",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"mapToUse",
")",
"throws",
"IOException",
"{",
"return",
"getTypedParam",
"(",
"paramName",
",",
"errorMessage",
",... | Convenience method for subclasses.
@param paramName the name of the parameter
@param errorMessage the errormessage to add to the exception if the param does not exist.
@param mapToUse the map to use as input parametersource
@return a stringparameter with given name. If it does not exist and the errormessage is provided,
an IOException is thrown with that message. if the errormessage is not provided, null is returned.
@throws IOException Exception if the paramname does not exist and an errormessage is provided. | [
"Convenience",
"method",
"for",
"subclasses",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java#L96-L99 |
petergeneric/stdlib | guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/module/TransactionMethodInterceptor.java | TransactionMethodInterceptor.makeReadOnly | private void makeReadOnly(final Session session, final String tracingId)
{
Tracing.logOngoing(tracingId, "TX:makeReadonly Set Default ReadOnly");
session.setDefaultReadOnly(true);
Tracing.logOngoing(tracingId, "TX:makeReadonly Set Hibernate Flush Mode to MANUAL");
session.setHibernateFlushMode(FlushMode.MANUAL);
Tracing.logOngoing(tracingId, "TX:makeReadonly Make Connection Read Only");
// Make the Connection read only
session.doWork(SetJDBCConnectionReadOnlyWork.READ_ONLY);
Tracing.logOngoing(tracingId, "TX:makeReadonly Complete");
} | java | private void makeReadOnly(final Session session, final String tracingId)
{
Tracing.logOngoing(tracingId, "TX:makeReadonly Set Default ReadOnly");
session.setDefaultReadOnly(true);
Tracing.logOngoing(tracingId, "TX:makeReadonly Set Hibernate Flush Mode to MANUAL");
session.setHibernateFlushMode(FlushMode.MANUAL);
Tracing.logOngoing(tracingId, "TX:makeReadonly Make Connection Read Only");
// Make the Connection read only
session.doWork(SetJDBCConnectionReadOnlyWork.READ_ONLY);
Tracing.logOngoing(tracingId, "TX:makeReadonly Complete");
} | [
"private",
"void",
"makeReadOnly",
"(",
"final",
"Session",
"session",
",",
"final",
"String",
"tracingId",
")",
"{",
"Tracing",
".",
"logOngoing",
"(",
"tracingId",
",",
"\"TX:makeReadonly Set Default ReadOnly\"",
")",
";",
"session",
".",
"setDefaultReadOnly",
"("... | Make the session (and the underlying {@link java.sql.Connection} read only
@param session
@param tracingId | [
"Make",
"the",
"session",
"(",
"and",
"the",
"underlying",
"{",
"@link",
"java",
".",
"sql",
".",
"Connection",
"}",
"read",
"only"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/module/TransactionMethodInterceptor.java#L341-L357 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/AppsImpl.java | AppsImpl.updateAsync | public Observable<OperationStatus> updateAsync(UUID appId, ApplicationUpdateObject applicationUpdateObject) {
return updateWithServiceResponseAsync(appId, applicationUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | java | public Observable<OperationStatus> updateAsync(UUID appId, ApplicationUpdateObject applicationUpdateObject) {
return updateWithServiceResponseAsync(appId, applicationUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatus",
">",
"updateAsync",
"(",
"UUID",
"appId",
",",
"ApplicationUpdateObject",
"applicationUpdateObject",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"appId",
",",
"applicationUpdateObject",
")",
".",
"map",
"(",... | Updates the name or description of the application.
@param appId The application ID.
@param applicationUpdateObject A model containing Name and Description of the application.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Updates",
"the",
"name",
"or",
"description",
"of",
"the",
"application",
"."
] | 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/AppsImpl.java#L1010-L1017 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/domainquery/DomainQueryResult.java | DomainQueryResult.resultOf | public <T> List<T> resultOf(DomainObjectMatch<T> match) {
return resultOf(match, false);
} | java | public <T> List<T> resultOf(DomainObjectMatch<T> match) {
return resultOf(match, false);
} | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"resultOf",
"(",
"DomainObjectMatch",
"<",
"T",
">",
"match",
")",
"{",
"return",
"resultOf",
"(",
"match",
",",
"false",
")",
";",
"}"
] | Answer the matching domain objects
@param match
@return a list of matching domain objects | [
"Answer",
"the",
"matching",
"domain",
"objects"
] | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/domainquery/DomainQueryResult.java#L39-L41 |
arakelian/docker-junit-rule | src/main/java/com/arakelian/docker/junit/Container.java | Container.stopContainerQuietly | private void stopContainerQuietly(final String image, final String idOrName) {
final long startTime = System.currentTimeMillis();
try {
LOGGER.info("Killing docker container {} with id {}", image, idOrName);
final int secondsToWaitBeforeKilling = 10;
client.stopContainer(containerId, secondsToWaitBeforeKilling);
} catch (DockerException | InterruptedException e) {
// log error and ignore exception
LOGGER.warn("Unable to kill docker container {} with id", image, idOrName, e);
} finally {
final long elapsedMillis = System.currentTimeMillis() - startTime;
LOGGER.info("Docker container {} with id {} killed in {}ms", image, idOrName, elapsedMillis);
}
} | java | private void stopContainerQuietly(final String image, final String idOrName) {
final long startTime = System.currentTimeMillis();
try {
LOGGER.info("Killing docker container {} with id {}", image, idOrName);
final int secondsToWaitBeforeKilling = 10;
client.stopContainer(containerId, secondsToWaitBeforeKilling);
} catch (DockerException | InterruptedException e) {
// log error and ignore exception
LOGGER.warn("Unable to kill docker container {} with id", image, idOrName, e);
} finally {
final long elapsedMillis = System.currentTimeMillis() - startTime;
LOGGER.info("Docker container {} with id {} killed in {}ms", image, idOrName, elapsedMillis);
}
} | [
"private",
"void",
"stopContainerQuietly",
"(",
"final",
"String",
"image",
",",
"final",
"String",
"idOrName",
")",
"{",
"final",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"try",
"{",
"LOGGER",
".",
"info",
"(",
"\"Killing... | Utility method to stop a container with the given image name and id/name.
@param image
image name
@param idOrName
container id or name | [
"Utility",
"method",
"to",
"stop",
"a",
"container",
"with",
"the",
"given",
"image",
"name",
"and",
"id",
"/",
"name",
"."
] | train | https://github.com/arakelian/docker-junit-rule/blob/cc99d63896a07df398b53fd5f0f6e4777e3b23cf/src/main/java/com/arakelian/docker/junit/Container.java#L613-L626 |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.getMazePoints | public List<Point> getMazePoints() {
List<Point> points = new ArrayList<Point>();
for (int row = 0; row < this.rows; row++) {
for (int column = 0; column < this.columns; column++) {
points.add(new Point(column, row));
}
}
return points;
} | java | public List<Point> getMazePoints() {
List<Point> points = new ArrayList<Point>();
for (int row = 0; row < this.rows; row++) {
for (int column = 0; column < this.columns; column++) {
points.add(new Point(column, row));
}
}
return points;
} | [
"public",
"List",
"<",
"Point",
">",
"getMazePoints",
"(",
")",
"{",
"List",
"<",
"Point",
">",
"points",
"=",
"new",
"ArrayList",
"<",
"Point",
">",
"(",
")",
";",
"for",
"(",
"int",
"row",
"=",
"0",
";",
"row",
"<",
"this",
".",
"rows",
";",
... | Return all tiles (i,j) of the maze
@return List of points, from (0,0) to (m,n). | [
"Return",
"all",
"tiles",
"(",
"i",
"j",
")",
"of",
"the",
"maze"
] | train | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L235-L243 |
apache/incubator-shardingsphere | sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/SQLLogger.java | SQLLogger.logSQL | public static void logSQL(final String logicSQL, final Collection<String> dataSourceNames) {
log("Rule Type: master-slave");
log("SQL: {} ::: DataSources: {}", logicSQL, Joiner.on(",").join(dataSourceNames));
} | java | public static void logSQL(final String logicSQL, final Collection<String> dataSourceNames) {
log("Rule Type: master-slave");
log("SQL: {} ::: DataSources: {}", logicSQL, Joiner.on(",").join(dataSourceNames));
} | [
"public",
"static",
"void",
"logSQL",
"(",
"final",
"String",
"logicSQL",
",",
"final",
"Collection",
"<",
"String",
">",
"dataSourceNames",
")",
"{",
"log",
"(",
"\"Rule Type: master-slave\"",
")",
";",
"log",
"(",
"\"SQL: {} ::: DataSources: {}\"",
",",
"logicSQ... | Print SQL log for master slave rule.
@param logicSQL logic SQL
@param dataSourceNames data source names | [
"Print",
"SQL",
"log",
"for",
"master",
"slave",
"rule",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/SQLLogger.java#L46-L49 |
taskadapter/redmine-java-api | src/main/java/com/taskadapter/redmineapi/internal/Transport.java | Transport.deleteChildId | public <T> void deleteChildId(Class<?> parentClass, String parentId, T object, Integer value) throws RedmineException {
URI uri = getURIConfigurator().getChildIdURI(parentClass, parentId, object.getClass(), value);
HttpDelete httpDelete = new HttpDelete(uri);
String response = send(httpDelete);
logger.debug(response);
} | java | public <T> void deleteChildId(Class<?> parentClass, String parentId, T object, Integer value) throws RedmineException {
URI uri = getURIConfigurator().getChildIdURI(parentClass, parentId, object.getClass(), value);
HttpDelete httpDelete = new HttpDelete(uri);
String response = send(httpDelete);
logger.debug(response);
} | [
"public",
"<",
"T",
">",
"void",
"deleteChildId",
"(",
"Class",
"<",
"?",
">",
"parentClass",
",",
"String",
"parentId",
",",
"T",
"object",
",",
"Integer",
"value",
")",
"throws",
"RedmineException",
"{",
"URI",
"uri",
"=",
"getURIConfigurator",
"(",
")",... | Performs "delete child Id" request.
@param parentClass
parent object id.
@param object
object to use.
@param value
child object id.
@throws RedmineException
if something goes wrong. | [
"Performs",
"delete",
"child",
"Id",
"request",
"."
] | train | https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/internal/Transport.java#L311-L316 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/RowColumnResourcesImpl.java | RowColumnResourcesImpl.addImageToCell | public void addImageToCell(long sheetId, long rowId, long columnId, String file, String fileType) throws FileNotFoundException, SmartsheetException {
addImage("sheets/" + sheetId + "/rows/" + rowId + "/columns/" + columnId + "/cellimages", file, fileType, false, null);
} | java | public void addImageToCell(long sheetId, long rowId, long columnId, String file, String fileType) throws FileNotFoundException, SmartsheetException {
addImage("sheets/" + sheetId + "/rows/" + rowId + "/columns/" + columnId + "/cellimages", file, fileType, false, null);
} | [
"public",
"void",
"addImageToCell",
"(",
"long",
"sheetId",
",",
"long",
"rowId",
",",
"long",
"columnId",
",",
"String",
"file",
",",
"String",
"fileType",
")",
"throws",
"FileNotFoundException",
",",
"SmartsheetException",
"{",
"addImage",
"(",
"\"sheets/\"",
... | Add an image to a cell.
It mirrors the following Smartsheet REST API method: POST /sheets/{sheetId}/rows/{rowId}/columns/{columnId}/cellimages
Exceptions:
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ResourceNotFoundException : if the resource can not be found
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param sheetId the sheet Id
@param rowId the row id
@param columnId the column id
@param file the file path
@param fileType
@throws SmartsheetException the smartsheet exception
@throws FileNotFoundException image file not found | [
"Add",
"an",
"image",
"to",
"a",
"cell",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/RowColumnResourcesImpl.java#L151-L153 |
biezhi/anima | src/main/java/io/github/biezhi/anima/core/AnimaQuery.java | AnimaQuery.buildInsertSQL | private <S extends Model> String buildInsertSQL(S model, List<Object> columnValues) {
SQLParams sqlParams = SQLParams.builder()
.model(model)
.columnValues(columnValues)
.modelClass(this.modelClass)
.tableName(this.tableName)
.pkName(this.primaryKeyColumn)
.build();
return Anima.of().dialect().insert(sqlParams);
} | java | private <S extends Model> String buildInsertSQL(S model, List<Object> columnValues) {
SQLParams sqlParams = SQLParams.builder()
.model(model)
.columnValues(columnValues)
.modelClass(this.modelClass)
.tableName(this.tableName)
.pkName(this.primaryKeyColumn)
.build();
return Anima.of().dialect().insert(sqlParams);
} | [
"private",
"<",
"S",
"extends",
"Model",
">",
"String",
"buildInsertSQL",
"(",
"S",
"model",
",",
"List",
"<",
"Object",
">",
"columnValues",
")",
"{",
"SQLParams",
"sqlParams",
"=",
"SQLParams",
".",
"builder",
"(",
")",
".",
"model",
"(",
"model",
")",... | Build a insert statement.
@param model model instance
@param <S>
@return insert sql | [
"Build",
"a",
"insert",
"statement",
"."
] | train | https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/core/AnimaQuery.java#L1426-L1436 |
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.updateHierarchicalEntityChild | public OperationStatus updateHierarchicalEntityChild(UUID appId, String versionId, UUID hEntityId, UUID hChildId, UpdateHierarchicalEntityChildOptionalParameter updateHierarchicalEntityChildOptionalParameter) {
return updateHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, hChildId, updateHierarchicalEntityChildOptionalParameter).toBlocking().single().body();
} | java | public OperationStatus updateHierarchicalEntityChild(UUID appId, String versionId, UUID hEntityId, UUID hChildId, UpdateHierarchicalEntityChildOptionalParameter updateHierarchicalEntityChildOptionalParameter) {
return updateHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, hChildId, updateHierarchicalEntityChildOptionalParameter).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"updateHierarchicalEntityChild",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"hEntityId",
",",
"UUID",
"hChildId",
",",
"UpdateHierarchicalEntityChildOptionalParameter",
"updateHierarchicalEntityChildOptionalParameter",
")",
"{",
... | Renames a single child in an existing hierarchical entity model.
@param appId The application ID.
@param versionId The version ID.
@param hEntityId The hierarchical entity extractor ID.
@param hChildId The hierarchical entity extractor child ID.
@param updateHierarchicalEntityChildOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Renames",
"a",
"single",
"child",
"in",
"an",
"existing",
"hierarchical",
"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#L6341-L6343 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.