repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.deposit_depositId_paidBills_billId_debt_operation_GET | public ArrayList<Long> deposit_depositId_paidBills_billId_debt_operation_GET(String depositId, String billId, Long depositOrderId) throws IOException {
"""
All operations related to these debts
REST: GET /me/deposit/{depositId}/paidBills/{billId}/debt/operation
@param depositOrderId [required] Filter the value... | java | public ArrayList<Long> deposit_depositId_paidBills_billId_debt_operation_GET(String depositId, String billId, Long depositOrderId) throws IOException {
String qPath = "/me/deposit/{depositId}/paidBills/{billId}/debt/operation";
StringBuilder sb = path(qPath, depositId, billId);
query(sb, "depositOrderId", deposit... | [
"public",
"ArrayList",
"<",
"Long",
">",
"deposit_depositId_paidBills_billId_debt_operation_GET",
"(",
"String",
"depositId",
",",
"String",
"billId",
",",
"Long",
"depositOrderId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/deposit/{depositId}/paid... | All operations related to these debts
REST: GET /me/deposit/{depositId}/paidBills/{billId}/debt/operation
@param depositOrderId [required] Filter the value of depositOrderId property (=)
@param depositId [required]
@param billId [required] | [
"All",
"operations",
"related",
"to",
"these",
"debts"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3164-L3170 |
jkyamog/DeDS | sample_clients/java/src/main/java/nz/net/catalyst/mobile/dds/sample/DDSClient.java | DDSClient.jsonDecode | private static <T> T jsonDecode(String responseContent, TypeReference<T> valueTypeRef) throws IOException {
"""
Given a string and a type ref. Decode the string and return the values.
@param <T>
@param responseContent
@param valueTypeRef
@return
@throws IOException
"""
ObjectMapper mapper = new ... | java | private static <T> T jsonDecode(String responseContent, TypeReference<T> valueTypeRef) throws IOException {
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.<T>readValue(responseContent, valueTypeRef);
} catch (JsonGenerationException e) {
logger.severe("unable d... | [
"private",
"static",
"<",
"T",
">",
"T",
"jsonDecode",
"(",
"String",
"responseContent",
",",
"TypeReference",
"<",
"T",
">",
"valueTypeRef",
")",
"throws",
"IOException",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"try",
"{",
... | Given a string and a type ref. Decode the string and return the values.
@param <T>
@param responseContent
@param valueTypeRef
@return
@throws IOException | [
"Given",
"a",
"string",
"and",
"a",
"type",
"ref",
".",
"Decode",
"the",
"string",
"and",
"return",
"the",
"values",
"."
] | train | https://github.com/jkyamog/DeDS/blob/d8cf6a294a23daa8e8a92073827c73b1befe3fa1/sample_clients/java/src/main/java/nz/net/catalyst/mobile/dds/sample/DDSClient.java#L103-L116 |
samskivert/pythagoras | src/main/java/pythagoras/f/Quaternion.java | Quaternion.randomize | public Quaternion randomize (Random rand) {
"""
Sets this to a random rotation obtained from a completely uniform distribution.
"""
// pick angles according to the surface area distribution
return fromAngles(MathUtil.lerp(-FloatMath.PI, +FloatMath.PI, rand.nextFloat()),
... | java | public Quaternion randomize (Random rand) {
// pick angles according to the surface area distribution
return fromAngles(MathUtil.lerp(-FloatMath.PI, +FloatMath.PI, rand.nextFloat()),
FloatMath.asin(MathUtil.lerp(-1f, +1f, rand.nextFloat())),
MathUtil.l... | [
"public",
"Quaternion",
"randomize",
"(",
"Random",
"rand",
")",
"{",
"// pick angles according to the surface area distribution",
"return",
"fromAngles",
"(",
"MathUtil",
".",
"lerp",
"(",
"-",
"FloatMath",
".",
"PI",
",",
"+",
"FloatMath",
".",
"PI",
",",
"rand"... | Sets this to a random rotation obtained from a completely uniform distribution. | [
"Sets",
"this",
"to",
"a",
"random",
"rotation",
"obtained",
"from",
"a",
"completely",
"uniform",
"distribution",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Quaternion.java#L173-L178 |
Wikidata/Wikidata-Toolkit | wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/EntityIdValueImpl.java | EntityIdValueImpl.fromId | static EntityIdValue fromId(String id, String siteIri) {
"""
Parses an item id
@param id
the identifier of the entity, such as "Q42"
@param siteIri
the siteIRI that this value refers to
@throws IllegalArgumentException
if the id is invalid
"""
switch (guessEntityTypeFromId(id)) {
case EntityIdValu... | java | static EntityIdValue fromId(String id, String siteIri) {
switch (guessEntityTypeFromId(id)) {
case EntityIdValueImpl.JSON_ENTITY_TYPE_ITEM:
return new ItemIdValueImpl(id, siteIri);
case EntityIdValueImpl.JSON_ENTITY_TYPE_PROPERTY:
return new PropertyIdValueImpl(id, siteIri);
case EntityIdValueImpl.JS... | [
"static",
"EntityIdValue",
"fromId",
"(",
"String",
"id",
",",
"String",
"siteIri",
")",
"{",
"switch",
"(",
"guessEntityTypeFromId",
"(",
"id",
")",
")",
"{",
"case",
"EntityIdValueImpl",
".",
"JSON_ENTITY_TYPE_ITEM",
":",
"return",
"new",
"ItemIdValueImpl",
"(... | Parses an item id
@param id
the identifier of the entity, such as "Q42"
@param siteIri
the siteIRI that this value refers to
@throws IllegalArgumentException
if the id is invalid | [
"Parses",
"an",
"item",
"id"
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/EntityIdValueImpl.java#L117-L132 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ChameleonInstanceHolder.java | ChameleonInstanceHolder.fixLoggingSystem | public static void fixLoggingSystem(File basedir) {
"""
Fixes the Chameleon logging configuration to write the logs in the logs/wisdom.log file instead of chameleon.log
file.
@param basedir the base directory of the chameleon
"""
ILoggerFactory factory = LoggerFactory.getILoggerFactory();
i... | java | public static void fixLoggingSystem(File basedir) {
ILoggerFactory factory = LoggerFactory.getILoggerFactory();
if (factory instanceof LoggerContext) {
// We know that we are using logback from here.
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
... | [
"public",
"static",
"void",
"fixLoggingSystem",
"(",
"File",
"basedir",
")",
"{",
"ILoggerFactory",
"factory",
"=",
"LoggerFactory",
".",
"getILoggerFactory",
"(",
")",
";",
"if",
"(",
"factory",
"instanceof",
"LoggerContext",
")",
"{",
"// We know that we are using... | Fixes the Chameleon logging configuration to write the logs in the logs/wisdom.log file instead of chameleon.log
file.
@param basedir the base directory of the chameleon | [
"Fixes",
"the",
"Chameleon",
"logging",
"configuration",
"to",
"write",
"the",
"logs",
"in",
"the",
"logs",
"/",
"wisdom",
".",
"log",
"file",
"instead",
"of",
"chameleon",
".",
"log",
"file",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ChameleonInstanceHolder.java#L128-L161 |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/util/UIUtils.java | UIUtils.getStatusBarHeight | public static int getStatusBarHeight(Context context, boolean force) {
"""
helper to calculate the statusBar height
@param context
@param force pass true to get the height even if the device has no translucent statusBar
@return
"""
int result = 0;
int resourceId = context.getResources().... | java | public static int getStatusBarHeight(Context context, boolean force) {
int result = 0;
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = context.getResources().getDimensionPixelSize(resourceId);
}
... | [
"public",
"static",
"int",
"getStatusBarHeight",
"(",
"Context",
"context",
",",
"boolean",
"force",
")",
"{",
"int",
"result",
"=",
"0",
";",
"int",
"resourceId",
"=",
"context",
".",
"getResources",
"(",
")",
".",
"getIdentifier",
"(",
"\"status_bar_height\"... | helper to calculate the statusBar height
@param context
@param force pass true to get the height even if the device has no translucent statusBar
@return | [
"helper",
"to",
"calculate",
"the",
"statusBar",
"height"
] | train | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/util/UIUtils.java#L150-L165 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/ItemCounter.java | ItemCounter.descendingKeys | public List<T> descendingKeys() {
"""
Returns a List of keys in descending value order.
@return the list of keys
"""
List<T> list = new ArrayList<T>(map.keySet());
sort(list, new Comparator<T>() {
@Override
public int compare(T o1, T o2) {
MutableLong... | java | public List<T> descendingKeys() {
List<T> list = new ArrayList<T>(map.keySet());
sort(list, new Comparator<T>() {
@Override
public int compare(T o1, T o2) {
MutableLong l1 = map.get(o1);
MutableLong l2 = map.get(o2);
return compare... | [
"public",
"List",
"<",
"T",
">",
"descendingKeys",
"(",
")",
"{",
"List",
"<",
"T",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"T",
">",
"(",
"map",
".",
"keySet",
"(",
")",
")",
";",
"sort",
"(",
"list",
",",
"new",
"Comparator",
"<",
"T",
">"... | Returns a List of keys in descending value order.
@return the list of keys | [
"Returns",
"a",
"List",
"of",
"keys",
"in",
"descending",
"value",
"order",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/ItemCounter.java#L63-L80 |
dropwizard/metrics | metrics-core/src/main/java/com/codahale/metrics/MetricRegistry.java | MetricRegistry.getGauges | @SuppressWarnings("rawtypes")
public SortedMap<String, Gauge> getGauges(MetricFilter filter) {
"""
Returns a map of all the gauges in the registry and their names which match the given filter.
@param filter the metric filter to match
@return all the gauges in the registry
"""
return getMetrics(... | java | @SuppressWarnings("rawtypes")
public SortedMap<String, Gauge> getGauges(MetricFilter filter) {
return getMetrics(Gauge.class, filter);
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"SortedMap",
"<",
"String",
",",
"Gauge",
">",
"getGauges",
"(",
"MetricFilter",
"filter",
")",
"{",
"return",
"getMetrics",
"(",
"Gauge",
".",
"class",
",",
"filter",
")",
";",
"}"
] | Returns a map of all the gauges in the registry and their names which match the given filter.
@param filter the metric filter to match
@return all the gauges in the registry | [
"Returns",
"a",
"map",
"of",
"all",
"the",
"gauges",
"in",
"the",
"registry",
"and",
"their",
"names",
"which",
"match",
"the",
"given",
"filter",
"."
] | train | https://github.com/dropwizard/metrics/blob/3c6105a0b9b4416c59e16b6b841b123052d6f57d/metrics-core/src/main/java/com/codahale/metrics/MetricRegistry.java#L347-L350 |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/Utils.java | Utils.getInt | public static int getInt(ByteBuffer buf, int index) {
"""
Reads an int value from the buffer starting at the given index relative to the current
position() of the buffer, without mutating the buffer in any way (so it's thread safe).
"""
return buf.order() == BIG_ENDIAN ? getIntB(buf, index) : getIntL(... | java | public static int getInt(ByteBuffer buf, int index) {
return buf.order() == BIG_ENDIAN ? getIntB(buf, index) : getIntL(buf, index);
} | [
"public",
"static",
"int",
"getInt",
"(",
"ByteBuffer",
"buf",
",",
"int",
"index",
")",
"{",
"return",
"buf",
".",
"order",
"(",
")",
"==",
"BIG_ENDIAN",
"?",
"getIntB",
"(",
"buf",
",",
"index",
")",
":",
"getIntL",
"(",
"buf",
",",
"index",
")",
... | Reads an int value from the buffer starting at the given index relative to the current
position() of the buffer, without mutating the buffer in any way (so it's thread safe). | [
"Reads",
"an",
"int",
"value",
"from",
"the",
"buffer",
"starting",
"at",
"the",
"given",
"index",
"relative",
"to",
"the",
"current",
"position",
"()",
"of",
"the",
"buffer",
"without",
"mutating",
"the",
"buffer",
"in",
"any",
"way",
"(",
"so",
"it",
"... | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/Utils.java#L434-L436 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/provisioning/ImportApi.java | ImportApi.terminateImport | public void terminateImport() throws ProvisioningApiException {
"""
Stop import.
Terminates the current user import operation.
@throws ProvisioningApiException if the call is unsuccessful.
"""
try {
ApiSuccessResponse resp = importApi.terminateImport();
if (!resp.getStatus().getCode().equals(... | java | public void terminateImport() throws ProvisioningApiException {
try {
ApiSuccessResponse resp = importApi.terminateImport();
if (!resp.getStatus().getCode().equals(0)) {
throw new ProvisioningApiException("Error terminating import. Code: " + resp.getStatus().getCode());
}
} catch(... | [
"public",
"void",
"terminateImport",
"(",
")",
"throws",
"ProvisioningApiException",
"{",
"try",
"{",
"ApiSuccessResponse",
"resp",
"=",
"importApi",
".",
"terminateImport",
"(",
")",
";",
"if",
"(",
"!",
"resp",
".",
"getStatus",
"(",
")",
".",
"getCode",
"... | Stop import.
Terminates the current user import operation.
@throws ProvisioningApiException if the call is unsuccessful. | [
"Stop",
"import",
".",
"Terminates",
"the",
"current",
"user",
"import",
"operation",
"."
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/provisioning/ImportApi.java#L67-L78 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/common/Similarity.java | Similarity.goodmanKruskalGamma | public static double goodmanKruskalGamma(DoubleVector a, DoubleVector b) {
"""
Computes the <a
href="http://www.unesco.org/webworld/idams/advguide/Chapt4_2.htm">Goodman-Kruskal
Gamma coefficient</a>, which is preferrable to Kendall's τ and
Spearman's ρ when there are many ties in the data.
@throws Il... | java | public static double goodmanKruskalGamma(DoubleVector a, DoubleVector b) {
check(a, b);
// NOTE: slow n^2 version. Needs to be replaced at some point with the
// n-log-n method and to take into account sparse vectors. -jurgens
int length = a.length();
double numerator = 0;
... | [
"public",
"static",
"double",
"goodmanKruskalGamma",
"(",
"DoubleVector",
"a",
",",
"DoubleVector",
"b",
")",
"{",
"check",
"(",
"a",
",",
"b",
")",
";",
"// NOTE: slow n^2 version. Needs to be replaced at some point with the",
"// n-log-n method and to take into account spa... | Computes the <a
href="http://www.unesco.org/webworld/idams/advguide/Chapt4_2.htm">Goodman-Kruskal
Gamma coefficient</a>, which is preferrable to Kendall's τ and
Spearman's ρ when there are many ties in the data.
@throws IllegalArgumentException when the length of the two vectors are
not the same. | [
"Computes",
"the",
"<a",
"href",
"=",
"http",
":",
"//",
"www",
".",
"unesco",
".",
"org",
"/",
"webworld",
"/",
"idams",
"/",
"advguide",
"/",
"Chapt4_2",
".",
"htm",
">",
"Goodman",
"-",
"Kruskal",
"Gamma",
"coefficient<",
"/",
"a",
">",
"which",
"... | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/common/Similarity.java#L2241-L2278 |
yuvipanda/java-http-fluent | src/main/java/in/yuvi/http/fluent/Http.java | Http.asString | public static String asString(final HttpResponse response, final String encoding) {
"""
Converts a {@linkplain HttpResponse} to a String by calling {@link EntityUtils#toString(HttpEntity)} on its {@linkplain HttpEntity
entity}.
@param response
the {@linkplain HttpResponse response} to convert.
@param encodin... | java | public static String asString(final HttpResponse response, final String encoding) {
if (response == null) {
throw new NullPointerException();
}
final HttpEntity entity = response.getEntity();
if (entity == null) {
return null;
}
try {
... | [
"public",
"static",
"String",
"asString",
"(",
"final",
"HttpResponse",
"response",
",",
"final",
"String",
"encoding",
")",
"{",
"if",
"(",
"response",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"final",
"HttpEntity"... | Converts a {@linkplain HttpResponse} to a String by calling {@link EntityUtils#toString(HttpEntity)} on its {@linkplain HttpEntity
entity}.
@param response
the {@linkplain HttpResponse response} to convert.
@param encoding
the encoding to use for the conversion.
@throws NullPointerException
if the given response was n... | [
"Converts",
"a",
"{",
"@linkplain",
"HttpResponse",
"}",
"to",
"a",
"String",
"by",
"calling",
"{",
"@link",
"EntityUtils#toString",
"(",
"HttpEntity",
")",
"}",
"on",
"its",
"{",
"@linkplain",
"HttpEntity",
"entity",
"}",
"."
] | train | https://github.com/yuvipanda/java-http-fluent/blob/e1da03aa23671cc099f30b9d7afbe2fad829f250/src/main/java/in/yuvi/http/fluent/Http.java#L187-L202 |
apereo/cas | support/cas-server-support-spnego-webflow/src/main/java/org/apereo/cas/web/flow/SpnegoCredentialsAction.java | SpnegoCredentialsAction.setResponseHeader | private void setResponseHeader(final RequestContext context) {
"""
Sets the response header based on the retrieved token.
@param context the context
"""
val credential = WebUtils.getCredential(context);
if (credential == null) {
LOGGER.debug("No credential was provided. No respo... | java | private void setResponseHeader(final RequestContext context) {
val credential = WebUtils.getCredential(context);
if (credential == null) {
LOGGER.debug("No credential was provided. No response header set.");
return;
}
val response = WebUtils.getHttpServletRespon... | [
"private",
"void",
"setResponseHeader",
"(",
"final",
"RequestContext",
"context",
")",
"{",
"val",
"credential",
"=",
"WebUtils",
".",
"getCredential",
"(",
"context",
")",
";",
"if",
"(",
"credential",
"==",
"null",
")",
"{",
"LOGGER",
".",
"debug",
"(",
... | Sets the response header based on the retrieved token.
@param context the context | [
"Sets",
"the",
"response",
"header",
"based",
"on",
"the",
"retrieved",
"token",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-spnego-webflow/src/main/java/org/apereo/cas/web/flow/SpnegoCredentialsAction.java#L105-L129 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getStoryInfo | public void getStoryInfo(int[] ids, Callback<List<Story>> callback) throws GuildWars2Exception, NullPointerException {
"""
For more info on stories API go <a href="https://wiki.guildwars2.com/wiki/API:2/stories">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#... | java | public void getStoryInfo(int[] ids, Callback<List<Story>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getStoryInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getStoryInfo",
"(",
"int",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"Story",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ids",
"... | For more info on stories API go <a href="https://wiki.guildwars2.com/wiki/API:2/stories">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of story id
@param callback callback that is go... | [
"For",
"more",
"info",
"on",
"stories",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"stories",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2437-L2440 |
prestodb/presto | presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/ColumnCardinalityCache.java | ColumnCardinalityCache.getColumnCardinality | public long getColumnCardinality(String schema, String table, Authorizations auths, String family, String qualifier, Collection<Range> colValues)
throws ExecutionException {
"""
Gets the column cardinality for all of the given range values. May reach out to the
metrics table in Accumulo to retrieve ne... | java | public long getColumnCardinality(String schema, String table, Authorizations auths, String family, String qualifier, Collection<Range> colValues)
throws ExecutionException
{
LOG.debug("Getting cardinality for %s:%s", family, qualifier);
// Collect all exact Accumulo Ranges, i.e. single ... | [
"public",
"long",
"getColumnCardinality",
"(",
"String",
"schema",
",",
"String",
"table",
",",
"Authorizations",
"auths",
",",
"String",
"family",
",",
"String",
"qualifier",
",",
"Collection",
"<",
"Range",
">",
"colValues",
")",
"throws",
"ExecutionException",
... | Gets the column cardinality for all of the given range values. May reach out to the
metrics table in Accumulo to retrieve new cache elements.
@param schema Table schema
@param table Table name
@param auths Scan authorizations
@param family Accumulo column family
@param qualifier Accumulo column qualifier
@param colVal... | [
"Gets",
"the",
"column",
"cardinality",
"for",
"all",
"of",
"the",
"given",
"range",
"values",
".",
"May",
"reach",
"out",
"to",
"the",
"metrics",
"table",
"in",
"Accumulo",
"to",
"retrieve",
"new",
"cache",
"elements",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/ColumnCardinalityCache.java#L188-L220 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/vector/AmortizedSparseVector.java | AmortizedSparseVector.set | public void set(int index, double value) {
"""
{@inheritDoc}
All read operations, and writes to indices which already exist are of
time O(log n). Writers to new indices are of time O(log n).
"""
checkIndex(index);
IndexValue item = new IndexValue(index, 0);
int valueIndex = Collec... | java | public void set(int index, double value) {
checkIndex(index);
IndexValue item = new IndexValue(index, 0);
int valueIndex = Collections.binarySearch(values, item, comp);
if (valueIndex >= 0 && value != 0d) {
// Replace a currently existing item with a non zero value.
... | [
"public",
"void",
"set",
"(",
"int",
"index",
",",
"double",
"value",
")",
"{",
"checkIndex",
"(",
"index",
")",
";",
"IndexValue",
"item",
"=",
"new",
"IndexValue",
"(",
"index",
",",
"0",
")",
";",
"int",
"valueIndex",
"=",
"Collections",
".",
"binar... | {@inheritDoc}
All read operations, and writes to indices which already exist are of
time O(log n). Writers to new indices are of time O(log n). | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/vector/AmortizedSparseVector.java#L140-L156 |
elki-project/elki | elki-docutil/src/main/java/de/lmu/ifi/dbs/elki/utilities/xml/HTMLUtil.java | HTMLUtil.appendMultilineText | public static Element appendMultilineText(Document htmldoc, Element parent, String text) {
"""
Append a multiline text to a node, transforming linewraps into BR tags.
@param htmldoc Document
@param parent Parent node
@param text Text to add.
@return parent node
"""
String[] parts = text != null ? tex... | java | public static Element appendMultilineText(Document htmldoc, Element parent, String text) {
String[] parts = text != null ? text.split("\n") : null;
if(parts == null || parts.length == 0) {
return parent;
}
parent.appendChild(htmldoc.createTextNode(parts[0]));
for(int i = 1; i < parts.length; i... | [
"public",
"static",
"Element",
"appendMultilineText",
"(",
"Document",
"htmldoc",
",",
"Element",
"parent",
",",
"String",
"text",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"text",
"!=",
"null",
"?",
"text",
".",
"split",
"(",
"\"\\n\"",
")",
":",
"nul... | Append a multiline text to a node, transforming linewraps into BR tags.
@param htmldoc Document
@param parent Parent node
@param text Text to add.
@return parent node | [
"Append",
"a",
"multiline",
"text",
"to",
"a",
"node",
"transforming",
"linewraps",
"into",
"BR",
"tags",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-docutil/src/main/java/de/lmu/ifi/dbs/elki/utilities/xml/HTMLUtil.java#L294-L305 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java | Utils.copyStream | public static void copyStream( File inputFile, OutputStream os ) throws IOException {
"""
Copies the content from inputFile into an output stream.
@param inputFile an input file (must be a file and exist)
@param os the output stream
@throws IOException if something went wrong
"""
InputStream is = new Fi... | java | public static void copyStream( File inputFile, OutputStream os ) throws IOException {
InputStream is = new FileInputStream( inputFile );
try {
copyStreamUnsafelyUseWithCaution( is, os );
} finally {
is.close();
}
} | [
"public",
"static",
"void",
"copyStream",
"(",
"File",
"inputFile",
",",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"new",
"FileInputStream",
"(",
"inputFile",
")",
";",
"try",
"{",
"copyStreamUnsafelyUseWithCaution",
"(",
... | Copies the content from inputFile into an output stream.
@param inputFile an input file (must be a file and exist)
@param os the output stream
@throws IOException if something went wrong | [
"Copies",
"the",
"content",
"from",
"inputFile",
"into",
"an",
"output",
"stream",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java#L388-L395 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/list/AbstractByteList.java | AbstractByteList.addAllOfFromTo | public void addAllOfFromTo(AbstractByteList other, int from, int to) {
"""
Appends the part of the specified list between <code>from</code> (inclusive) and <code>to</code> (inclusive) to the receiver.
@param other the list to be added to the receiver.
@param from the index of the first element to be appended (... | java | public void addAllOfFromTo(AbstractByteList other, int from, int to) {
beforeInsertAllOfFromTo(size,other,from,to);
} | [
"public",
"void",
"addAllOfFromTo",
"(",
"AbstractByteList",
"other",
",",
"int",
"from",
",",
"int",
"to",
")",
"{",
"beforeInsertAllOfFromTo",
"(",
"size",
",",
"other",
",",
"from",
",",
"to",
")",
";",
"}"
] | Appends the part of the specified list between <code>from</code> (inclusive) and <code>to</code> (inclusive) to the receiver.
@param other the list to be added to the receiver.
@param from the index of the first element to be appended (inclusive).
@param to the index of the last element to be appended (inclusive).
@ex... | [
"Appends",
"the",
"part",
"of",
"the",
"specified",
"list",
"between",
"<code",
">",
"from<",
"/",
"code",
">",
"(",
"inclusive",
")",
"and",
"<code",
">",
"to<",
"/",
"code",
">",
"(",
"inclusive",
")",
"to",
"the",
"receiver",
"."
] | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/AbstractByteList.java#L45-L47 |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java | ParameterTool.getDouble | public double getDouble(String key, double defaultValue) {
"""
Returns the Double value for the given key. If the key does not exists it will return the default value given.
The method fails if the value is not a Double.
"""
addToDefaults(key, Double.toString(defaultValue));
String value = get(key);
if ... | java | public double getDouble(String key, double defaultValue) {
addToDefaults(key, Double.toString(defaultValue));
String value = get(key);
if (value == null) {
return defaultValue;
} else {
return Double.valueOf(value);
}
} | [
"public",
"double",
"getDouble",
"(",
"String",
"key",
",",
"double",
"defaultValue",
")",
"{",
"addToDefaults",
"(",
"key",
",",
"Double",
".",
"toString",
"(",
"defaultValue",
")",
")",
";",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
... | Returns the Double value for the given key. If the key does not exists it will return the default value given.
The method fails if the value is not a Double. | [
"Returns",
"the",
"Double",
"value",
"for",
"the",
"given",
"key",
".",
"If",
"the",
"key",
"does",
"not",
"exists",
"it",
"will",
"return",
"the",
"default",
"value",
"given",
".",
"The",
"method",
"fails",
"if",
"the",
"value",
"is",
"not",
"a",
"Dou... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L371-L379 |
alibaba/jstorm | jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/spout/FileLock.java | FileLock.tryLock | public static FileLock tryLock(FileSystem fs, Path fileToLock, Path lockDirPath, String spoutId)
throws IOException {
"""
returns lock on file or null if file is already locked. throws if unexpected problem
"""
Path lockFile = new Path(lockDirPath, fileToLock.getName());
try {
FSDataOu... | java | public static FileLock tryLock(FileSystem fs, Path fileToLock, Path lockDirPath, String spoutId)
throws IOException {
Path lockFile = new Path(lockDirPath, fileToLock.getName());
try {
FSDataOutputStream ostream = HdfsUtils.tryCreateFile(fs, lockFile);
if (ostream != null) {
LOG.d... | [
"public",
"static",
"FileLock",
"tryLock",
"(",
"FileSystem",
"fs",
",",
"Path",
"fileToLock",
",",
"Path",
"lockDirPath",
",",
"String",
"spoutId",
")",
"throws",
"IOException",
"{",
"Path",
"lockFile",
"=",
"new",
"Path",
"(",
"lockDirPath",
",",
"fileToLock... | returns lock on file or null if file is already locked. throws if unexpected problem | [
"returns",
"lock",
"on",
"file",
"or",
"null",
"if",
"file",
"is",
"already",
"locked",
".",
"throws",
"if",
"unexpected",
"problem"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/spout/FileLock.java#L113-L130 |
googleapis/google-oauth-java-client | google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/Credential.java | Credential.executeRefreshToken | protected TokenResponse executeRefreshToken() throws IOException {
"""
Executes a request for new credentials from the token server.
<p>
The default implementation calls {@link RefreshTokenRequest#execute()} using the
{@link #getTransport()}, {@link #getJsonFactory()}, {@link #getRequestInitializer()},
{@lin... | java | protected TokenResponse executeRefreshToken() throws IOException {
if (refreshToken == null) {
return null;
}
return new RefreshTokenRequest(transport, jsonFactory, new GenericUrl(tokenServerEncodedUrl),
refreshToken).setClientAuthentication(clientAuthentication)
.setRequestInitializer... | [
"protected",
"TokenResponse",
"executeRefreshToken",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"refreshToken",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"RefreshTokenRequest",
"(",
"transport",
",",
"jsonFactory",
",",
"new",
... | Executes a request for new credentials from the token server.
<p>
The default implementation calls {@link RefreshTokenRequest#execute()} using the
{@link #getTransport()}, {@link #getJsonFactory()}, {@link #getRequestInitializer()},
{@link #getTokenServerEncodedUrl()}, {@link #getRefreshToken()}, and the
{@link #getCl... | [
"Executes",
"a",
"request",
"for",
"new",
"credentials",
"from",
"the",
"token",
"server",
"."
] | train | https://github.com/googleapis/google-oauth-java-client/blob/7a829f8fd4d216c7d5882a82b9b58930fb375592/google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/Credential.java#L571-L578 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/NotificationManager.java | NotificationManager.getInboxIfAvailable | private ClientNotificationArea getInboxIfAvailable(int clientID, JSONConverter converter) {
"""
This method returns the client inbox or throws an error if the client ID has timed out
"""
final ClientNotificationArea inbox = inboxes.get(clientID);
if (inbox == null) {
throw ErrorHel... | java | private ClientNotificationArea getInboxIfAvailable(int clientID, JSONConverter converter) {
final ClientNotificationArea inbox = inboxes.get(clientID);
if (inbox == null) {
throw ErrorHelper.createRESTHandlerJsonException(new RuntimeException("The requested clientID is no longer available b... | [
"private",
"ClientNotificationArea",
"getInboxIfAvailable",
"(",
"int",
"clientID",
",",
"JSONConverter",
"converter",
")",
"{",
"final",
"ClientNotificationArea",
"inbox",
"=",
"inboxes",
".",
"get",
"(",
"clientID",
")",
";",
"if",
"(",
"inbox",
"==",
"null",
... | This method returns the client inbox or throws an error if the client ID has timed out | [
"This",
"method",
"returns",
"the",
"client",
"inbox",
"or",
"throws",
"an",
"error",
"if",
"the",
"client",
"ID",
"has",
"timed",
"out"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/NotificationManager.java#L424-L434 |
Stratio/deep-spark | deep-jdbc/src/main/java/com/stratio/deep/jdbc/utils/UtilJdbc.java | UtilJdbc.getObjectFromRow | public static <T, S extends DeepJobConfig> T getObjectFromRow(Class<T> classEntity, Map<String, Object> row, DeepJobConfig<T, S> config) throws IllegalAccessException, InstantiationException, InvocationTargetException {
"""
Returns a Stratio Entity from a Jdbc row represented as a map.
@param classEntity Stratio ... | java | public static <T, S extends DeepJobConfig> T getObjectFromRow(Class<T> classEntity, Map<String, Object> row, DeepJobConfig<T, S> config) throws IllegalAccessException, InstantiationException, InvocationTargetException {
T t = classEntity.newInstance();
Field[] fields = AnnotationUtils.filterDeepFields(c... | [
"public",
"static",
"<",
"T",
",",
"S",
"extends",
"DeepJobConfig",
">",
"T",
"getObjectFromRow",
"(",
"Class",
"<",
"T",
">",
"classEntity",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"row",
",",
"DeepJobConfig",
"<",
"T",
",",
"S",
">",
"config",... | Returns a Stratio Entity from a Jdbc row represented as a map.
@param classEntity Stratio Entity.
@param row Jdbc row represented as a Map.
@param config JDBC Deep Job configuration.
@param <T> Stratio Entity class.
@return Stratio Entity from a Jdbc row represented as a map.
@throws IllegalAccessException
@throws Inst... | [
"Returns",
"a",
"Stratio",
"Entity",
"from",
"a",
"Jdbc",
"row",
"represented",
"as",
"a",
"map",
"."
] | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-jdbc/src/main/java/com/stratio/deep/jdbc/utils/UtilJdbc.java#L53-L76 |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java | SipApplicationSessionImpl.removeServletTimer | public void removeServletTimer(ServletTimer servletTimer, boolean updateAppSessionReadyToInvalidateState) {
"""
Remove a servlet timer from this application session
@param servletTimer the servlet timer to remove
"""
if(servletTimers != null) {
servletTimers.remove(servletTimer.getId());
}
if(upd... | java | public void removeServletTimer(ServletTimer servletTimer, boolean updateAppSessionReadyToInvalidateState){
if(servletTimers != null) {
servletTimers.remove(servletTimer.getId());
}
if(updateAppSessionReadyToInvalidateState) {
updateReadyToInvalidateState();
}
} | [
"public",
"void",
"removeServletTimer",
"(",
"ServletTimer",
"servletTimer",
",",
"boolean",
"updateAppSessionReadyToInvalidateState",
")",
"{",
"if",
"(",
"servletTimers",
"!=",
"null",
")",
"{",
"servletTimers",
".",
"remove",
"(",
"servletTimer",
".",
"getId",
"(... | Remove a servlet timer from this application session
@param servletTimer the servlet timer to remove | [
"Remove",
"a",
"servlet",
"timer",
"from",
"this",
"application",
"session"
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java#L609-L616 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/VoiceApi.java | VoiceApi.startRecording | public ApiSuccessResponse startRecording(String id, StartRecordingBody startRecordingBody) throws ApiException {
"""
Start recording a call
Start recording the specified call. Recording stops when the call is completed or you send [/voice/calls/{id}/stop-recording](/reference/workspace/Voice/index.html#stopRecord... | java | public ApiSuccessResponse startRecording(String id, StartRecordingBody startRecordingBody) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = startRecordingWithHttpInfo(id, startRecordingBody);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"startRecording",
"(",
"String",
"id",
",",
"StartRecordingBody",
"startRecordingBody",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"startRecordingWithHttpInfo",
"(",
"id",
",",
"startRe... | Start recording a call
Start recording the specified call. Recording stops when the call is completed or you send [/voice/calls/{id}/stop-recording](/reference/workspace/Voice/index.html#stopRecording) on either the call or the DN.
@param id The connection ID of the call. (required)
@param startRecordingBody Request pa... | [
"Start",
"recording",
"a",
"call",
"Start",
"recording",
"the",
"specified",
"call",
".",
"Recording",
"stops",
"when",
"the",
"call",
"is",
"completed",
"or",
"you",
"send",
"[",
"/",
"voice",
"/",
"calls",
"/",
"{",
"id",
"}",
"/",
"stop",
"-",
"reco... | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L4596-L4599 |
offbynull/coroutines | instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/MethodHasher.java | MethodHasher.dumpBytecode | private static byte[] dumpBytecode(MethodNode methodNode) {
"""
Takes into account the instructions and operands, as well as the overall structure.
"""
// Calculate label offsets -- required for hash calculation
// we only care about where the labels are in relation to the opcode instructions... | java | private static byte[] dumpBytecode(MethodNode methodNode) {
// Calculate label offsets -- required for hash calculation
// we only care about where the labels are in relation to the opcode instructions -- we don't care about things like
// LocalVariableNode or other ancillary data because th... | [
"private",
"static",
"byte",
"[",
"]",
"dumpBytecode",
"(",
"MethodNode",
"methodNode",
")",
"{",
"// Calculate label offsets -- required for hash calculation",
"// we only care about where the labels are in relation to the opcode instructions -- we don't care about things like",
"// Local... | Takes into account the instructions and operands, as well as the overall structure. | [
"Takes",
"into",
"account",
"the",
"instructions",
"and",
"operands",
"as",
"well",
"as",
"the",
"overall",
"structure",
"."
] | train | https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/MethodHasher.java#L60-L85 |
alibaba/canal | client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/rest/CommonRest.java | CommonRest.etl | @PutMapping("/syncSwitch/ {
"""
实例同步开关 curl http://127.0.0.1:8081/syncSwitch/example/off -X PUT
@param destination 实例名称
@param status 开关状态: off on
@return
"""destination}/{status}")
public Result etl(@PathVariable String destination, @PathVariable String status) {
if (status.equals("on")) {
... | java | @PutMapping("/syncSwitch/{destination}/{status}")
public Result etl(@PathVariable String destination, @PathVariable String status) {
if (status.equals("on")) {
syncSwitch.on(destination);
logger.info("#Destination: {} sync on", destination);
return Result.createSuccess("实... | [
"@",
"PutMapping",
"(",
"\"/syncSwitch/{destination}/{status}\"",
")",
"public",
"Result",
"etl",
"(",
"@",
"PathVariable",
"String",
"destination",
",",
"@",
"PathVariable",
"String",
"status",
")",
"{",
"if",
"(",
"status",
".",
"equals",
"(",
"\"on\"",
")",
... | 实例同步开关 curl http://127.0.0.1:8081/syncSwitch/example/off -X PUT
@param destination 实例名称
@param status 开关状态: off on
@return | [
"实例同步开关",
"curl",
"http",
":",
"//",
"127",
".",
"0",
".",
"0",
".",
"1",
":",
"8081",
"/",
"syncSwitch",
"/",
"example",
"/",
"off",
"-",
"X",
"PUT"
] | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/rest/CommonRest.java#L182-L198 |
algolia/instantsearch-android | core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java | Searcher.setFacet | @SuppressWarnings( {
"""
Sets a given facet as disjunctive or conjunctive.
@param attribute The facet's name.
@param isDisjunctive {@code true} to treat this facet as disjunctive (`OR`), false to treat it as conjunctive (`AND`, the default).
@return this {@link Searcher} for chaining.
""""WeakerAccess", "... | java | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public Searcher setFacet(@NonNull String attribute, boolean isDisjunctive) {
if (isDisjunctive && !disjunctiveFacets.contains(attribute)) {
disjunctiveFacets.add(attribute);
} else {
disjunctiveFacets.remove(a... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"unused\"",
"}",
")",
"// For library users",
"public",
"Searcher",
"setFacet",
"(",
"@",
"NonNull",
"String",
"attribute",
",",
"boolean",
"isDisjunctive",
")",
"{",
"if",
"(",
"isDisjunctive",
"&&",
... | Sets a given facet as disjunctive or conjunctive.
@param attribute The facet's name.
@param isDisjunctive {@code true} to treat this facet as disjunctive (`OR`), false to treat it as conjunctive (`AND`, the default).
@return this {@link Searcher} for chaining. | [
"Sets",
"a",
"given",
"facet",
"as",
"disjunctive",
"or",
"conjunctive",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java#L528-L536 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/util/ColorHelper.java | ColorHelper.fromRGB | public static Color fromRGB(final int red, final int green, final int blue) {
"""
Create a color from RGB values
@param red the red value, between 0-255
@param green the green value, between 0-255
@param blue the blue value, between 0-255
@return the color
"""
if (ColorHelper.helper == null)
... | java | public static Color fromRGB(final int red, final int green, final int blue) {
if (ColorHelper.helper == null)
ColorHelper.helper = new ColorHelper();
return ColorHelper.helper.getFromRGB(red, green, blue);
} | [
"public",
"static",
"Color",
"fromRGB",
"(",
"final",
"int",
"red",
",",
"final",
"int",
"green",
",",
"final",
"int",
"blue",
")",
"{",
"if",
"(",
"ColorHelper",
".",
"helper",
"==",
"null",
")",
"ColorHelper",
".",
"helper",
"=",
"new",
"ColorHelper",
... | Create a color from RGB values
@param red the red value, between 0-255
@param green the green value, between 0-255
@param blue the blue value, between 0-255
@return the color | [
"Create",
"a",
"color",
"from",
"RGB",
"values"
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/util/ColorHelper.java#L48-L52 |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java | TypicalLoginAssist.doLogin | protected void doLogin(LoginCredential credential, LoginSpecifiedOption option) throws LoginFailureException {
"""
Do actually login for the user by credential.
@param credential The login credential for the login user. (NotNull)
@param option The option of login specified by caller. (NotNull)
@throws LoginFail... | java | protected void doLogin(LoginCredential credential, LoginSpecifiedOption option) throws LoginFailureException {
handleLoginSuccess(findLoginUser(credential).orElseThrow(() -> {
final String msg = "Not found the user by the credential: " + credential + ", " + option;
return handleLoginFail... | [
"protected",
"void",
"doLogin",
"(",
"LoginCredential",
"credential",
",",
"LoginSpecifiedOption",
"option",
")",
"throws",
"LoginFailureException",
"{",
"handleLoginSuccess",
"(",
"findLoginUser",
"(",
"credential",
")",
".",
"orElseThrow",
"(",
"(",
")",
"->",
"{"... | Do actually login for the user by credential.
@param credential The login credential for the login user. (NotNull)
@param option The option of login specified by caller. (NotNull)
@throws LoginFailureException When it fails to do login by the user info. | [
"Do",
"actually",
"login",
"for",
"the",
"user",
"by",
"credential",
"."
] | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java#L280-L285 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java | Utils.findMethod | public ExecutableElement findMethod(TypeElement te, ExecutableElement method) {
"""
Search for the given method in the given class.
@param te Class to search into.
@param method Method to be searched.
@return ExecutableElement Method found, null otherwise.
"""
for (Element m : getMetho... | java | public ExecutableElement findMethod(TypeElement te, ExecutableElement method) {
for (Element m : getMethods(te)) {
if (executableMembersEqual(method, (ExecutableElement)m)) {
return (ExecutableElement)m;
}
}
return null;
} | [
"public",
"ExecutableElement",
"findMethod",
"(",
"TypeElement",
"te",
",",
"ExecutableElement",
"method",
")",
"{",
"for",
"(",
"Element",
"m",
":",
"getMethods",
"(",
"te",
")",
")",
"{",
"if",
"(",
"executableMembersEqual",
"(",
"method",
",",
"(",
"Execu... | Search for the given method in the given class.
@param te Class to search into.
@param method Method to be searched.
@return ExecutableElement Method found, null otherwise. | [
"Search",
"for",
"the",
"given",
"method",
"in",
"the",
"given",
"class",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java#L200-L207 |
mojohaus/aspectj-maven-plugin | src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java | AjcHelper.readBuildConfigFile | public static List<String> readBuildConfigFile( String fileName, File outputDir )
throws IOException {
"""
Reads a build config file, and returns the List of all compiler arguments.
@param fileName the filename of the argfile
@param outputDir the build output area
@return
@throws IOException
"""
... | java | public static List<String> readBuildConfigFile( String fileName, File outputDir )
throws IOException
{
List<String> arguments = new ArrayList<String>();
File argFile = new File( outputDir, fileName );
if ( FileUtils.fileExists( argFile.getAbsolutePath() ) )
{
File... | [
"public",
"static",
"List",
"<",
"String",
">",
"readBuildConfigFile",
"(",
"String",
"fileName",
",",
"File",
"outputDir",
")",
"throws",
"IOException",
"{",
"List",
"<",
"String",
">",
"arguments",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
"... | Reads a build config file, and returns the List of all compiler arguments.
@param fileName the filename of the argfile
@param outputDir the build output area
@return
@throws IOException | [
"Reads",
"a",
"build",
"config",
"file",
"and",
"returns",
"the",
"List",
"of",
"all",
"compiler",
"arguments",
"."
] | train | https://github.com/mojohaus/aspectj-maven-plugin/blob/120ee1ce08b93873931035ed98cd70e3ccceeefb/src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java#L264-L285 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderItemUrl.java | OrderItemUrl.createOrderItemUrl | public static MozuUrl createOrderItemUrl(String orderId, String responseFields, Boolean skipInventoryCheck, String updateMode, String version) {
"""
Get Resource Url for CreateOrderItem
@param orderId Unique identifier of the order.
@param responseFields Filtering syntax appended to an API call to increase or de... | java | public static MozuUrl createOrderItemUrl(String orderId, String responseFields, Boolean skipInventoryCheck, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items?updatemode={updateMode}&version={version}&skipInventoryCheck={skipInventoryCheck}&response... | [
"public",
"static",
"MozuUrl",
"createOrderItemUrl",
"(",
"String",
"orderId",
",",
"String",
"responseFields",
",",
"Boolean",
"skipInventoryCheck",
",",
"String",
"updateMode",
",",
"String",
"version",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormat... | Get Resource Url for CreateOrderItem
@param orderId Unique identifier of the order.
@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... | [
"Get",
"Resource",
"Url",
"for",
"CreateOrderItem"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderItemUrl.java#L77-L86 |
finmath/finmath-lib | src/main/java6/net/finmath/marketdata/products/SwapAnnuity.java | SwapAnnuity.getSwapAnnuity | public static double getSwapAnnuity(ScheduleInterface schedule, DiscountCurveInterface discountCurve) {
"""
Function to calculate an (idealized) swap annuity for a given schedule and discount curve.
Note: This method will consider evaluationTime being 0, see {@link net.finmath.marketdata.products.SwapAnnuity#ge... | java | public static double getSwapAnnuity(ScheduleInterface schedule, DiscountCurveInterface discountCurve) {
double evaluationTime = 0.0; // Consider only payment time > 0
return getSwapAnnuity(evaluationTime, schedule, discountCurve, null);
} | [
"public",
"static",
"double",
"getSwapAnnuity",
"(",
"ScheduleInterface",
"schedule",
",",
"DiscountCurveInterface",
"discountCurve",
")",
"{",
"double",
"evaluationTime",
"=",
"0.0",
";",
"// Consider only payment time > 0",
"return",
"getSwapAnnuity",
"(",
"evaluationTime... | Function to calculate an (idealized) swap annuity for a given schedule and discount curve.
Note: This method will consider evaluationTime being 0, see {@link net.finmath.marketdata.products.SwapAnnuity#getSwapAnnuity(double, ScheduleInterface, DiscountCurveInterface, AnalyticModelInterface)}.
@param schedule The sche... | [
"Function",
"to",
"calculate",
"an",
"(",
"idealized",
")",
"swap",
"annuity",
"for",
"a",
"given",
"schedule",
"and",
"discount",
"curve",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/products/SwapAnnuity.java#L83-L86 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationauthnprofile.java | authenticationauthnprofile.get | public static authenticationauthnprofile get(nitro_service service, String name) throws Exception {
"""
Use this API to fetch authenticationauthnprofile resource of given name .
"""
authenticationauthnprofile obj = new authenticationauthnprofile();
obj.set_name(name);
authenticationauthnprofile response ... | java | public static authenticationauthnprofile get(nitro_service service, String name) throws Exception{
authenticationauthnprofile obj = new authenticationauthnprofile();
obj.set_name(name);
authenticationauthnprofile response = (authenticationauthnprofile) obj.get_resource(service);
return response;
} | [
"public",
"static",
"authenticationauthnprofile",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"authenticationauthnprofile",
"obj",
"=",
"new",
"authenticationauthnprofile",
"(",
")",
";",
"obj",
".",
"set_name",
"(... | Use this API to fetch authenticationauthnprofile resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"authenticationauthnprofile",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationauthnprofile.java#L356-L361 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/resource/ClassPathResource.java | ClassPathResource.getInputStream | @Nullable
public static InputStream getInputStream (@Nonnull @Nonempty final String sPath) {
"""
Get the input stream for the specified path using automatic class loader
handling. The class loaders are iterated in the following order:
<ol>
<li>Default class loader (usually the context class loader)</li>
<li>... | java | @Nullable
public static InputStream getInputStream (@Nonnull @Nonempty final String sPath)
{
final URL aURL = URLHelper.getClassPathURL (sPath);
return _getInputStream (sPath, aURL, (ClassLoader) null);
} | [
"@",
"Nullable",
"public",
"static",
"InputStream",
"getInputStream",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sPath",
")",
"{",
"final",
"URL",
"aURL",
"=",
"URLHelper",
".",
"getClassPathURL",
"(",
"sPath",
")",
";",
"return",
"_getInputStre... | Get the input stream for the specified path using automatic class loader
handling. The class loaders are iterated in the following order:
<ol>
<li>Default class loader (usually the context class loader)</li>
<li>The class loader of this class</li>
<li>The system class loader</li>
</ol>
@param sPath
The path to be reso... | [
"Get",
"the",
"input",
"stream",
"for",
"the",
"specified",
"path",
"using",
"automatic",
"class",
"loader",
"handling",
".",
"The",
"class",
"loaders",
"are",
"iterated",
"in",
"the",
"following",
"order",
":",
"<ol",
">",
"<li",
">",
"Default",
"class",
... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/resource/ClassPathResource.java#L232-L237 |
Faylixe/googlecodejam-client | src/main/java/fr/faylixe/googlecodejam/client/Round.java | Round.fromURL | public static Round fromURL(final String url, final String cookie) throws GeneralSecurityException, IOException {
"""
<p>Static factory method that creates a round from the
given <tt>url</tt>.</p>
@param url Round url.
@param cookie Cookie value to use for retrieving contest.
@return Created round.
@throws ... | java | public static Round fromURL(final String url, final String cookie) throws GeneralSecurityException, IOException {
final HttpRequestExecutor executor = HttpRequestExecutor.create(Request.getHostname(), cookie);
final InitialValues values = InitialValues.get(executor, new Round("", "", url));
return new Round(UNKNO... | [
"public",
"static",
"Round",
"fromURL",
"(",
"final",
"String",
"url",
",",
"final",
"String",
"cookie",
")",
"throws",
"GeneralSecurityException",
",",
"IOException",
"{",
"final",
"HttpRequestExecutor",
"executor",
"=",
"HttpRequestExecutor",
".",
"create",
"(",
... | <p>Static factory method that creates a round from the
given <tt>url</tt>.</p>
@param url Round url.
@param cookie Cookie value to use for retrieving contest.
@return Created round.
@throws IOException If any error occurs while retrieving round information.
@throws GeneralSecurityException If any error occurs while cr... | [
"<p",
">",
"Static",
"factory",
"method",
"that",
"creates",
"a",
"round",
"from",
"the",
"given",
"<tt",
">",
"url<",
"/",
"tt",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/Faylixe/googlecodejam-client/blob/84a5fed4e049dca48994dc3f70213976aaff4bd3/src/main/java/fr/faylixe/googlecodejam/client/Round.java#L120-L124 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.getAppChatRoomInfo | public ChatRoomListResult getAppChatRoomInfo(int start, int count)
throws APIConnectionException, APIRequestException {
"""
Get application's chat room list
@param start start index
@param count list count
@return {@link ChatRoomListResult}
@throws APIConnectionException connect exception
@throw... | java | public ChatRoomListResult getAppChatRoomInfo(int start, int count)
throws APIConnectionException, APIRequestException {
return _chatRoomClient.getAppChatRoomInfo(start, count);
} | [
"public",
"ChatRoomListResult",
"getAppChatRoomInfo",
"(",
"int",
"start",
",",
"int",
"count",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_chatRoomClient",
".",
"getAppChatRoomInfo",
"(",
"start",
",",
"count",
")",
";",
"}... | Get application's chat room list
@param start start index
@param count list count
@return {@link ChatRoomListResult}
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"application",
"s",
"chat",
"room",
"list"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L818-L821 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java | ArgumentConvertor.convertArgument | Object convertArgument(String arg, Type paramType) throws IllegalArgumentException {
"""
try to convert json argument in java type
@param arg
@param paramType
@return
@throws IllegalArgumentException
"""
Object result = null;
if (null == arg || "null".equals(arg)) {
return result;
}
logge... | java | Object convertArgument(String arg, Type paramType) throws IllegalArgumentException {
Object result = null;
if (null == arg || "null".equals(arg)) {
return result;
}
logger.debug("Try to convert {} : param = {} : {}", new Object[]{arg, paramType, paramType.getClass()});
try { // GenericArrayType, Para... | [
"Object",
"convertArgument",
"(",
"String",
"arg",
",",
"Type",
"paramType",
")",
"throws",
"IllegalArgumentException",
"{",
"Object",
"result",
"=",
"null",
";",
"if",
"(",
"null",
"==",
"arg",
"||",
"\"null\"",
".",
"equals",
"(",
"arg",
")",
")",
"{",
... | try to convert json argument in java type
@param arg
@param paramType
@return
@throws IllegalArgumentException | [
"try",
"to",
"convert",
"json",
"argument",
"in",
"java",
"type"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java#L122-L148 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/api/MCAAuthorizationManager.java | MCAAuthorizationManager.registerAuthenticationListener | public void registerAuthenticationListener(String realm, AuthenticationListener listener) {
"""
Registers authentication listener for specified realm.
@param realm authentication realm.
@param listener authentication listener.
"""
if (realm == null || realm.isEmpty()) {
throw new Inv... | java | public void registerAuthenticationListener(String realm, AuthenticationListener listener) {
if (realm == null || realm.isEmpty()) {
throw new InvalidParameterException("The realm name can't be null or empty.");
}
if (listener == null) {
throw new InvalidParameterExceptio... | [
"public",
"void",
"registerAuthenticationListener",
"(",
"String",
"realm",
",",
"AuthenticationListener",
"listener",
")",
"{",
"if",
"(",
"realm",
"==",
"null",
"||",
"realm",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"InvalidParameterException",
"("... | Registers authentication listener for specified realm.
@param realm authentication realm.
@param listener authentication listener. | [
"Registers",
"authentication",
"listener",
"for",
"specified",
"realm",
"."
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/api/MCAAuthorizationManager.java#L291-L303 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileLexer.java | WhileyFileLexer.scanCharacterLiteral | public Token scanCharacterLiteral() {
"""
Scan a character literal, such as e.g. 'c'. Observe that care must be
taken to properly handle escape codes. For example, '\n' is a single
character constant which is made up from two characters in the input
string.
@return
"""
int start = pos;
pos++;
char ... | java | public Token scanCharacterLiteral() {
int start = pos;
pos++;
char c = input.charAt(pos++);
if (c == '\\') {
// escape code
switch (input.charAt(pos++)) {
case 'b':
c = '\b';
break;
case 't':
c = '\t';
break;
case 'n':
c = '\n';
break;
case 'f':
c = '\f';
break;... | [
"public",
"Token",
"scanCharacterLiteral",
"(",
")",
"{",
"int",
"start",
"=",
"pos",
";",
"pos",
"++",
";",
"char",
"c",
"=",
"input",
".",
"charAt",
"(",
"pos",
"++",
")",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"// escape code",
"switch",... | Scan a character literal, such as e.g. 'c'. Observe that care must be
taken to properly handle escape codes. For example, '\n' is a single
character constant which is made up from two characters in the input
string.
@return | [
"Scan",
"a",
"character",
"literal",
"such",
"as",
"e",
".",
"g",
".",
"c",
".",
"Observe",
"that",
"care",
"must",
"be",
"taken",
"to",
"properly",
"handle",
"escape",
"codes",
".",
"For",
"example",
"\\",
"n",
"is",
"a",
"single",
"character",
"const... | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileLexer.java#L160-L201 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java | ZipFileIndex.checkIndex | private void checkIndex() throws IOException {
"""
Here we need to make sure that the ZipFileIndex is valid. Check the timestamp of the file and
if its the same as the one at the time the index was build we don't need to reopen anything.
"""
boolean isUpToDate = true;
if (!isUpToDate()) {
... | java | private void checkIndex() throws IOException {
boolean isUpToDate = true;
if (!isUpToDate()) {
closeFile();
isUpToDate = false;
}
if (zipRandomFile != null || isUpToDate) {
lastReferenceTimeStamp = System.currentTimeMillis();
return;
... | [
"private",
"void",
"checkIndex",
"(",
")",
"throws",
"IOException",
"{",
"boolean",
"isUpToDate",
"=",
"true",
";",
"if",
"(",
"!",
"isUpToDate",
"(",
")",
")",
"{",
"closeFile",
"(",
")",
";",
"isUpToDate",
"=",
"false",
";",
"}",
"if",
"(",
"zipRando... | Here we need to make sure that the ZipFileIndex is valid. Check the timestamp of the file and
if its the same as the one at the time the index was build we don't need to reopen anything. | [
"Here",
"we",
"need",
"to",
"make",
"sure",
"that",
"the",
"ZipFileIndex",
"is",
"valid",
".",
"Check",
"the",
"timestamp",
"of",
"the",
"file",
"and",
"if",
"its",
"the",
"same",
"as",
"the",
"one",
"at",
"the",
"time",
"the",
"index",
"was",
"build",... | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java#L165-L199 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java | NetworkInterfacesInner.updateTags | public NetworkInterfaceInner updateTags(String resourceGroupName, String networkInterfaceName) {
"""
Updates a network interface tags.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@throws IllegalArgumentException thrown if parameters f... | java | public NetworkInterfaceInner updateTags(String resourceGroupName, String networkInterfaceName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, networkInterfaceName).toBlocking().last().body();
} | [
"public",
"NetworkInterfaceInner",
"updateTags",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkInterfaceName",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkInterfaceName",
")",
".",
"toBlocking",
"(",
")",
"... | Updates a network interface tags.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException... | [
"Updates",
"a",
"network",
"interface",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L660-L662 |
arquillian/arquillian-algeron | common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java | GitOperations.cloneRepository | public Git cloneRepository(String remoteUrl, Path localPath) {
"""
Clones a public remote git repository. Caller is responsible of closing git repository.
@param remoteUrl
to connect.
@param localPath
where to clone the repo.
@return Git instance. Caller is responsible to close the connection.
"""
... | java | public Git cloneRepository(String remoteUrl, Path localPath) {
try {
return Git.cloneRepository()
.setURI(remoteUrl)
.setDirectory(localPath.toFile())
.call();
} catch (GitAPIException e) {
throw new IllegalStateException(e);
... | [
"public",
"Git",
"cloneRepository",
"(",
"String",
"remoteUrl",
",",
"Path",
"localPath",
")",
"{",
"try",
"{",
"return",
"Git",
".",
"cloneRepository",
"(",
")",
".",
"setURI",
"(",
"remoteUrl",
")",
".",
"setDirectory",
"(",
"localPath",
".",
"toFile",
"... | Clones a public remote git repository. Caller is responsible of closing git repository.
@param remoteUrl
to connect.
@param localPath
where to clone the repo.
@return Git instance. Caller is responsible to close the connection. | [
"Clones",
"a",
"public",
"remote",
"git",
"repository",
".",
"Caller",
"is",
"responsible",
"of",
"closing",
"git",
"repository",
"."
] | train | https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java#L471-L480 |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateRecordAssign | private Context translateRecordAssign(WyilFile.Expr.RecordAccess lval, Expr rval, Context context) {
"""
Translate an assignment to a field.
@param lval
The field access expression
@param result
The value being assigned to the given array element
@param context
The enclosing context
@return
"""
// T... | java | private Context translateRecordAssign(WyilFile.Expr.RecordAccess lval, Expr rval, Context context) {
// Translate src expression
Pair<Expr, Context> p1 = translateExpressionWithChecks(lval.getOperand(), null, context);
Expr source = p1.first();
WyalFile.Identifier field = new WyalFile.Identifier(lval.getField()... | [
"private",
"Context",
"translateRecordAssign",
"(",
"WyilFile",
".",
"Expr",
".",
"RecordAccess",
"lval",
",",
"Expr",
"rval",
",",
"Context",
"context",
")",
"{",
"// Translate src expression",
"Pair",
"<",
"Expr",
",",
"Context",
">",
"p1",
"=",
"translateExpr... | Translate an assignment to a field.
@param lval
The field access expression
@param result
The value being assigned to the given array element
@param context
The enclosing context
@return | [
"Translate",
"an",
"assignment",
"to",
"a",
"field",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L621-L629 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java | TypeSignature.ofMap | public static TypeSignature ofMap(TypeSignature keyTypeSignature, TypeSignature valueTypeSignature) {
"""
Creates a new type signature for the map with the specified key and value type signatures.
This method is a shortcut of:
<pre>{@code
ofMap("map", keyTypeSignature, valueTypeSignature);
}</pre>
"""
... | java | public static TypeSignature ofMap(TypeSignature keyTypeSignature, TypeSignature valueTypeSignature) {
requireNonNull(keyTypeSignature, "keyTypeSignature");
requireNonNull(valueTypeSignature, "valueTypeSignature");
return ofContainer("map", keyTypeSignature, valueTypeSignature);
} | [
"public",
"static",
"TypeSignature",
"ofMap",
"(",
"TypeSignature",
"keyTypeSignature",
",",
"TypeSignature",
"valueTypeSignature",
")",
"{",
"requireNonNull",
"(",
"keyTypeSignature",
",",
"\"keyTypeSignature\"",
")",
";",
"requireNonNull",
"(",
"valueTypeSignature",
","... | Creates a new type signature for the map with the specified key and value type signatures.
This method is a shortcut of:
<pre>{@code
ofMap("map", keyTypeSignature, valueTypeSignature);
}</pre> | [
"Creates",
"a",
"new",
"type",
"signature",
"for",
"the",
"map",
"with",
"the",
"specified",
"key",
"and",
"value",
"type",
"signatures",
".",
"This",
"method",
"is",
"a",
"shortcut",
"of",
":",
"<pre",
">",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java#L158-L162 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java | EmulatedFields.get | public long get(String name, long defaultValue) throws IllegalArgumentException {
"""
Finds and returns the long value of a given field named {@code name} in the
receiver. If the field has not been assigned any value yet, the default
value {@code defaultValue} is returned instead.
@param name
the name of the... | java | public long get(String name, long defaultValue) throws IllegalArgumentException {
ObjectSlot slot = findMandatorySlot(name, long.class);
return slot.defaulted ? defaultValue : ((Long) slot.fieldValue).longValue();
} | [
"public",
"long",
"get",
"(",
"String",
"name",
",",
"long",
"defaultValue",
")",
"throws",
"IllegalArgumentException",
"{",
"ObjectSlot",
"slot",
"=",
"findMandatorySlot",
"(",
"name",
",",
"long",
".",
"class",
")",
";",
"return",
"slot",
".",
"defaulted",
... | Finds and returns the long value of a given field named {@code name} in the
receiver. If the field has not been assigned any value yet, the default
value {@code defaultValue} is returned instead.
@param name
the name of the field to find.
@param defaultValue
return value in case the field has not been assigned to yet.... | [
"Finds",
"and",
"returns",
"the",
"long",
"value",
"of",
"a",
"given",
"field",
"named",
"{",
"@code",
"name",
"}",
"in",
"the",
"receiver",
".",
"If",
"the",
"field",
"has",
"not",
"been",
"assigned",
"any",
"value",
"yet",
"the",
"default",
"value",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java#L308-L311 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/document/RtfDocumentHeader.java | RtfDocumentHeader.convertHeaderFooter | private RtfHeaderFooterGroup convertHeaderFooter(HeaderFooter hf, int type) {
"""
Converts a HeaderFooter into a RtfHeaderFooterGroup. Depending on which class
the HeaderFooter is, the correct RtfHeaderFooterGroup is created.
@param hf The HeaderFooter to convert.
@param type Whether the conversion is being d... | java | private RtfHeaderFooterGroup convertHeaderFooter(HeaderFooter hf, int type) {
if(hf != null) {
if(hf instanceof RtfHeaderFooterGroup) {
return new RtfHeaderFooterGroup(this.document, (RtfHeaderFooterGroup) hf, type);
} else if(hf instanceof RtfHeaderFooter) {
... | [
"private",
"RtfHeaderFooterGroup",
"convertHeaderFooter",
"(",
"HeaderFooter",
"hf",
",",
"int",
"type",
")",
"{",
"if",
"(",
"hf",
"!=",
"null",
")",
"{",
"if",
"(",
"hf",
"instanceof",
"RtfHeaderFooterGroup",
")",
"{",
"return",
"new",
"RtfHeaderFooterGroup",
... | Converts a HeaderFooter into a RtfHeaderFooterGroup. Depending on which class
the HeaderFooter is, the correct RtfHeaderFooterGroup is created.
@param hf The HeaderFooter to convert.
@param type Whether the conversion is being done on a footer or header
@return The converted RtfHeaderFooterGroup.
@see com.lowagie.text... | [
"Converts",
"a",
"HeaderFooter",
"into",
"a",
"RtfHeaderFooterGroup",
".",
"Depending",
"on",
"which",
"class",
"the",
"HeaderFooter",
"is",
"the",
"correct",
"RtfHeaderFooterGroup",
"is",
"created",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/document/RtfDocumentHeader.java#L319-L331 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/utils/OpenAPIUtils.java | OpenAPIUtils.getUrlAsStream | public static InputStream getUrlAsStream(URL url, String acceptValue) throws IOException {
"""
Get the resource at the specified URL as an InputStream
@param url - resource location
@param acceptValue - Request property for 'Accept' header
"""
HttpURLConnection connection = (HttpURLConnection) url.... | java | public static InputStream getUrlAsStream(URL url, String acceptValue) throws IOException {
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
if (acceptValue != null && !acceptValue.trim().isEmpty()) {
connection.setRequestPro... | [
"public",
"static",
"InputStream",
"getUrlAsStream",
"(",
"URL",
"url",
",",
"String",
"acceptValue",
")",
"throws",
"IOException",
"{",
"HttpURLConnection",
"connection",
"=",
"(",
"HttpURLConnection",
")",
"url",
".",
"openConnection",
"(",
")",
";",
"connection... | Get the resource at the specified URL as an InputStream
@param url - resource location
@param acceptValue - Request property for 'Accept' header | [
"Get",
"the",
"resource",
"at",
"the",
"specified",
"URL",
"as",
"an",
"InputStream"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/utils/OpenAPIUtils.java#L148-L163 |
encoway/edu | edu/src/main/java/com/encoway/edu/EventDrivenUpdatesMap.java | EventDrivenUpdatesMap.get | public String get(Iterable<String> events, String defaultValue) {
"""
Returns a space separated list of component IDs of components registered for at least one the `events`.
@param events a collection of events
@param defaultValue will be returned if no component is registered for one of the `events`
@return ... | java | public String get(Iterable<String> events, String defaultValue) {
final Iterator<String> iter = getSeparate(events, defaultValue).iterator();
StringBuilder builder = new StringBuilder();
if (iter.hasNext()) {
builder.append(iter.next());
while (iter.hasNext()) {
... | [
"public",
"String",
"get",
"(",
"Iterable",
"<",
"String",
">",
"events",
",",
"String",
"defaultValue",
")",
"{",
"final",
"Iterator",
"<",
"String",
">",
"iter",
"=",
"getSeparate",
"(",
"events",
",",
"defaultValue",
")",
".",
"iterator",
"(",
")",
";... | Returns a space separated list of component IDs of components registered for at least one the `events`.
@param events a collection of events
@param defaultValue will be returned if no component is registered for one of the `events`
@return a space separated list of fully qualified component IDs or `defaultValue` | [
"Returns",
"a",
"space",
"separated",
"list",
"of",
"component",
"IDs",
"of",
"components",
"registered",
"for",
"at",
"least",
"one",
"the",
"events",
"."
] | train | https://github.com/encoway/edu/blob/52ae92b2207f7d5668e212904359fbeb360f3f05/edu/src/main/java/com/encoway/edu/EventDrivenUpdatesMap.java#L100-L111 |
motown-io/motown | chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java | DomainService.getConnector | public Connector getConnector(Long chargingStationTypeId, Long evseId, Long id) {
"""
Find a connector based on its id.
@param id the id of the entity to find.
@return the connector.
"""
ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId);
... | java | public Connector getConnector(Long chargingStationTypeId, Long evseId, Long id) {
ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId);
Evse evse = getEvseById(chargingStationType, evseId);
return getConnectorById(evse, id);
} | [
"public",
"Connector",
"getConnector",
"(",
"Long",
"chargingStationTypeId",
",",
"Long",
"evseId",
",",
"Long",
"id",
")",
"{",
"ChargingStationType",
"chargingStationType",
"=",
"chargingStationTypeRepository",
".",
"findOne",
"(",
"chargingStationTypeId",
")",
";",
... | Find a connector based on its id.
@param id the id of the entity to find.
@return the connector. | [
"Find",
"a",
"connector",
"based",
"on",
"its",
"id",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java#L244-L249 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java | ReflectUtil.getMethod | public static Method getMethod(Class<?> clazz, boolean ignoreCase, String methodName, Class<?>... paramTypes) throws SecurityException {
"""
查找指定方法 如果找不到对应的方法则返回<code>null</code>
<p>
此方法为精准获取方法名,即方法名和参数数量和类型必须一致,否则返回<code>null</code>。
</p>
@param clazz 类,如果为{@code null}返回{@code null}
@param ignoreCase 是否忽... | java | public static Method getMethod(Class<?> clazz, boolean ignoreCase, String methodName, Class<?>... paramTypes) throws SecurityException {
if (null == clazz || StrUtil.isBlank(methodName)) {
return null;
}
final Method[] methods = getMethods(clazz);
if (ArrayUtil.isNotEmpty(methods)) {
for (Method m... | [
"public",
"static",
"Method",
"getMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"boolean",
"ignoreCase",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"paramTypes",
")",
"throws",
"SecurityException",
"{",
"if",
"(",
"null",
"==",
... | 查找指定方法 如果找不到对应的方法则返回<code>null</code>
<p>
此方法为精准获取方法名,即方法名和参数数量和类型必须一致,否则返回<code>null</code>。
</p>
@param clazz 类,如果为{@code null}返回{@code null}
@param ignoreCase 是否忽略大小写
@param methodName 方法名,如果为空字符串返回{@code null}
@param paramTypes 参数类型,指定参数类型如果是方法的子类也算
@return 方法
@throws SecurityException 无权访问抛出异常
@since 3.2.0 | [
"查找指定方法",
"如果找不到对应的方法则返回<code",
">",
"null<",
"/",
"code",
">"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L450-L466 |
tango-controls/JTango | common/src/main/java/org/tango/utils/ArrayUtils.java | ArrayUtils.toObjectArray | public final static Object toObjectArray(final Object array) {
"""
Convert an array of primitives to Objects if possible. Return input otherwise
@param array
the array to convert
@return The array of Objects
"""
if (!array.getClass().isArray()) {
return array;
}
final C... | java | public final static Object toObjectArray(final Object array) {
if (!array.getClass().isArray()) {
return array;
}
final Class<?> clazz = PRIMITIVE_TO_OBJ.get(array.getClass().getComponentType());
return setArray(clazz, array);
} | [
"public",
"final",
"static",
"Object",
"toObjectArray",
"(",
"final",
"Object",
"array",
")",
"{",
"if",
"(",
"!",
"array",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"array",
";",
"}",
"final",
"Class",
"<",
"?",
">",
... | Convert an array of primitives to Objects if possible. Return input otherwise
@param array
the array to convert
@return The array of Objects | [
"Convert",
"an",
"array",
"of",
"primitives",
"to",
"Objects",
"if",
"possible",
".",
"Return",
"input",
"otherwise"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/common/src/main/java/org/tango/utils/ArrayUtils.java#L60-L66 |
couchbase/couchbase-lite-java-core | src/main/java/com/couchbase/lite/replicator/Replication.java | Replication.setHeaders | @InterfaceAudience.Public
public void setHeaders(Map<String, Object> requestHeadersParam) {
"""
Set Extra HTTP headers to be sent in all requests to the remote server.
"""
// Fix - https://github.com/couchbase/couchbase-lite-java-core/issues/1617
storeCookiesIntoCookieJar(requestHeadersPara... | java | @InterfaceAudience.Public
public void setHeaders(Map<String, Object> requestHeadersParam) {
// Fix - https://github.com/couchbase/couchbase-lite-java-core/issues/1617
storeCookiesIntoCookieJar(requestHeadersParam);
properties.put(ReplicationField.REQUEST_HEADERS, requestHeadersParam);
... | [
"@",
"InterfaceAudience",
".",
"Public",
"public",
"void",
"setHeaders",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"requestHeadersParam",
")",
"{",
"// Fix - https://github.com/couchbase/couchbase-lite-java-core/issues/1617",
"storeCookiesIntoCookieJar",
"(",
"requestHea... | Set Extra HTTP headers to be sent in all requests to the remote server. | [
"Set",
"Extra",
"HTTP",
"headers",
"to",
"be",
"sent",
"in",
"all",
"requests",
"to",
"the",
"remote",
"server",
"."
] | train | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/Replication.java#L900-L907 |
tzaeschke/zoodb | src/org/zoodb/internal/server/DiskAccessOneFile.java | DiskAccessOneFile.readObject | @Override
public ZooPC readObject(DataDeSerializer dds, long oid) {
"""
Locate an object. This version allows providing a data de-serializer. This will be handy
later if we want to implement some concurrency, which requires using multiple of the
stateful DeSerializers.
@param dds DataDeSerializer
@param oid O... | java | @Override
public ZooPC readObject(DataDeSerializer dds, long oid) {
FilePos oie = oidIndex.findOid(oid);
if (oie == null) {
throw DBLogger.newObjectNotFoundException("OID not found: " + Util.oidToString(oid));
}
return dds.readObject(oie.getPage(), oie.getOffs(), false);
} | [
"@",
"Override",
"public",
"ZooPC",
"readObject",
"(",
"DataDeSerializer",
"dds",
",",
"long",
"oid",
")",
"{",
"FilePos",
"oie",
"=",
"oidIndex",
".",
"findOid",
"(",
"oid",
")",
";",
"if",
"(",
"oie",
"==",
"null",
")",
"{",
"throw",
"DBLogger",
".",... | Locate an object. This version allows providing a data de-serializer. This will be handy
later if we want to implement some concurrency, which requires using multiple of the
stateful DeSerializers.
@param dds DataDeSerializer
@param oid Object ID
@return Path name of the object (later: position of obj) | [
"Locate",
"an",
"object",
".",
"This",
"version",
"allows",
"providing",
"a",
"data",
"de",
"-",
"serializer",
".",
"This",
"will",
"be",
"handy",
"later",
"if",
"we",
"want",
"to",
"implement",
"some",
"concurrency",
"which",
"requires",
"using",
"multiple"... | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/DiskAccessOneFile.java#L391-L399 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java | MapIterate.getIfAbsentPut | public static <K, V> V getIfAbsentPut(Map<K, V> map, K key, Function0<? extends V> instanceBlock) {
"""
Get and return the value in the Map at the specified key, or if there is no value at the key, return the result
of evaluating the specified {@link Function0}, and put that value in the map at the specified key.... | java | public static <K, V> V getIfAbsentPut(Map<K, V> map, K key, Function0<? extends V> instanceBlock)
{
if (map instanceof MutableMap)
{
return ((MutableMap<K, V>) map).getIfAbsentPut(key, instanceBlock);
}
V result = map.get(key);
if (MapIterate.isAbsent(result, map,... | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"V",
"getIfAbsentPut",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"K",
"key",
",",
"Function0",
"<",
"?",
"extends",
"V",
">",
"instanceBlock",
")",
"{",
"if",
"(",
"map",
"instanceof",
"MutableMap... | Get and return the value in the Map at the specified key, or if there is no value at the key, return the result
of evaluating the specified {@link Function0}, and put that value in the map at the specified key.
<p>
This method handles the {@code null}-value-at-key case correctly. | [
"Get",
"and",
"return",
"the",
"value",
"in",
"the",
"Map",
"at",
"the",
"specified",
"key",
"or",
"if",
"there",
"is",
"no",
"value",
"at",
"the",
"key",
"return",
"the",
"result",
"of",
"evaluating",
"the",
"specified",
"{"
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L137-L150 |
tvesalainen/util | util/src/main/java/org/vesalainen/math/Polygon.java | Polygon.isRawHit | public static boolean isRawHit(double[] data, int points, double testx, double testy) {
"""
Returns true if point is inside a polygon.
<p>Doesn't check the bounding rectangle!
@param data x1, y1, x2, y2, ...
@param points Number of points (xi, yi)
@param testx
@param testy
@return
@see <a href="http://www.e... | java | public static boolean isRawHit(double[] data, int points, double testx, double testy)
{
boolean c = false;
int i, j;
for (i = 0, j = points - 1; i < points; j = i++)
{
if (((data[2*i+1] > testy) != (data[2*j+1] > testy))
&& (testx < (data[2*j] -... | [
"public",
"static",
"boolean",
"isRawHit",
"(",
"double",
"[",
"]",
"data",
",",
"int",
"points",
",",
"double",
"testx",
",",
"double",
"testy",
")",
"{",
"boolean",
"c",
"=",
"false",
";",
"int",
"i",
",",
"j",
";",
"for",
"(",
"i",
"=",
"0",
"... | Returns true if point is inside a polygon.
<p>Doesn't check the bounding rectangle!
@param data x1, y1, x2, y2, ...
@param points Number of points (xi, yi)
@param testx
@param testy
@return
@see <a href="http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html">PNPOLY - Point Inclusion in Polygon Test W. ... | [
"Returns",
"true",
"if",
"point",
"is",
"inside",
"a",
"polygon",
".",
"<p",
">",
"Doesn",
"t",
"check",
"the",
"bounding",
"rectangle!"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Polygon.java#L102-L115 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressString.java | IPAddressString.validateNetworkPrefixLength | public static int validateNetworkPrefixLength(IPVersion ipVersion, CharSequence networkPrefixLength) throws PrefixLenException {
"""
Validates that the string has the format "/x" for a valid prefix length x.
@param ipVersion IPv4, IPv6, or null if you do not know in which case it will be assumed that it can be ei... | java | public static int validateNetworkPrefixLength(IPVersion ipVersion, CharSequence networkPrefixLength) throws PrefixLenException {
try {
return Validator.VALIDATOR.validatePrefix(networkPrefixLength, ipVersion);
} catch(AddressStringException e) {
throw new PrefixLenException(networkPrefixLength, ipVersion, e);... | [
"public",
"static",
"int",
"validateNetworkPrefixLength",
"(",
"IPVersion",
"ipVersion",
",",
"CharSequence",
"networkPrefixLength",
")",
"throws",
"PrefixLenException",
"{",
"try",
"{",
"return",
"Validator",
".",
"VALIDATOR",
".",
"validatePrefix",
"(",
"networkPrefix... | Validates that the string has the format "/x" for a valid prefix length x.
@param ipVersion IPv4, IPv6, or null if you do not know in which case it will be assumed that it can be either
@param networkPrefixLength the network prefix length integer as a string, eg "24"
@return the network prefix length
@throws Incompatib... | [
"Validates",
"that",
"the",
"string",
"has",
"the",
"format",
"/",
"x",
"for",
"a",
"valid",
"prefix",
"length",
"x",
"."
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressString.java#L486-L492 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/Tools.java | Tools.Scale | public static float Scale(FloatRange from, FloatRange to, int x) {
"""
Converts the value x (which is measured in the scale 'from') to another value measured in the scale 'to'.
@param from Scale from.
@param to Scale to.
@param x Value.
@return Result.
"""
if (from.length() == 0) return 0;
... | java | public static float Scale(FloatRange from, FloatRange to, int x) {
if (from.length() == 0) return 0;
return (float) ((to.length()) * (x - from.getMin()) / from.length() + to.getMin());
} | [
"public",
"static",
"float",
"Scale",
"(",
"FloatRange",
"from",
",",
"FloatRange",
"to",
",",
"int",
"x",
")",
"{",
"if",
"(",
"from",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"0",
";",
"return",
"(",
"float",
")",
"(",
"(",
"to",
".",... | Converts the value x (which is measured in the scale 'from') to another value measured in the scale 'to'.
@param from Scale from.
@param to Scale to.
@param x Value.
@return Result. | [
"Converts",
"the",
"value",
"x",
"(",
"which",
"is",
"measured",
"in",
"the",
"scale",
"from",
")",
"to",
"another",
"value",
"measured",
"in",
"the",
"scale",
"to",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/Tools.java#L448-L451 |
alipay/sofa-rpc | extension-impl/codec-protobuf/src/main/java/com/alipay/sofa/rpc/codec/protobuf/ProtobufHelper.java | ProtobufHelper.loadProtoClassToCache | private void loadProtoClassToCache(String key, Class clazz, String methodName) {
"""
加载protobuf接口里方法的参数和返回值类型到缓存,不需要传递
@param key 缓存的key
@param clazz 接口名
@param methodName 方法名
"""
Method pbMethod = null;
Method[] methods = clazz.getMethods();
for (Method method : method... | java | private void loadProtoClassToCache(String key, Class clazz, String methodName) {
Method pbMethod = null;
Method[] methods = clazz.getMethods();
for (Method method : methods) {
if (methodName.equals(method.getName())) {
pbMethod = method;
break;
... | [
"private",
"void",
"loadProtoClassToCache",
"(",
"String",
"key",
",",
"Class",
"clazz",
",",
"String",
"methodName",
")",
"{",
"Method",
"pbMethod",
"=",
"null",
";",
"Method",
"[",
"]",
"methods",
"=",
"clazz",
".",
"getMethods",
"(",
")",
";",
"for",
... | 加载protobuf接口里方法的参数和返回值类型到缓存,不需要传递
@param key 缓存的key
@param clazz 接口名
@param methodName 方法名 | [
"加载protobuf接口里方法的参数和返回值类型到缓存,不需要传递"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/codec-protobuf/src/main/java/com/alipay/sofa/rpc/codec/protobuf/ProtobufHelper.java#L118-L145 |
forge/javaee-descriptors | impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/application5/ApplicationDescriptorImpl.java | ApplicationDescriptorImpl.addNamespace | public ApplicationDescriptor addNamespace(String name, String value) {
"""
Adds a new namespace
@return the current instance of <code>ApplicationDescriptor</code>
"""
model.attribute(name, value);
return this;
} | java | public ApplicationDescriptor addNamespace(String name, String value)
{
model.attribute(name, value);
return this;
} | [
"public",
"ApplicationDescriptor",
"addNamespace",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"model",
".",
"attribute",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds a new namespace
@return the current instance of <code>ApplicationDescriptor</code> | [
"Adds",
"a",
"new",
"namespace"
] | train | https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/application5/ApplicationDescriptorImpl.java#L87-L91 |
stanfy/goro | goro/src/main/java/com/stanfy/enroscar/goro/Goro.java | Goro.bindWith | public static BoundGoro bindWith(final Context context, final BoundGoro.OnUnexpectedDisconnection handler) {
"""
Creates a Goro implementation that binds to {@link GoroService}
in order to run scheduled tasks in service context.
{@code BoundGoro} exposes {@code bind()} and {@code unbind()} methods that you can u... | java | public static BoundGoro bindWith(final Context context, final BoundGoro.OnUnexpectedDisconnection handler) {
if (context == null) {
throw new IllegalArgumentException("Context cannot be null");
}
if (handler == null) {
throw new IllegalArgumentException("Disconnection handler cannot be null");
... | [
"public",
"static",
"BoundGoro",
"bindWith",
"(",
"final",
"Context",
"context",
",",
"final",
"BoundGoro",
".",
"OnUnexpectedDisconnection",
"handler",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"C... | Creates a Goro implementation that binds to {@link GoroService}
in order to run scheduled tasks in service context.
{@code BoundGoro} exposes {@code bind()} and {@code unbind()} methods that you can use to connect to
and disconnect from the worker service in other component lifecycle callbacks
(like {@code onStart}/{@c... | [
"Creates",
"a",
"Goro",
"implementation",
"that",
"binds",
"to",
"{"
] | train | https://github.com/stanfy/goro/blob/6618e63a926833d61f492ec611ee77668d756820/goro/src/main/java/com/stanfy/enroscar/goro/Goro.java#L92-L100 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java | ImageLoading.loadReuseExact | public static ReuseResult loadReuseExact(Uri uri, Context context, Bitmap dest) throws ImageLoadException {
"""
Loading bitmap with using reuse bitmap with the same size of source image.
If it is unable to load with reuse method tries to load without it.
Reuse works only in 3.0+
@param uri content uri for... | java | public static ReuseResult loadReuseExact(Uri uri, Context context, Bitmap dest) throws ImageLoadException {
return loadBitmapReuseExact(new UriSource(uri, context), dest);
} | [
"public",
"static",
"ReuseResult",
"loadReuseExact",
"(",
"Uri",
"uri",
",",
"Context",
"context",
",",
"Bitmap",
"dest",
")",
"throws",
"ImageLoadException",
"{",
"return",
"loadBitmapReuseExact",
"(",
"new",
"UriSource",
"(",
"uri",
",",
"context",
")",
",",
... | Loading bitmap with using reuse bitmap with the same size of source image.
If it is unable to load with reuse method tries to load without it.
Reuse works only in 3.0+
@param uri content uri for bitmap
@param context Application Context
@param dest reuse bitmap
@return result of loading
@throws ImageLoadExcepti... | [
"Loading",
"bitmap",
"with",
"using",
"reuse",
"bitmap",
"with",
"the",
"same",
"size",
"of",
"source",
"image",
".",
"If",
"it",
"is",
"unable",
"to",
"load",
"with",
"reuse",
"method",
"tries",
"to",
"load",
"without",
"it",
".",
"Reuse",
"works",
"onl... | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L188-L190 |
Jsondb/jsondb-core | src/main/java/io/jsondb/crypto/CryptoUtil.java | CryptoUtil.generate128BitKey | public static String generate128BitKey(String password, String salt)
throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeySpecException {
"""
Utility method to help generate a strong 128 bit Key to be used for the DefaultAESCBCCipher.
Note: This function is only provided as a utility ... | java | public static String generate128BitKey(String password, String salt)
throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeySpecException {
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
KeySpec spec = new PBEKeySpec(password.toCharArray(), salt.g... | [
"public",
"static",
"String",
"generate128BitKey",
"(",
"String",
"password",
",",
"String",
"salt",
")",
"throws",
"NoSuchAlgorithmException",
",",
"UnsupportedEncodingException",
",",
"InvalidKeySpecException",
"{",
"SecretKeyFactory",
"factory",
"=",
"SecretKeyFactory",
... | Utility method to help generate a strong 128 bit Key to be used for the DefaultAESCBCCipher.
Note: This function is only provided as a utility to generate strong password it should
be used statically to generate a key and then the key should be captured and used in your program.
This function defaults to using 65536 ... | [
"Utility",
"method",
"to",
"help",
"generate",
"a",
"strong",
"128",
"bit",
"Key",
"to",
"be",
"used",
"for",
"the",
"DefaultAESCBCCipher",
"."
] | train | https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/crypto/CryptoUtil.java#L131-L140 |
Impetus/Kundera | src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/DocumentIndexer.java | DocumentIndexer.addFieldToDocument | private void addFieldToDocument(Object object, Document document, java.lang.reflect.Field field, String colName,
String indexName) {
"""
Index field.
@param object
the object
@param document
the document
@param field
the field
@param colName
the col name
@param indexName
the index name
"""
... | java | private void addFieldToDocument(Object object, Document document, java.lang.reflect.Field field, String colName,
String indexName) {
try {
Object obj = PropertyAccessorHelper.getObject(object, field);
// String str =
// String value = (obj == null) ? null : obj.toStri... | [
"private",
"void",
"addFieldToDocument",
"(",
"Object",
"object",
",",
"Document",
"document",
",",
"java",
".",
"lang",
".",
"reflect",
".",
"Field",
"field",
",",
"String",
"colName",
",",
"String",
"indexName",
")",
"{",
"try",
"{",
"Object",
"obj",
"="... | Index field.
@param object
the object
@param document
the document
@param field
the field
@param colName
the col name
@param indexName
the index name | [
"Index",
"field",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/DocumentIndexer.java#L427-L446 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/RepositoryApi.java | RepositoryApi.createTag | public Tag createTag(Object projectIdOrPath, String tagName, String ref, String message, String releaseNotes) throws GitLabApiException {
"""
Creates a tag on a particular ref of the given project. A message and release notes are optional.
<pre><code>GitLab Endpoint: POST /projects/:id/repository/tags</code></p... | java | public Tag createTag(Object projectIdOrPath, String tagName, String ref, String message, String releaseNotes) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("tag_name", tagName, true)
.withParam("ref", ref, true)
.withParam("message", ... | [
"public",
"Tag",
"createTag",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"tagName",
",",
"String",
"ref",
",",
"String",
"message",
",",
"String",
"releaseNotes",
")",
"throws",
"GitLabApiException",
"{",
"Form",
"formData",
"=",
"new",
"GitLabApiForm",
"(... | Creates a tag on a particular ref of the given project. A message and release notes are optional.
<pre><code>GitLab Endpoint: POST /projects/:id/repository/tags</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param tagName The name of the tag Must be u... | [
"Creates",
"a",
"tag",
"on",
"a",
"particular",
"ref",
"of",
"the",
"given",
"project",
".",
"A",
"message",
"and",
"release",
"notes",
"are",
"optional",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryApi.java#L265-L275 |
dkpro/dkpro-argumentation | dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java | JCasUtil2.findTokenByEndPosition | public static Token findTokenByEndPosition(JCas jCas, int end) {
"""
Returns token ending at the given position
@param jCas jCas
@param end end
@return Token or null
"""
for (Token token : JCasUtil.select(getInitialView(jCas), Token.class)) {
if (token.getEnd() == end) {
... | java | public static Token findTokenByEndPosition(JCas jCas, int end)
{
for (Token token : JCasUtil.select(getInitialView(jCas), Token.class)) {
if (token.getEnd() == end) {
return token;
}
}
return null;
} | [
"public",
"static",
"Token",
"findTokenByEndPosition",
"(",
"JCas",
"jCas",
",",
"int",
"end",
")",
"{",
"for",
"(",
"Token",
"token",
":",
"JCasUtil",
".",
"select",
"(",
"getInitialView",
"(",
"jCas",
")",
",",
"Token",
".",
"class",
")",
")",
"{",
"... | Returns token ending at the given position
@param jCas jCas
@param end end
@return Token or null | [
"Returns",
"token",
"ending",
"at",
"the",
"given",
"position"
] | train | https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java#L350-L359 |
drapostolos/type-parser | src/main/java/com/github/drapostolos/typeparser/TypeParserBuilder.java | TypeParserBuilder.registerParser | public <T> TypeParserBuilder registerParser(GenericType<T> targetType, Parser<T> parser) {
"""
Register a custom made {@link Parser} implementation, associated with
the given generic {@code targetType}.
@param targetType generic type associated with given {@code parser}.
@param parser custom made {@link Parse... | java | public <T> TypeParserBuilder registerParser(GenericType<T> targetType, Parser<T> parser) {
if (parser == null) {
throw new NullPointerException(makeNullArgumentErrorMsg("parser"));
}
if (targetType == null) {
throw new NullPointerException(makeNullArgumentErrorMsg("target... | [
"public",
"<",
"T",
">",
"TypeParserBuilder",
"registerParser",
"(",
"GenericType",
"<",
"T",
">",
"targetType",
",",
"Parser",
"<",
"T",
">",
"parser",
")",
"{",
"if",
"(",
"parser",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"... | Register a custom made {@link Parser} implementation, associated with
the given generic {@code targetType}.
@param targetType generic type associated with given {@code parser}.
@param parser custom made {@link Parser} implementation.
@return {@link TypeParserBuilder}
@throws NullPointerException if any given argument ... | [
"Register",
"a",
"custom",
"made",
"{",
"@link",
"Parser",
"}",
"implementation",
"associated",
"with",
"the",
"given",
"generic",
"{",
"@code",
"targetType",
"}",
"."
] | train | https://github.com/drapostolos/type-parser/blob/74c66311f8dd009897c74ab5069e36c045cda073/src/main/java/com/github/drapostolos/typeparser/TypeParserBuilder.java#L89-L98 |
morimekta/providence | providence-core/src/main/java/net/morimekta/providence/util/LogFormatter.java | LogFormatter.formatTo | public <Message extends PMessage<Message, Field>, Field extends PField>
void formatTo(OutputStream out, Message message) {
"""
Format message and write to the output stream.
@param out The output stream to write to.
@param message The message to be written.
@param <Message> The message type.
@param <Fiel... | java | public <Message extends PMessage<Message, Field>, Field extends PField>
void formatTo(OutputStream out, Message message) {
IndentedPrintWriter builder = new IndentedPrintWriter(out, indent, newline);
if (message == null) {
builder.append(null);
} else {
builder.append... | [
"public",
"<",
"Message",
"extends",
"PMessage",
"<",
"Message",
",",
"Field",
">",
",",
"Field",
"extends",
"PField",
">",
"void",
"formatTo",
"(",
"OutputStream",
"out",
",",
"Message",
"message",
")",
"{",
"IndentedPrintWriter",
"builder",
"=",
"new",
"In... | Format message and write to the output stream.
@param out The output stream to write to.
@param message The message to be written.
@param <Message> The message type.
@param <Field> The field type. | [
"Format",
"message",
"and",
"write",
"to",
"the",
"output",
"stream",
"."
] | train | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/util/LogFormatter.java#L116-L127 |
real-logic/agrona | agrona/src/main/java/org/agrona/collections/Int2ObjectHashMap.java | Int2ObjectHashMap.computeIfAbsent | public V computeIfAbsent(final int key, final IntFunction<? extends V> mappingFunction) {
"""
Get a value for a given key, or if it does not exist then default the value via a
{@link java.util.function.IntFunction} and put it in the map.
<p>
Primitive specialized version of {@link java.util.Map#computeIfAbsent}... | java | public V computeIfAbsent(final int key, final IntFunction<? extends V> mappingFunction)
{
V value = getMapped(key);
if (value == null)
{
value = mappingFunction.apply(key);
if (value != null)
{
put(key, value);
}
}
... | [
"public",
"V",
"computeIfAbsent",
"(",
"final",
"int",
"key",
",",
"final",
"IntFunction",
"<",
"?",
"extends",
"V",
">",
"mappingFunction",
")",
"{",
"V",
"value",
"=",
"getMapped",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"... | Get a value for a given key, or if it does not exist then default the value via a
{@link java.util.function.IntFunction} and put it in the map.
<p>
Primitive specialized version of {@link java.util.Map#computeIfAbsent}.
@param key to search on.
@param mappingFunction to provide a value if the get returns n... | [
"Get",
"a",
"value",
"for",
"a",
"given",
"key",
"or",
"if",
"it",
"does",
"not",
"exist",
"then",
"default",
"the",
"value",
"via",
"a",
"{",
"@link",
"java",
".",
"util",
".",
"function",
".",
"IntFunction",
"}",
"and",
"put",
"it",
"in",
"the",
... | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/collections/Int2ObjectHashMap.java#L254-L271 |
apache/groovy | src/main/groovy/groovy/lang/ProxyMetaClass.java | ProxyMetaClass.invokeMethod | public Object invokeMethod(final Object object, final String methodName, final Object[] arguments) {
"""
Call invokeMethod on adaptee with logic like in MetaClass unless we have an Interceptor.
With Interceptor the call is nested in its beforeInvoke and afterInvoke methods.
The method call is suppressed if Inter... | java | public Object invokeMethod(final Object object, final String methodName, final Object[] arguments) {
return doCall(object, methodName, arguments, interceptor, new Callable() {
public Object call() {
return adaptee.invokeMethod(object, methodName, arguments);
}
});... | [
"public",
"Object",
"invokeMethod",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"methodName",
",",
"final",
"Object",
"[",
"]",
"arguments",
")",
"{",
"return",
"doCall",
"(",
"object",
",",
"methodName",
",",
"arguments",
",",
"interceptor",
"... | Call invokeMethod on adaptee with logic like in MetaClass unless we have an Interceptor.
With Interceptor the call is nested in its beforeInvoke and afterInvoke methods.
The method call is suppressed if Interceptor.doInvoke() returns false.
See Interceptor for details. | [
"Call",
"invokeMethod",
"on",
"adaptee",
"with",
"logic",
"like",
"in",
"MetaClass",
"unless",
"we",
"have",
"an",
"Interceptor",
".",
"With",
"Interceptor",
"the",
"call",
"is",
"nested",
"in",
"its",
"beforeInvoke",
"and",
"afterInvoke",
"methods",
".",
"The... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ProxyMetaClass.java#L117-L123 |
amzn/ion-java | src/com/amazon/ion/impl/SharedSymbolTable.java | SharedSymbolTable.newSharedSymbolTable | static SymbolTable newSharedSymbolTable(String name, int version,
SymbolTable priorSymtab,
Iterator<String> symbols) {
"""
Constructs a new shared symbol table from the parameters.
<p>
As per {@link IonSystem#newSharedSymbolT... | java | static SymbolTable newSharedSymbolTable(String name, int version,
SymbolTable priorSymtab,
Iterator<String> symbols)
{
if (name == null || name.length() < 1)
{
throw new IllegalArgumentException("name... | [
"static",
"SymbolTable",
"newSharedSymbolTable",
"(",
"String",
"name",
",",
"int",
"version",
",",
"SymbolTable",
"priorSymtab",
",",
"Iterator",
"<",
"String",
">",
"symbols",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"length",
"(",
"... | Constructs a new shared symbol table from the parameters.
<p>
As per {@link IonSystem#newSharedSymbolTable(String, int, Iterator, SymbolTable...)},
any duplicate or null symbol texts are skipped.
<p>
Therefore, <b>THIS METHOD IS NOT SUITABLE WHEN READING SERIALIZED
SHARED SYMBOL TABLES</b> since that scenario must pres... | [
"Constructs",
"a",
"new",
"shared",
"symbol",
"table",
"from",
"the",
"parameters",
".",
"<p",
">",
"As",
"per",
"{",
"@link",
"IonSystem#newSharedSymbolTable",
"(",
"String",
"int",
"Iterator",
"SymbolTable",
"...",
")",
"}",
"any",
"duplicate",
"or",
"null",... | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/SharedSymbolTable.java#L155-L178 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java | ExcelReader.aliasHeader | private String aliasHeader(Object headerObj, int index) {
"""
转换标题别名,如果没有别名则使用原标题,当标题为空时,列号对应的字母便是header
@param headerObj 原标题
@param index 标题所在列号,当标题为空时,列号对应的字母便是header
@return 转换别名列表
@since 4.3.2
"""
if(null == headerObj) {
return ExcelUtil.indexToColName(index);
}
final String header =... | java | private String aliasHeader(Object headerObj, int index) {
if(null == headerObj) {
return ExcelUtil.indexToColName(index);
}
final String header = headerObj.toString();
return ObjectUtil.defaultIfNull(this.headerAlias.get(header), header);
} | [
"private",
"String",
"aliasHeader",
"(",
"Object",
"headerObj",
",",
"int",
"index",
")",
"{",
"if",
"(",
"null",
"==",
"headerObj",
")",
"{",
"return",
"ExcelUtil",
".",
"indexToColName",
"(",
"index",
")",
";",
"}",
"final",
"String",
"header",
"=",
"h... | 转换标题别名,如果没有别名则使用原标题,当标题为空时,列号对应的字母便是header
@param headerObj 原标题
@param index 标题所在列号,当标题为空时,列号对应的字母便是header
@return 转换别名列表
@since 4.3.2 | [
"转换标题别名,如果没有别名则使用原标题,当标题为空时,列号对应的字母便是header"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java#L466-L473 |
BigBadaboom/androidsvg | androidsvg/src/main/java/com/caverock/androidsvg/SVG.java | SVG.renderViewToCanvas | @SuppressWarnings( {
"""
Renders this SVG document to a Canvas using the specified view defined in the document.
<p>
A View is an special element in a SVG documents that describes a rectangular area in the document.
Calling this method with a {@code viewId} will result in the specified view being positioned and... | java | @SuppressWarnings({"WeakerAccess", "unused"})
public void renderViewToCanvas(String viewId, Canvas canvas, RectF viewPort)
{
RenderOptions renderOptions = RenderOptions.create().view(viewId);
if (viewPort != null) {
renderOptions.viewPort(viewPort.left, viewPort.top, viewPort.width()... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"unused\"",
"}",
")",
"public",
"void",
"renderViewToCanvas",
"(",
"String",
"viewId",
",",
"Canvas",
"canvas",
",",
"RectF",
"viewPort",
")",
"{",
"RenderOptions",
"renderOptions",
"=",
"RenderOptions"... | Renders this SVG document to a Canvas using the specified view defined in the document.
<p>
A View is an special element in a SVG documents that describes a rectangular area in the document.
Calling this method with a {@code viewId} will result in the specified view being positioned and scaled
to the viewport. In othe... | [
"Renders",
"this",
"SVG",
"document",
"to",
"a",
"Canvas",
"using",
"the",
"specified",
"view",
"defined",
"in",
"the",
"document",
".",
"<p",
">",
"A",
"View",
"is",
"an",
"special",
"element",
"in",
"a",
"SVG",
"documents",
"that",
"describes",
"a",
"r... | train | https://github.com/BigBadaboom/androidsvg/blob/0d1614dd1a4da10ea4afe3b0cea1361a4ac6b45a/androidsvg/src/main/java/com/caverock/androidsvg/SVG.java#L578-L588 |
jmchilton/galaxy-bootstrap | src/main/java/com/github/jmchilton/galaxybootstrap/GalaxyProperties.java | GalaxyProperties.getConfigIni | private File getConfigIni(File galaxyRoot) {
"""
Gets the config ini for this Galaxy installation.
@param galaxyRoot The root directory of Galaxy.
@return A File object for the config ini for Galaxy.
"""
if (isPre20141006Release(galaxyRoot)) {
return new File(galaxyRoot, "universe_wsgi.ini");
... | java | private File getConfigIni(File galaxyRoot) {
if (isPre20141006Release(galaxyRoot)) {
return new File(galaxyRoot, "universe_wsgi.ini");
} else {
File configDirectory = new File(galaxyRoot, CONFIG_DIR_NAME);
return new File(configDirectory, "galaxy.ini");
}
} | [
"private",
"File",
"getConfigIni",
"(",
"File",
"galaxyRoot",
")",
"{",
"if",
"(",
"isPre20141006Release",
"(",
"galaxyRoot",
")",
")",
"{",
"return",
"new",
"File",
"(",
"galaxyRoot",
",",
"\"universe_wsgi.ini\"",
")",
";",
"}",
"else",
"{",
"File",
"config... | Gets the config ini for this Galaxy installation.
@param galaxyRoot The root directory of Galaxy.
@return A File object for the config ini for Galaxy. | [
"Gets",
"the",
"config",
"ini",
"for",
"this",
"Galaxy",
"installation",
"."
] | train | https://github.com/jmchilton/galaxy-bootstrap/blob/4a899f5e6ec0c9f6f4b9b21d5a0320e5925ec649/src/main/java/com/github/jmchilton/galaxybootstrap/GalaxyProperties.java#L156-L163 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirth.java | JRebirth.runIntoJTPSync | public static void runIntoJTPSync(final String runnableName, final Runnable runnable, final long... timeout) {
"""
Run into the JRebirth Thread Pool [JTP] <b>Synchronously</b>.
Be careful this method can be called through any thread.
@param runnableName the name of the runnable for logging purpose
@param ru... | java | public static void runIntoJTPSync(final String runnableName, final Runnable runnable, final long... timeout) {
runIntoJTPSync(new JrbReferenceRunnable(runnableName, runnable), timeout);
} | [
"public",
"static",
"void",
"runIntoJTPSync",
"(",
"final",
"String",
"runnableName",
",",
"final",
"Runnable",
"runnable",
",",
"final",
"long",
"...",
"timeout",
")",
"{",
"runIntoJTPSync",
"(",
"new",
"JrbReferenceRunnable",
"(",
"runnableName",
",",
"runnable"... | Run into the JRebirth Thread Pool [JTP] <b>Synchronously</b>.
Be careful this method can be called through any thread.
@param runnableName the name of the runnable for logging purpose
@param runnable the task to run
@param timeout the optional timeout value after which the thread will be released (default is 1000 ms) | [
"Run",
"into",
"the",
"JRebirth",
"Thread",
"Pool",
"[",
"JTP",
"]",
"<b",
">",
"Synchronously<",
"/",
"b",
">",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirth.java#L366-L368 |
CodeNarc/CodeNarc | src/main/java/org/codenarc/rule/AbstractRule.java | AbstractRule.createViolation | protected Violation createViolation(Integer lineNumber, String sourceLine, String message) {
"""
Create and return a new Violation for this rule and the specified values
@param lineNumber - the line number for the violation; may be null
@param sourceLine - the source line for the violation; may be null
@param m... | java | protected Violation createViolation(Integer lineNumber, String sourceLine, String message) {
Violation violation = new Violation();
violation.setRule(this);
violation.setSourceLine(sourceLine);
violation.setLineNumber(lineNumber);
violation.setMessage(message);
return vio... | [
"protected",
"Violation",
"createViolation",
"(",
"Integer",
"lineNumber",
",",
"String",
"sourceLine",
",",
"String",
"message",
")",
"{",
"Violation",
"violation",
"=",
"new",
"Violation",
"(",
")",
";",
"violation",
".",
"setRule",
"(",
"this",
")",
";",
... | Create and return a new Violation for this rule and the specified values
@param lineNumber - the line number for the violation; may be null
@param sourceLine - the source line for the violation; may be null
@param message - the message for the violation; may be null
@return a new Violation object | [
"Create",
"and",
"return",
"a",
"new",
"Violation",
"for",
"this",
"rule",
"and",
"the",
"specified",
"values"
] | train | https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/rule/AbstractRule.java#L195-L202 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.divadd | private int divadd(int[] a, int[] result, int offset) {
"""
A primitive used for division. This method adds in one multiple of the
divisor a back to the dividend result at a specified offset. It is used
when qhat was estimated too large, and must be adjusted.
"""
long carry = 0;
for (int j=a... | java | private int divadd(int[] a, int[] result, int offset) {
long carry = 0;
for (int j=a.length-1; j >= 0; j--) {
long sum = (a[j] & LONG_MASK) +
(result[j+offset] & LONG_MASK) + carry;
result[j+offset] = (int)sum;
carry = sum >>> 32;
}
... | [
"private",
"int",
"divadd",
"(",
"int",
"[",
"]",
"a",
",",
"int",
"[",
"]",
"result",
",",
"int",
"offset",
")",
"{",
"long",
"carry",
"=",
"0",
";",
"for",
"(",
"int",
"j",
"=",
"a",
".",
"length",
"-",
"1",
";",
"j",
">=",
"0",
";",
"j",... | A primitive used for division. This method adds in one multiple of the
divisor a back to the dividend result at a specified offset. It is used
when qhat was estimated too large, and must be adjusted. | [
"A",
"primitive",
"used",
"for",
"division",
".",
"This",
"method",
"adds",
"in",
"one",
"multiple",
"of",
"the",
"divisor",
"a",
"back",
"to",
"the",
"dividend",
"result",
"at",
"a",
"specified",
"offset",
".",
"It",
"is",
"used",
"when",
"qhat",
"was",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L620-L630 |
codelibs/jcifs | src/main/java/jcifs/smb1/smb1/SmbFile.java | SmbFile.mkdir | public void mkdir() throws SmbException {
"""
Creates a directory with the path specified by this
<code>SmbFile</code>. For this method to be successful, the target
must not already exist. This method will fail when
used with <code>smb1://</code>, <code>smb1://workgroup/</code>,
<code>smb1://server/</code>, or... | java | public void mkdir() throws SmbException {
String path = getUncPath0();
if( path.length() == 1 ) {
throw new SmbException( "Invalid operation for workgroups, servers, or shares" );
}
/*
* Create Directory Request / Response
*/
if( log.level >= 3 )
... | [
"public",
"void",
"mkdir",
"(",
")",
"throws",
"SmbException",
"{",
"String",
"path",
"=",
"getUncPath0",
"(",
")",
";",
"if",
"(",
"path",
".",
"length",
"(",
")",
"==",
"1",
")",
"{",
"throw",
"new",
"SmbException",
"(",
"\"Invalid operation for workgrou... | Creates a directory with the path specified by this
<code>SmbFile</code>. For this method to be successful, the target
must not already exist. This method will fail when
used with <code>smb1://</code>, <code>smb1://workgroup/</code>,
<code>smb1://server/</code>, or <code>smb1://server/share/</code> URLs
because workgro... | [
"Creates",
"a",
"directory",
"with",
"the",
"path",
"specified",
"by",
"this",
"<code",
">",
"SmbFile<",
"/",
"code",
">",
".",
"For",
"this",
"method",
"to",
"be",
"successful",
"the",
"target",
"must",
"not",
"already",
"exist",
".",
"This",
"method",
... | train | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/SmbFile.java#L2519-L2536 |
atomix/catalyst | serializer/src/main/java/io/atomix/catalyst/serializer/util/CatalystSerializableSerializer.java | CatalystSerializableSerializer.readObject | @SuppressWarnings("unchecked")
private T readObject(Class<T> type, BufferInput<?> buffer, Serializer serializer) {
"""
Reads an object.
@param type The object type.
@param buffer The object buffer.
@param serializer The serializer with which the object is being read.
@return The object.
"""
try {
... | java | @SuppressWarnings("unchecked")
private T readObject(Class<T> type, BufferInput<?> buffer, Serializer serializer) {
try {
Constructor<?> constructor = constructorMap.get(type);
if (constructor == null) {
try {
constructor = type.getDeclaredConstructor();
constructor.setAcces... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"T",
"readObject",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"BufferInput",
"<",
"?",
">",
"buffer",
",",
"Serializer",
"serializer",
")",
"{",
"try",
"{",
"Constructor",
"<",
"?",
">",
"cons... | Reads an object.
@param type The object type.
@param buffer The object buffer.
@param serializer The serializer with which the object is being read.
@return The object. | [
"Reads",
"an",
"object",
"."
] | train | https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/util/CatalystSerializableSerializer.java#L115-L135 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/EntityMetadata.java | EntityMetadata.addRelation | public void addRelation(String property, Relation relation) {
"""
Adds the relation.
@param property
the property
@param relation
the relation
"""
relationsMap.put(property, relation);
addRelationName(relation);
} | java | public void addRelation(String property, Relation relation)
{
relationsMap.put(property, relation);
addRelationName(relation);
} | [
"public",
"void",
"addRelation",
"(",
"String",
"property",
",",
"Relation",
"relation",
")",
"{",
"relationsMap",
".",
"put",
"(",
"property",
",",
"relation",
")",
";",
"addRelationName",
"(",
"relation",
")",
";",
"}"
] | Adds the relation.
@param property
the property
@param relation
the relation | [
"Adds",
"the",
"relation",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/EntityMetadata.java#L361-L365 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_conference_serviceName_histories_id_GET | public OvhConferenceHistory billingAccount_conference_serviceName_histories_id_GET(String billingAccount, String serviceName, Long id) throws IOException {
"""
Get this object properties
REST: GET /telephony/{billingAccount}/conference/{serviceName}/histories/{id}
@param billingAccount [required] The name of y... | java | public OvhConferenceHistory billingAccount_conference_serviceName_histories_id_GET(String billingAccount, String serviceName, Long id) throws IOException {
String qPath = "/telephony/{billingAccount}/conference/{serviceName}/histories/{id}";
StringBuilder sb = path(qPath, billingAccount, serviceName, id);
String ... | [
"public",
"OvhConferenceHistory",
"billingAccount_conference_serviceName_histories_id_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"id",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/conference/{se... | Get this object properties
REST: GET /telephony/{billingAccount}/conference/{serviceName}/histories/{id}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param id [required] Id of the object | [
"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#L4680-L4685 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceRequestMap.java | InstanceRequestMap.setMinimumNumberOfInstances | public void setMinimumNumberOfInstances(final InstanceType instanceType, final int number) {
"""
Sets the minimum number of instances to be requested from the given instance type.
@param instanceType
the type of instance to request
@param number
the minimum number of instances to request
"""
this.mini... | java | public void setMinimumNumberOfInstances(final InstanceType instanceType, final int number) {
this.minimumMap.put(instanceType, Integer.valueOf(number));
} | [
"public",
"void",
"setMinimumNumberOfInstances",
"(",
"final",
"InstanceType",
"instanceType",
",",
"final",
"int",
"number",
")",
"{",
"this",
".",
"minimumMap",
".",
"put",
"(",
"instanceType",
",",
"Integer",
".",
"valueOf",
"(",
"number",
")",
")",
";",
... | Sets the minimum number of instances to be requested from the given instance type.
@param instanceType
the type of instance to request
@param number
the minimum number of instances to request | [
"Sets",
"the",
"minimum",
"number",
"of",
"instances",
"to",
"be",
"requested",
"from",
"the",
"given",
"instance",
"type",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceRequestMap.java#L53-L56 |
sagiegurari/fax4j | src/main/java/org/fax4j/bridge/http/SimpleHTTPRequestParser.java | SimpleHTTPRequestParser.getFileInfoFromRequestImpl | protected FileInfo getFileInfoFromRequestImpl(HTTPRequest request,Map<String,String> queryStringMap) {
"""
This function returns the file info from the request data.
@param request
The HTTP request
@param queryStringMap
The query string as key/value map
@return The file info
"""
//get file ... | java | protected FileInfo getFileInfoFromRequestImpl(HTTPRequest request,Map<String,String> queryStringMap)
{
//get file name
String name=queryStringMap.get("file");
if(name==null)
{
throw new FaxException("File name not provided in query string.");
}
//... | [
"protected",
"FileInfo",
"getFileInfoFromRequestImpl",
"(",
"HTTPRequest",
"request",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryStringMap",
")",
"{",
"//get file name",
"String",
"name",
"=",
"queryStringMap",
".",
"get",
"(",
"\"file\"",
")",
";",
"i... | This function returns the file info from the request data.
@param request
The HTTP request
@param queryStringMap
The query string as key/value map
@return The file info | [
"This",
"function",
"returns",
"the",
"file",
"info",
"from",
"the",
"request",
"data",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/bridge/http/SimpleHTTPRequestParser.java#L166-L199 |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.setItem | public final void setItem(final int index, final int id, @NonNull final CharSequence title) {
"""
Replaces the item at a specific index with another item.
@param index
The index of the item, which should be replaced, as an {@link Integer} value
@param id
The id of the item, which should be added, as an {@lin... | java | public final void setItem(final int index, final int id, @NonNull final CharSequence title) {
Item item = new Item(id, title);
adapter.set(index, item);
adaptGridViewHeight();
} | [
"public",
"final",
"void",
"setItem",
"(",
"final",
"int",
"index",
",",
"final",
"int",
"id",
",",
"@",
"NonNull",
"final",
"CharSequence",
"title",
")",
"{",
"Item",
"item",
"=",
"new",
"Item",
"(",
"id",
",",
"title",
")",
";",
"adapter",
".",
"se... | Replaces the item at a specific index with another item.
@param index
The index of the item, which should be replaced, as an {@link Integer} value
@param id
The id of the item, which should be added, as an {@link Integer} value. The id must
be at least 0
@param title
The title of the item, which should be added, as an... | [
"Replaces",
"the",
"item",
"at",
"a",
"specific",
"index",
"with",
"another",
"item",
"."
] | train | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L2058-L2062 |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/environment/classloading/ThreadContextClassLoaderBuilder.java | ThreadContextClassLoaderBuilder.createFor | public static ThreadContextClassLoaderBuilder createFor(final ClassLoader classLoader,
final Log log,
final String encoding) {
"""
Creates a new ThreadContextClassLoaderBuilder using the supplied... | java | public static ThreadContextClassLoaderBuilder createFor(final ClassLoader classLoader,
final Log log,
final String encoding) {
// Check sanity
Validate.notNull(classLoader, "classLoad... | [
"public",
"static",
"ThreadContextClassLoaderBuilder",
"createFor",
"(",
"final",
"ClassLoader",
"classLoader",
",",
"final",
"Log",
"log",
",",
"final",
"String",
"encoding",
")",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"classLoader",
",",
"\"class... | Creates a new ThreadContextClassLoaderBuilder using the supplied original classLoader, as well
as the supplied Maven Log.
@param classLoader The original ClassLoader which should be used as the parent for the ThreadContext
ClassLoader produced by the ThreadContextClassLoaderBuilder generated by this builder method.
Ca... | [
"Creates",
"a",
"new",
"ThreadContextClassLoaderBuilder",
"using",
"the",
"supplied",
"original",
"classLoader",
"as",
"well",
"as",
"the",
"supplied",
"Maven",
"Log",
"."
] | train | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/environment/classloading/ThreadContextClassLoaderBuilder.java#L253-L263 |
Ellzord/JALSE | src/main/java/jalse/entities/Entities.java | Entities.walkEntityTree | public static void walkEntityTree(final EntityContainer container, final int maxDepth,
final EntityVisitor visitor) {
"""
Walks through all entities (recursive and breadth-first). Walking can be stopped or filtered
based on the visit result returned.
@param container
Entity container.
@param maxDepth
M... | java | public static void walkEntityTree(final EntityContainer container, final int maxDepth,
final EntityVisitor visitor) {
final EntityTreeWalker walker = new EntityTreeWalker(container, maxDepth, visitor);
while (walker.isWalking()) {
walker.walk();
}
} | [
"public",
"static",
"void",
"walkEntityTree",
"(",
"final",
"EntityContainer",
"container",
",",
"final",
"int",
"maxDepth",
",",
"final",
"EntityVisitor",
"visitor",
")",
"{",
"final",
"EntityTreeWalker",
"walker",
"=",
"new",
"EntityTreeWalker",
"(",
"container",
... | Walks through all entities (recursive and breadth-first). Walking can be stopped or filtered
based on the visit result returned.
@param container
Entity container.
@param maxDepth
Maximum depth of the walk.
@param visitor
Entity visitor.
@see EntityVisitor | [
"Walks",
"through",
"all",
"entities",
"(",
"recursive",
"and",
"breadth",
"-",
"first",
")",
".",
"Walking",
"can",
"be",
"stopped",
"or",
"filtered",
"based",
"on",
"the",
"visit",
"result",
"returned",
"."
] | train | https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L519-L525 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/ClassUtils.java | ClassUtils.createInstance | public static <T> T createInstance(Class<T> cls, Object... args) {
"""
Method that can be called to try to create an instantiate of
specified type.
@param <T> the generic type
@param cls the class to check
@param args the arguments
@return an instantiated object
@throws IllegalArgumentException if instanti... | java | public static <T> T createInstance(Class<T> cls, Object... args) {
Class<?>[] argTypes = new Class<?>[args.length];
for (int i = 0; i < args.length; i++) {
argTypes[i] = args[i].getClass();
}
return createInstance(cls, args, argTypes);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createInstance",
"(",
"Class",
"<",
"T",
">",
"cls",
",",
"Object",
"...",
"args",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"argTypes",
"=",
"new",
"Class",
"<",
"?",
">",
"[",
"args",
".",
"length",
... | Method that can be called to try to create an instantiate of
specified type.
@param <T> the generic type
@param cls the class to check
@param args the arguments
@return an instantiated object
@throws IllegalArgumentException if instantiation fails for any reason;
except for cases where constructor throws an unchecked ... | [
"Method",
"that",
"can",
"be",
"called",
"to",
"try",
"to",
"create",
"an",
"instantiate",
"of",
"specified",
"type",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ClassUtils.java#L73-L79 |
netty/netty | common/src/main/java/io/netty/util/ThreadDeathWatcher.java | ThreadDeathWatcher.awaitInactivity | public static boolean awaitInactivity(long timeout, TimeUnit unit) throws InterruptedException {
"""
Waits until the thread of this watcher has no threads to watch and terminates itself.
Because a new watcher thread will be started again on {@link #watch(Thread, Runnable)},
this operation is only useful when you... | java | public static boolean awaitInactivity(long timeout, TimeUnit unit) throws InterruptedException {
if (unit == null) {
throw new NullPointerException("unit");
}
Thread watcherThread = ThreadDeathWatcher.watcherThread;
if (watcherThread != null) {
watcherThread.join... | [
"public",
"static",
"boolean",
"awaitInactivity",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"unit",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"unit\"",
")",
";",
"}",
... | Waits until the thread of this watcher has no threads to watch and terminates itself.
Because a new watcher thread will be started again on {@link #watch(Thread, Runnable)},
this operation is only useful when you want to ensure that the watcher thread is terminated
<strong>after</strong> your application is shut down a... | [
"Waits",
"until",
"the",
"thread",
"of",
"this",
"watcher",
"has",
"no",
"threads",
"to",
"watch",
"and",
"terminates",
"itself",
".",
"Because",
"a",
"new",
"watcher",
"thread",
"will",
"be",
"started",
"again",
"on",
"{",
"@link",
"#watch",
"(",
"Thread"... | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ThreadDeathWatcher.java#L139-L151 |
geomajas/geomajas-project-server | api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java | AssociationValue.setCurrencyAttribute | public void setCurrencyAttribute(String name, String value) {
"""
Sets the specified currency attribute to the specified value.
@param name name of the attribute
@param value value of the attribute
@since 1.9.0
"""
ensureAttributes();
Attribute attribute = new CurrencyAttribute(value);
attribute.set... | java | public void setCurrencyAttribute(String name, String value) {
ensureAttributes();
Attribute attribute = new CurrencyAttribute(value);
attribute.setEditable(isEditable(name));
getAllAttributes().put(name, attribute);
} | [
"public",
"void",
"setCurrencyAttribute",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"ensureAttributes",
"(",
")",
";",
"Attribute",
"attribute",
"=",
"new",
"CurrencyAttribute",
"(",
"value",
")",
";",
"attribute",
".",
"setEditable",
"(",
"isEd... | Sets the specified currency attribute to the specified value.
@param name name of the attribute
@param value value of the attribute
@since 1.9.0 | [
"Sets",
"the",
"specified",
"currency",
"attribute",
"to",
"the",
"specified",
"value",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java#L232-L237 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/Environment.java | Environment.handleErrorResponse | public static void handleErrorResponse(String msg, String responseText) {
"""
Creates exception that will display nicely in a columnFixture.
@param msg message for exception
@param responseText XML received, which will be shown in wiki table.
@throws FitFailureException always
"""
String responseHtm... | java | public static void handleErrorResponse(String msg, String responseText) {
String responseHtml;
Environment instance = getInstance();
try {
responseHtml = instance.getHtmlForXml(responseText);
} catch (Exception e) {
responseHtml = instance.getHtml(value -> value, ... | [
"public",
"static",
"void",
"handleErrorResponse",
"(",
"String",
"msg",
",",
"String",
"responseText",
")",
"{",
"String",
"responseHtml",
";",
"Environment",
"instance",
"=",
"getInstance",
"(",
")",
";",
"try",
"{",
"responseHtml",
"=",
"instance",
".",
"ge... | Creates exception that will display nicely in a columnFixture.
@param msg message for exception
@param responseText XML received, which will be shown in wiki table.
@throws FitFailureException always | [
"Creates",
"exception",
"that",
"will",
"display",
"nicely",
"in",
"a",
"columnFixture",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L545-L555 |
facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java | ServerLogReaderTransactional.setupIngestStreamWithRetries | private void setupIngestStreamWithRetries(long txid) throws IOException {
"""
Setup the input stream to be consumed by the reader, with retries on
failures.
"""
for (int i = 0; i < inputStreamRetries; i++) {
try {
setupCurrentEditStream(txid);
return;
} catch (IOException e) {
... | java | private void setupIngestStreamWithRetries(long txid) throws IOException {
for (int i = 0; i < inputStreamRetries; i++) {
try {
setupCurrentEditStream(txid);
return;
} catch (IOException e) {
if (i == inputStreamRetries - 1) {
throw new IOException("Cannot obtain stream ... | [
"private",
"void",
"setupIngestStreamWithRetries",
"(",
"long",
"txid",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"inputStreamRetries",
";",
"i",
"++",
")",
"{",
"try",
"{",
"setupCurrentEditStream",
"(",
"txid",
"... | Setup the input stream to be consumed by the reader, with retries on
failures. | [
"Setup",
"the",
"input",
"stream",
"to",
"be",
"consumed",
"by",
"the",
"reader",
"with",
"retries",
"on",
"failures",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java#L378-L393 |
Harium/keel | src/main/java/com/harium/keel/catalano/core/FloatPoint.java | FloatPoint.Add | public FloatPoint Add(FloatPoint point1, FloatPoint point2) {
"""
Adds values of two points.
@param point1 FloatPoint.
@param point2 FloatPoint.
@return A new FloatPoint with the add operation.
"""
FloatPoint result = new FloatPoint(point1);
result.Add(point2);
return result;
... | java | public FloatPoint Add(FloatPoint point1, FloatPoint point2) {
FloatPoint result = new FloatPoint(point1);
result.Add(point2);
return result;
} | [
"public",
"FloatPoint",
"Add",
"(",
"FloatPoint",
"point1",
",",
"FloatPoint",
"point2",
")",
"{",
"FloatPoint",
"result",
"=",
"new",
"FloatPoint",
"(",
"point1",
")",
";",
"result",
".",
"Add",
"(",
"point2",
")",
";",
"return",
"result",
";",
"}"
] | Adds values of two points.
@param point1 FloatPoint.
@param point2 FloatPoint.
@return A new FloatPoint with the add operation. | [
"Adds",
"values",
"of",
"two",
"points",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/FloatPoint.java#L137-L141 |
facebook/fresco | samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/data/impl/ContentProviderSimpleAdapter.java | ContentProviderSimpleAdapter.getExternalPhotoSimpleAdapter | public static ContentProviderSimpleAdapter getExternalPhotoSimpleAdapter(Context context) {
"""
Creates and returns a SimpleAdapter for External Photos
@param context The Context
@return The SimpleAdapter for local photo
"""
return new ContentProviderSimpleAdapter(MediaStore.Images.Media.EXTERNAL_CONTE... | java | public static ContentProviderSimpleAdapter getExternalPhotoSimpleAdapter(Context context) {
return new ContentProviderSimpleAdapter(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, context);
} | [
"public",
"static",
"ContentProviderSimpleAdapter",
"getExternalPhotoSimpleAdapter",
"(",
"Context",
"context",
")",
"{",
"return",
"new",
"ContentProviderSimpleAdapter",
"(",
"MediaStore",
".",
"Images",
".",
"Media",
".",
"EXTERNAL_CONTENT_URI",
",",
"context",
")",
"... | Creates and returns a SimpleAdapter for External Photos
@param context The Context
@return The SimpleAdapter for local photo | [
"Creates",
"and",
"returns",
"a",
"SimpleAdapter",
"for",
"External",
"Photos"
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/data/impl/ContentProviderSimpleAdapter.java#L57-L59 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractTriangle3F.java | AbstractTriangle3F.toPlane | @Pure
protected static Plane3D<?> toPlane(
double tx1, double ty1, double tz1,
double tx2, double ty2, double tz2,
double tx3, double ty3, double tz3) {
"""
Compute the plane of the given triangle.
@param tx1 x coordinate of the first point of the triangle.
@param ty1 y coordinate of the first point ... | java | @Pure
protected static Plane3D<?> toPlane(
double tx1, double ty1, double tz1,
double tx2, double ty2, double tz2,
double tx3, double ty3, double tz3) {
Vector3f norm = new Vector3f();
FunctionalVector3D.crossProduct(
tx2 - tx1,
ty2 - ty1,
tz2 - tz1,
tx3 - tx1,
ty3 - ty1,
tz3 - tz1... | [
"@",
"Pure",
"protected",
"static",
"Plane3D",
"<",
"?",
">",
"toPlane",
"(",
"double",
"tx1",
",",
"double",
"ty1",
",",
"double",
"tz1",
",",
"double",
"tx2",
",",
"double",
"ty2",
",",
"double",
"tz2",
",",
"double",
"tx3",
",",
"double",
"ty3",
"... | Compute the plane of the given triangle.
@param tx1 x coordinate of the first point of the triangle.
@param ty1 y coordinate of the first point of the triangle.
@param tz1 z coordinate of the first point of the triangle.
@param tx2 x coordinate of the second point of the triangle.
@param ty2 y coordinate of the second... | [
"Compute",
"the",
"plane",
"of",
"the",
"given",
"triangle",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractTriangle3F.java#L407-L429 |
di2e/Argo | clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java | CLIContext.put | public Object put(String key, Object o) {
"""
Add an object to the context.
@param key The key to add.
@param o The object to add.
@return The previous object associated with this key, or null if there was none.
"""
return _properties.put(key, o);
} | java | public Object put(String key, Object o) {
return _properties.put(key, o);
} | [
"public",
"Object",
"put",
"(",
"String",
"key",
",",
"Object",
"o",
")",
"{",
"return",
"_properties",
".",
"put",
"(",
"key",
",",
"o",
")",
";",
"}"
] | Add an object to the context.
@param key The key to add.
@param o The object to add.
@return The previous object associated with this key, or null if there was none. | [
"Add",
"an",
"object",
"to",
"the",
"context",
"."
] | train | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java#L134-L136 |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/ChangeObjects.java | ChangeObjects.changeMonomerNotation | public final static void changeMonomerNotation(int position, PolymerNotation polymer, MonomerNotation not) {
"""
method to change the MonomerNotation on the specific position
@param position
position of the changed MonomerNotation
@param polymer
PolymerNotation
@param not
changed MonomerNotation
"""
... | java | public final static void changeMonomerNotation(int position, PolymerNotation polymer, MonomerNotation not) {
polymer.getPolymerElements().getListOfElements().set(position, not);
} | [
"public",
"final",
"static",
"void",
"changeMonomerNotation",
"(",
"int",
"position",
",",
"PolymerNotation",
"polymer",
",",
"MonomerNotation",
"not",
")",
"{",
"polymer",
".",
"getPolymerElements",
"(",
")",
".",
"getListOfElements",
"(",
")",
".",
"set",
"(",... | method to change the MonomerNotation on the specific position
@param position
position of the changed MonomerNotation
@param polymer
PolymerNotation
@param not
changed MonomerNotation | [
"method",
"to",
"change",
"the",
"MonomerNotation",
"on",
"the",
"specific",
"position"
] | train | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L291-L293 |
jmeter-maven-plugin/jmeter-maven-plugin | src/main/java/com/lazerycode/jmeter/mojo/AbstractJMeterMojo.java | AbstractJMeterMojo.computeJMeterArgumentsArray | protected JMeterArgumentsArray computeJMeterArgumentsArray(boolean disableGUI, boolean isCSVFormat) throws MojoExecutionException {
"""
Generate the initial JMeter Arguments array that is used to create the command line that we pass to JMeter.
@throws MojoExecutionException
"""
JMeterArgumentsArray ... | java | protected JMeterArgumentsArray computeJMeterArgumentsArray(boolean disableGUI, boolean isCSVFormat) throws MojoExecutionException {
JMeterArgumentsArray testArgs = new JMeterArgumentsArray(disableGUI, jmeterDirectory.getAbsolutePath())
.setResultsDirectory(resultsDirectory.getAbsolutePath())
... | [
"protected",
"JMeterArgumentsArray",
"computeJMeterArgumentsArray",
"(",
"boolean",
"disableGUI",
",",
"boolean",
"isCSVFormat",
")",
"throws",
"MojoExecutionException",
"{",
"JMeterArgumentsArray",
"testArgs",
"=",
"new",
"JMeterArgumentsArray",
"(",
"disableGUI",
",",
"jm... | Generate the initial JMeter Arguments array that is used to create the command line that we pass to JMeter.
@throws MojoExecutionException | [
"Generate",
"the",
"initial",
"JMeter",
"Arguments",
"array",
"that",
"is",
"used",
"to",
"create",
"the",
"command",
"line",
"that",
"we",
"pass",
"to",
"JMeter",
"."
] | train | https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/63dc8b49cc6b9542deb681e25a2ada6025ddbf6b/src/main/java/com/lazerycode/jmeter/mojo/AbstractJMeterMojo.java#L235-L253 |
kotcrab/vis-ui | ui/src/main/java/com/kotcrab/vis/ui/widget/file/FileUtils.java | FileUtils.sortFiles | public static Array<FileHandle> sortFiles (FileHandle[] files, Comparator<FileHandle> comparator) {
"""
Sorts file list, using this rules: directories first, sorted using provided comparator, then files sorted using provided comparator.
@param files list to sort
@param comparator comparator used to sort files an... | java | public static Array<FileHandle> sortFiles (FileHandle[] files, Comparator<FileHandle> comparator) {
return sortFiles(files, comparator, false);
} | [
"public",
"static",
"Array",
"<",
"FileHandle",
">",
"sortFiles",
"(",
"FileHandle",
"[",
"]",
"files",
",",
"Comparator",
"<",
"FileHandle",
">",
"comparator",
")",
"{",
"return",
"sortFiles",
"(",
"files",
",",
"comparator",
",",
"false",
")",
";",
"}"
] | Sorts file list, using this rules: directories first, sorted using provided comparator, then files sorted using provided comparator.
@param files list to sort
@param comparator comparator used to sort files and directories list
@return sorted file list | [
"Sorts",
"file",
"list",
"using",
"this",
"rules",
":",
"directories",
"first",
"sorted",
"using",
"provided",
"comparator",
"then",
"files",
"sorted",
"using",
"provided",
"comparator",
"."
] | train | https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/widget/file/FileUtils.java#L99-L101 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.