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 |
|---|---|---|---|---|---|---|---|---|---|---|
JodaOrg/joda-time | src/main/java/org/joda/time/tz/DateTimeZoneBuilder.java | DateTimeZoneBuilder.writeTo | public void writeTo(String zoneID, OutputStream out) throws IOException {
"""
Encodes a built DateTimeZone to the given stream. Call readFrom to
decode the data into a DateTimeZone object.
@param out the output stream to receive the encoded DateTimeZone
@since 1.5 (parameter added)
"""
if (out in... | java | public void writeTo(String zoneID, OutputStream out) throws IOException {
if (out instanceof DataOutput) {
writeTo(zoneID, (DataOutput)out);
} else {
DataOutputStream dout = new DataOutputStream(out);
writeTo(zoneID, (DataOutput)dout);
dout.flush();
... | [
"public",
"void",
"writeTo",
"(",
"String",
"zoneID",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"out",
"instanceof",
"DataOutput",
")",
"{",
"writeTo",
"(",
"zoneID",
",",
"(",
"DataOutput",
")",
"out",
")",
";",
"}",
"els... | Encodes a built DateTimeZone to the given stream. Call readFrom to
decode the data into a DateTimeZone object.
@param out the output stream to receive the encoded DateTimeZone
@since 1.5 (parameter added) | [
"Encodes",
"a",
"built",
"DateTimeZone",
"to",
"the",
"given",
"stream",
".",
"Call",
"readFrom",
"to",
"decode",
"the",
"data",
"into",
"a",
"DateTimeZone",
"object",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/tz/DateTimeZoneBuilder.java#L447-L455 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/map/MapView.java | MapView.getWorldToPanTranslation | public Matrix getWorldToPanTranslation() {
"""
Return the translation of scaled world coordinates to coordinates relative to the pan origin.
@return transformation matrix
"""
if (viewState.getScale() > 0) {
double dX = -(viewState.getPanX() * viewState.getScale());
double dY = viewState.getPanY() * ... | java | public Matrix getWorldToPanTranslation() {
if (viewState.getScale() > 0) {
double dX = -(viewState.getPanX() * viewState.getScale());
double dY = viewState.getPanY() * viewState.getScale();
return new Matrix(1, 0, 0, 1, dX, dY);
}
return new Matrix(1, 0, 0, 1, 0, 0);
} | [
"public",
"Matrix",
"getWorldToPanTranslation",
"(",
")",
"{",
"if",
"(",
"viewState",
".",
"getScale",
"(",
")",
">",
"0",
")",
"{",
"double",
"dX",
"=",
"-",
"(",
"viewState",
".",
"getPanX",
"(",
")",
"*",
"viewState",
".",
"getScale",
"(",
")",
"... | Return the translation of scaled world coordinates to coordinates relative to the pan origin.
@return transformation matrix | [
"Return",
"the",
"translation",
"of",
"scaled",
"world",
"coordinates",
"to",
"coordinates",
"relative",
"to",
"the",
"pan",
"origin",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L197-L204 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java | FSImage.confirmFormat | boolean confirmFormat(boolean force, boolean interactive) throws IOException {
"""
Check whether the storage directories and non-file journals exist.
If running in interactive mode, will prompt the user for each
directory to allow them to format anyway. Otherwise, returns
false, unless 'force' is specified.
... | java | boolean confirmFormat(boolean force, boolean interactive) throws IOException {
List<FormatConfirmable> confirms = Lists.newArrayList();
for (StorageDirectory sd : storage.dirIterable(null)) {
confirms.add(sd);
}
confirms.addAll(editLog.getFormatConfirmables());
return Storage.confirmFormat(... | [
"boolean",
"confirmFormat",
"(",
"boolean",
"force",
",",
"boolean",
"interactive",
")",
"throws",
"IOException",
"{",
"List",
"<",
"FormatConfirmable",
">",
"confirms",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"for",
"(",
"StorageDirectory",
"sd",
":... | Check whether the storage directories and non-file journals exist.
If running in interactive mode, will prompt the user for each
directory to allow them to format anyway. Otherwise, returns
false, unless 'force' is specified.
@param interactive prompt the user when a dir exists
@return true if formatting should procee... | [
"Check",
"whether",
"the",
"storage",
"directories",
"and",
"non",
"-",
"file",
"journals",
"exist",
".",
"If",
"running",
"in",
"interactive",
"mode",
"will",
"prompt",
"the",
"user",
"for",
"each",
"directory",
"to",
"allow",
"them",
"to",
"format",
"anywa... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L1112-L1119 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.setProperties | private void setProperties(KsDef ksDef, Map<String, String> strategy_options) {
"""
Sets the properties.
@param ksDef
the ks def
@param strategy_options
the strategy_options
"""
Schema schema = CassandraPropertyReader.csmd.getSchema(databaseName);
if (schema != null && schema.getName() !=... | java | private void setProperties(KsDef ksDef, Map<String, String> strategy_options)
{
Schema schema = CassandraPropertyReader.csmd.getSchema(databaseName);
if (schema != null && schema.getName() != null && schema.getName().equalsIgnoreCase(databaseName)
&& schema.getSchemaProperties() != n... | [
"private",
"void",
"setProperties",
"(",
"KsDef",
"ksDef",
",",
"Map",
"<",
"String",
",",
"String",
">",
"strategy_options",
")",
"{",
"Schema",
"schema",
"=",
"CassandraPropertyReader",
".",
"csmd",
".",
"getSchema",
"(",
"databaseName",
")",
";",
"if",
"(... | Sets the properties.
@param ksDef
the ks def
@param strategy_options
the strategy_options | [
"Sets",
"the",
"properties",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L2157-L2169 |
ModeShape/modeshape | web/modeshape-web-jcr-rest/src/main/java/org/modeshape/web/jcr/rest/handler/RestItemHandler.java | RestItemHandler.addItems | public Response addItems( HttpServletRequest request,
String repositoryName,
String workspaceName,
String requestContent ) throws JSONException, RepositoryException {
"""
Performs a bulk creation of items, using a single {@li... | java | public Response addItems( HttpServletRequest request,
String repositoryName,
String workspaceName,
String requestContent ) throws JSONException, RepositoryException {
JSONObject requestBody = stringToJSONObject(requestCont... | [
"public",
"Response",
"addItems",
"(",
"HttpServletRequest",
"request",
",",
"String",
"repositoryName",
",",
"String",
"workspaceName",
",",
"String",
"requestContent",
")",
"throws",
"JSONException",
",",
"RepositoryException",
"{",
"JSONObject",
"requestBody",
"=",
... | Performs a bulk creation of items, using a single {@link Session}. If any of the items cannot be created for whatever
reason, the entire operation fails.
@param request the servlet request; may not be null or unauthenticated
@param repositoryName the URL-encoded repository name
@param workspaceName the URL-encoded wor... | [
"Performs",
"a",
"bulk",
"creation",
"of",
"items",
"using",
"a",
"single",
"{",
"@link",
"Session",
"}",
".",
"If",
"any",
"of",
"the",
"items",
"cannot",
"be",
"created",
"for",
"whatever",
"reason",
"the",
"entire",
"operation",
"fails",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-jcr-rest/src/main/java/org/modeshape/web/jcr/rest/handler/RestItemHandler.java#L179-L190 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java | DebugUtil.printDebug | public static void printDebug(final Properties pProperties, final PrintStream pPrintStream) {
"""
Prints the content of a {@code java.util.Properties} to a {@code java.io.PrintStream}.
<p>
@param pProperties the {@code java.util.Properties} to be printed.
@param pPrintStream the {@code java.io.PrintStream} for ... | java | public static void printDebug(final Properties pProperties, final PrintStream pPrintStream) {
if (pPrintStream == null) {
System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE);
return;
}
if (pProperties == null) {
pPrintStream.println(PROPERTIES_IS_NULL_ERROR_MESSAGE);
retur... | [
"public",
"static",
"void",
"printDebug",
"(",
"final",
"Properties",
"pProperties",
",",
"final",
"PrintStream",
"pPrintStream",
")",
"{",
"if",
"(",
"pPrintStream",
"==",
"null",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"PRINTSTREAM_IS_NULL_ERROR_M... | Prints the content of a {@code java.util.Properties} to a {@code java.io.PrintStream}.
<p>
@param pProperties the {@code java.util.Properties} to be printed.
@param pPrintStream the {@code java.io.PrintStream} for flushing the results.
@see <a href="http://java.sun.com/products/jdk/1.3/docs/api/java/util/Properties.htm... | [
"Prints",
"the",
"content",
"of",
"a",
"{"
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java#L698-L716 |
buschmais/jqa-core-framework | plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/PluginConfigurationReaderImpl.java | PluginConfigurationReaderImpl.getPlugins | @Override
public List<JqassistantPlugin> getPlugins() {
"""
Returns an {@link Iterable} over all plugins which can be resolved from
the current classpath.
@return The plugins which can be resolved from the current classpath.
"""
if (this.plugins == null) {
final Enumeration<URL> res... | java | @Override
public List<JqassistantPlugin> getPlugins() {
if (this.plugins == null) {
final Enumeration<URL> resources;
try {
resources = pluginClassLoader.getResources(PLUGIN_RESOURCE);
} catch (IOException e) {
throw new IllegalStateExcepti... | [
"@",
"Override",
"public",
"List",
"<",
"JqassistantPlugin",
">",
"getPlugins",
"(",
")",
"{",
"if",
"(",
"this",
".",
"plugins",
"==",
"null",
")",
"{",
"final",
"Enumeration",
"<",
"URL",
">",
"resources",
";",
"try",
"{",
"resources",
"=",
"pluginClas... | Returns an {@link Iterable} over all plugins which can be resolved from
the current classpath.
@return The plugins which can be resolved from the current classpath. | [
"Returns",
"an",
"{",
"@link",
"Iterable",
"}",
"over",
"all",
"plugins",
"which",
"can",
"be",
"resolved",
"from",
"the",
"current",
"classpath",
"."
] | train | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/PluginConfigurationReaderImpl.java#L82-L104 |
haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/image/ColorServlet.java | ColorServlet.updateCRC | private void updateCRC(byte[] pBytes, int pOff, int pLen) {
"""
Updates the CRC for a byte array. Note that the byte array must be at
least {@code pOff + pLen + 4} bytes long, as the CRC is stored in the
4 last bytes.
@param pBytes the bytes to create CRC for
@param pOff the offset into the byte array to cre... | java | private void updateCRC(byte[] pBytes, int pOff, int pLen) {
int value;
synchronized (crc) {
crc.reset();
crc.update(pBytes, pOff, pLen);
value = (int) crc.getValue();
}
pBytes[pOff + pLen ] = (byte) ((value >> 24) & 0xff);
pBytes... | [
"private",
"void",
"updateCRC",
"(",
"byte",
"[",
"]",
"pBytes",
",",
"int",
"pOff",
",",
"int",
"pLen",
")",
"{",
"int",
"value",
";",
"synchronized",
"(",
"crc",
")",
"{",
"crc",
".",
"reset",
"(",
")",
";",
"crc",
".",
"update",
"(",
"pBytes",
... | Updates the CRC for a byte array. Note that the byte array must be at
least {@code pOff + pLen + 4} bytes long, as the CRC is stored in the
4 last bytes.
@param pBytes the bytes to create CRC for
@param pOff the offset into the byte array to create CRC for
@param pLen the length of the byte array to create CRC for | [
"Updates",
"the",
"CRC",
"for",
"a",
"byte",
"array",
".",
"Note",
"that",
"the",
"byte",
"array",
"must",
"be",
"at",
"least",
"{",
"@code",
"pOff",
"+",
"pLen",
"+",
"4",
"}",
"bytes",
"long",
"as",
"the",
"CRC",
"is",
"stored",
"in",
"the",
"4",... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/ColorServlet.java#L173-L186 |
intellimate/Izou | src/main/java/org/intellimate/izou/security/SecureAccess.java | SecureAccess.createSecureAccess | static SecureAccess createSecureAccess(Main main, SystemMail systemMail) throws IllegalAccessException {
"""
Creates an SecureAccess. There can only be one single SecureAccess, so calling this method twice
will cause an illegal access exception.
@param main the main instance of izou
@param systemMail the syst... | java | static SecureAccess createSecureAccess(Main main, SystemMail systemMail) throws IllegalAccessException {
if (!exists) {
SecureAccess secureAccess = new SecureAccess(main, systemMail);
exists = true;
return secureAccess;
}
throw new IllegalAccessException("Can... | [
"static",
"SecureAccess",
"createSecureAccess",
"(",
"Main",
"main",
",",
"SystemMail",
"systemMail",
")",
"throws",
"IllegalAccessException",
"{",
"if",
"(",
"!",
"exists",
")",
"{",
"SecureAccess",
"secureAccess",
"=",
"new",
"SecureAccess",
"(",
"main",
",",
... | Creates an SecureAccess. There can only be one single SecureAccess, so calling this method twice
will cause an illegal access exception.
@param main the main instance of izou
@param systemMail the system mail object in order to send e-mails to owner in case of emergency
@return a SecureAccess object
@throws IllegalAcc... | [
"Creates",
"an",
"SecureAccess",
".",
"There",
"can",
"only",
"be",
"one",
"single",
"SecureAccess",
"so",
"calling",
"this",
"method",
"twice",
"will",
"cause",
"an",
"illegal",
"access",
"exception",
"."
] | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/security/SecureAccess.java#L32-L40 |
SeleniumHQ/fluent-selenium | java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java | FluentSelect.deselectAll | public FluentSelect deselectAll() {
"""
Clear all selected entries. This is only valid when the SELECT supports multiple selections.
@throws UnsupportedOperationException If the SELECT does not support multiple selections
"""
executeAndWrapReThrowIfNeeded(new DeselectAll(), Context.singular(context,... | java | public FluentSelect deselectAll() {
executeAndWrapReThrowIfNeeded(new DeselectAll(), Context.singular(context, "deselectAll"), true);
return new FluentSelect(super.delegate, currentElement.getFound(), this.context, monitor, booleanInsteadOfNotFoundException);
} | [
"public",
"FluentSelect",
"deselectAll",
"(",
")",
"{",
"executeAndWrapReThrowIfNeeded",
"(",
"new",
"DeselectAll",
"(",
")",
",",
"Context",
".",
"singular",
"(",
"context",
",",
"\"deselectAll\"",
")",
",",
"true",
")",
";",
"return",
"new",
"FluentSelect",
... | Clear all selected entries. This is only valid when the SELECT supports multiple selections.
@throws UnsupportedOperationException If the SELECT does not support multiple selections | [
"Clear",
"all",
"selected",
"entries",
".",
"This",
"is",
"only",
"valid",
"when",
"the",
"SELECT",
"supports",
"multiple",
"selections",
"."
] | train | https://github.com/SeleniumHQ/fluent-selenium/blob/fcb171471a7d1abb2800bcbca21b3ae3e6c12472/java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java#L123-L126 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/query/LiteralMapList.java | LiteralMapList.selectFirst | public LiteralMap selectFirst(String key, Object value) {
"""
Answer the first literal map with the given key and value
@param key
@param value
@return
"""
for (LiteralMap lm : this) {
if (isEqual(value, lm.get(key)))
return lm;
}
return null;
} | java | public LiteralMap selectFirst(String key, Object value) {
for (LiteralMap lm : this) {
if (isEqual(value, lm.get(key)))
return lm;
}
return null;
} | [
"public",
"LiteralMap",
"selectFirst",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"for",
"(",
"LiteralMap",
"lm",
":",
"this",
")",
"{",
"if",
"(",
"isEqual",
"(",
"value",
",",
"lm",
".",
"get",
"(",
"key",
")",
")",
")",
"return",
"l... | Answer the first literal map with the given key and value
@param key
@param value
@return | [
"Answer",
"the",
"first",
"literal",
"map",
"with",
"the",
"given",
"key",
"and",
"value"
] | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/LiteralMapList.java#L91-L97 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java | RunsInner.update | public RunInner update(String resourceGroupName, String registryName, String runId, Boolean isArchiveEnabled) {
"""
Patch the run properties.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param runId Th... | java | public RunInner update(String resourceGroupName, String registryName, String runId, Boolean isArchiveEnabled) {
return updateWithServiceResponseAsync(resourceGroupName, registryName, runId, isArchiveEnabled).toBlocking().last().body();
} | [
"public",
"RunInner",
"update",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"runId",
",",
"Boolean",
"isArchiveEnabled",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"ru... | Patch the run properties.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param runId The run ID.
@param isArchiveEnabled The value that indicates whether archiving is enabled or not.
@throws IllegalArgumentExcept... | [
"Patch",
"the",
"run",
"properties",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java#L524-L526 |
elki-project/elki | addons/uncertain/src/main/java/de/lmu/ifi/dbs/elki/data/uncertain/AbstractUncertainObject.java | AbstractUncertainObject.computeBounds | protected static HyperBoundingBox computeBounds(NumberVector[] samples) {
"""
Compute the bounding box for some samples.
@param samples Samples
@return Bounding box.
"""
assert(samples.length > 0) : "Cannot compute bounding box of empty set.";
// Compute bounds:
final int dimensions = samples[0... | java | protected static HyperBoundingBox computeBounds(NumberVector[] samples) {
assert(samples.length > 0) : "Cannot compute bounding box of empty set.";
// Compute bounds:
final int dimensions = samples[0].getDimensionality();
final double[] min = new double[dimensions];
final double[] max = new double[d... | [
"protected",
"static",
"HyperBoundingBox",
"computeBounds",
"(",
"NumberVector",
"[",
"]",
"samples",
")",
"{",
"assert",
"(",
"samples",
".",
"length",
">",
"0",
")",
":",
"\"Cannot compute bounding box of empty set.\"",
";",
"// Compute bounds:",
"final",
"int",
"... | Compute the bounding box for some samples.
@param samples Samples
@return Bounding box. | [
"Compute",
"the",
"bounding",
"box",
"for",
"some",
"samples",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/uncertain/src/main/java/de/lmu/ifi/dbs/elki/data/uncertain/AbstractUncertainObject.java#L50-L69 |
apache/incubator-gobblin | gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/converter/BaseEnvelopeSchemaConverter.java | BaseEnvelopeSchemaConverter.getFieldSchema | protected Schema getFieldSchema(GenericRecord record, String schemaIdLocation) throws Exception {
"""
Get the schema of a field
@param record the input record which has the schema id
@param schemaIdLocation a dot separated location string the schema id
@return a schema referenced by the schema id
"""
... | java | protected Schema getFieldSchema(GenericRecord record, String schemaIdLocation) throws Exception {
Optional<Object> schemaIdValue = AvroUtils.getFieldValue(record, schemaIdLocation);
if (!schemaIdValue.isPresent()) {
throw new Exception("Schema id with key " + schemaIdLocation + " not found in the record")... | [
"protected",
"Schema",
"getFieldSchema",
"(",
"GenericRecord",
"record",
",",
"String",
"schemaIdLocation",
")",
"throws",
"Exception",
"{",
"Optional",
"<",
"Object",
">",
"schemaIdValue",
"=",
"AvroUtils",
".",
"getFieldValue",
"(",
"record",
",",
"schemaIdLocatio... | Get the schema of a field
@param record the input record which has the schema id
@param schemaIdLocation a dot separated location string the schema id
@return a schema referenced by the schema id | [
"Get",
"the",
"schema",
"of",
"a",
"field"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/converter/BaseEnvelopeSchemaConverter.java#L101-L108 |
io7m/jaffirm | com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java | Postconditions.checkPostconditionD | public static double checkPostconditionD(
final double value,
final DoublePredicate predicate,
final DoubleFunction<String> describer) {
"""
A {@code double} specialized version of {@link #checkPostcondition(Object,
Predicate, Function)}
@param value The value
@param predicate The predicate
@... | java | public static double checkPostconditionD(
final double value,
final DoublePredicate predicate,
final DoubleFunction<String> describer)
{
final boolean ok;
try {
ok = predicate.test(value);
} catch (final Throwable e) {
throw failed(
e,
Double.valueOf(value),
... | [
"public",
"static",
"double",
"checkPostconditionD",
"(",
"final",
"double",
"value",
",",
"final",
"DoublePredicate",
"predicate",
",",
"final",
"DoubleFunction",
"<",
"String",
">",
"describer",
")",
"{",
"final",
"boolean",
"ok",
";",
"try",
"{",
"ok",
"=",... | A {@code double} specialized version of {@link #checkPostcondition(Object,
Predicate, Function)}
@param value The value
@param predicate The predicate
@param describer The describer of the predicate
@return value
@throws PostconditionViolationException If the predicate is false | [
"A",
"{",
"@code",
"double",
"}",
"specialized",
"version",
"of",
"{",
"@link",
"#checkPostcondition",
"(",
"Object",
"Predicate",
"Function",
")",
"}"
] | train | https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java#L518-L534 |
damianszczepanik/cucumber-reporting | src/main/java/net/masterthought/cucumber/json/Feature.java | Feature.setMetaData | public void setMetaData(int jsonFileNo, Configuration configuration) {
"""
Sets additional information and calculates values which should be calculated during object creation.
@param jsonFileNo index of the JSON file
@param configuration configuration for the report
"""
for (Element element : element... | java | public void setMetaData(int jsonFileNo, Configuration configuration) {
for (Element element : elements) {
element.setMetaData(this);
if (element.isScenario()) {
scenarios.add(element);
}
}
reportFileName = calculateReportFileName(jsonFileNo);... | [
"public",
"void",
"setMetaData",
"(",
"int",
"jsonFileNo",
",",
"Configuration",
"configuration",
")",
"{",
"for",
"(",
"Element",
"element",
":",
"elements",
")",
"{",
"element",
".",
"setMetaData",
"(",
"this",
")",
";",
"if",
"(",
"element",
".",
"isSce... | Sets additional information and calculates values which should be calculated during object creation.
@param jsonFileNo index of the JSON file
@param configuration configuration for the report | [
"Sets",
"additional",
"information",
"and",
"calculates",
"values",
"which",
"should",
"be",
"calculated",
"during",
"object",
"creation",
"."
] | train | https://github.com/damianszczepanik/cucumber-reporting/blob/9ffe0d4a9c0aec161b0988a930a8312ba36dc742/src/main/java/net/masterthought/cucumber/json/Feature.java#L156-L169 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java | SegmentAggregator.getOrCreateAggregatedAppend | private AggregatedAppendOperation getOrCreateAggregatedAppend(long operationOffset, long operationSequenceNumber) {
"""
Gets an existing AggregatedAppendOperation or creates a new one to add the given operation to.
An existing AggregatedAppend will be returned if it meets the following criteria:
* It is the last... | java | private AggregatedAppendOperation getOrCreateAggregatedAppend(long operationOffset, long operationSequenceNumber) {
AggregatedAppendOperation aggregatedAppend = null;
if (this.operations.size() > 0) {
StorageOperation last = this.operations.getLast();
if (last.getLength() < this.... | [
"private",
"AggregatedAppendOperation",
"getOrCreateAggregatedAppend",
"(",
"long",
"operationOffset",
",",
"long",
"operationSequenceNumber",
")",
"{",
"AggregatedAppendOperation",
"aggregatedAppend",
"=",
"null",
";",
"if",
"(",
"this",
".",
"operations",
".",
"size",
... | Gets an existing AggregatedAppendOperation or creates a new one to add the given operation to.
An existing AggregatedAppend will be returned if it meets the following criteria:
* It is the last operation in the operation queue.
* Its size is smaller than maxLength.
* It is not sealed (already flushed).
<p>
If at least ... | [
"Gets",
"an",
"existing",
"AggregatedAppendOperation",
"or",
"creates",
"a",
"new",
"one",
"to",
"add",
"the",
"given",
"operation",
"to",
".",
"An",
"existing",
"AggregatedAppend",
"will",
"be",
"returned",
"if",
"it",
"meets",
"the",
"following",
"criteria",
... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java#L504-L525 |
aws/aws-cloudtrail-processing-library | src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/configuration/PropertiesFileConfiguration.java | PropertiesFileConfiguration.loadProperty | private Properties loadProperty(String propertiesFile) {
"""
Load properties from a classpath property file.
@param propertiesFile the classpath properties file to read.
@return a <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html">Properties</a> object
containing the properties set i... | java | private Properties loadProperty(String propertiesFile) {
Properties prop = new Properties();
try {
InputStream in = getClass().getResourceAsStream(propertiesFile);
prop.load(in);
in.close();
} catch (IOException e) {
throw new IllegalStateException... | [
"private",
"Properties",
"loadProperty",
"(",
"String",
"propertiesFile",
")",
"{",
"Properties",
"prop",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"InputStream",
"in",
"=",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"(",
"propertiesFile",
")... | Load properties from a classpath property file.
@param propertiesFile the classpath properties file to read.
@return a <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html">Properties</a> object
containing the properties set in the file. | [
"Load",
"properties",
"from",
"a",
"classpath",
"property",
"file",
"."
] | train | https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/configuration/PropertiesFileConfiguration.java#L261-L271 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/map/geotools/grid/GridUtils.java | GridUtils.calculateBounds | public static Polygon calculateBounds(final MapfishMapContext context) {
"""
Create a polygon that represents in world space the exact area that will be visible on the printed
map.
@param context map context
"""
double rotation = context.getRootContext().getRotation();
ReferencedEnvelope en... | java | public static Polygon calculateBounds(final MapfishMapContext context) {
double rotation = context.getRootContext().getRotation();
ReferencedEnvelope env = context.getRootContext().toReferencedEnvelope();
Coordinate centre = env.centre();
AffineTransform rotateInstance = AffineTransform... | [
"public",
"static",
"Polygon",
"calculateBounds",
"(",
"final",
"MapfishMapContext",
"context",
")",
"{",
"double",
"rotation",
"=",
"context",
".",
"getRootContext",
"(",
")",
".",
"getRotation",
"(",
")",
";",
"ReferencedEnvelope",
"env",
"=",
"context",
".",
... | Create a polygon that represents in world space the exact area that will be visible on the printed
map.
@param context map context | [
"Create",
"a",
"polygon",
"that",
"represents",
"in",
"world",
"space",
"the",
"exact",
"area",
"that",
"will",
"be",
"visible",
"on",
"the",
"printed",
"map",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/map/geotools/grid/GridUtils.java#L42-L62 |
Alexey1Gavrilov/ExpectIt | expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java | Matchers.startsWith | public static Matcher<Result> startsWith(final String prefix) {
"""
Creates a matcher that matches when the input buffer starts with the given string.
<p/>
If the result is successful, the {@link net.sf.expectit.Result#getBefore()} returns an
empty string, the {@link net.sf.expectit.Result#group()} returns the ... | java | public static Matcher<Result> startsWith(final String prefix) {
return new Matcher<Result>() {
@Override
public Result matches(String input, boolean isEof) {
return input.startsWith(prefix)
? success(input, "", prefix)
: fai... | [
"public",
"static",
"Matcher",
"<",
"Result",
">",
"startsWith",
"(",
"final",
"String",
"prefix",
")",
"{",
"return",
"new",
"Matcher",
"<",
"Result",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Result",
"matches",
"(",
"String",
"input",
",",
"bool... | Creates a matcher that matches when the input buffer starts with the given string.
<p/>
If the result is successful, the {@link net.sf.expectit.Result#getBefore()} returns an
empty string, the {@link net.sf.expectit.Result#group()} returns the given string.
@param prefix the prefix string to match.
@return the result. | [
"Creates",
"a",
"matcher",
"that",
"matches",
"when",
"the",
"input",
"buffer",
"starts",
"with",
"the",
"given",
"string",
".",
"<p",
"/",
">",
"If",
"the",
"result",
"is",
"successful",
"the",
"{",
"@link",
"net",
".",
"sf",
".",
"expectit",
".",
"Re... | train | https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java#L356-L370 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java | Logger.entering | public void entering(String sourceClass, String sourceMethod, Object param1) {
"""
Log a method entry, with one parameter.
<p>
This is a convenience method that can be used to log entry
to a method. A LogRecord with message "ENTRY {0}", log level
FINER, and the given sourceMethod, sourceClass, and parameter
... | java | public void entering(String sourceClass, String sourceMethod, Object param1) {
if (Level.FINER.intValue() < levelValue) {
return;
}
Object params[] = { param1 };
logp(Level.FINER, sourceClass, sourceMethod, "ENTRY {0}", params);
} | [
"public",
"void",
"entering",
"(",
"String",
"sourceClass",
",",
"String",
"sourceMethod",
",",
"Object",
"param1",
")",
"{",
"if",
"(",
"Level",
".",
"FINER",
".",
"intValue",
"(",
")",
"<",
"levelValue",
")",
"{",
"return",
";",
"}",
"Object",
"params"... | Log a method entry, with one parameter.
<p>
This is a convenience method that can be used to log entry
to a method. A LogRecord with message "ENTRY {0}", log level
FINER, and the given sourceMethod, sourceClass, and parameter
is logged.
<p>
@param sourceClass name of class that issued the logging request
@param ... | [
"Log",
"a",
"method",
"entry",
"with",
"one",
"parameter",
".",
"<p",
">",
"This",
"is",
"a",
"convenience",
"method",
"that",
"can",
"be",
"used",
"to",
"log",
"entry",
"to",
"a",
"method",
".",
"A",
"LogRecord",
"with",
"message",
"ENTRY",
"{",
"0",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java#L1045-L1051 |
etnetera/seb | src/main/java/cz/etnetera/seb/element/SebElement.java | SebElement.blur | public void blur() {
"""
Loose focus from element.
It works only for {@link JavascriptExecutor} drivers.
It throws {@link SebException} if driver is not
implementing {@link JavascriptExecutor}.
"""
if (getDriver() instanceof JavascriptExecutor)
getSeb().getJavascriptLibrary().callEmbeddedSelenium(getDr... | java | public void blur() {
if (getDriver() instanceof JavascriptExecutor)
getSeb().getJavascriptLibrary().callEmbeddedSelenium(getDriver(), "triggerEvent", this, "blur");
else
throw new SebException("Triggering blur event is supported with JavascriptExecutor driver only, this is " + getDriver().getClass());
} | [
"public",
"void",
"blur",
"(",
")",
"{",
"if",
"(",
"getDriver",
"(",
")",
"instanceof",
"JavascriptExecutor",
")",
"getSeb",
"(",
")",
".",
"getJavascriptLibrary",
"(",
")",
".",
"callEmbeddedSelenium",
"(",
"getDriver",
"(",
")",
",",
"\"triggerEvent\"",
"... | Loose focus from element.
It works only for {@link JavascriptExecutor} drivers.
It throws {@link SebException} if driver is not
implementing {@link JavascriptExecutor}. | [
"Loose",
"focus",
"from",
"element",
".",
"It",
"works",
"only",
"for",
"{"
] | train | https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/element/SebElement.java#L267-L272 |
GerdHolz/TOVAL | src/de/invation/code/toval/graphic/util/GraphicUtils.java | GraphicUtils.drawCircle | public static void drawCircle(Graphics g, int centerX, int centerY, int diameter) {
"""
Draws a circle with the specified diameter using the given point coordinates as center.
@param g Graphics context
@param centerX X coordinate of circle center
@param centerY Y coordinate of circle center
@param diameter Cir... | java | public static void drawCircle(Graphics g, int centerX, int centerY, int diameter){
g.drawOval((int) (centerX-diameter/2), (int) (centerY-diameter/2), diameter, diameter);
} | [
"public",
"static",
"void",
"drawCircle",
"(",
"Graphics",
"g",
",",
"int",
"centerX",
",",
"int",
"centerY",
",",
"int",
"diameter",
")",
"{",
"g",
".",
"drawOval",
"(",
"(",
"int",
")",
"(",
"centerX",
"-",
"diameter",
"/",
"2",
")",
",",
"(",
"i... | Draws a circle with the specified diameter using the given point coordinates as center.
@param g Graphics context
@param centerX X coordinate of circle center
@param centerY Y coordinate of circle center
@param diameter Circle diameter | [
"Draws",
"a",
"circle",
"with",
"the",
"specified",
"diameter",
"using",
"the",
"given",
"point",
"coordinates",
"as",
"center",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/util/GraphicUtils.java#L30-L32 |
real-logic/agrona | agrona/src/main/java/org/agrona/collections/Object2IntHashMap.java | Object2IntHashMap.computeIfAbsent | public int computeIfAbsent(final K key, final ToIntFunction<? super K> 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 int computeIfAbsent(final K key, final ToIntFunction<? super K> mappingFunction)
{
int value = getValue(key);
if (value == missingValue)
{
value = mappingFunction.applyAsInt(key);
if (value != missingValue)
{
put(key, value);
... | [
"public",
"int",
"computeIfAbsent",
"(",
"final",
"K",
"key",
",",
"final",
"ToIntFunction",
"<",
"?",
"super",
"K",
">",
"mappingFunction",
")",
"{",
"int",
"value",
"=",
"getValue",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"missingValue",
")",
... | 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 m... | [
"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/Object2IntHashMap.java#L278-L291 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteQueryBuilder.java | SQLiteQueryBuilder.buildUnionQuery | public String buildUnionQuery(String[] subQueries, String sortOrder, String limit) {
"""
Given a set of subqueries, all of which are SELECT statements,
construct a query that returns the union of what those
subqueries return.
@param subQueries an array of SQL SELECT statements, all of
which must have the same ... | java | public String buildUnionQuery(String[] subQueries, String sortOrder, String limit) {
StringBuilder query = new StringBuilder(128);
int subQueryCount = subQueries.length;
String unionOperator = mDistinct ? " UNION " : " UNION ALL ";
for (int i = 0; i < subQueryCount; i++) {
i... | [
"public",
"String",
"buildUnionQuery",
"(",
"String",
"[",
"]",
"subQueries",
",",
"String",
"sortOrder",
",",
"String",
"limit",
")",
"{",
"StringBuilder",
"query",
"=",
"new",
"StringBuilder",
"(",
"128",
")",
";",
"int",
"subQueryCount",
"=",
"subQueries",
... | Given a set of subqueries, all of which are SELECT statements,
construct a query that returns the union of what those
subqueries return.
@param subQueries an array of SQL SELECT statements, all of
which must have the same columns as the same positions in
their results
@param sortOrder How to order the rows, formatted a... | [
"Given",
"a",
"set",
"of",
"subqueries",
"all",
"of",
"which",
"are",
"SELECT",
"statements",
"construct",
"a",
"query",
"that",
"returns",
"the",
"union",
"of",
"what",
"those",
"subqueries",
"return",
".",
"@param",
"subQueries",
"an",
"array",
"of",
"SQL"... | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteQueryBuilder.java#L587-L601 |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/player/NotificationManager.java | NotificationManager.initNotificationBuilder | private void initNotificationBuilder(Context context) {
"""
Init all static components of the notification.
@param context context used to instantiate the builder.
"""
// inti builder.
mNotificationBuilder = new NotificationCompat.Builder(context);
mNotificationView = new RemoteView... | java | private void initNotificationBuilder(Context context) {
// inti builder.
mNotificationBuilder = new NotificationCompat.Builder(context);
mNotificationView = new RemoteViews(context.getPackageName(),
R.layout.simple_sound_cloud_notification);
mNotificationExpandedView = n... | [
"private",
"void",
"initNotificationBuilder",
"(",
"Context",
"context",
")",
"{",
"// inti builder.",
"mNotificationBuilder",
"=",
"new",
"NotificationCompat",
".",
"Builder",
"(",
"context",
")",
";",
"mNotificationView",
"=",
"new",
"RemoteViews",
"(",
"context",
... | Init all static components of the notification.
@param context context used to instantiate the builder. | [
"Init",
"all",
"static",
"components",
"of",
"the",
"notification",
"."
] | train | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/NotificationManager.java#L313-L365 |
google/truth | core/src/main/java/com/google/common/truth/Correspondence.java | Correspondence.safeFormatDiff | @NullableDecl
final String safeFormatDiff(
@NullableDecl A actual, @NullableDecl E expected, ExceptionStore exceptions) {
"""
Invokes {@link #formatDiff}, catching any exceptions. If the comparison does not throw, returns
the result. If it does throw, adds the exception to the given {@link ExceptionStore}... | java | @NullableDecl
final String safeFormatDiff(
@NullableDecl A actual, @NullableDecl E expected, ExceptionStore exceptions) {
try {
return formatDiff(actual, expected);
} catch (RuntimeException e) {
exceptions.addFormatDiffException(Correspondence.class, e, actual, expected);
return null;... | [
"@",
"NullableDecl",
"final",
"String",
"safeFormatDiff",
"(",
"@",
"NullableDecl",
"A",
"actual",
",",
"@",
"NullableDecl",
"E",
"expected",
",",
"ExceptionStore",
"exceptions",
")",
"{",
"try",
"{",
"return",
"formatDiff",
"(",
"actual",
",",
"expected",
")"... | Invokes {@link #formatDiff}, catching any exceptions. If the comparison does not throw, returns
the result. If it does throw, adds the exception to the given {@link ExceptionStore} and
returns null. | [
"Invokes",
"{"
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/Correspondence.java#L719-L728 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/query/values/JcCollection.java | JcCollection.length | public JcNumber length() {
"""
<div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div>
<div color='red' style="font-size:18px;color:red"><i>return the size of a collection, return a <b>JcNumber</b></i></div>
<br/>
"""
JcNumber ret = new JcNumber(null, this,
new FunctionInst... | java | public JcNumber length() {
JcNumber ret = new JcNumber(null, this,
new FunctionInstance(FUNCTION.Collection.LENGTH, 1));
QueryRecorder.recordInvocationConditional(this, "length", ret);
return ret;
} | [
"public",
"JcNumber",
"length",
"(",
")",
"{",
"JcNumber",
"ret",
"=",
"new",
"JcNumber",
"(",
"null",
",",
"this",
",",
"new",
"FunctionInstance",
"(",
"FUNCTION",
".",
"Collection",
".",
"LENGTH",
",",
"1",
")",
")",
";",
"QueryRecorder",
".",
"recordI... | <div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div>
<div color='red' style="font-size:18px;color:red"><i>return the size of a collection, return a <b>JcNumber</b></i></div>
<br/> | [
"<div",
"color",
"=",
"red",
"style",
"=",
"font",
"-",
"size",
":",
"24px",
";",
"color",
":",
"red",
">",
"<b",
">",
"<i",
">",
"<u",
">",
"JCYPHER<",
"/",
"u",
">",
"<",
"/",
"i",
">",
"<",
"/",
"b",
">",
"<",
"/",
"div",
">",
"<div",
... | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/JcCollection.java#L73-L78 |
knowm/XChange | xchange-wex/src/main/java/org/knowm/xchange/wex/v3/WexAdapters.java | WexAdapters.adaptTicker | public static Ticker adaptTicker(WexTicker bTCETicker, CurrencyPair currencyPair) {
"""
Adapts a WexTicker to a Ticker Object
@param bTCETicker
@return
"""
BigDecimal last = bTCETicker.getLast();
BigDecimal bid = bTCETicker.getSell();
BigDecimal ask = bTCETicker.getBuy();
BigDecimal high =... | java | public static Ticker adaptTicker(WexTicker bTCETicker, CurrencyPair currencyPair) {
BigDecimal last = bTCETicker.getLast();
BigDecimal bid = bTCETicker.getSell();
BigDecimal ask = bTCETicker.getBuy();
BigDecimal high = bTCETicker.getHigh();
BigDecimal low = bTCETicker.getLow();
BigDecimal avg =... | [
"public",
"static",
"Ticker",
"adaptTicker",
"(",
"WexTicker",
"bTCETicker",
",",
"CurrencyPair",
"currencyPair",
")",
"{",
"BigDecimal",
"last",
"=",
"bTCETicker",
".",
"getLast",
"(",
")",
";",
"BigDecimal",
"bid",
"=",
"bTCETicker",
".",
"getSell",
"(",
")"... | Adapts a WexTicker to a Ticker Object
@param bTCETicker
@return | [
"Adapts",
"a",
"WexTicker",
"to",
"a",
"Ticker",
"Object"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-wex/src/main/java/org/knowm/xchange/wex/v3/WexAdapters.java#L143-L165 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/SchedulesInner.java | SchedulesInner.get | public ScheduleInner get(String resourceGroupName, String automationAccountName, String scheduleName) {
"""
Retrieve the schedule identified by schedule name.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param scheduleName The sche... | java | public ScheduleInner get(String resourceGroupName, String automationAccountName, String scheduleName) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, scheduleName).toBlocking().single().body();
} | [
"public",
"ScheduleInner",
"get",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"scheduleName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
",",
"scheduleName",
")"... | Retrieve the schedule identified by schedule name.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param scheduleName The schedule name.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException t... | [
"Retrieve",
"the",
"schedule",
"identified",
"by",
"schedule",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/SchedulesInner.java#L303-L305 |
ppiastucki/recast4j | detour/src/main/java/org/recast4j/detour/NavMesh.java | NavMesh.encodePolyId | public static long encodePolyId(int salt, int it, int ip) {
"""
Derives a standard polygon reference.
@note This function is generally meant for internal use only.
@param salt
The tile's salt value.
@param it
The index of the tile.
@param ip
The index of the polygon within the tile.
@return encoded polyg... | java | public static long encodePolyId(int salt, int it, int ip) {
return (((long) salt) << (DT_POLY_BITS + DT_TILE_BITS)) | ((long) it << DT_POLY_BITS) | ip;
} | [
"public",
"static",
"long",
"encodePolyId",
"(",
"int",
"salt",
",",
"int",
"it",
",",
"int",
"ip",
")",
"{",
"return",
"(",
"(",
"(",
"long",
")",
"salt",
")",
"<<",
"(",
"DT_POLY_BITS",
"+",
"DT_TILE_BITS",
")",
")",
"|",
"(",
"(",
"long",
")",
... | Derives a standard polygon reference.
@note This function is generally meant for internal use only.
@param salt
The tile's salt value.
@param it
The index of the tile.
@param ip
The index of the polygon within the tile.
@return encoded polygon reference | [
"Derives",
"a",
"standard",
"polygon",
"reference",
"."
] | train | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/NavMesh.java#L124-L126 |
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.removeObject | public void removeObject(String bucketName, String objectName)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException, InvalidArgumentExcept... | java | public void removeObject(String bucketName, String objectName)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException, InvalidArgumentExcept... | [
"public",
"void",
"removeObject",
"(",
"String",
"bucketName",
",",
"String",
"objectName",
")",
"throws",
"InvalidBucketNameException",
",",
"NoSuchAlgorithmException",
",",
"InsufficientDataException",
",",
"IOException",
",",
"InvalidKeyException",
",",
"NoResponseExcept... | Removes an object from a bucket.
</p><b>Example:</b><br>
<pre>{@code minioClient.removeObject("my-bucketname", "my-objectname"); }</pre>
@param bucketName Bucket name.
@param objectName Object name in the bucket.
@throws InvalidBucketNameException upon invalid bucket name is given
@throws NoSuchAlgorithmException
u... | [
"Removes",
"an",
"object",
"from",
"a",
"bucket",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L2615-L2628 |
zeroturnaround/zt-exec | src/main/java/org/zeroturnaround/exec/ProcessExecutor.java | ProcessExecutor.redirectOutputAlsoTo | private static PumpStreamHandler redirectOutputAlsoTo(PumpStreamHandler pumps, OutputStream output) {
"""
Redirects the process' output stream also to a given output stream.
@return new stream handler created.
"""
if (output == null)
throw new IllegalArgumentException("OutputStream must be provide... | java | private static PumpStreamHandler redirectOutputAlsoTo(PumpStreamHandler pumps, OutputStream output) {
if (output == null)
throw new IllegalArgumentException("OutputStream must be provided.");
OutputStream current = pumps.getOut();
if (current != null && !(current instanceof NullOutputStream)) {
... | [
"private",
"static",
"PumpStreamHandler",
"redirectOutputAlsoTo",
"(",
"PumpStreamHandler",
"pumps",
",",
"OutputStream",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"OutputStream must be provided.\"",
"... | Redirects the process' output stream also to a given output stream.
@return new stream handler created. | [
"Redirects",
"the",
"process",
"output",
"stream",
"also",
"to",
"a",
"given",
"output",
"stream",
"."
] | train | https://github.com/zeroturnaround/zt-exec/blob/6c3b93b99bf3c69c9f41d6350bf7707005b6a4cd/src/main/java/org/zeroturnaround/exec/ProcessExecutor.java#L560-L568 |
davetcc/tcMenu | tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/controller/OSXAdapter.java | OSXAdapter.setAboutHandler | public static boolean setAboutHandler(Object target, Method aboutHandler) {
"""
They will be called when the About menu item is selected from the application menu
"""
boolean enableAboutMenu = (target != null && aboutHandler != null);
if (enableAboutMenu) {
setHandler(new OSXAdapter... | java | public static boolean setAboutHandler(Object target, Method aboutHandler) {
boolean enableAboutMenu = (target != null && aboutHandler != null);
if (enableAboutMenu) {
setHandler(new OSXAdapter("handleAbout", target, aboutHandler));
}
// If we're setting a handler, enable the ... | [
"public",
"static",
"boolean",
"setAboutHandler",
"(",
"Object",
"target",
",",
"Method",
"aboutHandler",
")",
"{",
"boolean",
"enableAboutMenu",
"=",
"(",
"target",
"!=",
"null",
"&&",
"aboutHandler",
"!=",
"null",
")",
";",
"if",
"(",
"enableAboutMenu",
")",... | They will be called when the About menu item is selected from the application menu | [
"They",
"will",
"be",
"called",
"when",
"the",
"About",
"menu",
"item",
"is",
"selected",
"from",
"the",
"application",
"menu"
] | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/controller/OSXAdapter.java#L89-L105 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathVariableResolver.java | MapBasedXPathVariableResolver.addUniqueVariable | @Nonnull
public EChange addUniqueVariable (@Nonnull final String sName, @Nonnull final Object aValue) {
"""
Add a new variable.
@param sName
The name (=local part) of the variable
@param aValue
The value to be used.
@return {@link EChange}
"""
ValueEnforcer.notNull (sName, "Name");
ValueEnforc... | java | @Nonnull
public EChange addUniqueVariable (@Nonnull final String sName, @Nonnull final Object aValue)
{
ValueEnforcer.notNull (sName, "Name");
ValueEnforcer.notNull (aValue, "Value");
if (m_aMap.containsKey (sName))
return EChange.UNCHANGED;
m_aMap.put (sName, aValue);
return EChange.CHAN... | [
"@",
"Nonnull",
"public",
"EChange",
"addUniqueVariable",
"(",
"@",
"Nonnull",
"final",
"String",
"sName",
",",
"@",
"Nonnull",
"final",
"Object",
"aValue",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"sName",
",",
"\"Name\"",
")",
";",
"ValueEnforcer",
... | Add a new variable.
@param sName
The name (=local part) of the variable
@param aValue
The value to be used.
@return {@link EChange} | [
"Add",
"a",
"new",
"variable",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathVariableResolver.java#L92-L102 |
igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java | MultiUserChatLightManager.unblockUsers | public void unblockUsers(DomainBareJid mucLightService, List<Jid> usersJids)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
Unblock users.
@param mucLightService
@param usersJids
@throws NoResponseException
@throws XMPPErrorException
@throws Not... | java | public void unblockUsers(DomainBareJid mucLightService, List<Jid> usersJids)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
HashMap<Jid, Boolean> users = new HashMap<>();
for (Jid jid : usersJids) {
users.put(jid, true);
}
... | [
"public",
"void",
"unblockUsers",
"(",
"DomainBareJid",
"mucLightService",
",",
"List",
"<",
"Jid",
">",
"usersJids",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"HashMap",
"<",
"Jid"... | Unblock users.
@param mucLightService
@param usersJids
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException | [
"Unblock",
"users",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java#L401-L408 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/lib/ArrayCounter.java | ArrayCounter.calcInterval | static long calcInterval(int segments, int start, int limit) {
"""
Helper method to calculate the span of the sub-interval. Simply returns
the cieling of ((limit - start) / segments) and accounts for invalid
start and limit combinations.
"""
long range = limit - start;
if (range < 0) {
... | java | static long calcInterval(int segments, int start, int limit) {
long range = limit - start;
if (range < 0) {
return 0;
}
int partSegment = (range % segments) == 0 ? 0
: 1;
return (range / segments) + partSegment;
... | [
"static",
"long",
"calcInterval",
"(",
"int",
"segments",
",",
"int",
"start",
",",
"int",
"limit",
")",
"{",
"long",
"range",
"=",
"limit",
"-",
"start",
";",
"if",
"(",
"range",
"<",
"0",
")",
"{",
"return",
"0",
";",
"}",
"int",
"partSegment",
"... | Helper method to calculate the span of the sub-interval. Simply returns
the cieling of ((limit - start) / segments) and accounts for invalid
start and limit combinations. | [
"Helper",
"method",
"to",
"calculate",
"the",
"span",
"of",
"the",
"sub",
"-",
"interval",
".",
"Simply",
"returns",
"the",
"cieling",
"of",
"((",
"limit",
"-",
"start",
")",
"/",
"segments",
")",
"and",
"accounts",
"for",
"invalid",
"start",
"and",
"lim... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/ArrayCounter.java#L139-L151 |
VoltDB/voltdb | src/frontend/org/voltdb/iv2/SpPromoteAlgo.java | SpPromoteAlgo.prepareForFaultRecovery | void prepareForFaultRecovery() {
"""
Start fixing survivors: setup scoreboard and request repair logs.
"""
for (Long hsid : m_survivors) {
m_replicaRepairStructs.put(hsid, new ReplicaRepairStruct());
}
repairLogger.info(m_whoami + "found (including self) " + m_survivors.siz... | java | void prepareForFaultRecovery()
{
for (Long hsid : m_survivors) {
m_replicaRepairStructs.put(hsid, new ReplicaRepairStruct());
}
repairLogger.info(m_whoami + "found (including self) " + m_survivors.size()
+ " surviving replicas to repair. "
+ " S... | [
"void",
"prepareForFaultRecovery",
"(",
")",
"{",
"for",
"(",
"Long",
"hsid",
":",
"m_survivors",
")",
"{",
"m_replicaRepairStructs",
".",
"put",
"(",
"hsid",
",",
"new",
"ReplicaRepairStruct",
"(",
")",
")",
";",
"}",
"repairLogger",
".",
"info",
"(",
"m_... | Start fixing survivors: setup scoreboard and request repair logs. | [
"Start",
"fixing",
"survivors",
":",
"setup",
"scoreboard",
"and",
"request",
"repair",
"logs",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/SpPromoteAlgo.java#L141-L153 |
mapsforge/mapsforge | mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java | AndroidUtil.createTileCache | public static TileCache createTileCache(File cacheDir, String id, int tileSize,
int width, int height, double overdraw, boolean persistent) {
"""
Utility function to create a two-level tile cache with the right size, using the size of the map view.
@param cacheDir t... | java | public static TileCache createTileCache(File cacheDir, String id, int tileSize,
int width, int height, double overdraw, boolean persistent) {
int cacheSize = getMinimumCacheSize(tileSize, overdraw, width, height);
return createExternalStorageTileCache(cacheDir... | [
"public",
"static",
"TileCache",
"createTileCache",
"(",
"File",
"cacheDir",
",",
"String",
"id",
",",
"int",
"tileSize",
",",
"int",
"width",
",",
"int",
"height",
",",
"double",
"overdraw",
",",
"boolean",
"persistent",
")",
"{",
"int",
"cacheSize",
"=",
... | Utility function to create a two-level tile cache with the right size, using the size of the map view.
@param cacheDir the cache directory
@param id name for the storage directory
@param tileSize tile size
@param width the width of the map view
@param height the height of the map view
@param overd... | [
"Utility",
"function",
"to",
"create",
"a",
"two",
"-",
"level",
"tile",
"cache",
"with",
"the",
"right",
"size",
"using",
"the",
"size",
"of",
"the",
"map",
"view",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java#L186-L190 |
hibernate/hibernate-ogm | core/src/main/java/org/hibernate/ogm/util/impl/ArrayHelper.java | ArrayHelper.indexOf | public static <T> int indexOf(T[] array, T element) {
"""
Return the position of an element inside an array
@param array the array where it looks for an element
@param element the element to find in the array
@param <T> the type of elements in the array
@return the position of the element if it's found in th... | java | public static <T> int indexOf(T[] array, T element) {
for ( int i = 0; i < array.length; i++ ) {
if ( array[i].equals( element ) ) {
return i;
}
}
return -1;
} | [
"public",
"static",
"<",
"T",
">",
"int",
"indexOf",
"(",
"T",
"[",
"]",
"array",
",",
"T",
"element",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"array",
"[",
"i"... | Return the position of an element inside an array
@param array the array where it looks for an element
@param element the element to find in the array
@param <T> the type of elements in the array
@return the position of the element if it's found in the array, -1 otherwise | [
"Return",
"the",
"position",
"of",
"an",
"element",
"inside",
"an",
"array"
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/ArrayHelper.java#L51-L58 |
zaproxy/zaproxy | src/org/apache/commons/httpclient/HttpMethodBase.java | HttpMethodBase.setRequestHeader | @Override
public void setRequestHeader(String headerName, String headerValue) {
"""
Set the specified request header, overwriting any previous value. Note
that header-name matching is case-insensitive.
@param headerName the header's name
@param headerValue the header's value
"""
Header header ... | java | @Override
public void setRequestHeader(String headerName, String headerValue) {
Header header = new Header(headerName, headerValue);
setRequestHeader(header);
} | [
"@",
"Override",
"public",
"void",
"setRequestHeader",
"(",
"String",
"headerName",
",",
"String",
"headerValue",
")",
"{",
"Header",
"header",
"=",
"new",
"Header",
"(",
"headerName",
",",
"headerValue",
")",
";",
"setRequestHeader",
"(",
"header",
")",
";",
... | Set the specified request header, overwriting any previous value. Note
that header-name matching is case-insensitive.
@param headerName the header's name
@param headerValue the header's value | [
"Set",
"the",
"specified",
"request",
"header",
"overwriting",
"any",
"previous",
"value",
".",
"Note",
"that",
"header",
"-",
"name",
"matching",
"is",
"case",
"-",
"insensitive",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/apache/commons/httpclient/HttpMethodBase.java#L498-L502 |
spockframework/spock | spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java | GroovyRuntimeUtil.isVoidMethod | public static boolean isVoidMethod(@Nullable Object target, String method, Object... args) {
"""
InvokerHelper.invokeMethod, even if the same method is chosen (see Spec GroovyMopExploration)
"""
if (target == null) return false; // no way to tell
Class[] argTypes = ReflectionUtil.getTypes(args);
... | java | public static boolean isVoidMethod(@Nullable Object target, String method, Object... args) {
if (target == null) return false; // no way to tell
Class[] argTypes = ReflectionUtil.getTypes(args);
// the way we choose metaClass, we won't find methods on java.lang.Class
// but since java.lang.Class has n... | [
"public",
"static",
"boolean",
"isVoidMethod",
"(",
"@",
"Nullable",
"Object",
"target",
",",
"String",
"method",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"target",
"==",
"null",
")",
"return",
"false",
";",
"// no way to tell",
"Class",
"[",
"]"... | InvokerHelper.invokeMethod, even if the same method is chosen (see Spec GroovyMopExploration) | [
"InvokerHelper",
".",
"invokeMethod",
"even",
"if",
"the",
"same",
"method",
"is",
"chosen",
"(",
"see",
"Spec",
"GroovyMopExploration",
")"
] | train | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java#L261-L285 |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByMobilePhone | public Iterable<DContact> queryByMobilePhone(Object parent, java.lang.String mobilePhone) {
"""
query-by method for field mobilePhone
@param mobilePhone the specified attribute
@return an Iterable of DContacts for the specified mobilePhone
"""
return queryByField(parent, DContactMapper.Field.MOBILEPHONE.... | java | public Iterable<DContact> queryByMobilePhone(Object parent, java.lang.String mobilePhone) {
return queryByField(parent, DContactMapper.Field.MOBILEPHONE.getFieldName(), mobilePhone);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByMobilePhone",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"mobilePhone",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"MOBILEPHONE",
".",
... | query-by method for field mobilePhone
@param mobilePhone the specified attribute
@return an Iterable of DContacts for the specified mobilePhone | [
"query",
"-",
"by",
"method",
"for",
"field",
"mobilePhone"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L223-L225 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUEUnit.java | CLIQUEUnit.checkDimensions | private boolean checkDimensions(CLIQUEUnit other, int e) {
"""
Check that the first e dimensions agree.
@param other Other unit
@param e Number of dimensions to check
@return {@code true} if the first e dimensions are the same (index and
bounds)
"""
for(int i = 0, j = 0; i < e; i++, j += 2) {
i... | java | private boolean checkDimensions(CLIQUEUnit other, int e) {
for(int i = 0, j = 0; i < e; i++, j += 2) {
if(dims[i] != other.dims[i] || bounds[j] != other.bounds[j] || bounds[j + 1] != bounds[j + 1]) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"checkDimensions",
"(",
"CLIQUEUnit",
"other",
",",
"int",
"e",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"j",
"=",
"0",
";",
"i",
"<",
"e",
";",
"i",
"++",
",",
"j",
"+=",
"2",
")",
"{",
"if",
"(",
"dims",
"[",
... | Check that the first e dimensions agree.
@param other Other unit
@param e Number of dimensions to check
@return {@code true} if the first e dimensions are the same (index and
bounds) | [
"Check",
"that",
"the",
"first",
"e",
"dimensions",
"agree",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUEUnit.java#L256-L263 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpntrafficpolicy_binding.java | vpntrafficpolicy_binding.get | public static vpntrafficpolicy_binding get(nitro_service service, String name) throws Exception {
"""
Use this API to fetch vpntrafficpolicy_binding resource of given name .
"""
vpntrafficpolicy_binding obj = new vpntrafficpolicy_binding();
obj.set_name(name);
vpntrafficpolicy_binding response = (vpntraf... | java | public static vpntrafficpolicy_binding get(nitro_service service, String name) throws Exception{
vpntrafficpolicy_binding obj = new vpntrafficpolicy_binding();
obj.set_name(name);
vpntrafficpolicy_binding response = (vpntrafficpolicy_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"vpntrafficpolicy_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"vpntrafficpolicy_binding",
"obj",
"=",
"new",
"vpntrafficpolicy_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"... | Use this API to fetch vpntrafficpolicy_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"vpntrafficpolicy_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpntrafficpolicy_binding.java#L136-L141 |
bbottema/simple-java-mail | modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageParser.java | MimeMessageParser.isMimeType | @SuppressWarnings("WeakerAccess")
public static boolean isMimeType(@Nonnull final MimePart part, @Nonnull final String mimeType) {
"""
Checks whether the MimePart contains an object of the given mime type.
@param part the current MimePart
@param mimeType the mime type to check
@return {@code true} if the... | java | @SuppressWarnings("WeakerAccess")
public static boolean isMimeType(@Nonnull final MimePart part, @Nonnull final String mimeType) {
// Do not use part.isMimeType(String) as it is broken for MimeBodyPart
// and does not really check the actual content type.
try {
final ContentType contentType = new ContentType... | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"static",
"boolean",
"isMimeType",
"(",
"@",
"Nonnull",
"final",
"MimePart",
"part",
",",
"@",
"Nonnull",
"final",
"String",
"mimeType",
")",
"{",
"// Do not use part.isMimeType(String) as it is broken for... | Checks whether the MimePart contains an object of the given mime type.
@param part the current MimePart
@param mimeType the mime type to check
@return {@code true} if the MimePart matches the given mime type, {@code false} otherwise | [
"Checks",
"whether",
"the",
"MimePart",
"contains",
"an",
"object",
"of",
"the",
"given",
"mime",
"type",
"."
] | train | https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageParser.java#L300-L311 |
apiman/apiman | gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/SingleNodeRateLimiterComponent.java | SingleNodeRateLimiterComponent.startBucketSavingThread | private void startBucketSavingThread(Map<String, String> config) {
"""
Save the buckets to file (persist them) from time to time. This is done
in a thread so that it does not impact performance of the rate limits.
@param config
"""
String delay = config.get("persistence.delay"); //$NON-NLS-1$
... | java | private void startBucketSavingThread(Map<String, String> config) {
String delay = config.get("persistence.delay"); //$NON-NLS-1$
if (delay == null) {
delay = "30"; //$NON-NLS-1$
}
String period = config.get("persistence.period"); //$NON-NLS-1$
if (period == null) {
... | [
"private",
"void",
"startBucketSavingThread",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"config",
")",
"{",
"String",
"delay",
"=",
"config",
".",
"get",
"(",
"\"persistence.delay\"",
")",
";",
"//$NON-NLS-1$",
"if",
"(",
"delay",
"==",
"null",
")",
"... | Save the buckets to file (persist them) from time to time. This is done
in a thread so that it does not impact performance of the rate limits.
@param config | [
"Save",
"the",
"buckets",
"to",
"file",
"(",
"persist",
"them",
")",
"from",
"time",
"to",
"time",
".",
"This",
"is",
"done",
"in",
"a",
"thread",
"so",
"that",
"it",
"does",
"not",
"impact",
"performance",
"of",
"the",
"rate",
"limits",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/SingleNodeRateLimiterComponent.java#L111-L135 |
haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/ServletUtil.java | ServletUtil.getBooleanParameter | public static boolean getBooleanParameter(final ServletRequest pReq, final String pName, final boolean pDefault) {
"""
Gets the value of the given parameter from the request converted to
a {@code boolean}. If the parameter is not set or not parseable, the default
value is returned.
@param pReq the se... | java | public static boolean getBooleanParameter(final ServletRequest pReq, final String pName, final boolean pDefault) {
String str = pReq.getParameter(pName);
try {
return str != null ? Boolean.valueOf(str) : pDefault;
}
catch (NumberFormatException nfe) {
retu... | [
"public",
"static",
"boolean",
"getBooleanParameter",
"(",
"final",
"ServletRequest",
"pReq",
",",
"final",
"String",
"pName",
",",
"final",
"boolean",
"pDefault",
")",
"{",
"String",
"str",
"=",
"pReq",
".",
"getParameter",
"(",
"pName",
")",
";",
"try",
"{... | Gets the value of the given parameter from the request converted to
a {@code boolean}. If the parameter is not set or not parseable, the default
value is returned.
@param pReq the servlet request
@param pName the parameter name
@param pDefault the default value
@return the value of the parameter converted ... | [
"Gets",
"the",
"value",
"of",
"the",
"given",
"parameter",
"from",
"the",
"request",
"converted",
"to",
"a",
"{",
"@code",
"boolean",
"}",
".",
" ",
";",
"If",
"the",
"parameter",
"is",
"not",
"set",
"or",
"not",
"parseable",
"the",
"default",
"value... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/ServletUtil.java#L184-L193 |
hypfvieh/java-utils | src/main/java/com/github/hypfvieh/util/xml/XmlUtil.java | XmlUtil.applyXpathExpressionToDocument | public static NodeList applyXpathExpressionToDocument(String _xpathExpression, Node _xmlDocumentOrNode)
throws IOException {
"""
Applys a xpathExpression to a xml-Document and return a {@link NodeList} with the results.
@param _xpathExpression xpath expression
@param _xmlDocumentOrNode document or ... | java | public static NodeList applyXpathExpressionToDocument(String _xpathExpression, Node _xmlDocumentOrNode)
throws IOException {
XPathFactory xfactory = XPathFactory.newInstance();
XPath xpath = xfactory.newXPath();
XPathExpression expr = null;
try {
expr = xpath.com... | [
"public",
"static",
"NodeList",
"applyXpathExpressionToDocument",
"(",
"String",
"_xpathExpression",
",",
"Node",
"_xmlDocumentOrNode",
")",
"throws",
"IOException",
"{",
"XPathFactory",
"xfactory",
"=",
"XPathFactory",
".",
"newInstance",
"(",
")",
";",
"XPath",
"xpa... | Applys a xpathExpression to a xml-Document and return a {@link NodeList} with the results.
@param _xpathExpression xpath expression
@param _xmlDocumentOrNode document or node
@return {@link NodeList}
@throws IOException on error | [
"Applys",
"a",
"xpathExpression",
"to",
"a",
"xml",
"-",
"Document",
"and",
"return",
"a",
"{",
"@link",
"NodeList",
"}",
"with",
"the",
"results",
"."
] | train | https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/xml/XmlUtil.java#L81-L101 |
FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/MultiChangeBuilder.java | MultiChangeBuilder.insertAbsolutely | public MultiChangeBuilder<PS, SEG, S> insertAbsolutely(int position, StyledDocument<PS, SEG, S> document) {
"""
Inserts the given rich-text content at the given position.
@param position The position to insert the text.
@param document The rich-text content to insert.
"""
return replaceAbsolutely(p... | java | public MultiChangeBuilder<PS, SEG, S> insertAbsolutely(int position, StyledDocument<PS, SEG, S> document) {
return replaceAbsolutely(position, position, document);
} | [
"public",
"MultiChangeBuilder",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"insertAbsolutely",
"(",
"int",
"position",
",",
"StyledDocument",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"document",
")",
"{",
"return",
"replaceAbsolutely",
"(",
"position",
",",
"posit... | Inserts the given rich-text content at the given position.
@param position The position to insert the text.
@param document The rich-text content to insert. | [
"Inserts",
"the",
"given",
"rich",
"-",
"text",
"content",
"at",
"the",
"given",
"position",
"."
] | train | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/MultiChangeBuilder.java#L198-L200 |
caspervg/SC4D-LEX4J | lex4j/src/main/java/net/caspervg/lex4j/route/LotRoute.java | LotRoute.getLotDownload | public boolean getLotDownload(int id, File directory) {
"""
Downloads a lot/file
@param id ID of the lot/file
@param directory Directory where the file should be downloaded
@custom.require Authentication
@return Download succeeded
"""
ClientResource resource = new ClientResource(Route.DOWNLOAD_LOT.... | java | public boolean getLotDownload(int id, File directory) {
ClientResource resource = new ClientResource(Route.DOWNLOAD_LOT.url(id));
resource.setChallengeResponse(this.auth.toChallenge());
try {
Representation repr = resource.get(MediaType.APPLICATION_ZIP);
Disposition disp... | [
"public",
"boolean",
"getLotDownload",
"(",
"int",
"id",
",",
"File",
"directory",
")",
"{",
"ClientResource",
"resource",
"=",
"new",
"ClientResource",
"(",
"Route",
".",
"DOWNLOAD_LOT",
".",
"url",
"(",
"id",
")",
")",
";",
"resource",
".",
"setChallengeRe... | Downloads a lot/file
@param id ID of the lot/file
@param directory Directory where the file should be downloaded
@custom.require Authentication
@return Download succeeded | [
"Downloads",
"a",
"lot",
"/",
"file"
] | train | https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/route/LotRoute.java#L105-L126 |
mojohaus/aspectj-maven-plugin | src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java | AjcHelper.createClassPath | @SuppressWarnings( "unchecked" )
public static String createClassPath( MavenProject project, List<Artifact> pluginArtifacts, List<String> outDirs ) {
"""
Constructs AspectJ compiler classpath string
@param project the Maven Project
@param pluginArtifacts the plugin Artifacts
@param outDirs the outputDirec... | java | @SuppressWarnings( "unchecked" )
public static String createClassPath( MavenProject project, List<Artifact> pluginArtifacts, List<String> outDirs )
{
String cp = new String();
Set<Artifact> classPathElements = Collections.synchronizedSet( new LinkedHashSet<Artifact>() );
Set<Artifact> de... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"String",
"createClassPath",
"(",
"MavenProject",
"project",
",",
"List",
"<",
"Artifact",
">",
"pluginArtifacts",
",",
"List",
"<",
"String",
">",
"outDirs",
")",
"{",
"String",
"cp",
"="... | Constructs AspectJ compiler classpath string
@param project the Maven Project
@param pluginArtifacts the plugin Artifacts
@param outDirs the outputDirectories
@return a os spesific classpath string | [
"Constructs",
"AspectJ",
"compiler",
"classpath",
"string"
] | train | https://github.com/mojohaus/aspectj-maven-plugin/blob/120ee1ce08b93873931035ed98cd70e3ccceeefb/src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java#L89-L124 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/session/impl/HttpSessionContextImpl.java | HttpSessionContextImpl.isRequestedSessionIdValid | public boolean isRequestedSessionIdValid(HttpServletRequest _request, HttpSession sess) {
"""
/*
Determine if the requested session id is valid. We will get the session
passed in if it exists -- we know that getSession has been called
"""
SessionAffinityContext sac = getSessionAffinityContext(_request);... | java | public boolean isRequestedSessionIdValid(HttpServletRequest _request, HttpSession sess)
{
SessionAffinityContext sac = getSessionAffinityContext(_request);
String sessionId = sac.getRequestedSessionID();
if ((sessionId != null) && (sess != null) && (!sess.isNew() || !_smc.checkSessionNewOnIsValidRequest... | [
"public",
"boolean",
"isRequestedSessionIdValid",
"(",
"HttpServletRequest",
"_request",
",",
"HttpSession",
"sess",
")",
"{",
"SessionAffinityContext",
"sac",
"=",
"getSessionAffinityContext",
"(",
"_request",
")",
";",
"String",
"sessionId",
"=",
"sac",
".",
"getReq... | /*
Determine if the requested session id is valid. We will get the session
passed in if it exists -- we know that getSession has been called | [
"/",
"*",
"Determine",
"if",
"the",
"requested",
"session",
"id",
"is",
"valid",
".",
"We",
"will",
"get",
"the",
"session",
"passed",
"in",
"if",
"it",
"exists",
"--",
"we",
"know",
"that",
"getSession",
"has",
"been",
"called"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/session/impl/HttpSessionContextImpl.java#L422-L433 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpd/MPDUtility.java | MPDUtility.fileDump | public static final void fileDump(String fileName, byte[] data) {
"""
Writes a large byte array to a file.
@param fileName output file name
@param data target data
"""
try
{
FileOutputStream os = new FileOutputStream(fileName);
os.write(data);
os.close();
}
... | java | public static final void fileDump(String fileName, byte[] data)
{
try
{
FileOutputStream os = new FileOutputStream(fileName);
os.write(data);
os.close();
}
catch (IOException ex)
{
ex.printStackTrace();
}
} | [
"public",
"static",
"final",
"void",
"fileDump",
"(",
"String",
"fileName",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"try",
"{",
"FileOutputStream",
"os",
"=",
"new",
"FileOutputStream",
"(",
"fileName",
")",
";",
"os",
".",
"write",
"(",
"data",
")",
... | Writes a large byte array to a file.
@param fileName output file name
@param data target data | [
"Writes",
"a",
"large",
"byte",
"array",
"to",
"a",
"file",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPDUtility.java#L509-L522 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java | IndexChangeAdapters.forTextProperty | public static IndexChangeAdapter forTextProperty( ExecutionContext context,
NodeTypePredicate matcher,
String workspaceName,
Name propertyName,
... | java | public static IndexChangeAdapter forTextProperty( ExecutionContext context,
NodeTypePredicate matcher,
String workspaceName,
Name propertyName,
... | [
"public",
"static",
"IndexChangeAdapter",
"forTextProperty",
"(",
"ExecutionContext",
"context",
",",
"NodeTypePredicate",
"matcher",
",",
"String",
"workspaceName",
",",
"Name",
"propertyName",
",",
"ValueFactory",
"<",
"String",
">",
"factory",
",",
"ProvidedIndex",
... | Create an {@link IndexChangeAdapter} implementation that handles full text information.
@param context the execution context; may not be null
@param matcher the node type matcher used to determine which nodes should be included in the index; may not be null
@param workspaceName the name of the workspace; may not be nu... | [
"Create",
"an",
"{",
"@link",
"IndexChangeAdapter",
"}",
"implementation",
"that",
"handles",
"full",
"text",
"information",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java#L256-L263 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.installationTemplate_templateName_partitionScheme_POST | public void installationTemplate_templateName_partitionScheme_POST(String templateName, String name, Long priority) throws IOException {
"""
Add a scheme of partition
REST: POST /me/installationTemplate/{templateName}/partitionScheme
@param priority [required] on a reinstall, if a partitioning scheme is not sp... | java | public void installationTemplate_templateName_partitionScheme_POST(String templateName, String name, Long priority) throws IOException {
String qPath = "/me/installationTemplate/{templateName}/partitionScheme";
StringBuilder sb = path(qPath, templateName);
HashMap<String, Object>o = new HashMap<String, Object>();... | [
"public",
"void",
"installationTemplate_templateName_partitionScheme_POST",
"(",
"String",
"templateName",
",",
"String",
"name",
",",
"Long",
"priority",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/installationTemplate/{templateName}/partitionScheme\"",
... | Add a scheme of partition
REST: POST /me/installationTemplate/{templateName}/partitionScheme
@param priority [required] on a reinstall, if a partitioning scheme is not specified, the one with the higher priority will be used by default, among all the compatible partitioning schemes (given the underlying hardware speci... | [
"Add",
"a",
"scheme",
"of",
"partition"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3491-L3498 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/geom/ShapeRenderer.java | ShapeRenderer.textureFit | public static final void textureFit(Shape shape, final Image image, final float scaleX, final float scaleY) {
"""
Draw the the given shape filled in with a texture. Only the vertices are set.
The colour has to be set independently of this method. This method is required to
fit the texture scaleX times across th... | java | public static final void textureFit(Shape shape, final Image image, final float scaleX, final float scaleY) {
if (!validFill(shape)) {
return;
}
float points[] = shape.getPoints();
Texture t = TextureImpl.getLastBind();
image.getTexture().bind();
... | [
"public",
"static",
"final",
"void",
"textureFit",
"(",
"Shape",
"shape",
",",
"final",
"Image",
"image",
",",
"final",
"float",
"scaleX",
",",
"final",
"float",
"scaleY",
")",
"{",
"if",
"(",
"!",
"validFill",
"(",
"shape",
")",
")",
"{",
"return",
";... | Draw the the given shape filled in with a texture. Only the vertices are set.
The colour has to be set independently of this method. This method is required to
fit the texture scaleX times across the shape and scaleY times down the shape.
@param shape The shape to texture.
@param image The image to tile across the sh... | [
"Draw",
"the",
"the",
"given",
"shape",
"filled",
"in",
"with",
"a",
"texture",
".",
"Only",
"the",
"vertices",
"are",
"set",
".",
"The",
"colour",
"has",
"to",
"be",
"set",
"independently",
"of",
"this",
"method",
".",
"This",
"method",
"is",
"required"... | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/ShapeRenderer.java#L226-L265 |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java | UtilImageIO.savePPM | public static void savePPM(Planar<GrayU8> rgb , String fileName , GrowQueue_I8 temp ) throws IOException {
"""
Saves an image in PPM format.
@param rgb 3-band RGB image
@param fileName Location where the image is to be written to.
@param temp (Optional) Used internally to store the image. Can be null.
@thro... | java | public static void savePPM(Planar<GrayU8> rgb , String fileName , GrowQueue_I8 temp ) throws IOException {
File out = new File(fileName);
DataOutputStream os = new DataOutputStream(new FileOutputStream(out));
String header = String.format("P6\n%d %d\n255\n", rgb.width, rgb.height);
os.write(header.getBytes());... | [
"public",
"static",
"void",
"savePPM",
"(",
"Planar",
"<",
"GrayU8",
">",
"rgb",
",",
"String",
"fileName",
",",
"GrowQueue_I8",
"temp",
")",
"throws",
"IOException",
"{",
"File",
"out",
"=",
"new",
"File",
"(",
"fileName",
")",
";",
"DataOutputStream",
"o... | Saves an image in PPM format.
@param rgb 3-band RGB image
@param fileName Location where the image is to be written to.
@param temp (Optional) Used internally to store the image. Can be null.
@throws IOException Thrown if there is a problem reading the image | [
"Saves",
"an",
"image",
"in",
"PPM",
"format",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java#L462-L491 |
google/closure-compiler | src/com/google/javascript/jscomp/deps/JsFileLineParser.java | JsFileLineParser.parseJsString | String parseJsString(String jsStringLiteral) throws ParseException {
"""
Parses a JS string literal.
@param jsStringLiteral The literal. Must look like "asdf" or 'asdf'
@throws ParseException Thrown if there is a string literal that cannot be parsed.
"""
valueMatcher.reset(jsStringLiteral);
if (!va... | java | String parseJsString(String jsStringLiteral) throws ParseException {
valueMatcher.reset(jsStringLiteral);
if (!valueMatcher.matches()) {
throw new ParseException("Syntax error in JS String literal", true /* fatal */);
}
return valueMatcher.group(1) != null ? valueMatcher.group(1) : valueMatcher.gr... | [
"String",
"parseJsString",
"(",
"String",
"jsStringLiteral",
")",
"throws",
"ParseException",
"{",
"valueMatcher",
".",
"reset",
"(",
"jsStringLiteral",
")",
";",
"if",
"(",
"!",
"valueMatcher",
".",
"matches",
"(",
")",
")",
"{",
"throw",
"new",
"ParseExcepti... | Parses a JS string literal.
@param jsStringLiteral The literal. Must look like "asdf" or 'asdf'
@throws ParseException Thrown if there is a string literal that cannot be parsed. | [
"Parses",
"a",
"JS",
"string",
"literal",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/JsFileLineParser.java#L297-L303 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/geom/Line.java | Line.getClosestPoint | public void getClosestPoint(Vector2f point, Vector2f result) {
"""
Get the closest point on the line to a given point
@param point
The point which we want to project
@param result
The point on the line closest to the given point
"""
loc.set(point);
loc.sub(start);
float projDistance = vec.dot(... | java | public void getClosestPoint(Vector2f point, Vector2f result) {
loc.set(point);
loc.sub(start);
float projDistance = vec.dot(loc);
projDistance /= vec.lengthSquared();
if (projDistance < 0) {
result.set(start);
return;
}
if (projDistance > 1) {
result.set(end);
return;
}
... | [
"public",
"void",
"getClosestPoint",
"(",
"Vector2f",
"point",
",",
"Vector2f",
"result",
")",
"{",
"loc",
".",
"set",
"(",
"point",
")",
";",
"loc",
".",
"sub",
"(",
"start",
")",
";",
"float",
"projDistance",
"=",
"vec",
".",
"dot",
"(",
"loc",
")"... | Get the closest point on the line to a given point
@param point
The point which we want to project
@param result
The point on the line closest to the given point | [
"Get",
"the",
"closest",
"point",
"on",
"the",
"line",
"to",
"a",
"given",
"point"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Line.java#L342-L361 |
eyp/serfj | src/main/java/net/sf/serfj/client/Client.java | Client.postRequest | public Object postRequest(String restUrl, Map<String, String> params) throws IOException, WebServiceException {
"""
Do a POST HTTP request to the given REST-URL.
@param restUrl
REST URL.
@param params
Parameters for adding to the query string.
@throws IOException
if the request go bad.
"""
return thi... | java | public Object postRequest(String restUrl, Map<String, String> params) throws IOException, WebServiceException {
return this.postRequest(HttpMethod.POST, restUrl, params);
} | [
"public",
"Object",
"postRequest",
"(",
"String",
"restUrl",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"IOException",
",",
"WebServiceException",
"{",
"return",
"this",
".",
"postRequest",
"(",
"HttpMethod",
".",
"POST",
",",
"r... | Do a POST HTTP request to the given REST-URL.
@param restUrl
REST URL.
@param params
Parameters for adding to the query string.
@throws IOException
if the request go bad. | [
"Do",
"a",
"POST",
"HTTP",
"request",
"to",
"the",
"given",
"REST",
"-",
"URL",
"."
] | train | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/client/Client.java#L130-L132 |
qiujuer/Genius-Android | caprice/ui/src/main/java/net/qiujuer/genius/ui/widget/AbsSeekBar.java | AbsSeekBar.setThumbColor | public void setThumbColor(int startColor, int endColor) {
"""
Sets the color of the seek thumb, as well as the color of the popup indicator.
@param startColor The color the seek thumb will be changed to
@param endColor The color the popup indicator will be changed to
"""
mSeekBarDrawable.setThumb... | java | public void setThumbColor(int startColor, int endColor) {
mSeekBarDrawable.setThumbColor(ColorStateList.valueOf(startColor));
if (mIndicator != null)
mIndicator.setColors(startColor, endColor);
} | [
"public",
"void",
"setThumbColor",
"(",
"int",
"startColor",
",",
"int",
"endColor",
")",
"{",
"mSeekBarDrawable",
".",
"setThumbColor",
"(",
"ColorStateList",
".",
"valueOf",
"(",
"startColor",
")",
")",
";",
"if",
"(",
"mIndicator",
"!=",
"null",
")",
"mIn... | Sets the color of the seek thumb, as well as the color of the popup indicator.
@param startColor The color the seek thumb will be changed to
@param endColor The color the popup indicator will be changed to | [
"Sets",
"the",
"color",
"of",
"the",
"seek",
"thumb",
"as",
"well",
"as",
"the",
"color",
"of",
"the",
"popup",
"indicator",
"."
] | train | https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/ui/src/main/java/net/qiujuer/genius/ui/widget/AbsSeekBar.java#L502-L506 |
sarxos/v4l4j | src/main/java/au/edu/jcu/v4l4j/ImageFormatList.java | ImageFormatList.moveToFirstIfNative | private void moveToFirstIfNative(List<ImageFormat> v, int format) {
"""
This method moves the given image format <code>format</code>
in the first position of the vector.
@param v the vector if image format
@param format the index of the format to be moved in first position
"""
for(ImageFormat i : v)
if... | java | private void moveToFirstIfNative(List<ImageFormat> v, int format){
for(ImageFormat i : v)
if((i.getIndex()==format) && (formats.contains(i))){
v.remove(i);
v.add(0, i);
break;
}
} | [
"private",
"void",
"moveToFirstIfNative",
"(",
"List",
"<",
"ImageFormat",
">",
"v",
",",
"int",
"format",
")",
"{",
"for",
"(",
"ImageFormat",
"i",
":",
"v",
")",
"if",
"(",
"(",
"i",
".",
"getIndex",
"(",
")",
"==",
"format",
")",
"&&",
"(",
"for... | This method moves the given image format <code>format</code>
in the first position of the vector.
@param v the vector if image format
@param format the index of the format to be moved in first position | [
"This",
"method",
"moves",
"the",
"given",
"image",
"format",
"<code",
">",
"format<",
"/",
"code",
">",
"in",
"the",
"first",
"position",
"of",
"the",
"vector",
"."
] | train | https://github.com/sarxos/v4l4j/blob/4fc0eec2c3a1a4260593f6ac03b7a8013e3804c9/src/main/java/au/edu/jcu/v4l4j/ImageFormatList.java#L162-L169 |
livetribe/livetribe-slp | core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java | StandardDirectoryAgentServer.handleTCPSrvReg | protected void handleTCPSrvReg(SrvReg srvReg, Socket socket) {
"""
Handles a unicast TCP SrvReg message arrived to this directory agent.
<br />
This directory agent will reply with an acknowledge containing the result of the registration.
@param srvReg the SrvReg message to handle
@param socket the socket co... | java | protected void handleTCPSrvReg(SrvReg srvReg, Socket socket)
{
try
{
boolean update = srvReg.isUpdating();
ServiceInfo service = ServiceInfo.from(srvReg);
cacheService(service, update);
tcpSrvAck.perform(socket, srvReg, SLPError.NO_ERROR);
}
... | [
"protected",
"void",
"handleTCPSrvReg",
"(",
"SrvReg",
"srvReg",
",",
"Socket",
"socket",
")",
"{",
"try",
"{",
"boolean",
"update",
"=",
"srvReg",
".",
"isUpdating",
"(",
")",
";",
"ServiceInfo",
"service",
"=",
"ServiceInfo",
".",
"from",
"(",
"srvReg",
... | Handles a unicast TCP SrvReg message arrived to this directory agent.
<br />
This directory agent will reply with an acknowledge containing the result of the registration.
@param srvReg the SrvReg message to handle
@param socket the socket connected to th client where to write the reply | [
"Handles",
"a",
"unicast",
"TCP",
"SrvReg",
"message",
"arrived",
"to",
"this",
"directory",
"agent",
".",
"<br",
"/",
">",
"This",
"directory",
"agent",
"will",
"reply",
"with",
"an",
"acknowledge",
"containing",
"the",
"result",
"of",
"the",
"registration",
... | train | https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java#L547-L560 |
dashbuilder/dashbuilder | dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/AbstractDisplayer.java | AbstractDisplayer.filterInterval | public Interval filterInterval(String columnId, int idx) {
"""
Get the current filter interval matching the specified index
@param columnId The column identifier.
@param idx The index of the interval
@return The target interval matching the specified parameters or null if it does not exist.
"""
Li... | java | public Interval filterInterval(String columnId, int idx) {
List<Interval> selected = columnSelectionMap.get(columnId);
if (selected != null && !selected.isEmpty()) {
for (Interval interval : selected) {
if (interval.getIndex() == idx) {
return interval;
... | [
"public",
"Interval",
"filterInterval",
"(",
"String",
"columnId",
",",
"int",
"idx",
")",
"{",
"List",
"<",
"Interval",
">",
"selected",
"=",
"columnSelectionMap",
".",
"get",
"(",
"columnId",
")",
";",
"if",
"(",
"selected",
"!=",
"null",
"&&",
"!",
"s... | Get the current filter interval matching the specified index
@param columnId The column identifier.
@param idx The index of the interval
@return The target interval matching the specified parameters or null if it does not exist. | [
"Get",
"the",
"current",
"filter",
"interval",
"matching",
"the",
"specified",
"index"
] | train | https://github.com/dashbuilder/dashbuilder/blob/50ef88210726b4f2f33f1a82eaf0f542e38dedd9/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/AbstractDisplayer.java#L553-L563 |
redkale/redkale | src/org/redkale/net/AsyncConnection.java | AsyncConnection.createTCP | public static CompletableFuture<AsyncConnection> createTCP(final ObjectPool<ByteBuffer> bufferPool, final AsynchronousChannelGroup group, final SSLContext sslContext,
final SocketAddress address, final int readTimeoutSeconds, final int writeTimeoutSeconds) {
"""
创建TCP协议客户端连接
@param bufferPool ... | java | public static CompletableFuture<AsyncConnection> createTCP(final ObjectPool<ByteBuffer> bufferPool, final AsynchronousChannelGroup group, final SSLContext sslContext,
final SocketAddress address, final int readTimeoutSeconds, final int writeTimeoutSeconds) {
return createTCP(bufferPool, bufferPool, gr... | [
"public",
"static",
"CompletableFuture",
"<",
"AsyncConnection",
">",
"createTCP",
"(",
"final",
"ObjectPool",
"<",
"ByteBuffer",
">",
"bufferPool",
",",
"final",
"AsynchronousChannelGroup",
"group",
",",
"final",
"SSLContext",
"sslContext",
",",
"final",
"SocketAddre... | 创建TCP协议客户端连接
@param bufferPool ByteBuffer对象池
@param address 连接点子
@param sslContext SSLContext
@param group 连接AsynchronousChannelGroup
@param readTimeoutSeconds 读取超时秒数
@param writeTimeoutSeconds 写入超时秒数
@return 连接CompletableFuture | [
"创建TCP协议客户端连接"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/AsyncConnection.java#L276-L279 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/gm/maxent/LogLinearXYData.java | LogLinearXYData.addExStrFeats | public void addExStrFeats(double weight, Object xObj, Object yObj, List<String>[] fvStrs) {
"""
Adds a new log-linear model instance.
@param weight The weight of this example.
@param x The observation, x.
@param y The prediction, y.
@param fvs The binary features on the observations, x, for all possible labe... | java | public void addExStrFeats(double weight, Object xObj, Object yObj, List<String>[] fvStrs) {
FeatureVector[] fvs = new FeatureVector[fvStrs.length];
for (int i=0; i<fvs.length; i++) {
fvs[i] = new FeatureVector();
for (String featName : fvStrs[i]) {
fvs[i].add(feat... | [
"public",
"void",
"addExStrFeats",
"(",
"double",
"weight",
",",
"Object",
"xObj",
",",
"Object",
"yObj",
",",
"List",
"<",
"String",
">",
"[",
"]",
"fvStrs",
")",
"{",
"FeatureVector",
"[",
"]",
"fvs",
"=",
"new",
"FeatureVector",
"[",
"fvStrs",
".",
... | Adds a new log-linear model instance.
@param weight The weight of this example.
@param x The observation, x.
@param y The prediction, y.
@param fvs The binary features on the observations, x, for all possible labels, y'. Indexed by y'. | [
"Adds",
"a",
"new",
"log",
"-",
"linear",
"model",
"instance",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/maxent/LogLinearXYData.java#L112-L121 |
xvik/generics-resolver | src/main/java/ru/vyarus/java/generics/resolver/util/type/CommonTypeFactory.java | CommonTypeFactory.buildCommonType | private static Type buildCommonType(final Class<?> type,
final Map<Class<?>, LinkedHashMap<String, Type>> firstContext,
final Map<Class<?>, LinkedHashMap<String, Type>> secondContext,
final boolean al... | java | private static Type buildCommonType(final Class<?> type,
final Map<Class<?>, LinkedHashMap<String, Type>> firstContext,
final Map<Class<?>, LinkedHashMap<String, Type>> secondContext,
final boolean al... | [
"private",
"static",
"Type",
"buildCommonType",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
",",
"final",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"LinkedHashMap",
"<",
"String",
",",
"Type",
">",
">",
"firstContext",
",",
"final",
"Map",
"<",
"Class... | Called when common class is found in order to properly resolve generics for the common class.
For example, suppose we detect that {@link Comparable} is common for {@link Integer} and {@link Double}
and now we need to know it's common generic (in context of both types) which is {@code Comparable<Number>}.
<p>
Infinite g... | [
"Called",
"when",
"common",
"class",
"is",
"found",
"in",
"order",
"to",
"properly",
"resolve",
"generics",
"for",
"the",
"common",
"class",
".",
"For",
"example",
"suppose",
"we",
"detect",
"that",
"{",
"@link",
"Comparable",
"}",
"is",
"common",
"for",
"... | train | https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/type/CommonTypeFactory.java#L414-L443 |
wkgcass/Style | src/main/java/net/cassite/style/aggregation/ListFuncSup.java | ListFuncSup.forEach | @SuppressWarnings("unchecked")
public <R> R forEach(VFunc1<T> func, int index) {
"""
define a function to deal with each element in the list with given
start index
@param func
a function takes in each element from list
@param index
the index where to start iteration
@return return 'last loop value'... | java | @SuppressWarnings("unchecked")
public <R> R forEach(VFunc1<T> func, int index) {
return (R) forEach($(func), index);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"R",
">",
"R",
"forEach",
"(",
"VFunc1",
"<",
"T",
">",
"func",
",",
"int",
"index",
")",
"{",
"return",
"(",
"R",
")",
"forEach",
"(",
"$",
"(",
"func",
")",
",",
"index",
")",
"... | define a function to deal with each element in the list with given
start index
@param func
a function takes in each element from list
@param index
the index where to start iteration
@return return 'last loop value'.<br>
check
<a href="https://github.com/wkgcass/Style/">tutorial</a> for
more info about 'last loop value... | [
"define",
"a",
"function",
"to",
"deal",
"with",
"each",
"element",
"in",
"the",
"list",
"with",
"given",
"start",
"index"
] | train | https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/aggregation/ListFuncSup.java#L64-L67 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java | JspViewDeclarationLanguageBase.setViewBuilt | protected void setViewBuilt(FacesContext facesContext, UIViewRoot view) {
"""
Saves a flag in the attribute map of the FacesContext to indicate
that the given UIViewRoot was already built with VDL.buildView().
@param facesContext
@param view
"""
facesContext.getAttributes().put(view, Boolean.TRUE);
... | java | protected void setViewBuilt(FacesContext facesContext, UIViewRoot view)
{
facesContext.getAttributes().put(view, Boolean.TRUE);
} | [
"protected",
"void",
"setViewBuilt",
"(",
"FacesContext",
"facesContext",
",",
"UIViewRoot",
"view",
")",
"{",
"facesContext",
".",
"getAttributes",
"(",
")",
".",
"put",
"(",
"view",
",",
"Boolean",
".",
"TRUE",
")",
";",
"}"
] | Saves a flag in the attribute map of the FacesContext to indicate
that the given UIViewRoot was already built with VDL.buildView().
@param facesContext
@param view | [
"Saves",
"a",
"flag",
"in",
"the",
"attribute",
"map",
"of",
"the",
"FacesContext",
"to",
"indicate",
"that",
"the",
"given",
"UIViewRoot",
"was",
"already",
"built",
"with",
"VDL",
".",
"buildView",
"()",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java#L402-L405 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/DataGrid.java | DataGrid.setBehavior | public void setBehavior(String name, Object value, String facet)
throws JspException {
"""
<p>
Implementation of the {@link IBehaviorConsumer} interface that extends the functionality of this
tag beyond that exposed via the JSP tag attributes. This method accepts the following facets:
<table>
<tr>... | java | public void setBehavior(String name, Object value, String facet)
throws JspException {
if(facet != null && facet.equals(FACET_RESOURCE)) {
_dataGridTagModel.addResourceOverride(name, (value != null ? value.toString() : null));
}
else {
String s = Bundle.getStr... | [
"public",
"void",
"setBehavior",
"(",
"String",
"name",
",",
"Object",
"value",
",",
"String",
"facet",
")",
"throws",
"JspException",
"{",
"if",
"(",
"facet",
"!=",
"null",
"&&",
"facet",
".",
"equals",
"(",
"FACET_RESOURCE",
")",
")",
"{",
"_dataGridTagM... | <p>
Implementation of the {@link IBehaviorConsumer} interface that extends the functionality of this
tag beyond that exposed via the JSP tag attributes. This method accepts the following facets:
<table>
<tr><td>Facet Name</td><td>Operation</td></tr>
<tr><td><code>resource</code></td><td>Adds or overrides a data grid r... | [
"<p",
">",
"Implementation",
"of",
"the",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/DataGrid.java#L749-L758 |
firebase/geofire-java | common/src/main/java/com/firebase/geofire/GeoFire.java | GeoFire.setLocation | public void setLocation(final String key, final GeoLocation location, final CompletionListener completionListener) {
"""
Sets the location for a given key.
@param key The key to save the location for
@param location The location of this key
@param completionListener A listener that is... | java | public void setLocation(final String key, final GeoLocation location, final CompletionListener completionListener) {
if (key == null) {
throw new NullPointerException();
}
DatabaseReference keyRef = this.getDatabaseRefForKey(key);
GeoHash geoHash = new GeoHash(location);
... | [
"public",
"void",
"setLocation",
"(",
"final",
"String",
"key",
",",
"final",
"GeoLocation",
"location",
",",
"final",
"CompletionListener",
"completionListener",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
... | Sets the location for a given key.
@param key The key to save the location for
@param location The location of this key
@param completionListener A listener that is called once the location was successfully saved on the server or an
error occurred | [
"Sets",
"the",
"location",
"for",
"a",
"given",
"key",
"."
] | train | https://github.com/firebase/geofire-java/blob/c46ff339060d150741a8d0d40c8e73b78edca6c3/common/src/main/java/com/firebase/geofire/GeoFire.java#L165-L184 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java | PyExpressionGenerator._generate | protected XExpression _generate(AnonymousClass anonClass, IAppendable it, IExtraLanguageGeneratorContext context) {
"""
Generate the given object.
@param anonClass the anonymous class.
@param it the target for the generated content.
@param context the context.
@return the class definition.
"""
if (it.h... | java | protected XExpression _generate(AnonymousClass anonClass, IAppendable it, IExtraLanguageGeneratorContext context) {
if (it.hasName(anonClass)) {
appendReturnIfExpectedReturnedExpression(it, context);
it.append(it.getName(anonClass)).append("("); //$NON-NLS-1$
boolean firstArg = true;
for (final XExpressio... | [
"protected",
"XExpression",
"_generate",
"(",
"AnonymousClass",
"anonClass",
",",
"IAppendable",
"it",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"if",
"(",
"it",
".",
"hasName",
"(",
"anonClass",
")",
")",
"{",
"appendReturnIfExpectedReturnedExpressi... | Generate the given object.
@param anonClass the anonymous class.
@param it the target for the generated content.
@param context the context.
@return the class definition. | [
"Generate",
"the",
"given",
"object",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L256-L272 |
apiman/apiman | gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultPluginRegistry.java | DefaultPluginRegistry.downloadFromMavenRepo | protected void downloadFromMavenRepo(PluginCoordinates coordinates, URI mavenRepoUrl, IAsyncResultHandler<File> handler) {
"""
Tries to download the plugin from the given remote maven repository.
"""
String artifactSubPath = PluginUtils.getMavenPath(coordinates);
try {
File tempArti... | java | protected void downloadFromMavenRepo(PluginCoordinates coordinates, URI mavenRepoUrl, IAsyncResultHandler<File> handler) {
String artifactSubPath = PluginUtils.getMavenPath(coordinates);
try {
File tempArtifactFile = File.createTempFile("_plugin", "dwn"); //$NON-NLS-1$ //$NON-NLS-2$
... | [
"protected",
"void",
"downloadFromMavenRepo",
"(",
"PluginCoordinates",
"coordinates",
",",
"URI",
"mavenRepoUrl",
",",
"IAsyncResultHandler",
"<",
"File",
">",
"handler",
")",
"{",
"String",
"artifactSubPath",
"=",
"PluginUtils",
".",
"getMavenPath",
"(",
"coordinate... | Tries to download the plugin from the given remote maven repository. | [
"Tries",
"to",
"download",
"the",
"plugin",
"from",
"the",
"given",
"remote",
"maven",
"repository",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultPluginRegistry.java#L360-L369 |
UrielCh/ovh-java-sdk | ovh-java-sdk-caascontainers/src/main/java/net/minidev/ovh/api/ApiOvhCaascontainers.java | ApiOvhCaascontainers.serviceName_frameworks_frameworkId_GET | public OvhFramework serviceName_frameworks_frameworkId_GET(String serviceName, String frameworkId) throws IOException {
"""
Inspect the stack framework
REST: GET /caas/containers/{serviceName}/frameworks/{frameworkId}
@param frameworkId [required] framework id
@param serviceName [required] service name
API... | java | public OvhFramework serviceName_frameworks_frameworkId_GET(String serviceName, String frameworkId) throws IOException {
String qPath = "/caas/containers/{serviceName}/frameworks/{frameworkId}";
StringBuilder sb = path(qPath, serviceName, frameworkId);
String resp = exec(qPath, "GET", sb.toString(), null);
retur... | [
"public",
"OvhFramework",
"serviceName_frameworks_frameworkId_GET",
"(",
"String",
"serviceName",
",",
"String",
"frameworkId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/caas/containers/{serviceName}/frameworks/{frameworkId}\"",
";",
"StringBuilder",
"sb",
... | Inspect the stack framework
REST: GET /caas/containers/{serviceName}/frameworks/{frameworkId}
@param frameworkId [required] framework id
@param serviceName [required] service name
API beta | [
"Inspect",
"the",
"stack",
"framework"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-caascontainers/src/main/java/net/minidev/ovh/api/ApiOvhCaascontainers.java#L231-L236 |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/InvalidNameException.java | InvalidNameException.fromThrowable | public static InvalidNameException fromThrowable(String message, Throwable cause) {
"""
Converts a Throwable to a InvalidNameException with the specified detail message. If the
Throwable is a InvalidNameException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed throug... | java | public static InvalidNameException fromThrowable(String message, Throwable cause) {
return (cause instanceof InvalidNameException && Objects.equals(message, cause.getMessage()))
? (InvalidNameException) cause
: new InvalidNameException(message, cause);
} | [
"public",
"static",
"InvalidNameException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"InvalidNameException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMessage... | Converts a Throwable to a InvalidNameException with the specified detail message. If the
Throwable is a InvalidNameException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new InvalidNameException with the detail messa... | [
"Converts",
"a",
"Throwable",
"to",
"a",
"InvalidNameException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"InvalidNameException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the",
... | train | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/InvalidNameException.java#L64-L68 |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java | IOUtil.bufferedWriteWithFlush | public static void bufferedWriteWithFlush(final OutputStream output, final byte[] content) throws IOException {
"""
Writing the specified contents to the specified OutputStream using an internal buffer. Flushing the stream when
completed. Caller is responsible for opening and closing the specified stream.
@par... | java | public static void bufferedWriteWithFlush(final OutputStream output, final byte[] content) throws IOException {
final int size = 4096;
int offset = 0;
while (content.length - offset > size) {
output.write(content, offset, size);
offset += size;
}
output.wr... | [
"public",
"static",
"void",
"bufferedWriteWithFlush",
"(",
"final",
"OutputStream",
"output",
",",
"final",
"byte",
"[",
"]",
"content",
")",
"throws",
"IOException",
"{",
"final",
"int",
"size",
"=",
"4096",
";",
"int",
"offset",
"=",
"0",
";",
"while",
"... | Writing the specified contents to the specified OutputStream using an internal buffer. Flushing the stream when
completed. Caller is responsible for opening and closing the specified stream.
@param output
The OutputStream
@param content
The content to write to the specified stream
@throws IOException
If a problem occu... | [
"Writing",
"the",
"specified",
"contents",
"to",
"the",
"specified",
"OutputStream",
"using",
"an",
"internal",
"buffer",
".",
"Flushing",
"the",
"stream",
"when",
"completed",
".",
"Caller",
"is",
"responsible",
"for",
"opening",
"and",
"closing",
"the",
"speci... | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java#L182-L191 |
jmrozanec/cron-utils | src/main/java/com/cronutils/descriptor/CronDescriptor.java | CronDescriptor.describeDayOfMonth | public String describeDayOfMonth(final Map<CronFieldName, CronField> fields) {
"""
Provide description for day of month.
@param fields - fields to describe;
@return description - String
"""
final String description = DescriptionStrategyFactory.daysOfMonthInstance(
resourceBundle,
... | java | public String describeDayOfMonth(final Map<CronFieldName, CronField> fields) {
final String description = DescriptionStrategyFactory.daysOfMonthInstance(
resourceBundle,
fields.containsKey(CronFieldName.DAY_OF_MONTH) ? fields.get(CronFieldName.DAY_OF_MONTH).getExpression() : null... | [
"public",
"String",
"describeDayOfMonth",
"(",
"final",
"Map",
"<",
"CronFieldName",
",",
"CronField",
">",
"fields",
")",
"{",
"final",
"String",
"description",
"=",
"DescriptionStrategyFactory",
".",
"daysOfMonthInstance",
"(",
"resourceBundle",
",",
"fields",
"."... | Provide description for day of month.
@param fields - fields to describe;
@return description - String | [
"Provide",
"description",
"for",
"day",
"of",
"month",
"."
] | train | https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/CronDescriptor.java#L94-L100 |
jledit/jledit | core/src/main/java/org/jledit/utils/Files.java | Files.writeToFile | public static void writeToFile(File file, String content, Charset charset) throws IOException {
"""
Writes {@link String} content to {@link File}.
@param file
@param content
@param charset
@throws IOException
"""
FileOutputStream fos = null;
OutputStreamWriter writer = null;
try {... | java | public static void writeToFile(File file, String content, Charset charset) throws IOException {
FileOutputStream fos = null;
OutputStreamWriter writer = null;
try {
if (file == null) {
throw new FileNotFoundException("No file specified.");
} else if (!file... | [
"public",
"static",
"void",
"writeToFile",
"(",
"File",
"file",
",",
"String",
"content",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"fos",
"=",
"null",
";",
"OutputStreamWriter",
"writer",
"=",
"null",
";",
"try",
"{",
... | Writes {@link String} content to {@link File}.
@param file
@param content
@param charset
@throws IOException | [
"Writes",
"{",
"@link",
"String",
"}",
"content",
"to",
"{",
"@link",
"File",
"}",
"."
] | train | https://github.com/jledit/jledit/blob/ced2c4b44330664adb65f8be4c8fff780ccaa6fd/core/src/main/java/org/jledit/utils/Files.java#L89-L106 |
OwlPlatform/java-owl-worldmodel | src/main/java/com/owlplatform/worldmodel/Attribute.java | Attribute.getSolverLength | public int getSolverLength() {
"""
Returns the length of this attribute, in bytes, as encoded according to the
Solver-World Model protocol.
@return the length of the encoded form of this attribute object
"""
// Attribute name alias, creation date, Id length,
int length = 4 + 8 + 4;
// Id,
... | java | public int getSolverLength() {
// Attribute name alias, creation date, Id length,
int length = 4 + 8 + 4;
// Id,
if (this.identifier != null) {
try {
length += this.identifier.getBytes("UTF-16BE").length;
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(... | [
"public",
"int",
"getSolverLength",
"(",
")",
"{",
"// Attribute name alias, creation date, Id length,",
"int",
"length",
"=",
"4",
"+",
"8",
"+",
"4",
";",
"// Id,",
"if",
"(",
"this",
".",
"identifier",
"!=",
"null",
")",
"{",
"try",
"{",
"length",
"+=",
... | Returns the length of this attribute, in bytes, as encoded according to the
Solver-World Model protocol.
@return the length of the encoded form of this attribute object | [
"Returns",
"the",
"length",
"of",
"this",
"attribute",
"in",
"bytes",
"as",
"encoded",
"according",
"to",
"the",
"Solver",
"-",
"World",
"Model",
"protocol",
"."
] | train | https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/Attribute.java#L106-L127 |
UrielCh/ovh-java-sdk | ovh-java-sdk-partners/src/main/java/net/minidev/ovh/api/ApiOvhPartners.java | ApiOvhPartners.register_company_companyId_contact_POST | public OvhContact register_company_companyId_contact_POST(String companyId, String email, String facebook, String firstName, String lastName, String linkedin, Boolean newsletter, OvhNic[] otherNics, String phone, String role, String twitter) throws IOException {
"""
Created a new contact for the inscription
RES... | java | public OvhContact register_company_companyId_contact_POST(String companyId, String email, String facebook, String firstName, String lastName, String linkedin, Boolean newsletter, OvhNic[] otherNics, String phone, String role, String twitter) throws IOException {
String qPath = "/partners/register/company/{companyId}/... | [
"public",
"OvhContact",
"register_company_companyId_contact_POST",
"(",
"String",
"companyId",
",",
"String",
"email",
",",
"String",
"facebook",
",",
"String",
"firstName",
",",
"String",
"lastName",
",",
"String",
"linkedin",
",",
"Boolean",
"newsletter",
",",
"Ov... | Created a new contact for the inscription
REST: POST /partners/register/company/{companyId}/contact
@param companyId [required] Company's id
@param otherNics [required] List of nics to associate with this contact
@param firstName [required] Contact's first name
@param lastName [required] Contact's last name
@param ema... | [
"Created",
"a",
"new",
"contact",
"for",
"the",
"inscription"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-partners/src/main/java/net/minidev/ovh/api/ApiOvhPartners.java#L250-L266 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/classimbalance/BaseUnderSamplingPreProcessor.java | BaseUnderSamplingPreProcessor.calculateBernoulli | private INDArray calculateBernoulli(INDArray minorityLabels, INDArray labelMask, double targetMinorityDist) {
"""
/*
Given a list of labels return the bernoulli prob that the masks
will be sampled at to meet the target minority label distribution
Masks at time steps where label is the minority class will alwa... | java | private INDArray calculateBernoulli(INDArray minorityLabels, INDArray labelMask, double targetMinorityDist) {
INDArray minorityClass = minorityLabels.castTo(Nd4j.defaultFloatingPointType()).muli(labelMask);
INDArray majorityClass = minorityLabels.rsub(1.0).muli(labelMask); //rsub(1.0) is equivalen... | [
"private",
"INDArray",
"calculateBernoulli",
"(",
"INDArray",
"minorityLabels",
",",
"INDArray",
"labelMask",
",",
"double",
"targetMinorityDist",
")",
"{",
"INDArray",
"minorityClass",
"=",
"minorityLabels",
".",
"castTo",
"(",
"Nd4j",
".",
"defaultFloatingPointType",
... | /*
Given a list of labels return the bernoulli prob that the masks
will be sampled at to meet the target minority label distribution
Masks at time steps where label is the minority class will always be one
i.e a bernoulli with p = 1
Masks at time steps where label is the majority class will be sampled from
a bernoulli... | [
"/",
"*",
"Given",
"a",
"list",
"of",
"labels",
"return",
"the",
"bernoulli",
"prob",
"that",
"the",
"masks",
"will",
"be",
"sampled",
"at",
"to",
"meet",
"the",
"target",
"minority",
"label",
"distribution"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/classimbalance/BaseUnderSamplingPreProcessor.java#L102-L121 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ie/crf/FactorTable.java | FactorTable.conditionalLogProbGivenFirst | public double conditionalLogProbGivenFirst(int given, int[] of) {
"""
Computes the probability of the sequence OF being at the end of the table
given that the first tag in table is GIVEN. given is at the beginning, of is
at the end
@return the probability of the sequence of being at the end of the table
"... | java | public double conditionalLogProbGivenFirst(int given, int[] of) {
if (of.length != windowSize - 1) {
throw new IllegalArgumentException("conditionalLogProbGivenFirst requires of one less than clique size (" +
windowSize + ") but was " + Arrays.toString(of));
}
// compute P(given, of)
... | [
"public",
"double",
"conditionalLogProbGivenFirst",
"(",
"int",
"given",
",",
"int",
"[",
"]",
"of",
")",
"{",
"if",
"(",
"of",
".",
"length",
"!=",
"windowSize",
"-",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"conditionalLogProbGivenFi... | Computes the probability of the sequence OF being at the end of the table
given that the first tag in table is GIVEN. given is at the beginning, of is
at the end
@return the probability of the sequence of being at the end of the table | [
"Computes",
"the",
"probability",
"of",
"the",
"sequence",
"OF",
"being",
"at",
"the",
"end",
"of",
"the",
"table",
"given",
"that",
"the",
"first",
"tag",
"in",
"table",
"is",
"GIVEN",
".",
"given",
"is",
"at",
"the",
"beginning",
"of",
"is",
"at",
"t... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/crf/FactorTable.java#L283-L301 |
rzwitserloot/lombok | src/core/lombok/javac/HandlerLibrary.java | HandlerLibrary.loadVisitorHandlers | private static void loadVisitorHandlers(HandlerLibrary lib, Trees trees) throws IOException {
"""
Uses SPI Discovery to find implementations of {@link JavacASTVisitor}.
"""
//No, that seemingly superfluous reference to JavacASTVisitor's classloader is not in fact superfluous!
for (JavacASTVisitor visitor :... | java | private static void loadVisitorHandlers(HandlerLibrary lib, Trees trees) throws IOException {
//No, that seemingly superfluous reference to JavacASTVisitor's classloader is not in fact superfluous!
for (JavacASTVisitor visitor : SpiLoadUtil.findServices(JavacASTVisitor.class, JavacASTVisitor.class.getClassLoader())... | [
"private",
"static",
"void",
"loadVisitorHandlers",
"(",
"HandlerLibrary",
"lib",
",",
"Trees",
"trees",
")",
"throws",
"IOException",
"{",
"//No, that seemingly superfluous reference to JavacASTVisitor's classloader is not in fact superfluous!",
"for",
"(",
"JavacASTVisitor",
"v... | Uses SPI Discovery to find implementations of {@link JavacASTVisitor}. | [
"Uses",
"SPI",
"Discovery",
"to",
"find",
"implementations",
"of",
"{"
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/HandlerLibrary.java#L194-L200 |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/installer/feature/jersey/AbstractJerseyInstaller.java | AbstractJerseyInstaller.hasScopeAnnotation | private boolean hasScopeAnnotation(final Class<?> type, final boolean hkManaged) {
"""
Checks scope annotation presence directly on bean. Base classes are not checked as scope is not
inheritable.
@param type bean type
@param hkManaged true if bean is going to be managed by hk, false for guice management
... | java | private boolean hasScopeAnnotation(final Class<?> type, final boolean hkManaged) {
boolean found = false;
for (Annotation ann : type.getAnnotations()) {
final Class<? extends Annotation> annType = ann.annotationType();
if (annType.isAnnotationPresent(Scope.class)) {
... | [
"private",
"boolean",
"hasScopeAnnotation",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
",",
"final",
"boolean",
"hkManaged",
")",
"{",
"boolean",
"found",
"=",
"false",
";",
"for",
"(",
"Annotation",
"ann",
":",
"type",
".",
"getAnnotations",
"(",
")",
... | Checks scope annotation presence directly on bean. Base classes are not checked as scope is not
inheritable.
@param type bean type
@param hkManaged true if bean is going to be managed by hk, false for guice management
@return true if scope annotation found, false otherwise | [
"Checks",
"scope",
"annotation",
"presence",
"directly",
"on",
"bean",
".",
"Base",
"classes",
"are",
"not",
"checked",
"as",
"scope",
"is",
"not",
"inheritable",
"."
] | train | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/installer/feature/jersey/AbstractJerseyInstaller.java#L92-L107 |
cojen/Cojen | src/main/java/org/cojen/classfile/ClassFile.java | ClassFile.addInnerClass | public ClassFile addInnerClass(String fullInnerClassName, String innerClassName,
String superClassName) {
"""
Add an inner class to this class. By default, inner classes are private
static.
@param fullInnerClassName Optional full inner class name.
@param innerClassName Opti... | java | public ClassFile addInnerClass(String fullInnerClassName, String innerClassName,
String superClassName) {
if (fullInnerClassName == null) {
if (innerClassName == null) {
fullInnerClassName = mClassName + '$' + (++mAnonymousInnerClassCount);
... | [
"public",
"ClassFile",
"addInnerClass",
"(",
"String",
"fullInnerClassName",
",",
"String",
"innerClassName",
",",
"String",
"superClassName",
")",
"{",
"if",
"(",
"fullInnerClassName",
"==",
"null",
")",
"{",
"if",
"(",
"innerClassName",
"==",
"null",
")",
"{",... | Add an inner class to this class. By default, inner classes are private
static.
@param fullInnerClassName Optional full inner class name.
@param innerClassName Optional short inner class name.
@param superClassName Full super class name. | [
"Add",
"an",
"inner",
"class",
"to",
"this",
"class",
".",
"By",
"default",
"inner",
"classes",
"are",
"private",
"static",
"."
] | train | https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/classfile/ClassFile.java#L862-L901 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.mergeCoverages | public static GridCoverage2D mergeCoverages( GridCoverage2D valuesMap, GridCoverage2D onMap ) {
"""
Coverage merger.
<p>Values from valuesMap are placed into the onMap coverage, if they are valid.</p>
@param valuesMap the map from which to take teh valid values to place in the output map.
@param onMap the b... | java | public static GridCoverage2D mergeCoverages( GridCoverage2D valuesMap, GridCoverage2D onMap ) {
RegionMap valuesRegionMap = getRegionParamsFromGridCoverage(valuesMap);
int cs = valuesRegionMap.getCols();
int rs = valuesRegionMap.getRows();
RegionMap onRegionMap = getRegionParamsFromGridC... | [
"public",
"static",
"GridCoverage2D",
"mergeCoverages",
"(",
"GridCoverage2D",
"valuesMap",
",",
"GridCoverage2D",
"onMap",
")",
"{",
"RegionMap",
"valuesRegionMap",
"=",
"getRegionParamsFromGridCoverage",
"(",
"valuesMap",
")",
";",
"int",
"cs",
"=",
"valuesRegionMap",... | Coverage merger.
<p>Values from valuesMap are placed into the onMap coverage, if they are valid.</p>
@param valuesMap the map from which to take teh valid values to place in the output map.
@param onMap the base map on which to place the valuesMap values.
@return the merged map of valuesMap over onMap. | [
"Coverage",
"merger",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1408-L1434 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/auth/AuthInterface.java | AuthInterface.getAccessToken | @SuppressWarnings("boxing")
public OAuth1Token getAccessToken(OAuth1RequestToken oAuthRequestToken, String verifier) {
"""
Trade the request token for an access token, this is step three of authorization.
@param oAuthRequestToken
this is the token returned by the {@link AuthInterface#getRequestToken} call.
... | java | @SuppressWarnings("boxing")
public OAuth1Token getAccessToken(OAuth1RequestToken oAuthRequestToken, String verifier) {
OAuth10aService service = new ServiceBuilder(apiKey)
.apiSecret(sharedSecret)
.build(FlickrApi.instance());
// Flickr seems to return invalid ... | [
"@",
"SuppressWarnings",
"(",
"\"boxing\"",
")",
"public",
"OAuth1Token",
"getAccessToken",
"(",
"OAuth1RequestToken",
"oAuthRequestToken",
",",
"String",
"verifier",
")",
"{",
"OAuth10aService",
"service",
"=",
"new",
"ServiceBuilder",
"(",
"apiKey",
")",
".",
"api... | Trade the request token for an access token, this is step three of authorization.
@param oAuthRequestToken
this is the token returned by the {@link AuthInterface#getRequestToken} call.
@param verifier | [
"Trade",
"the",
"request",
"token",
"for",
"an",
"access",
"token",
"this",
"is",
"step",
"three",
"of",
"authorization",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/auth/AuthInterface.java#L124-L154 |
johnkil/Android-RobotoTextView | robototextview/src/main/java/com/devspark/robototextview/inflater/RobotoCompatInflater.java | RobotoCompatInflater.checkOnClickListener | private void checkOnClickListener(View view, AttributeSet attrs) {
"""
android:onClick doesn't handle views with a ContextWrapper context. This method
backports new framework functionality to traverse the Context wrappers to find a
suitable target.
"""
final Context context = view.getContext();
... | java | private void checkOnClickListener(View view, AttributeSet attrs) {
final Context context = view.getContext();
if (!(context instanceof ContextWrapper) ||
(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 && !ViewCompat.hasOnClickListeners(view))) {
// Skip... | [
"private",
"void",
"checkOnClickListener",
"(",
"View",
"view",
",",
"AttributeSet",
"attrs",
")",
"{",
"final",
"Context",
"context",
"=",
"view",
".",
"getContext",
"(",
")",
";",
"if",
"(",
"!",
"(",
"context",
"instanceof",
"ContextWrapper",
")",
"||",
... | android:onClick doesn't handle views with a ContextWrapper context. This method
backports new framework functionality to traverse the Context wrappers to find a
suitable target. | [
"android",
":",
"onClick",
"doesn",
"t",
"handle",
"views",
"with",
"a",
"ContextWrapper",
"context",
".",
"This",
"method",
"backports",
"new",
"framework",
"functionality",
"to",
"traverse",
"the",
"Context",
"wrappers",
"to",
"find",
"a",
"suitable",
"target"... | train | https://github.com/johnkil/Android-RobotoTextView/blob/1341602f16c08057dddd193411e7dab96f963b77/robototextview/src/main/java/com/devspark/robototextview/inflater/RobotoCompatInflater.java#L97-L114 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslUtils.java | SslUtils.addIfSupported | static void addIfSupported(Set<String> supported, List<String> enabled, String... names) {
"""
Add elements from {@code names} into {@code enabled} if they are in {@code supported}.
"""
for (String n: names) {
if (supported.contains(n)) {
enabled.add(n);
}
... | java | static void addIfSupported(Set<String> supported, List<String> enabled, String... names) {
for (String n: names) {
if (supported.contains(n)) {
enabled.add(n);
}
}
} | [
"static",
"void",
"addIfSupported",
"(",
"Set",
"<",
"String",
">",
"supported",
",",
"List",
"<",
"String",
">",
"enabled",
",",
"String",
"...",
"names",
")",
"{",
"for",
"(",
"String",
"n",
":",
"names",
")",
"{",
"if",
"(",
"supported",
".",
"con... | Add elements from {@code names} into {@code enabled} if they are in {@code supported}. | [
"Add",
"elements",
"from",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslUtils.java#L135-L141 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanCache.java | InfinispanCache.cacheEntryRemoved | private void cacheEntryRemoved(String key, T value) {
"""
Dispatch data remove event.
@param key the entry key.
@param value the entry value.
"""
InfinispanCacheEntryEvent<T> event =
new InfinispanCacheEntryEvent<>(new InfinispanCacheEntry<T>(this, key, value));
sendEntryRemove... | java | private void cacheEntryRemoved(String key, T value)
{
InfinispanCacheEntryEvent<T> event =
new InfinispanCacheEntryEvent<>(new InfinispanCacheEntry<T>(this, key, value));
sendEntryRemovedEvent(event);
} | [
"private",
"void",
"cacheEntryRemoved",
"(",
"String",
"key",
",",
"T",
"value",
")",
"{",
"InfinispanCacheEntryEvent",
"<",
"T",
">",
"event",
"=",
"new",
"InfinispanCacheEntryEvent",
"<>",
"(",
"new",
"InfinispanCacheEntry",
"<",
"T",
">",
"(",
"this",
",",
... | Dispatch data remove event.
@param key the entry key.
@param value the entry value. | [
"Dispatch",
"data",
"remove",
"event",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanCache.java#L224-L230 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/http/HttpMediaType.java | HttpMediaType.setParameter | public HttpMediaType setParameter(String name, String value) {
"""
Sets the media parameter to the specified value.
@param name case-insensitive name of the parameter
@param value value of the parameter or {@code null} to remove
"""
if (value == null) {
removeParameter(name);
return this;
... | java | public HttpMediaType setParameter(String name, String value) {
if (value == null) {
removeParameter(name);
return this;
}
Preconditions.checkArgument(
TOKEN_REGEX.matcher(name).matches(), "Name contains reserved characters");
cachedBuildResult = null;
parameters.put(name.toLower... | [
"public",
"HttpMediaType",
"setParameter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"removeParameter",
"(",
"name",
")",
";",
"return",
"this",
";",
"}",
"Preconditions",
".",
"checkArgument",
"("... | Sets the media parameter to the specified value.
@param name case-insensitive name of the parameter
@param value value of the parameter or {@code null} to remove | [
"Sets",
"the",
"media",
"parameter",
"to",
"the",
"specified",
"value",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/HttpMediaType.java#L203-L214 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceClient.java | TraceServiceClient.batchWriteSpans | public final void batchWriteSpans(ProjectName name, List<Span> spans) {
"""
Sends new spans to new or existing traces. You cannot update existing spans.
<p>Sample code:
<pre><code>
try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
L... | java | public final void batchWriteSpans(ProjectName name, List<Span> spans) {
BatchWriteSpansRequest request =
BatchWriteSpansRequest.newBuilder()
.setName(name == null ? null : name.toString())
.addAllSpans(spans)
.build();
batchWriteSpans(request);
} | [
"public",
"final",
"void",
"batchWriteSpans",
"(",
"ProjectName",
"name",
",",
"List",
"<",
"Span",
">",
"spans",
")",
"{",
"BatchWriteSpansRequest",
"request",
"=",
"BatchWriteSpansRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
"==",
"nul... | Sends new spans to new or existing traces. You cannot update existing spans.
<p>Sample code:
<pre><code>
try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
List<Span> spans = new ArrayList<>();
traceServiceClient.batchWriteSpans(name... | [
"Sends",
"new",
"spans",
"to",
"new",
"or",
"existing",
"traces",
".",
"You",
"cannot",
"update",
"existing",
"spans",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceClient.java#L175-L183 |
hsiafan/requests | src/main/java/net/dongliu/requests/RawResponse.java | RawResponse.decompressBody | private InputStream decompressBody() {
"""
Wrap response input stream if it is compressed, return input its self if not use compress
"""
if (!decompress) {
return body;
}
// if has no body, some server still set content-encoding header,
// GZIPInputStream wrap empty ... | java | private InputStream decompressBody() {
if (!decompress) {
return body;
}
// if has no body, some server still set content-encoding header,
// GZIPInputStream wrap empty input stream will cause exception. we should check this
if (method.equals(Methods.HEAD)
... | [
"private",
"InputStream",
"decompressBody",
"(",
")",
"{",
"if",
"(",
"!",
"decompress",
")",
"{",
"return",
"body",
";",
"}",
"// if has no body, some server still set content-encoding header,",
"// GZIPInputStream wrap empty input stream will cause exception. we should check this... | Wrap response input stream if it is compressed, return input its self if not use compress | [
"Wrap",
"response",
"input",
"stream",
"if",
"it",
"is",
"compressed",
"return",
"input",
"its",
"self",
"if",
"not",
"use",
"compress"
] | train | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L378-L412 |
alkacon/opencms-core | src/org/opencms/db/CmsDbContext.java | CmsDbContext.setAttribute | public void setAttribute(String key, Object value) {
"""
Sets an attribute in the DB context.<p>
@param key the attribute key
@param value the attribute value
"""
if (m_attributes == null) {
m_attributes = new HashMap<String, Object>(4);
}
m_attributes.put(key, value);
... | java | public void setAttribute(String key, Object value) {
if (m_attributes == null) {
m_attributes = new HashMap<String, Object>(4);
}
m_attributes.put(key, value);
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"m_attributes",
"==",
"null",
")",
"{",
"m_attributes",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
"4",
")",
";",
"}",
"m_attribute... | Sets an attribute in the DB context.<p>
@param key the attribute key
@param value the attribute value | [
"Sets",
"an",
"attribute",
"in",
"the",
"DB",
"context",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDbContext.java#L304-L310 |
Faylixe/googlecodejam-client | src/main/java/fr/faylixe/googlecodejam/client/executor/HttpRequestExecutor.java | HttpRequestExecutor.buildDataPart | public static Part buildDataPart(final String name, final String data) {
"""
Static factory method that creates a {@link Part} which contains
simple form data.
@param name Name of the POST data to create part for.
@param data Value of the POST data to create part for.
@return Created data part.
"""
fin... | java | public static Part buildDataPart(final String name, final String data) {
final ByteArrayContent content = new ByteArrayContent(null, data.getBytes());
final Part part = new Part(content);
final HttpHeaders headers = new HttpHeaders();
final String disposition = String.format(Request.DATA_CONTENT_DISPOSITION, na... | [
"public",
"static",
"Part",
"buildDataPart",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"data",
")",
"{",
"final",
"ByteArrayContent",
"content",
"=",
"new",
"ByteArrayContent",
"(",
"null",
",",
"data",
".",
"getBytes",
"(",
")",
")",
";",
"f... | Static factory method that creates a {@link Part} which contains
simple form data.
@param name Name of the POST data to create part for.
@param data Value of the POST data to create part for.
@return Created data part. | [
"Static",
"factory",
"method",
"that",
"creates",
"a",
"{",
"@link",
"Part",
"}",
"which",
"contains",
"simple",
"form",
"data",
"."
] | train | https://github.com/Faylixe/googlecodejam-client/blob/84a5fed4e049dca48994dc3f70213976aaff4bd3/src/main/java/fr/faylixe/googlecodejam/client/executor/HttpRequestExecutor.java#L124-L132 |
workplacesystems/queuj | src/main/java/com/workplacesystems/queuj/Resilience.java | Resilience.createRunOnceResilience | public static Resilience createRunOnceResilience(int retry_count, int retry_interval) {
"""
create a simple Resilience object so process can restart - runs once, with retries as parameters
"""
Resilience resilience = new RunOnlyOnce();
RunFiniteTimes failure_occurrence = new RunFiniteTimes(retr... | java | public static Resilience createRunOnceResilience(int retry_count, int retry_interval)
{
Resilience resilience = new RunOnlyOnce();
RunFiniteTimes failure_occurrence = new RunFiniteTimes(retry_count);
resilience.setFailureSchedule(failure_occurrence);
for (int i=0 ; i < retry_count ;... | [
"public",
"static",
"Resilience",
"createRunOnceResilience",
"(",
"int",
"retry_count",
",",
"int",
"retry_interval",
")",
"{",
"Resilience",
"resilience",
"=",
"new",
"RunOnlyOnce",
"(",
")",
";",
"RunFiniteTimes",
"failure_occurrence",
"=",
"new",
"RunFiniteTimes",
... | create a simple Resilience object so process can restart - runs once, with retries as parameters | [
"create",
"a",
"simple",
"Resilience",
"object",
"so",
"process",
"can",
"restart",
"-",
"runs",
"once",
"with",
"retries",
"as",
"parameters"
] | train | https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Resilience.java#L57-L71 |
xqbase/util | util/src/main/java/com/xqbase/util/Numbers.java | Numbers.parseFloat | public static float parseFloat(String s, float f) {
"""
Parse a <b>float</b> with a given default value <b>f</b>
@return default value if null or not parsable
"""
if (s == null) {
return f;
}
try {
return Float.parseFloat(s.trim());
} catch (NumberFormatException e) {
return f;
}
... | java | public static float parseFloat(String s, float f) {
if (s == null) {
return f;
}
try {
return Float.parseFloat(s.trim());
} catch (NumberFormatException e) {
return f;
}
} | [
"public",
"static",
"float",
"parseFloat",
"(",
"String",
"s",
",",
"float",
"f",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"f",
";",
"}",
"try",
"{",
"return",
"Float",
".",
"parseFloat",
"(",
"s",
".",
"trim",
"(",
")",
")",
... | Parse a <b>float</b> with a given default value <b>f</b>
@return default value if null or not parsable | [
"Parse",
"a",
"<b",
">",
"float<",
"/",
"b",
">",
"with",
"a",
"given",
"default",
"value",
"<b",
">",
"f<",
"/",
"b",
">"
] | train | https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util/src/main/java/com/xqbase/util/Numbers.java#L99-L108 |
mozilla/rhino | src/org/mozilla/javascript/ScriptRuntime.java | ScriptRuntime.getNameFunctionAndThis | public static Callable getNameFunctionAndThis(String name,
Context cx,
Scriptable scope) {
"""
Prepare for calling name(...): return function corresponding to
name and make current top scope available
as ScriptRun... | java | public static Callable getNameFunctionAndThis(String name,
Context cx,
Scriptable scope)
{
Scriptable parent = scope.getParentScope();
if (parent == null) {
Object result = topScopeName(cx... | [
"public",
"static",
"Callable",
"getNameFunctionAndThis",
"(",
"String",
"name",
",",
"Context",
"cx",
",",
"Scriptable",
"scope",
")",
"{",
"Scriptable",
"parent",
"=",
"scope",
".",
"getParentScope",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
")",
... | Prepare for calling name(...): return function corresponding to
name and make current top scope available
as ScriptRuntime.lastStoredScriptable() for consumption as thisObj.
The caller must call ScriptRuntime.lastStoredScriptable() immediately
after calling this method. | [
"Prepare",
"for",
"calling",
"name",
"(",
"...",
")",
":",
"return",
"function",
"corresponding",
"to",
"name",
"and",
"make",
"current",
"top",
"scope",
"available",
"as",
"ScriptRuntime",
".",
"lastStoredScriptable",
"()",
"for",
"consumption",
"as",
"thisObj"... | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L2448-L2469 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java | BackupShortTermRetentionPoliciesInner.beginCreateOrUpdateAsync | public Observable<BackupShortTermRetentionPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) {
"""
Updates a database's short term retention policy.
@param resourceGroupName The name of the resource group that contains the resource. You... | java | public Observable<BackupShortTermRetentionPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1<ServiceResponse<... | [
"public",
"Observable",
"<",
"BackupShortTermRetentionPolicyInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"Integer",
"retentionDays",
")",
"{",
"return",
"beginCreateOrUpdateWith... | Updates a database's short term retention policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@param retentionDays... | [
"Updates",
"a",
"database",
"s",
"short",
"term",
"retention",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java#L480-L487 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.