repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
ops4j/org.ops4j.pax.exam2 | core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/WarBuilder.java | WarBuilder.toJar | private File toJar(File root) throws IOException {
String artifactName = findArtifactName(root);
File jar = new File(tempDir, artifactName);
ZipBuilder builder = new ZipBuilder(jar);
builder.addDirectory(root, "");
builder.close();
return jar;
} | java | private File toJar(File root) throws IOException {
String artifactName = findArtifactName(root);
File jar = new File(tempDir, artifactName);
ZipBuilder builder = new ZipBuilder(jar);
builder.addDirectory(root, "");
builder.close();
return jar;
} | [
"private",
"File",
"toJar",
"(",
"File",
"root",
")",
"throws",
"IOException",
"{",
"String",
"artifactName",
"=",
"findArtifactName",
"(",
"root",
")",
";",
"File",
"jar",
"=",
"new",
"File",
"(",
"tempDir",
",",
"artifactName",
")",
";",
"ZipBuilder",
"b... | Creates a JAR file from the contents of the given root directory. The file is located in
a temporary directory and is named <code>${artifactId}-${version}.jar</code> according to
Maven conventions, if there is a {@code pom.properties} resource located anywhere under
{@code META-INF/maven} defining the two propeties {@code artifactId} and {@code version}.
<p>
Otherwise the file is named <code>${uuid}.jar</code>, where {@code uuid} represents a random
{@link UUID}.
@param root root directory with archive contents
@return archive file
@throws IOException | [
"Creates",
"a",
"JAR",
"file",
"from",
"the",
"contents",
"of",
"the",
"given",
"root",
"directory",
".",
"The",
"file",
"is",
"located",
"in",
"a",
"temporary",
"directory",
"and",
"is",
"named",
"<code",
">",
"${",
";",
"artifactId}",
";",
"-",
... | train | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/WarBuilder.java#L132-L139 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Checker.java | Checker.isButtonChecked | public <T extends CompoundButton> boolean isButtonChecked(Class<T> expectedClass, int index)
{
return (waiter.waitForAndGetView(index, expectedClass).isChecked());
} | java | public <T extends CompoundButton> boolean isButtonChecked(Class<T> expectedClass, int index)
{
return (waiter.waitForAndGetView(index, expectedClass).isChecked());
} | [
"public",
"<",
"T",
"extends",
"CompoundButton",
">",
"boolean",
"isButtonChecked",
"(",
"Class",
"<",
"T",
">",
"expectedClass",
",",
"int",
"index",
")",
"{",
"return",
"(",
"waiter",
".",
"waitForAndGetView",
"(",
"index",
",",
"expectedClass",
")",
".",
... | Checks if a {@link CompoundButton} with a given index is checked.
@param expectedClass the expected class, e.g. {@code CheckBox.class} or {@code RadioButton.class}
@param index of the {@code CompoundButton} to check. {@code 0} if only one is available
@return {@code true} if {@code CompoundButton} is checked and {@code false} if it is not checked | [
"Checks",
"if",
"a",
"{",
"@link",
"CompoundButton",
"}",
"with",
"a",
"given",
"index",
"is",
"checked",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Checker.java#L44-L47 |
dropwizard/metrics | metrics-healthchecks/src/main/java/com/codahale/metrics/health/SharedHealthCheckRegistries.java | SharedHealthCheckRegistries.setDefault | public synchronized static HealthCheckRegistry setDefault(String name) {
final HealthCheckRegistry registry = getOrCreate(name);
return setDefault(name, registry);
} | java | public synchronized static HealthCheckRegistry setDefault(String name) {
final HealthCheckRegistry registry = getOrCreate(name);
return setDefault(name, registry);
} | [
"public",
"synchronized",
"static",
"HealthCheckRegistry",
"setDefault",
"(",
"String",
"name",
")",
"{",
"final",
"HealthCheckRegistry",
"registry",
"=",
"getOrCreate",
"(",
"name",
")",
";",
"return",
"setDefault",
"(",
"name",
",",
"registry",
")",
";",
"}"
] | Creates a new registry and sets it as the default one under the provided name.
@param name the registry name
@return the default registry
@throws IllegalStateException if the name has already been set | [
"Creates",
"a",
"new",
"registry",
"and",
"sets",
"it",
"as",
"the",
"default",
"one",
"under",
"the",
"provided",
"name",
"."
] | train | https://github.com/dropwizard/metrics/blob/3c6105a0b9b4416c59e16b6b841b123052d6f57d/metrics-healthchecks/src/main/java/com/codahale/metrics/health/SharedHealthCheckRegistries.java#L60-L63 |
classgraph/classgraph | src/main/java/io/github/classgraph/ReferenceTypeSignature.java | ReferenceTypeSignature.parseClassBound | static ReferenceTypeSignature parseClassBound(final Parser parser, final String definingClassName)
throws ParseException {
parser.expect(':');
// May return null if there is no signature after ':' (class bound signature may be empty)
return parseReferenceTypeSignature(parser, definingClassName);
} | java | static ReferenceTypeSignature parseClassBound(final Parser parser, final String definingClassName)
throws ParseException {
parser.expect(':');
// May return null if there is no signature after ':' (class bound signature may be empty)
return parseReferenceTypeSignature(parser, definingClassName);
} | [
"static",
"ReferenceTypeSignature",
"parseClassBound",
"(",
"final",
"Parser",
"parser",
",",
"final",
"String",
"definingClassName",
")",
"throws",
"ParseException",
"{",
"parser",
".",
"expect",
"(",
"'",
"'",
")",
";",
"// May return null if there is no signature aft... | Parse a class bound.
@param parser
The parser.
@param definingClassName
The class containing the type descriptor.
@return The parsed class bound.
@throws ParseException
If the type signature could not be parsed. | [
"Parse",
"a",
"class",
"bound",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ReferenceTypeSignature.java#L83-L88 |
facebookarchive/hadoop-20 | src/contrib/benchmark/src/java/org/apache/hadoop/mapred/MapOutputCorrectness.java | MapOutputCorrectness.getMapperId | private static int getMapperId(long key, int numReducers, int maxKeySpace) {
key = key - getFirstSumKey(numReducers, maxKeySpace);
return (int) (key / numReducers);
} | java | private static int getMapperId(long key, int numReducers, int maxKeySpace) {
key = key - getFirstSumKey(numReducers, maxKeySpace);
return (int) (key / numReducers);
} | [
"private",
"static",
"int",
"getMapperId",
"(",
"long",
"key",
",",
"int",
"numReducers",
",",
"int",
"maxKeySpace",
")",
"{",
"key",
"=",
"key",
"-",
"getFirstSumKey",
"(",
"numReducers",
",",
"maxKeySpace",
")",
";",
"return",
"(",
"int",
")",
"(",
"ke... | Which mapper sent this key sum?
@param key Key to check
@param numReducers Number of reducers
@param maxKeySpace Max key space
@return Mapper that send this key sum | [
"Which",
"mapper",
"sent",
"this",
"key",
"sum?"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/mapred/MapOutputCorrectness.java#L339-L342 |
mike706574/java-map-support | src/main/java/fun/mike/map/alpha/Get.java | Get.requiredStringEnum | public static <T> String requiredStringEnum(Map<String, T> map, String key, List<String> options) {
String value = requiredString(map, key);
List<String> uppercaseOptions = options.stream().map(String::toUpperCase).collect(Collectors.toList());
if (!uppercaseOptions.contains(value.toUpperCase())) {
String optionsStr = options.stream()
.map(option -> String.format("\"%s\"", option))
.collect(Collectors.joining(", "));
String message = String.format("Unsupported value \"%s\" for enumerated string property \"%s\". Valid options: %s",
value,
key,
optionsStr);
throw new IllegalArgumentException(message);
}
return value;
} | java | public static <T> String requiredStringEnum(Map<String, T> map, String key, List<String> options) {
String value = requiredString(map, key);
List<String> uppercaseOptions = options.stream().map(String::toUpperCase).collect(Collectors.toList());
if (!uppercaseOptions.contains(value.toUpperCase())) {
String optionsStr = options.stream()
.map(option -> String.format("\"%s\"", option))
.collect(Collectors.joining(", "));
String message = String.format("Unsupported value \"%s\" for enumerated string property \"%s\". Valid options: %s",
value,
key,
optionsStr);
throw new IllegalArgumentException(message);
}
return value;
} | [
"public",
"static",
"<",
"T",
">",
"String",
"requiredStringEnum",
"(",
"Map",
"<",
"String",
",",
"T",
">",
"map",
",",
"String",
"key",
",",
"List",
"<",
"String",
">",
"options",
")",
"{",
"String",
"value",
"=",
"requiredString",
"(",
"map",
",",
... | Validates that the value from {@code map} for the given {@code key} is a
string and is present in {@code options}. Returns the value when valid;
otherwise, throws an {@code IllegalArgumentException}.
@param map a map
@param key a key
@param options acceptable values
@param <T> the type of value
@return The string value
@throws java.util.NoSuchElementException if the required value is not
present
@throws java.lang.IllegalArgumentException if the value is in valid | [
"Validates",
"that",
"the",
"value",
"from",
"{"
] | train | https://github.com/mike706574/java-map-support/blob/7cb09f34c24adfaca73ad25a3c3e05abec72eafe/src/main/java/fun/mike/map/alpha/Get.java#L24-L38 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeValidator.java | TypeValidator.expectStringOrNumber | void expectStringOrNumber(Node n, JSType type, String msg) {
if (!type.matchesNumberContext()
&& !type.matchesStringContext()
&& !type.matchesStringContext()) {
mismatch(n, msg, type, NUMBER_STRING);
} else {
expectStringOrNumberOrSymbolStrict(n, type, msg);
}
} | java | void expectStringOrNumber(Node n, JSType type, String msg) {
if (!type.matchesNumberContext()
&& !type.matchesStringContext()
&& !type.matchesStringContext()) {
mismatch(n, msg, type, NUMBER_STRING);
} else {
expectStringOrNumberOrSymbolStrict(n, type, msg);
}
} | [
"void",
"expectStringOrNumber",
"(",
"Node",
"n",
",",
"JSType",
"type",
",",
"String",
"msg",
")",
"{",
"if",
"(",
"!",
"type",
".",
"matchesNumberContext",
"(",
")",
"&&",
"!",
"type",
".",
"matchesStringContext",
"(",
")",
"&&",
"!",
"type",
".",
"m... | Expect the type to be a number or string or symbol, or a type convertible to a number or
string. If the expectation is not met, issue a warning at the provided node's source code
position. | [
"Expect",
"the",
"type",
"to",
"be",
"a",
"number",
"or",
"string",
"or",
"symbol",
"or",
"a",
"type",
"convertible",
"to",
"a",
"number",
"or",
"string",
".",
"If",
"the",
"expectation",
"is",
"not",
"met",
"issue",
"a",
"warning",
"at",
"the",
"provi... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L434-L442 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.angleBetween | public static double angleBetween( LineSegment l1, LineSegment l2 ) {
double azimuth1 = azimuth(l1.p0, l1.p1);
double azimuth2 = azimuth(l2.p0, l2.p1);
if (azimuth1 < azimuth2) {
return azimuth2 - azimuth1;
} else {
return 360 - azimuth1 + azimuth2;
}
} | java | public static double angleBetween( LineSegment l1, LineSegment l2 ) {
double azimuth1 = azimuth(l1.p0, l1.p1);
double azimuth2 = azimuth(l2.p0, l2.p1);
if (azimuth1 < azimuth2) {
return azimuth2 - azimuth1;
} else {
return 360 - azimuth1 + azimuth2;
}
} | [
"public",
"static",
"double",
"angleBetween",
"(",
"LineSegment",
"l1",
",",
"LineSegment",
"l2",
")",
"{",
"double",
"azimuth1",
"=",
"azimuth",
"(",
"l1",
".",
"p0",
",",
"l1",
".",
"p1",
")",
";",
"double",
"azimuth2",
"=",
"azimuth",
"(",
"l2",
"."... | Calculates the angle between two {@link LineSegment}s.
@param l1 the first segment.
@param l2 the second segment.
@return the angle between the two segments, starting from the first segment
moving clockwise. | [
"Calculates",
"the",
"angle",
"between",
"two",
"{",
"@link",
"LineSegment",
"}",
"s",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L200-L209 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/AxiomType_CustomFieldSerializer.java | AxiomType_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, AxiomType instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, AxiomType instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"AxiomType",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/AxiomType_CustomFieldSerializer.java#L62-L65 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java | Agg.denseRank | public static <T extends Comparable<? super T>> Collector<T, ?, Optional<Long>> denseRank(T value) {
return denseRankBy(value, t -> t, naturalOrder());
} | java | public static <T extends Comparable<? super T>> Collector<T, ?, Optional<Long>> denseRank(T value) {
return denseRankBy(value, t -> t, naturalOrder());
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"Optional",
"<",
"Long",
">",
">",
"denseRank",
"(",
"T",
"value",
")",
"{",
"return",
"denseRankBy",
"(",
"value",
",",
... | Get a {@link Collector} that calculates the <code>DENSE_RANK()</code> function given natural ordering. | [
"Get",
"a",
"{"
] | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java#L699-L701 |
elki-project/elki | elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/AbstractMTreeNode.java | AbstractMTreeNode.integrityCheckParameters | protected void integrityCheckParameters(E parentEntry, N parent, int index, AbstractMTree<O, N, E, ?> mTree) {
// test if parent distance is correctly set
E entry = parent.getEntry(index);
double parentDistance = mTree.distance(entry.getRoutingObjectID(), parentEntry.getRoutingObjectID());
if(Math.abs(entry.getParentDistance() - parentDistance) > 1E-10) {
throw new InconsistentDataException("Wrong parent distance in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + parentDistance + ",\n ist: " + entry.getParentDistance());
}
// test if covering radius is correctly set
double mincover = parentDistance + entry.getCoveringRadius();
if(parentEntry.getCoveringRadius() < mincover && //
Math.abs(parentDistance - entry.getCoveringRadius()) > 1e-10) {
throw new InconsistentDataException("pcr < pd + cr \n" + parentEntry.getCoveringRadius() + " < " + parentDistance + " + " + entry.getCoveringRadius() + "in node " + parent.getPageID() + " at index " + index + " (child " + entry + "):\n" + "dist(" + entry.getRoutingObjectID() + " - " + parentEntry.getRoutingObjectID() + ")" + " > cr(" + entry + ")");
}
} | java | protected void integrityCheckParameters(E parentEntry, N parent, int index, AbstractMTree<O, N, E, ?> mTree) {
// test if parent distance is correctly set
E entry = parent.getEntry(index);
double parentDistance = mTree.distance(entry.getRoutingObjectID(), parentEntry.getRoutingObjectID());
if(Math.abs(entry.getParentDistance() - parentDistance) > 1E-10) {
throw new InconsistentDataException("Wrong parent distance in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + parentDistance + ",\n ist: " + entry.getParentDistance());
}
// test if covering radius is correctly set
double mincover = parentDistance + entry.getCoveringRadius();
if(parentEntry.getCoveringRadius() < mincover && //
Math.abs(parentDistance - entry.getCoveringRadius()) > 1e-10) {
throw new InconsistentDataException("pcr < pd + cr \n" + parentEntry.getCoveringRadius() + " < " + parentDistance + " + " + entry.getCoveringRadius() + "in node " + parent.getPageID() + " at index " + index + " (child " + entry + "):\n" + "dist(" + entry.getRoutingObjectID() + " - " + parentEntry.getRoutingObjectID() + ")" + " > cr(" + entry + ")");
}
} | [
"protected",
"void",
"integrityCheckParameters",
"(",
"E",
"parentEntry",
",",
"N",
"parent",
",",
"int",
"index",
",",
"AbstractMTree",
"<",
"O",
",",
"N",
",",
"E",
",",
"?",
">",
"mTree",
")",
"{",
"// test if parent distance is correctly set",
"E",
"entry"... | Tests, if the parameters of the entry representing this node, are correctly
set. Subclasses may need to overwrite this method.
@param parentEntry the entry representing the parent
@param parent the parent holding the entry representing this node
@param index the index of the entry in the parents child arry
@param mTree the M-Tree holding this node | [
"Tests",
"if",
"the",
"parameters",
"of",
"the",
"entry",
"representing",
"this",
"node",
"are",
"correctly",
"set",
".",
"Subclasses",
"may",
"need",
"to",
"overwrite",
"this",
"method",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/AbstractMTreeNode.java#L168-L182 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/AbstractMessageActionParser.java | AbstractMessageActionParser.parseExtractHeaderElements | protected void parseExtractHeaderElements(Element element, List<VariableExtractor> variableExtractors) {
Element extractElement = DomUtils.getChildElementByTagName(element, "extract");
Map<String, String> extractHeaderValues = new HashMap<>();
if (extractElement != null) {
List<?> headerValueElements = DomUtils.getChildElementsByTagName(extractElement, "header");
for (Iterator<?> iter = headerValueElements.iterator(); iter.hasNext();) {
Element headerValue = (Element) iter.next();
extractHeaderValues.put(headerValue.getAttribute("name"), headerValue.getAttribute("variable"));
}
MessageHeaderVariableExtractor headerVariableExtractor = new MessageHeaderVariableExtractor();
headerVariableExtractor.setHeaderMappings(extractHeaderValues);
if (!CollectionUtils.isEmpty(extractHeaderValues)) {
variableExtractors.add(headerVariableExtractor);
}
}
} | java | protected void parseExtractHeaderElements(Element element, List<VariableExtractor> variableExtractors) {
Element extractElement = DomUtils.getChildElementByTagName(element, "extract");
Map<String, String> extractHeaderValues = new HashMap<>();
if (extractElement != null) {
List<?> headerValueElements = DomUtils.getChildElementsByTagName(extractElement, "header");
for (Iterator<?> iter = headerValueElements.iterator(); iter.hasNext();) {
Element headerValue = (Element) iter.next();
extractHeaderValues.put(headerValue.getAttribute("name"), headerValue.getAttribute("variable"));
}
MessageHeaderVariableExtractor headerVariableExtractor = new MessageHeaderVariableExtractor();
headerVariableExtractor.setHeaderMappings(extractHeaderValues);
if (!CollectionUtils.isEmpty(extractHeaderValues)) {
variableExtractors.add(headerVariableExtractor);
}
}
} | [
"protected",
"void",
"parseExtractHeaderElements",
"(",
"Element",
"element",
",",
"List",
"<",
"VariableExtractor",
">",
"variableExtractors",
")",
"{",
"Element",
"extractElement",
"=",
"DomUtils",
".",
"getChildElementByTagName",
"(",
"element",
",",
"\"extract\"",
... | Parses header extract information.
@param element the root action element.
@param variableExtractors the variable extractors to add new extractors to. | [
"Parses",
"header",
"extract",
"information",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/AbstractMessageActionParser.java#L255-L272 |
liferay/com-liferay-commerce | commerce-api/src/main/java/com/liferay/commerce/service/persistence/CommerceRegionUtil.java | CommerceRegionUtil.removeByC_C | public static CommerceRegion removeByC_C(long commerceCountryId, String code)
throws com.liferay.commerce.exception.NoSuchRegionException {
return getPersistence().removeByC_C(commerceCountryId, code);
} | java | public static CommerceRegion removeByC_C(long commerceCountryId, String code)
throws com.liferay.commerce.exception.NoSuchRegionException {
return getPersistence().removeByC_C(commerceCountryId, code);
} | [
"public",
"static",
"CommerceRegion",
"removeByC_C",
"(",
"long",
"commerceCountryId",
",",
"String",
"code",
")",
"throws",
"com",
".",
"liferay",
".",
"commerce",
".",
"exception",
".",
"NoSuchRegionException",
"{",
"return",
"getPersistence",
"(",
")",
".",
"... | Removes the commerce region where commerceCountryId = ? and code = ? from the database.
@param commerceCountryId the commerce country ID
@param code the code
@return the commerce region that was removed | [
"Removes",
"the",
"commerce",
"region",
"where",
"commerceCountryId",
"=",
"?",
";",
"and",
"code",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-api/src/main/java/com/liferay/commerce/service/persistence/CommerceRegionUtil.java#L724-L727 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bos/BosClient.java | BosClient.generatePresignedUrl | public URL generatePresignedUrl(String bucketName, String key, int expirationInSeconds) {
return this.generatePresignedUrl(bucketName, key, expirationInSeconds, HttpMethodName.GET);
} | java | public URL generatePresignedUrl(String bucketName, String key, int expirationInSeconds) {
return this.generatePresignedUrl(bucketName, key, expirationInSeconds, HttpMethodName.GET);
} | [
"public",
"URL",
"generatePresignedUrl",
"(",
"String",
"bucketName",
",",
"String",
"key",
",",
"int",
"expirationInSeconds",
")",
"{",
"return",
"this",
".",
"generatePresignedUrl",
"(",
"bucketName",
",",
"key",
",",
"expirationInSeconds",
",",
"HttpMethodName",
... | Returns a pre-signed URL for accessing a Bos resource.
@param bucketName The name of the bucket containing the desired object.
@param key The key in the specified bucket under which the desired object is stored.
@param expirationInSeconds The expiration after which the returned pre-signed URL will expire.
@return A pre-signed URL which expires at the specified time, and can be
used to allow anyone to download the specified object from Bos,
without exposing the owner's Bce secret access key. | [
"Returns",
"a",
"pre",
"-",
"signed",
"URL",
"for",
"accessing",
"a",
"Bos",
"resource",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L459-L461 |
flow/caustic | api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java | MeshGenerator.generateWireCuboid | public static VertexData generateWireCuboid(Vector3f size) {
final VertexData destination = new VertexData();
final VertexAttribute positionsAttribute = new VertexAttribute("positions", DataType.FLOAT, 3);
destination.addAttribute(0, positionsAttribute);
final TFloatList positions = new TFloatArrayList();
final TIntList indices = destination.getIndices();
// Generate the mesh
generateWireCuboid(positions, indices, size);
// Put the mesh in the vertex data
positionsAttribute.setData(positions);
return destination;
} | java | public static VertexData generateWireCuboid(Vector3f size) {
final VertexData destination = new VertexData();
final VertexAttribute positionsAttribute = new VertexAttribute("positions", DataType.FLOAT, 3);
destination.addAttribute(0, positionsAttribute);
final TFloatList positions = new TFloatArrayList();
final TIntList indices = destination.getIndices();
// Generate the mesh
generateWireCuboid(positions, indices, size);
// Put the mesh in the vertex data
positionsAttribute.setData(positions);
return destination;
} | [
"public",
"static",
"VertexData",
"generateWireCuboid",
"(",
"Vector3f",
"size",
")",
"{",
"final",
"VertexData",
"destination",
"=",
"new",
"VertexData",
"(",
")",
";",
"final",
"VertexAttribute",
"positionsAttribute",
"=",
"new",
"VertexAttribute",
"(",
"\"positio... | Generates a cuboid shaped wireframe (the outline of the cuboid). The center is at the middle of the cuboid.
@param size The size of the cuboid to generate, on x, y and z
@return The vertex data | [
"Generates",
"a",
"cuboid",
"shaped",
"wireframe",
"(",
"the",
"outline",
"of",
"the",
"cuboid",
")",
".",
"The",
"center",
"is",
"at",
"the",
"middle",
"of",
"the",
"cuboid",
"."
] | train | https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java#L530-L541 |
jglobus/JGlobus | gridftp/src/main/java/org/globus/ftp/FTPClient.java | FTPClient.getSize | public long getSize(String filename)
throws IOException, ServerException {
if (filename == null) {
throw new IllegalArgumentException("Required argument missing");
}
Command cmd = new Command("SIZE", filename);
Reply reply = null;
try {
reply = controlChannel.execute(cmd);
return Long.parseLong(reply.getMessage());
} catch (NumberFormatException e) {
throw ServerException.embedFTPReplyParseException(
new FTPReplyParseException(
FTPReplyParseException.MESSAGE_UNPARSABLE,
"Could not parse size: " + reply.getMessage()));
} catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(urce);
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
} | java | public long getSize(String filename)
throws IOException, ServerException {
if (filename == null) {
throw new IllegalArgumentException("Required argument missing");
}
Command cmd = new Command("SIZE", filename);
Reply reply = null;
try {
reply = controlChannel.execute(cmd);
return Long.parseLong(reply.getMessage());
} catch (NumberFormatException e) {
throw ServerException.embedFTPReplyParseException(
new FTPReplyParseException(
FTPReplyParseException.MESSAGE_UNPARSABLE,
"Could not parse size: " + reply.getMessage()));
} catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(urce);
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
} | [
"public",
"long",
"getSize",
"(",
"String",
"filename",
")",
"throws",
"IOException",
",",
"ServerException",
"{",
"if",
"(",
"filename",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Required argument missing\"",
")",
";",
"}",
"Co... | Returns the remote file size.
@param filename filename get the size for.
@return size of the file.
@exception ServerException if the file does not exist or
an error occured. | [
"Returns",
"the",
"remote",
"file",
"size",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L141-L161 |
liferay/com-liferay-commerce | commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentEntryPersistenceImpl.java | CommerceUserSegmentEntryPersistenceImpl.findAll | @Override
public List<CommerceUserSegmentEntry> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CommerceUserSegmentEntry> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceUserSegmentEntry",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce user segment entries.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceUserSegmentEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce user segment entries
@param end the upper bound of the range of commerce user segment entries (not inclusive)
@return the range of commerce user segment entries | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"user",
"segment",
"entries",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentEntryPersistenceImpl.java#L2786-L2789 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java | SparseCpuLevel1.dnrm2 | @Override
protected double dnrm2(long N, INDArray X, int incx){
return cblas_dnrm2((int) N, (DoublePointer) X.data().addressPointer(), incx);
} | java | @Override
protected double dnrm2(long N, INDArray X, int incx){
return cblas_dnrm2((int) N, (DoublePointer) X.data().addressPointer(), incx);
} | [
"@",
"Override",
"protected",
"double",
"dnrm2",
"(",
"long",
"N",
",",
"INDArray",
"X",
",",
"int",
"incx",
")",
"{",
"return",
"cblas_dnrm2",
"(",
"(",
"int",
")",
"N",
",",
"(",
"DoublePointer",
")",
"X",
".",
"data",
"(",
")",
".",
"addressPointe... | Computes the Euclidean norm of a double vector
@param N The number of elements in vector X
@param X an INDArray
@param incx the increment of X | [
"Computes",
"the",
"Euclidean",
"norm",
"of",
"a",
"double",
"vector"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java#L85-L88 |
openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java | RestRequest.preparePostHeader | private void preparePostHeader(HttpPost httpPost, String acceptMimeType, String contentMimeType) {
if (acceptMimeType != null && !acceptMimeType.equals("")) {
httpPost.setHeader(new BasicHeader("accept", acceptMimeType));
}
if (contentMimeType != null && !contentMimeType.equals("")) {
httpPost.setHeader(new BasicHeader("Content-Type", contentMimeType));
}
httpPost.setHeader(new BasicHeader("project-id", projectId));
if (token != null && bearerToken != null) {
httpPost.setHeader(new BasicHeader("authorization", bearerToken.replaceAll("\"", "")));
}
} | java | private void preparePostHeader(HttpPost httpPost, String acceptMimeType, String contentMimeType) {
if (acceptMimeType != null && !acceptMimeType.equals("")) {
httpPost.setHeader(new BasicHeader("accept", acceptMimeType));
}
if (contentMimeType != null && !contentMimeType.equals("")) {
httpPost.setHeader(new BasicHeader("Content-Type", contentMimeType));
}
httpPost.setHeader(new BasicHeader("project-id", projectId));
if (token != null && bearerToken != null) {
httpPost.setHeader(new BasicHeader("authorization", bearerToken.replaceAll("\"", "")));
}
} | [
"private",
"void",
"preparePostHeader",
"(",
"HttpPost",
"httpPost",
",",
"String",
"acceptMimeType",
",",
"String",
"contentMimeType",
")",
"{",
"if",
"(",
"acceptMimeType",
"!=",
"null",
"&&",
"!",
"acceptMimeType",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",... | Add accept, content-type, projectId and token headers to an HttpPost object.
@param httpPost
@param acceptMimeType
@param contentMimeType | [
"Add",
"accept",
"content",
"-",
"type",
"projectId",
"and",
"token",
"headers",
"to",
"an",
"HttpPost",
"object",
"."
] | train | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java#L364-L375 |
kiegroup/jbpmmigration | src/main/java/org/jbpm/migration/Validator.java | Validator.validateDefinition | static boolean validateDefinition(final String def, final ProcessLanguage language) {
return XmlUtils.validate(new StreamSource(new StringReader(def)), language.getSchemaSources());
} | java | static boolean validateDefinition(final String def, final ProcessLanguage language) {
return XmlUtils.validate(new StreamSource(new StringReader(def)), language.getSchemaSources());
} | [
"static",
"boolean",
"validateDefinition",
"(",
"final",
"String",
"def",
",",
"final",
"ProcessLanguage",
"language",
")",
"{",
"return",
"XmlUtils",
".",
"validate",
"(",
"new",
"StreamSource",
"(",
"new",
"StringReader",
"(",
"def",
")",
")",
",",
"language... | Validate a given jPDL process definition against the applicable definition language's schema.
@param def
The process definition, in {@link String} format.
@param language
The process definition language for which the given definition is to be validated.
@return Whether the validation was successful. | [
"Validate",
"a",
"given",
"jPDL",
"process",
"definition",
"against",
"the",
"applicable",
"definition",
"language",
"s",
"schema",
"."
] | train | https://github.com/kiegroup/jbpmmigration/blob/5e133e2824aa38f316a2eb061123313a7276aba0/src/main/java/org/jbpm/migration/Validator.java#L99-L101 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java | AvroUtils.switchName | public static Schema switchName(Schema schema, String newName) {
if (schema.getName().equals(newName)) {
return schema;
}
Schema newSchema = Schema.createRecord(newName, schema.getDoc(), schema.getNamespace(), schema.isError());
List<Field> fields = schema.getFields();
Iterable<Field> fieldsNew = Iterables.transform(fields, new Function<Field, Field>() {
@Override
public Schema.Field apply(Field input) {
//this should never happen but the API has marked input as Nullable
if (null == input) {
return null;
}
Field field = new Field(input.name(), input.schema(), input.doc(), input.defaultValue(), input.order());
return field;
}
});
newSchema.setFields(Lists.newArrayList(fieldsNew));
return newSchema;
} | java | public static Schema switchName(Schema schema, String newName) {
if (schema.getName().equals(newName)) {
return schema;
}
Schema newSchema = Schema.createRecord(newName, schema.getDoc(), schema.getNamespace(), schema.isError());
List<Field> fields = schema.getFields();
Iterable<Field> fieldsNew = Iterables.transform(fields, new Function<Field, Field>() {
@Override
public Schema.Field apply(Field input) {
//this should never happen but the API has marked input as Nullable
if (null == input) {
return null;
}
Field field = new Field(input.name(), input.schema(), input.doc(), input.defaultValue(), input.order());
return field;
}
});
newSchema.setFields(Lists.newArrayList(fieldsNew));
return newSchema;
} | [
"public",
"static",
"Schema",
"switchName",
"(",
"Schema",
"schema",
",",
"String",
"newName",
")",
"{",
"if",
"(",
"schema",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"newName",
")",
")",
"{",
"return",
"schema",
";",
"}",
"Schema",
"newSchema",
"... | Copies the input {@link org.apache.avro.Schema} but changes the schema name.
@param schema {@link org.apache.avro.Schema} to copy.
@param newName name for the copied {@link org.apache.avro.Schema}.
@return A {@link org.apache.avro.Schema} that is a copy of schema, but has the name newName. | [
"Copies",
"the",
"input",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java#L673-L695 |
aws/aws-sdk-java | aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/DeleteChannelResult.java | DeleteChannelResult.withTags | public DeleteChannelResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public DeleteChannelResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"DeleteChannelResult",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | A collection of key-value pairs.
@param tags
A collection of key-value pairs.
@return Returns a reference to this object so that method calls can be chained together. | [
"A",
"collection",
"of",
"key",
"-",
"value",
"pairs",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/DeleteChannelResult.java#L658-L661 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/async/WatcherManager.java | WatcherManager.validateWatcher | public boolean validateWatcher(String name, Watcher watcher){
synchronized(watchers){
if(watchers.containsKey(name)){
return watchers.get(name).contains(watcher);
}
return false;
}
} | java | public boolean validateWatcher(String name, Watcher watcher){
synchronized(watchers){
if(watchers.containsKey(name)){
return watchers.get(name).contains(watcher);
}
return false;
}
} | [
"public",
"boolean",
"validateWatcher",
"(",
"String",
"name",
",",
"Watcher",
"watcher",
")",
"{",
"synchronized",
"(",
"watchers",
")",
"{",
"if",
"(",
"watchers",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"return",
"watchers",
".",
"get",
"(",
"... | Validate whether the Watcher register to the Service.
@param name
the Service Name.
@param watcher
the Watcher Object.
@return
return true if the Watcher registered to the Service. | [
"Validate",
"whether",
"the",
"Watcher",
"register",
"to",
"the",
"Service",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/async/WatcherManager.java#L135-L142 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/http/HttpConnection.java | HttpConnection.outputNotify | public void outputNotify(OutputStream out, int action, Object ignoredData)
throws IOException
{
if (_response==null)
return;
switch(action)
{
case OutputObserver.__FIRST_WRITE:
if (!_firstWrite)
{
firstWrite();
_firstWrite=true;
}
break;
case OutputObserver.__RESET_BUFFER:
resetBuffer();
break;
case OutputObserver.__COMMITING:
commit();
break;
case OutputObserver.__CLOSING:
if (_response!=null)
{
completing();
if (!_response.isCommitted() &&
_request.getState()==HttpMessage.__MSG_RECEIVED)
commit();
}
break;
case OutputObserver.__CLOSED:
break;
}
} | java | public void outputNotify(OutputStream out, int action, Object ignoredData)
throws IOException
{
if (_response==null)
return;
switch(action)
{
case OutputObserver.__FIRST_WRITE:
if (!_firstWrite)
{
firstWrite();
_firstWrite=true;
}
break;
case OutputObserver.__RESET_BUFFER:
resetBuffer();
break;
case OutputObserver.__COMMITING:
commit();
break;
case OutputObserver.__CLOSING:
if (_response!=null)
{
completing();
if (!_response.isCommitted() &&
_request.getState()==HttpMessage.__MSG_RECEIVED)
commit();
}
break;
case OutputObserver.__CLOSED:
break;
}
} | [
"public",
"void",
"outputNotify",
"(",
"OutputStream",
"out",
",",
"int",
"action",
",",
"Object",
"ignoredData",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_response",
"==",
"null",
")",
"return",
";",
"switch",
"(",
"action",
")",
"{",
"case",
"Outpu... | Output Notifications.
Trigger header and/or filters from output stream observations.
Also finalizes method of indicating response content length.
Called as a result of the connection subscribing for notifications
to the HttpOutputStream.
@see HttpOutputStream
@param out The output stream observed.
@param action The action. | [
"Output",
"Notifications",
".",
"Trigger",
"header",
"and",
"/",
"or",
"filters",
"from",
"output",
"stream",
"observations",
".",
"Also",
"finalizes",
"method",
"of",
"indicating",
"response",
"content",
"length",
".",
"Called",
"as",
"a",
"result",
"of",
"th... | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/HttpConnection.java#L535-L573 |
jmrozanec/cron-utils | src/main/java/com/cronutils/model/time/TimeNode.java | TimeNode.getValueFromList | @VisibleForTesting
int getValueFromList(final List<Integer> values, int index, final AtomicInteger shift) {
Preconditions.checkNotNullNorEmpty(values, "List must not be empty");
if (index < 0) {
index = index + values.size();
shift.incrementAndGet();
return getValueFromList(values, index, shift);
}
if (index >= values.size()) {
index = index - values.size();
shift.incrementAndGet();
return getValueFromList(values, index, shift);
}
return values.get(index);
} | java | @VisibleForTesting
int getValueFromList(final List<Integer> values, int index, final AtomicInteger shift) {
Preconditions.checkNotNullNorEmpty(values, "List must not be empty");
if (index < 0) {
index = index + values.size();
shift.incrementAndGet();
return getValueFromList(values, index, shift);
}
if (index >= values.size()) {
index = index - values.size();
shift.incrementAndGet();
return getValueFromList(values, index, shift);
}
return values.get(index);
} | [
"@",
"VisibleForTesting",
"int",
"getValueFromList",
"(",
"final",
"List",
"<",
"Integer",
">",
"values",
",",
"int",
"index",
",",
"final",
"AtomicInteger",
"shift",
")",
"{",
"Preconditions",
".",
"checkNotNullNorEmpty",
"(",
"values",
",",
"\"List must not be e... | Obtain value from list considering specified index and required shifts.
@param values - possible values
@param index - index to be considered
@param shift - shifts that should be applied
@return int - required value from values list | [
"Obtain",
"value",
"from",
"list",
"considering",
"specified",
"index",
"and",
"required",
"shifts",
"."
] | train | https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/model/time/TimeNode.java#L129-L143 |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/plugin/typeloader/java/JavaDocument.java | JavaDocument.remove | @Override
public void remove( int offset, int length ) throws BadLocationException
{
super.remove( offset, length );
processChangedLines( offset, 0 );
} | java | @Override
public void remove( int offset, int length ) throws BadLocationException
{
super.remove( offset, length );
processChangedLines( offset, 0 );
} | [
"@",
"Override",
"public",
"void",
"remove",
"(",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"BadLocationException",
"{",
"super",
".",
"remove",
"(",
"offset",
",",
"length",
")",
";",
"processChangedLines",
"(",
"offset",
",",
"0",
")",
";",
... | /*
Override to apply syntax highlighting after the document has been updated | [
"/",
"*",
"Override",
"to",
"apply",
"syntax",
"highlighting",
"after",
"the",
"document",
"has",
"been",
"updated"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/plugin/typeloader/java/JavaDocument.java#L139-L144 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/TransitiveGroup.java | TransitiveGroup.checkTransitives | private void checkTransitives(Tile neighbor, String group, GroupTransition current, TileRef ref)
{
if (!group.equals(current.getOut())
&& TransitionType.CENTER == mapTransition.getTransition(ref, current.getOut()).getType())
{
map.setTile(map.createTile(ref.getSheet(), ref.getNumber(), neighbor.getX(), neighbor.getY()));
}
} | java | private void checkTransitives(Tile neighbor, String group, GroupTransition current, TileRef ref)
{
if (!group.equals(current.getOut())
&& TransitionType.CENTER == mapTransition.getTransition(ref, current.getOut()).getType())
{
map.setTile(map.createTile(ref.getSheet(), ref.getNumber(), neighbor.getX(), neighbor.getY()));
}
} | [
"private",
"void",
"checkTransitives",
"(",
"Tile",
"neighbor",
",",
"String",
"group",
",",
"GroupTransition",
"current",
",",
"TileRef",
"ref",
")",
"{",
"if",
"(",
"!",
"group",
".",
"equals",
"(",
"current",
".",
"getOut",
"(",
")",
")",
"&&",
"Trans... | Check transitive tiles.
@param neighbor The current neighbor.
@param group The current group.
@param current The current transition.
@param ref The tile ref to check. | [
"Check",
"transitive",
"tiles",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/TransitiveGroup.java#L319-L326 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/Provisioner.java | Provisioner.getBundleLocation | public static String getBundleLocation(String urlString, String productName) {
String productNameInfo = (productName != null && !productName.isEmpty()) ? (BUNDLE_LOC_PROD_EXT_TAG + productName + ":") : "";
return BUNDLE_LOC_FEATURE_TAG + productNameInfo + urlString;
} | java | public static String getBundleLocation(String urlString, String productName) {
String productNameInfo = (productName != null && !productName.isEmpty()) ? (BUNDLE_LOC_PROD_EXT_TAG + productName + ":") : "";
return BUNDLE_LOC_FEATURE_TAG + productNameInfo + urlString;
} | [
"public",
"static",
"String",
"getBundleLocation",
"(",
"String",
"urlString",
",",
"String",
"productName",
")",
"{",
"String",
"productNameInfo",
"=",
"(",
"productName",
"!=",
"null",
"&&",
"!",
"productName",
".",
"isEmpty",
"(",
")",
")",
"?",
"(",
"BUN... | Gets the bundle location.
The location format is consistent with what SchemaBundle and BundleList.
@return The bundle location. | [
"Gets",
"the",
"bundle",
"location",
".",
"The",
"location",
"format",
"is",
"consistent",
"with",
"what",
"SchemaBundle",
"and",
"BundleList",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/Provisioner.java#L628-L631 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotateAroundLocal | public Matrix4f rotateAroundLocal(Quaternionfc quat, float ox, float oy, float oz, Matrix4f dest) {
float w2 = quat.w() * quat.w();
float x2 = quat.x() * quat.x();
float y2 = quat.y() * quat.y();
float z2 = quat.z() * quat.z();
float zw = quat.z() * quat.w();
float xy = quat.x() * quat.y();
float xz = quat.x() * quat.z();
float yw = quat.y() * quat.w();
float yz = quat.y() * quat.z();
float xw = quat.x() * quat.w();
float lm00 = w2 + x2 - z2 - y2;
float lm01 = xy + zw + zw + xy;
float lm02 = xz - yw + xz - yw;
float lm10 = -zw + xy - zw + xy;
float lm11 = y2 - z2 + w2 - x2;
float lm12 = yz + yz + xw + xw;
float lm20 = yw + xz + xz + yw;
float lm21 = yz + yz - xw - xw;
float lm22 = z2 - y2 - x2 + w2;
float tm00 = m00 - ox * m03;
float tm01 = m01 - oy * m03;
float tm02 = m02 - oz * m03;
float tm10 = m10 - ox * m13;
float tm11 = m11 - oy * m13;
float tm12 = m12 - oz * m13;
float tm20 = m20 - ox * m23;
float tm21 = m21 - oy * m23;
float tm22 = m22 - oz * m23;
float tm30 = m30 - ox * m33;
float tm31 = m31 - oy * m33;
float tm32 = m32 - oz * m33;
dest._m00(lm00 * tm00 + lm10 * tm01 + lm20 * tm02 + ox * m03);
dest._m01(lm01 * tm00 + lm11 * tm01 + lm21 * tm02 + oy * m03);
dest._m02(lm02 * tm00 + lm12 * tm01 + lm22 * tm02 + oz * m03);
dest._m03(m03);
dest._m10(lm00 * tm10 + lm10 * tm11 + lm20 * tm12 + ox * m13);
dest._m11(lm01 * tm10 + lm11 * tm11 + lm21 * tm12 + oy * m13);
dest._m12(lm02 * tm10 + lm12 * tm11 + lm22 * tm12 + oz * m13);
dest._m13(m13);
dest._m20(lm00 * tm20 + lm10 * tm21 + lm20 * tm22 + ox * m23);
dest._m21(lm01 * tm20 + lm11 * tm21 + lm21 * tm22 + oy * m23);
dest._m22(lm02 * tm20 + lm12 * tm21 + lm22 * tm22 + oz * m23);
dest._m23(m23);
dest._m30(lm00 * tm30 + lm10 * tm31 + lm20 * tm32 + ox * m33);
dest._m31(lm01 * tm30 + lm11 * tm31 + lm21 * tm32 + oy * m33);
dest._m32(lm02 * tm30 + lm12 * tm31 + lm22 * tm32 + oz * m33);
dest._m33(m33);
dest._properties(properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION));
return dest;
} | java | public Matrix4f rotateAroundLocal(Quaternionfc quat, float ox, float oy, float oz, Matrix4f dest) {
float w2 = quat.w() * quat.w();
float x2 = quat.x() * quat.x();
float y2 = quat.y() * quat.y();
float z2 = quat.z() * quat.z();
float zw = quat.z() * quat.w();
float xy = quat.x() * quat.y();
float xz = quat.x() * quat.z();
float yw = quat.y() * quat.w();
float yz = quat.y() * quat.z();
float xw = quat.x() * quat.w();
float lm00 = w2 + x2 - z2 - y2;
float lm01 = xy + zw + zw + xy;
float lm02 = xz - yw + xz - yw;
float lm10 = -zw + xy - zw + xy;
float lm11 = y2 - z2 + w2 - x2;
float lm12 = yz + yz + xw + xw;
float lm20 = yw + xz + xz + yw;
float lm21 = yz + yz - xw - xw;
float lm22 = z2 - y2 - x2 + w2;
float tm00 = m00 - ox * m03;
float tm01 = m01 - oy * m03;
float tm02 = m02 - oz * m03;
float tm10 = m10 - ox * m13;
float tm11 = m11 - oy * m13;
float tm12 = m12 - oz * m13;
float tm20 = m20 - ox * m23;
float tm21 = m21 - oy * m23;
float tm22 = m22 - oz * m23;
float tm30 = m30 - ox * m33;
float tm31 = m31 - oy * m33;
float tm32 = m32 - oz * m33;
dest._m00(lm00 * tm00 + lm10 * tm01 + lm20 * tm02 + ox * m03);
dest._m01(lm01 * tm00 + lm11 * tm01 + lm21 * tm02 + oy * m03);
dest._m02(lm02 * tm00 + lm12 * tm01 + lm22 * tm02 + oz * m03);
dest._m03(m03);
dest._m10(lm00 * tm10 + lm10 * tm11 + lm20 * tm12 + ox * m13);
dest._m11(lm01 * tm10 + lm11 * tm11 + lm21 * tm12 + oy * m13);
dest._m12(lm02 * tm10 + lm12 * tm11 + lm22 * tm12 + oz * m13);
dest._m13(m13);
dest._m20(lm00 * tm20 + lm10 * tm21 + lm20 * tm22 + ox * m23);
dest._m21(lm01 * tm20 + lm11 * tm21 + lm21 * tm22 + oy * m23);
dest._m22(lm02 * tm20 + lm12 * tm21 + lm22 * tm22 + oz * m23);
dest._m23(m23);
dest._m30(lm00 * tm30 + lm10 * tm31 + lm20 * tm32 + ox * m33);
dest._m31(lm01 * tm30 + lm11 * tm31 + lm21 * tm32 + oy * m33);
dest._m32(lm02 * tm30 + lm12 * tm31 + lm22 * tm32 + oz * m33);
dest._m33(m33);
dest._properties(properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION));
return dest;
} | [
"public",
"Matrix4f",
"rotateAroundLocal",
"(",
"Quaternionfc",
"quat",
",",
"float",
"ox",
",",
"float",
"oy",
",",
"float",
"oz",
",",
"Matrix4f",
"dest",
")",
"{",
"float",
"w2",
"=",
"quat",
".",
"w",
"(",
")",
"*",
"quat",
".",
"w",
"(",
")",
... | /* (non-Javadoc)
@see org.joml.Matrix4fc#rotateAroundLocal(org.joml.Quaternionfc, float, float, float, org.joml.Matrix4f) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L11484-L11534 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ProjectApi.java | ProjectApi.deleteVariable | public void deleteVariable(Object projectIdOrPath, String key) throws GitLabApiException {
delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "variables", key);
} | java | public void deleteVariable(Object projectIdOrPath, String key) throws GitLabApiException {
delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "variables", key);
} | [
"public",
"void",
"deleteVariable",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"key",
")",
"throws",
"GitLabApiException",
"{",
"delete",
"(",
"Response",
".",
"Status",
".",
"NO_CONTENT",
",",
"null",
",",
"\"projects\"",
",",
"getProjectIdOrPath",
"(",
"... | Deletes a project variable.
<pre><code>DELETE /projects/:id/variables/:key</code></pre>
@param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
@param key the key of an existing variable, required
@throws GitLabApiException if any exception occurs | [
"Deletes",
"a",
"project",
"variable",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L2580-L2582 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br/br_disable.java | br_disable.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_disable_responses result = (br_disable_responses) service.get_payload_formatter().string_to_resource(br_disable_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_disable_response_array);
}
br_disable[] result_br_disable = new br_disable[result.br_disable_response_array.length];
for(int i = 0; i < result.br_disable_response_array.length; i++)
{
result_br_disable[i] = result.br_disable_response_array[i].br_disable[0];
}
return result_br_disable;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_disable_responses result = (br_disable_responses) service.get_payload_formatter().string_to_resource(br_disable_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_disable_response_array);
}
br_disable[] result_br_disable = new br_disable[result.br_disable_response_array.length];
for(int i = 0; i < result.br_disable_response_array.length; i++)
{
result_br_disable[i] = result.br_disable_response_array[i].br_disable[0];
}
return result_br_disable;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"br_disable_responses",
"result",
"=",
"(",
"br_disable_responses",
")",
"service",
".",
"get_payload_formatte... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_disable.java#L136-L153 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/vod/VodClient.java | VodClient.generateMediaPlayerCode | public GenerateMediaPlayerCodeResponse generateMediaPlayerCode(GenerateMediaPlayerCodeRequest request) {
checkStringNotEmpty(request.getMediaId(), "Media ID should not be null or empty!");
checkIsTrue(request.getHeight() > 0, "Height of playback view should be positive!");
checkIsTrue(request.getWidth() > 0, "Width of playback view should be positive!");
InternalRequest internalRequest =
createRequest(HttpMethodName.GET, request, PATH_MEDIA, request.getMediaId(), PARA_GENCODE);
internalRequest.addParameter(PARA_WIDTH, Integer.toString(request.getWidth()));
internalRequest.addParameter(PARA_HEIGHT, Integer.toString(request.getHeight()));
internalRequest.addParameter(PARA_AUTO_START_NEW, Boolean.toString(request.isAutoStart()));
internalRequest.addParameter(PARA_AK, config.getCredentials().getAccessKeyId());
internalRequest.addParameter(PARAM_TRANSCODING_PRESET_NAME, request.getTranscodingPresetName());
return invokeHttpClient(internalRequest, GenerateMediaPlayerCodeResponse.class);
} | java | public GenerateMediaPlayerCodeResponse generateMediaPlayerCode(GenerateMediaPlayerCodeRequest request) {
checkStringNotEmpty(request.getMediaId(), "Media ID should not be null or empty!");
checkIsTrue(request.getHeight() > 0, "Height of playback view should be positive!");
checkIsTrue(request.getWidth() > 0, "Width of playback view should be positive!");
InternalRequest internalRequest =
createRequest(HttpMethodName.GET, request, PATH_MEDIA, request.getMediaId(), PARA_GENCODE);
internalRequest.addParameter(PARA_WIDTH, Integer.toString(request.getWidth()));
internalRequest.addParameter(PARA_HEIGHT, Integer.toString(request.getHeight()));
internalRequest.addParameter(PARA_AUTO_START_NEW, Boolean.toString(request.isAutoStart()));
internalRequest.addParameter(PARA_AK, config.getCredentials().getAccessKeyId());
internalRequest.addParameter(PARAM_TRANSCODING_PRESET_NAME, request.getTranscodingPresetName());
return invokeHttpClient(internalRequest, GenerateMediaPlayerCodeResponse.class);
} | [
"public",
"GenerateMediaPlayerCodeResponse",
"generateMediaPlayerCode",
"(",
"GenerateMediaPlayerCodeRequest",
"request",
")",
"{",
"checkStringNotEmpty",
"(",
"request",
".",
"getMediaId",
"(",
")",
",",
"\"Media ID should not be null or empty!\"",
")",
";",
"checkIsTrue",
"... | Get the HTML5 code snippet (encoded in Base64) to play the specific media resource.
@param request The request object containing all the options on how to
@return The Flash and HTML5 code snippet | [
"Get",
"the",
"HTML5",
"code",
"snippet",
"(",
"encoded",
"in",
"Base64",
")",
"to",
"play",
"the",
"specific",
"media",
"resource",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L803-L818 |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ccy/DefaultCurrencyCalculatorConfig.java | DefaultCurrencyCalculatorConfig.setWorkingWeeks | public void setWorkingWeeks(final Map<String, WorkingWeek> workingWeeks) {
final Map<String, WorkingWeek> ww = new HashMap<>();
ww.putAll(workingWeeks);
this.workingWeeks = ww;
} | java | public void setWorkingWeeks(final Map<String, WorkingWeek> workingWeeks) {
final Map<String, WorkingWeek> ww = new HashMap<>();
ww.putAll(workingWeeks);
this.workingWeeks = ww;
} | [
"public",
"void",
"setWorkingWeeks",
"(",
"final",
"Map",
"<",
"String",
",",
"WorkingWeek",
">",
"workingWeeks",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"WorkingWeek",
">",
"ww",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"ww",
".",
"putAll",
"... | Will take a copy of a non null map but doing so by replacing the internal one in one go for consistency. | [
"Will",
"take",
"a",
"copy",
"of",
"a",
"non",
"null",
"map",
"but",
"doing",
"so",
"by",
"replacing",
"the",
"internal",
"one",
"in",
"one",
"go",
"for",
"consistency",
"."
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ccy/DefaultCurrencyCalculatorConfig.java#L57-L61 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java | PersistenceBrokerImpl.deleteReferences | private void deleteReferences(ClassDescriptor cld, Object obj, Identity oid, boolean ignoreReferences) throws PersistenceBrokerException
{
List listRds = cld.getObjectReferenceDescriptors();
// get all members of obj that are references and delete them
Iterator i = listRds.iterator();
while (i.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
if ((!ignoreReferences && rds.getCascadingDelete() == ObjectReferenceDescriptor.CASCADE_OBJECT)
|| rds.isSuperReferenceDescriptor())
{
Object referencedObject = rds.getPersistentField().get(obj);
if (referencedObject != null)
{
if(rds.isSuperReferenceDescriptor())
{
ClassDescriptor base = cld.getSuperClassDescriptor();
/*
arminw: If "table-per-subclass" inheritance is used we have to
guarantee that all super-class table entries are deleted too.
Thus we have to perform the recursive deletion of all super-class
table entries.
*/
performDeletion(base, referencedObject, oid, ignoreReferences);
}
else
{
doDelete(referencedObject, ignoreReferences);
}
}
}
}
} | java | private void deleteReferences(ClassDescriptor cld, Object obj, Identity oid, boolean ignoreReferences) throws PersistenceBrokerException
{
List listRds = cld.getObjectReferenceDescriptors();
// get all members of obj that are references and delete them
Iterator i = listRds.iterator();
while (i.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
if ((!ignoreReferences && rds.getCascadingDelete() == ObjectReferenceDescriptor.CASCADE_OBJECT)
|| rds.isSuperReferenceDescriptor())
{
Object referencedObject = rds.getPersistentField().get(obj);
if (referencedObject != null)
{
if(rds.isSuperReferenceDescriptor())
{
ClassDescriptor base = cld.getSuperClassDescriptor();
/*
arminw: If "table-per-subclass" inheritance is used we have to
guarantee that all super-class table entries are deleted too.
Thus we have to perform the recursive deletion of all super-class
table entries.
*/
performDeletion(base, referencedObject, oid, ignoreReferences);
}
else
{
doDelete(referencedObject, ignoreReferences);
}
}
}
}
} | [
"private",
"void",
"deleteReferences",
"(",
"ClassDescriptor",
"cld",
",",
"Object",
"obj",
",",
"Identity",
"oid",
",",
"boolean",
"ignoreReferences",
")",
"throws",
"PersistenceBrokerException",
"{",
"List",
"listRds",
"=",
"cld",
".",
"getObjectReferenceDescriptors... | Deletes references that <b>obj</b> points to.
All objects which we have a FK poiting to (Via ReferenceDescriptors)
will be deleted if auto-delete is true <b>AND</b>
the member field containing the object reference is NOT null.
@param obj Object which we will delete references for
@param listRds list of ObjectRederenceDescriptors
@param ignoreReferences With this flag the automatic deletion/unlinking
of references can be suppressed (independent of the used auto-delete setting in metadata),
except {@link org.apache.ojb.broker.metadata.SuperReferenceDescriptor}
these kind of reference (descriptor) will always be performed.
@throws PersistenceBrokerException if some goes wrong - please see the error message for details | [
"Deletes",
"references",
"that",
"<b",
">",
"obj<",
"/",
"b",
">",
"points",
"to",
".",
"All",
"objects",
"which",
"we",
"have",
"a",
"FK",
"poiting",
"to",
"(",
"Via",
"ReferenceDescriptors",
")",
"will",
"be",
"deleted",
"if",
"auto",
"-",
"delete",
... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L712-L744 |
petergeneric/stdlib | guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/webquery/impl/jpa/JPAQueryBuilder.java | JPAQueryBuilder.getOrCreateJoin | @Override
public JPAJoin getOrCreateJoin(final WQPath path)
{
if (path == null)
return new JPAJoin(criteriaBuilder, entity, root, false);
if (!joins.containsKey(path.getPath()))
{
final JPAJoin parent = getOrCreateJoin(path.getTail());
final JPAJoin join = parent.join(path.getHead().getPath());
joins.put(path.getPath(), join);
return join;
}
else
{
return joins.get(path.getPath());
}
} | java | @Override
public JPAJoin getOrCreateJoin(final WQPath path)
{
if (path == null)
return new JPAJoin(criteriaBuilder, entity, root, false);
if (!joins.containsKey(path.getPath()))
{
final JPAJoin parent = getOrCreateJoin(path.getTail());
final JPAJoin join = parent.join(path.getHead().getPath());
joins.put(path.getPath(), join);
return join;
}
else
{
return joins.get(path.getPath());
}
} | [
"@",
"Override",
"public",
"JPAJoin",
"getOrCreateJoin",
"(",
"final",
"WQPath",
"path",
")",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"return",
"new",
"JPAJoin",
"(",
"criteriaBuilder",
",",
"entity",
",",
"root",
",",
"false",
")",
";",
"if",
"(",
... | Ensure a join has been set up for a path
@param path
@return | [
"Ensure",
"a",
"join",
"has",
"been",
"set",
"up",
"for",
"a",
"path"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/webquery/impl/jpa/JPAQueryBuilder.java#L196-L216 |
zackpollard/JavaTelegramBot-API | core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java | TelegramBot.kickChatMember | public boolean kickChatMember(String chatId, int userId) {
HttpResponse<String> response;
JSONObject jsonResponse;
try {
MultipartBody request = Unirest.post(getBotAPIUrl() + "kickChatMember")
.field("chat_id", chatId, "application/json; charset=utf8;")
.field("user_id", userId);
response = request.asString();
jsonResponse = Utils.processResponse(response);
if(jsonResponse != null) {
if(jsonResponse.getBoolean("result")) return true;
}
} catch (UnirestException e) {
e.printStackTrace();
}
return false;
} | java | public boolean kickChatMember(String chatId, int userId) {
HttpResponse<String> response;
JSONObject jsonResponse;
try {
MultipartBody request = Unirest.post(getBotAPIUrl() + "kickChatMember")
.field("chat_id", chatId, "application/json; charset=utf8;")
.field("user_id", userId);
response = request.asString();
jsonResponse = Utils.processResponse(response);
if(jsonResponse != null) {
if(jsonResponse.getBoolean("result")) return true;
}
} catch (UnirestException e) {
e.printStackTrace();
}
return false;
} | [
"public",
"boolean",
"kickChatMember",
"(",
"String",
"chatId",
",",
"int",
"userId",
")",
"{",
"HttpResponse",
"<",
"String",
">",
"response",
";",
"JSONObject",
"jsonResponse",
";",
"try",
"{",
"MultipartBody",
"request",
"=",
"Unirest",
".",
"post",
"(",
... | Use this method to kick a user from a group or a supergroup. In the case of supergroups, the user will not be
able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be
an administrator in the group for this to work
@param chatId The ID of the chat that you want to kick the user from
@param userId The ID of the user that you want to kick from the chat
@return True if the user was kicked successfully, otherwise False | [
"Use",
"this",
"method",
"to",
"kick",
"a",
"user",
"from",
"a",
"group",
"or",
"a",
"supergroup",
".",
"In",
"the",
"case",
"of",
"supergroups",
"the",
"user",
"will",
"not",
"be",
"able",
"to",
"return",
"to",
"the",
"group",
"on",
"their",
"own",
... | train | https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java#L1036-L1058 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java | PvmExecutionImpl.delayEvent | public void delayEvent(PvmExecutionImpl targetScope, VariableEvent variableEvent) {
DelayedVariableEvent delayedVariableEvent = new DelayedVariableEvent(targetScope, variableEvent);
delayEvent(delayedVariableEvent);
} | java | public void delayEvent(PvmExecutionImpl targetScope, VariableEvent variableEvent) {
DelayedVariableEvent delayedVariableEvent = new DelayedVariableEvent(targetScope, variableEvent);
delayEvent(delayedVariableEvent);
} | [
"public",
"void",
"delayEvent",
"(",
"PvmExecutionImpl",
"targetScope",
",",
"VariableEvent",
"variableEvent",
")",
"{",
"DelayedVariableEvent",
"delayedVariableEvent",
"=",
"new",
"DelayedVariableEvent",
"(",
"targetScope",
",",
"variableEvent",
")",
";",
"delayEvent",
... | Delays a given variable event with the given target scope.
@param targetScope the target scope of the variable event
@param variableEvent the variable event which should be delayed | [
"Delays",
"a",
"given",
"variable",
"event",
"with",
"the",
"given",
"target",
"scope",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java#L1866-L1869 |
OpenLiberty/open-liberty | dev/com.ibm.ws.management.j2ee.mejb/src/com/ibm/ws/management/j2ee/mejb/ManagementEJB.java | ManagementEJB.getAttributes | public AttributeList getAttributes(ObjectName name, String[] attributes)
throws InstanceNotFoundException, ReflectionException {
AttributeList a = getMBeanServer().getAttributes(name, attributes);
return a;
} | java | public AttributeList getAttributes(ObjectName name, String[] attributes)
throws InstanceNotFoundException, ReflectionException {
AttributeList a = getMBeanServer().getAttributes(name, attributes);
return a;
} | [
"public",
"AttributeList",
"getAttributes",
"(",
"ObjectName",
"name",
",",
"String",
"[",
"]",
"attributes",
")",
"throws",
"InstanceNotFoundException",
",",
"ReflectionException",
"{",
"AttributeList",
"a",
"=",
"getMBeanServer",
"(",
")",
".",
"getAttributes",
"(... | /*
Gets the values of several attributes of a named managed object. The
managed object is identified by its object name.
Throws:
javax.management.InstanceNotFoundException
javax.management.ReflectionException
java.rmi.RemoteException
Parameters:
name - The object name of the managed object from which the
attributes are retrieved.
attributes - A list of the attributes to be retrieved.
Returns:
An instance of javax.management.AttributeList which contains a list of
the retrieved attributes as javax.management.Attribute instances. | [
"/",
"*",
"Gets",
"the",
"values",
"of",
"several",
"attributes",
"of",
"a",
"named",
"managed",
"object",
".",
"The",
"managed",
"object",
"is",
"identified",
"by",
"its",
"object",
"name",
".",
"Throws",
":",
"javax",
".",
"management",
".",
"InstanceNot... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.management.j2ee.mejb/src/com/ibm/ws/management/j2ee/mejb/ManagementEJB.java#L195-L201 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java | UCharacter.toUpperCase | public static String toUpperCase(ULocale locale, String str) {
return toUpperCase(getCaseLocale(locale), str);
} | java | public static String toUpperCase(ULocale locale, String str) {
return toUpperCase(getCaseLocale(locale), str);
} | [
"public",
"static",
"String",
"toUpperCase",
"(",
"ULocale",
"locale",
",",
"String",
"str",
")",
"{",
"return",
"toUpperCase",
"(",
"getCaseLocale",
"(",
"locale",
")",
",",
"str",
")",
";",
"}"
] | Returns the uppercase version of the argument string.
Casing is dependent on the argument locale and context-sensitive.
@param locale which string is to be converted in
@param str source string to be performed on
@return uppercase version of the argument string | [
"Returns",
"the",
"uppercase",
"version",
"of",
"the",
"argument",
"string",
".",
"Casing",
"is",
"dependent",
"on",
"the",
"argument",
"locale",
"and",
"context",
"-",
"sensitive",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L4421-L4423 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/ContainerMetadataUpdateTransaction.java | ContainerMetadataUpdateTransaction.getSegmentUpdateTransaction | private SegmentMetadataUpdateTransaction getSegmentUpdateTransaction(long segmentId) throws MetadataUpdateException {
SegmentMetadataUpdateTransaction tsm = tryGetSegmentUpdateTransaction(segmentId);
if (tsm == null) {
throw new MetadataUpdateException(this.containerId, String.format("No metadata entry exists for Segment Id %d.", segmentId));
}
return tsm;
} | java | private SegmentMetadataUpdateTransaction getSegmentUpdateTransaction(long segmentId) throws MetadataUpdateException {
SegmentMetadataUpdateTransaction tsm = tryGetSegmentUpdateTransaction(segmentId);
if (tsm == null) {
throw new MetadataUpdateException(this.containerId, String.format("No metadata entry exists for Segment Id %d.", segmentId));
}
return tsm;
} | [
"private",
"SegmentMetadataUpdateTransaction",
"getSegmentUpdateTransaction",
"(",
"long",
"segmentId",
")",
"throws",
"MetadataUpdateException",
"{",
"SegmentMetadataUpdateTransaction",
"tsm",
"=",
"tryGetSegmentUpdateTransaction",
"(",
"segmentId",
")",
";",
"if",
"(",
"tsm... | Gets all pending changes for the given Segment.
@param segmentId The Id of the Segment to query.
@throws MetadataUpdateException If no metadata entry exists for the given Segment Id. | [
"Gets",
"all",
"pending",
"changes",
"for",
"the",
"given",
"Segment",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/ContainerMetadataUpdateTransaction.java#L512-L519 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/model/ApplicationTemplateDescriptor.java | ApplicationTemplateDescriptor.getLegacyProperty | static String getLegacyProperty( Properties props, String property, String defaultValue ) {
String result = props.getProperty( property, null );
if( result == null )
result = props.getProperty( LEGACY_PREFIX + property, defaultValue );
return result;
} | java | static String getLegacyProperty( Properties props, String property, String defaultValue ) {
String result = props.getProperty( property, null );
if( result == null )
result = props.getProperty( LEGACY_PREFIX + property, defaultValue );
return result;
} | [
"static",
"String",
"getLegacyProperty",
"(",
"Properties",
"props",
",",
"String",
"property",
",",
"String",
"defaultValue",
")",
"{",
"String",
"result",
"=",
"props",
".",
"getProperty",
"(",
"property",
",",
"null",
")",
";",
"if",
"(",
"result",
"==",
... | Gets a property value while supporting legacy ones.
@param props non-null properties
@param property a non-null property name (not legacy)
@param defaultValue the default value if the property is not found
@return a non-null string if the property was found, the default value otherwise | [
"Gets",
"a",
"property",
"value",
"while",
"supporting",
"legacy",
"ones",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/ApplicationTemplateDescriptor.java#L315-L322 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/MessageUtils.java | MessageUtils.substituteParams | public static String substituteParams(Locale locale, String msgtext, Object params[])
{
String localizedStr = null;
if(params == null || msgtext == null)
{
return msgtext;
}
if(locale != null)
{
MessageFormat mf = new MessageFormat(msgtext,locale);
localizedStr = mf.format(params);
}
return localizedStr;
} | java | public static String substituteParams(Locale locale, String msgtext, Object params[])
{
String localizedStr = null;
if(params == null || msgtext == null)
{
return msgtext;
}
if(locale != null)
{
MessageFormat mf = new MessageFormat(msgtext,locale);
localizedStr = mf.format(params);
}
return localizedStr;
} | [
"public",
"static",
"String",
"substituteParams",
"(",
"Locale",
"locale",
",",
"String",
"msgtext",
",",
"Object",
"params",
"[",
"]",
")",
"{",
"String",
"localizedStr",
"=",
"null",
";",
"if",
"(",
"params",
"==",
"null",
"||",
"msgtext",
"==",
"null",
... | Uses <code>MessageFormat</code> and the supplied parameters to fill in the param placeholders in the String.
@param locale The <code>Locale</code> to use when performing the substitution.
@param msgtext The original parameterized String.
@param params The params to fill in the String with.
@return The updated String. | [
"Uses",
"<code",
">",
"MessageFormat<",
"/",
"code",
">",
"and",
"the",
"supplied",
"parameters",
"to",
"fill",
"in",
"the",
"param",
"placeholders",
"in",
"the",
"String",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/MessageUtils.java#L228-L242 |
VoltDB/voltdb | src/frontend/org/voltdb/exportclient/ExportEncoder.java | ExportEncoder.encodeDecimal | static public void encodeDecimal(final FastSerializer fs, BigDecimal value)
throws IOException {
fs.write((byte)VoltDecimalHelper.kDefaultScale);
fs.write((byte)16);
fs.write(VoltDecimalHelper.serializeBigDecimal(value));
} | java | static public void encodeDecimal(final FastSerializer fs, BigDecimal value)
throws IOException {
fs.write((byte)VoltDecimalHelper.kDefaultScale);
fs.write((byte)16);
fs.write(VoltDecimalHelper.serializeBigDecimal(value));
} | [
"static",
"public",
"void",
"encodeDecimal",
"(",
"final",
"FastSerializer",
"fs",
",",
"BigDecimal",
"value",
")",
"throws",
"IOException",
"{",
"fs",
".",
"write",
"(",
"(",
"byte",
")",
"VoltDecimalHelper",
".",
"kDefaultScale",
")",
";",
"fs",
".",
"writ... | Read a decimal according to the Export encoding specification.
@param fds
Fastdeserializer containing Export stream data
@return decoded BigDecimal value
@throws IOException | [
"Read",
"a",
"decimal",
"according",
"to",
"the",
"Export",
"encoding",
"specification",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/exportclient/ExportEncoder.java#L222-L227 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java | SequenceTools.permuteCyclic | public static <T> void permuteCyclic(T[] array, T[] fill, int n) {
if (array.length != fill.length) throw new IllegalArgumentException("Lengths do not match");
if (n < 0) n = array.length + n;
while (n > array.length) {
n -= array.length;
}
for (int i = 0; i < array.length; i++) {
if (i + n < array.length) {
fill[i] = array[i + n];
} else {
fill[i] = array[i - array.length + n];
}
}
} | java | public static <T> void permuteCyclic(T[] array, T[] fill, int n) {
if (array.length != fill.length) throw new IllegalArgumentException("Lengths do not match");
if (n < 0) n = array.length + n;
while (n > array.length) {
n -= array.length;
}
for (int i = 0; i < array.length; i++) {
if (i + n < array.length) {
fill[i] = array[i + n];
} else {
fill[i] = array[i - array.length + n];
}
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"permuteCyclic",
"(",
"T",
"[",
"]",
"array",
",",
"T",
"[",
"]",
"fill",
",",
"int",
"n",
")",
"{",
"if",
"(",
"array",
".",
"length",
"!=",
"fill",
".",
"length",
")",
"throw",
"new",
"IllegalArgumentExc... | Cyclically permute {@code array} <em>forward</em> by {@code n} elements.
@param array The original result; will not be changed
@param fill The permuted result will be filled into this array
@param n The number of elements to permute by; can be positive or negative; values greater than the length of the array are acceptable | [
"Cyclically",
"permute",
"{"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java#L59-L72 |
fcrepo3/fcrepo | fcrepo-common/src/main/java/org/fcrepo/utilities/xml/DOM.java | DOM.selectNode | public static Node selectNode(Node dom, String xpath) {
return selector.selectNode(dom, xpath);
} | java | public static Node selectNode(Node dom, String xpath) {
return selector.selectNode(dom, xpath);
} | [
"public",
"static",
"Node",
"selectNode",
"(",
"Node",
"dom",
",",
"String",
"xpath",
")",
"{",
"return",
"selector",
".",
"selectNode",
"(",
"dom",
",",
"xpath",
")",
";",
"}"
] | <p>Select the Node with the given XPath.
</p><p>
Note: This is a convenience method that logs exceptions instead of
throwing them.
</p>
@param dom the root document.
@param xpath the xpath for the node.
@return the Node or null if unattainable. | [
"<p",
">",
"Select",
"the",
"Node",
"with",
"the",
"given",
"XPath",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Note",
":",
"This",
"is",
"a",
"convenience",
"method",
"that",
"logs",
"exceptions",
"instead",
"of",
"throwing",
"them",
".",
"<",
"/",
"p",
... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/utilities/xml/DOM.java#L350-L352 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/tm/tmformssoaction.java | tmformssoaction.get | public static tmformssoaction get(nitro_service service, String name) throws Exception{
tmformssoaction obj = new tmformssoaction();
obj.set_name(name);
tmformssoaction response = (tmformssoaction) obj.get_resource(service);
return response;
} | java | public static tmformssoaction get(nitro_service service, String name) throws Exception{
tmformssoaction obj = new tmformssoaction();
obj.set_name(name);
tmformssoaction response = (tmformssoaction) obj.get_resource(service);
return response;
} | [
"public",
"static",
"tmformssoaction",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"tmformssoaction",
"obj",
"=",
"new",
"tmformssoaction",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"tmf... | Use this API to fetch tmformssoaction resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"tmformssoaction",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/tm/tmformssoaction.java#L452-L457 |
amplexus/java-flac-encoder | src/main/java/net/sourceforge/javaflacencoder/MetadataBlockHeader.java | MetadataBlockHeader.getMetadataBlockHeader | public static EncodedElement getMetadataBlockHeader(boolean lastBlock,
MetadataBlockType type, int length) {
EncodedElement ele = new EncodedElement(4, 0);
int encodedLastBlock = (lastBlock) ? 1:0;
ele.addInt(encodedLastBlock, 1);
int encodedType = 0;
MetadataBlockType[] vals = MetadataBlockType.values();
for(int i = 0; i < vals.length; i++) {
if(vals[i] == type) {
encodedType = i;
break;
}
}
ele.addInt(encodedType, 7);
ele.addInt(length, 24);
return ele;
} | java | public static EncodedElement getMetadataBlockHeader(boolean lastBlock,
MetadataBlockType type, int length) {
EncodedElement ele = new EncodedElement(4, 0);
int encodedLastBlock = (lastBlock) ? 1:0;
ele.addInt(encodedLastBlock, 1);
int encodedType = 0;
MetadataBlockType[] vals = MetadataBlockType.values();
for(int i = 0; i < vals.length; i++) {
if(vals[i] == type) {
encodedType = i;
break;
}
}
ele.addInt(encodedType, 7);
ele.addInt(length, 24);
return ele;
} | [
"public",
"static",
"EncodedElement",
"getMetadataBlockHeader",
"(",
"boolean",
"lastBlock",
",",
"MetadataBlockType",
"type",
",",
"int",
"length",
")",
"{",
"EncodedElement",
"ele",
"=",
"new",
"EncodedElement",
"(",
"4",
",",
"0",
")",
";",
"int",
"encodedLas... | Create a meta-data block header of the given type, and return the result
in a new EncodedElement(so data is ready to be placed directly in FLAC
stream)
@param lastBlock True if this is the last meta-block in the stream. False
otherwise.
@param type enum indicating which type of block we're creating.
@param length Length of the meta-data block which follows this header.
@return EncodedElement containing the header. | [
"Create",
"a",
"meta",
"-",
"data",
"block",
"header",
"of",
"the",
"given",
"type",
"and",
"return",
"the",
"result",
"in",
"a",
"new",
"EncodedElement",
"(",
"so",
"data",
"is",
"ready",
"to",
"be",
"placed",
"directly",
"in",
"FLAC",
"stream",
")"
] | train | https://github.com/amplexus/java-flac-encoder/blob/3d536b877dee2a3fd4ab2e0d9569e292cae93bc9/src/main/java/net/sourceforge/javaflacencoder/MetadataBlockHeader.java#L78-L95 |
wnameless/rubycollect4j | src/main/java/net/sf/rubycollect4j/RubyObject.java | RubyObject.send | public static <E> E send(Object o, String methodName, Long arg) {
return send(o, methodName, (Object) arg);
} | java | public static <E> E send(Object o, String methodName, Long arg) {
return send(o, methodName, (Object) arg);
} | [
"public",
"static",
"<",
"E",
">",
"E",
"send",
"(",
"Object",
"o",
",",
"String",
"methodName",
",",
"Long",
"arg",
")",
"{",
"return",
"send",
"(",
"o",
",",
"methodName",
",",
"(",
"Object",
")",
"arg",
")",
";",
"}"
] | Executes a method of any Object by Java reflection.
@param o
an Object
@param methodName
name of the method
@param arg
a Long
@return the result of the method called | [
"Executes",
"a",
"method",
"of",
"any",
"Object",
"by",
"Java",
"reflection",
"."
] | train | https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyObject.java#L219-L221 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/redis/Cache.java | Cache.decrBy | public Long decrBy(Object key, long longValue) {
Jedis jedis = getJedis();
try {
return jedis.decrBy(keyToBytes(key), longValue);
}
finally {close(jedis);}
} | java | public Long decrBy(Object key, long longValue) {
Jedis jedis = getJedis();
try {
return jedis.decrBy(keyToBytes(key), longValue);
}
finally {close(jedis);}
} | [
"public",
"Long",
"decrBy",
"(",
"Object",
"key",
",",
"long",
"longValue",
")",
"{",
"Jedis",
"jedis",
"=",
"getJedis",
"(",
")",
";",
"try",
"{",
"return",
"jedis",
".",
"decrBy",
"(",
"keyToBytes",
"(",
"key",
")",
",",
"longValue",
")",
";",
"}",... | 将 key 所储存的值减去减量 decrement 。
如果 key 不存在,那么 key 的值会先被初始化为 0 ,然后再执行 DECRBY 操作。
如果值包含错误的类型,或字符串类型的值不能表示为数字,那么返回一个错误。
本操作的值限制在 64 位(bit)有符号数字表示之内。
关于更多递增(increment) / 递减(decrement)操作的更多信息,请参见 INCR 命令。 | [
"将",
"key",
"所储存的值减去减量",
"decrement",
"。",
"如果",
"key",
"不存在,那么",
"key",
"的值会先被初始化为",
"0",
",然后再执行",
"DECRBY",
"操作。",
"如果值包含错误的类型,或字符串类型的值不能表示为数字,那么返回一个错误。",
"本操作的值限制在",
"64",
"位",
"(",
"bit",
")",
"有符号数字表示之内。",
"关于更多递增",
"(",
"increment",
")",
"/",
"递减",
"(",... | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/redis/Cache.java#L201-L207 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Pipelines.java | Pipelines.watchers | public static Pipeline watchers(Context context, File baseDir, Mojo mojo, boolean pomFileMonitoring) {
return new Pipeline(mojo, baseDir, Watchers.all(context), pomFileMonitoring);
} | java | public static Pipeline watchers(Context context, File baseDir, Mojo mojo, boolean pomFileMonitoring) {
return new Pipeline(mojo, baseDir, Watchers.all(context), pomFileMonitoring);
} | [
"public",
"static",
"Pipeline",
"watchers",
"(",
"Context",
"context",
",",
"File",
"baseDir",
",",
"Mojo",
"mojo",
",",
"boolean",
"pomFileMonitoring",
")",
"{",
"return",
"new",
"Pipeline",
"(",
"mojo",
",",
"baseDir",
",",
"Watchers",
".",
"all",
"(",
"... | Creates a 'watching' pipeline.
@param context the Plexus context
@param baseDir the project's base directory
@param mojo the 'run' mojo
@param pomFileMonitoring flag enabling or disabling the pom file monitoring
@return the created pipeline | [
"Creates",
"a",
"watching",
"pipeline",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/Pipelines.java#L53-L55 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaastimeseries/src/main/java/net/minidev/ovh/api/ApiOvhDbaastimeseries.java | ApiOvhDbaastimeseries.serviceName_token_opentsdb_tokenId_GET | public OvhOpenTSDBToken serviceName_token_opentsdb_tokenId_GET(String serviceName, String tokenId) throws IOException {
String qPath = "/dbaas/timeseries/{serviceName}/token/opentsdb/{tokenId}";
StringBuilder sb = path(qPath, serviceName, tokenId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOpenTSDBToken.class);
} | java | public OvhOpenTSDBToken serviceName_token_opentsdb_tokenId_GET(String serviceName, String tokenId) throws IOException {
String qPath = "/dbaas/timeseries/{serviceName}/token/opentsdb/{tokenId}";
StringBuilder sb = path(qPath, serviceName, tokenId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOpenTSDBToken.class);
} | [
"public",
"OvhOpenTSDBToken",
"serviceName_token_opentsdb_tokenId_GET",
"(",
"String",
"serviceName",
",",
"String",
"tokenId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/timeseries/{serviceName}/token/opentsdb/{tokenId}\"",
";",
"StringBuilder",
"sb",... | Get a OpenTSDB token
REST: GET /dbaas/timeseries/{serviceName}/token/opentsdb/{tokenId}
@param serviceName [required] Service Name
@param tokenId [required] token id
API beta | [
"Get",
"a",
"OpenTSDB",
"token"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaastimeseries/src/main/java/net/minidev/ovh/api/ApiOvhDbaastimeseries.java#L101-L106 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java | Query.startAfter | public Query startAfter(Object... fieldValues) {
QueryOptions newOptions = new QueryOptions(options);
newOptions.startCursor = createCursor(newOptions.fieldOrders, fieldValues, false);
return new Query(firestore, path, newOptions);
} | java | public Query startAfter(Object... fieldValues) {
QueryOptions newOptions = new QueryOptions(options);
newOptions.startCursor = createCursor(newOptions.fieldOrders, fieldValues, false);
return new Query(firestore, path, newOptions);
} | [
"public",
"Query",
"startAfter",
"(",
"Object",
"...",
"fieldValues",
")",
"{",
"QueryOptions",
"newOptions",
"=",
"new",
"QueryOptions",
"(",
"options",
")",
";",
"newOptions",
".",
"startCursor",
"=",
"createCursor",
"(",
"newOptions",
".",
"fieldOrders",
",",... | Creates and returns a new Query that starts after the provided fields relative to the order of
the query. The order of the field values must match the order of the order by clauses of the
query.
@param fieldValues The field values to start this query after, in order of the query's order
by.
@return The created Query. | [
"Creates",
"and",
"returns",
"a",
"new",
"Query",
"that",
"starts",
"after",
"the",
"provided",
"fields",
"relative",
"to",
"the",
"order",
"of",
"the",
"query",
".",
"The",
"order",
"of",
"the",
"field",
"values",
"must",
"match",
"the",
"order",
"of",
... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L798-L802 |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java | MapWithProtoValuesSubject.ignoringFieldScopeForValues | public MapWithProtoValuesFluentAssertion<M> ignoringFieldScopeForValues(FieldScope fieldScope) {
return usingConfig(config.ignoringFieldScope(checkNotNull(fieldScope, "fieldScope")));
} | java | public MapWithProtoValuesFluentAssertion<M> ignoringFieldScopeForValues(FieldScope fieldScope) {
return usingConfig(config.ignoringFieldScope(checkNotNull(fieldScope, "fieldScope")));
} | [
"public",
"MapWithProtoValuesFluentAssertion",
"<",
"M",
">",
"ignoringFieldScopeForValues",
"(",
"FieldScope",
"fieldScope",
")",
"{",
"return",
"usingConfig",
"(",
"config",
".",
"ignoringFieldScope",
"(",
"checkNotNull",
"(",
"fieldScope",
",",
"\"fieldScope\"",
")",... | Excludes all specific field paths under the argument {@link FieldScope} from the comparison.
<p>This method is additive and has well-defined ordering semantics. If the invoking {@link
ProtoFluentAssertion} is already scoped to a {@link FieldScope} {@code X}, and this method is
invoked with {@link FieldScope} {@code Y}, the resultant {@link ProtoFluentAssertion} is
constrained to the subtraction of {@code X - Y}.
<p>By default, {@link ProtoFluentAssertion} is constrained to {@link FieldScopes#all()}, that
is, no fields are excluded from comparison. | [
"Excludes",
"all",
"specific",
"field",
"paths",
"under",
"the",
"argument",
"{",
"@link",
"FieldScope",
"}",
"from",
"the",
"comparison",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java#L719-L721 |
microfocus-idol/java-configuration-impl | src/main/java/com/hp/autonomy/frontend/configuration/ConfigurationUtils.java | ConfigurationUtils.basicValidate | public static <F extends ConfigurationComponent<F>> void basicValidate(final F component, final String section) throws ConfigException {
final Optional<F> maybeComponent = Optional.ofNullable(component);
if (maybeComponent.isPresent()) {
maybeComponent.get().basicValidate(section);
}
} | java | public static <F extends ConfigurationComponent<F>> void basicValidate(final F component, final String section) throws ConfigException {
final Optional<F> maybeComponent = Optional.ofNullable(component);
if (maybeComponent.isPresent()) {
maybeComponent.get().basicValidate(section);
}
} | [
"public",
"static",
"<",
"F",
"extends",
"ConfigurationComponent",
"<",
"F",
">",
">",
"void",
"basicValidate",
"(",
"final",
"F",
"component",
",",
"final",
"String",
"section",
")",
"throws",
"ConfigException",
"{",
"final",
"Optional",
"<",
"F",
">",
"may... | Calls {@link ConfigurationComponent#basicValidate(String)} on the supplied component if not null
@param component the nullable component
@param section the configuration section
@param <F> the component type
@throws ConfigException validation failure | [
"Calls",
"{",
"@link",
"ConfigurationComponent#basicValidate",
"(",
"String",
")",
"}",
"on",
"the",
"supplied",
"component",
"if",
"not",
"null"
] | train | https://github.com/microfocus-idol/java-configuration-impl/blob/cd9d744cacfaaae3c76cacc211e65742bbc7b00a/src/main/java/com/hp/autonomy/frontend/configuration/ConfigurationUtils.java#L84-L89 |
javagl/Common | src/main/java/de/javagl/common/collections/Maps.java | Maps.addToList | public static <K, E> void addToList(Map<K, List<E>> map, K k, E e)
{
getList(map, k).add(e);
} | java | public static <K, E> void addToList(Map<K, List<E>> map, K k, E e)
{
getList(map, k).add(e);
} | [
"public",
"static",
"<",
"K",
",",
"E",
">",
"void",
"addToList",
"(",
"Map",
"<",
"K",
",",
"List",
"<",
"E",
">",
">",
"map",
",",
"K",
"k",
",",
"E",
"e",
")",
"{",
"getList",
"(",
"map",
",",
"k",
")",
".",
"add",
"(",
"e",
")",
";",
... | Adds the given element to the list that is stored under the
given key. If the list does not yet exist, it is created and
inserted into the map.
@param <K> The key type
@param <E> The element type
@param map The map
@param k The key
@param e The element | [
"Adds",
"the",
"given",
"element",
"to",
"the",
"list",
"that",
"is",
"stored",
"under",
"the",
"given",
"key",
".",
"If",
"the",
"list",
"does",
"not",
"yet",
"exist",
"it",
"is",
"created",
"and",
"inserted",
"into",
"the",
"map",
"."
] | train | https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/collections/Maps.java#L112-L115 |
structr/structr | structr-ui/src/main/java/org/structr/web/common/FileHelper.java | FileHelper.createFile | public static <T extends File> T createFile(final SecurityContext securityContext, final byte[] fileData, final String contentType, final Class<T> t)
throws FrameworkException, IOException {
return createFile(securityContext, fileData, contentType, t, null, true);
} | java | public static <T extends File> T createFile(final SecurityContext securityContext, final byte[] fileData, final String contentType, final Class<T> t)
throws FrameworkException, IOException {
return createFile(securityContext, fileData, contentType, t, null, true);
} | [
"public",
"static",
"<",
"T",
"extends",
"File",
">",
"T",
"createFile",
"(",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"byte",
"[",
"]",
"fileData",
",",
"final",
"String",
"contentType",
",",
"final",
"Class",
"<",
"T",
">",
"t",
")",
... | Create a new file node from the given byte array
@param <T>
@param securityContext
@param fileData
@param contentType
@param t defaults to File.class if null
@return file
@throws FrameworkException
@throws IOException | [
"Create",
"a",
"new",
"file",
"node",
"from",
"the",
"given",
"byte",
"array"
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L239-L244 |
mygreen/excel-cellformatter | src/main/java/com/github/mygreen/cellformatter/lang/ExcelDateUtils.java | ExcelDateUtils.convertJavaDate | public static Date convertJavaDate(final double numValue, final boolean startDate1904) {
double utcDay;
if(startDate1904) {
// 1904年始まりの場合
// UTC(1970年基準に戻す)
utcDay = numValue + OFFSET_DAYS_1904;
} else {
// 1900年始まりの場合
// UTC(1970年基準に戻す)
utcDay = numValue + OFFSET_DAYS_1900;
/*
* 1900年3月1日(Excel上は1900年2月29日)以降の場合の補正。
* ・Excel上は1900年は、閏年扱いで1900年2月29日の閏年が存在する。
* ・しかし、グレゴリオ歴上は1900年は閏年ではないため、UTCの表現上から見ると1日多い。
* ・1900年2月29日は、1900年1月0日から数えて61日目なので、61日以降は、1日前に戻す。
*/
if(numValue >= NON_LEAP_DAY) {
utcDay -= 1;
}
}
/*
* Javaのミリ秒に直す。
* ・Excelの日付の形式の場合小数部が時間を示すため、24時間分のミリ秒を考慮する。
*/
long utcTime = Math.round(utcDay * SECONDS_IN_DAYS) * 1000;
return new Date(utcTime);
} | java | public static Date convertJavaDate(final double numValue, final boolean startDate1904) {
double utcDay;
if(startDate1904) {
// 1904年始まりの場合
// UTC(1970年基準に戻す)
utcDay = numValue + OFFSET_DAYS_1904;
} else {
// 1900年始まりの場合
// UTC(1970年基準に戻す)
utcDay = numValue + OFFSET_DAYS_1900;
/*
* 1900年3月1日(Excel上は1900年2月29日)以降の場合の補正。
* ・Excel上は1900年は、閏年扱いで1900年2月29日の閏年が存在する。
* ・しかし、グレゴリオ歴上は1900年は閏年ではないため、UTCの表現上から見ると1日多い。
* ・1900年2月29日は、1900年1月0日から数えて61日目なので、61日以降は、1日前に戻す。
*/
if(numValue >= NON_LEAP_DAY) {
utcDay -= 1;
}
}
/*
* Javaのミリ秒に直す。
* ・Excelの日付の形式の場合小数部が時間を示すため、24時間分のミリ秒を考慮する。
*/
long utcTime = Math.round(utcDay * SECONDS_IN_DAYS) * 1000;
return new Date(utcTime);
} | [
"public",
"static",
"Date",
"convertJavaDate",
"(",
"final",
"double",
"numValue",
",",
"final",
"boolean",
"startDate1904",
")",
"{",
"double",
"utcDay",
";",
"if",
"(",
"startDate1904",
")",
"{",
"// 1904年始まりの場合\r",
"// UTC(1970年基準に戻す)\r",
"utcDay",
"=",
"numVal... | Excel表現上の数値をJavaの{@link Date}型(UTC形式)に変換する。
<p>1900年始まりの場合は以下の注意が必要。</p>
<ul>
<li>値{@literal 0.0}は、Excel上は1900年1月0日であるが、Date型へ変換した場合は1899年12月31日となります。</li>
<li>値{@literal 60.0}は、Excel上は1900年2月29日だが、グレゴリオ歴上は閏日ではあにため、1900年3月1日となります。</li>
</ul>
@param numValue 変換対象のExcel表現上の数値。
@param startDate1904 基準日が1904年始まりかどうか。
@return Java表現上に変換した日時。
ただし、この値はタイムゾーンは考慮されていない(=GMT-00:00)ため、
変換後は独自に処理を行う必要があります。 | [
"Excel表現上の数値をJavaの",
"{",
"@link",
"Date",
"}",
"型",
"(",
"UTC形式",
")",
"に変換する。",
"<p",
">",
"1900年始まりの場合は以下の注意が必要。<",
"/",
"p",
">",
"<ul",
">",
"<li",
">",
"値",
"{",
"@literal",
"0",
".",
"0",
"}",
"は、Excel上は1900年1月0日であるが、Date型へ変換した場合は1899年12月31日となります。<",
"/... | train | https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/lang/ExcelDateUtils.java#L86-L120 |
elastic/elasticsearch-hadoop | mr/src/main/java/org/elasticsearch/hadoop/util/encoding/HttpEncodingTools.java | HttpEncodingTools.encodeUri | @Deprecated
public static String encodeUri(String uri) {
try {
return URIUtil.encodePathQuery(uri);
} catch (URIException ex) {
throw new EsHadoopIllegalArgumentException("Cannot escape uri [" + uri + "]", ex);
}
} | java | @Deprecated
public static String encodeUri(String uri) {
try {
return URIUtil.encodePathQuery(uri);
} catch (URIException ex) {
throw new EsHadoopIllegalArgumentException("Cannot escape uri [" + uri + "]", ex);
}
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"encodeUri",
"(",
"String",
"uri",
")",
"{",
"try",
"{",
"return",
"URIUtil",
".",
"encodePathQuery",
"(",
"uri",
")",
";",
"}",
"catch",
"(",
"URIException",
"ex",
")",
"{",
"throw",
"new",
"EsHadoopIllegal... | Splits the given string on the first '?' then encodes the first half as a path (ignoring slashes and colons)
and the second half as a query segment (ignoring questionmarks, equals signs, etc...).
@deprecated Prefer to use {@link HttpEncodingTools#encode(String)} instead for encoding specific
pieces of the URI. This method does not escape certain reserved characters, like '/', ':', '=', and '?'.
As such, this is not safe to use on URIs that may contain these reserved characters in the wrong places. | [
"Splits",
"the",
"given",
"string",
"on",
"the",
"first",
"?",
"then",
"encodes",
"the",
"first",
"half",
"as",
"a",
"path",
"(",
"ignoring",
"slashes",
"and",
"colons",
")",
"and",
"the",
"second",
"half",
"as",
"a",
"query",
"segment",
"(",
"ignoring",... | train | https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/util/encoding/HttpEncodingTools.java#L52-L59 |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/util/UIUtils.java | UIUtils.getThemeColor | public static int getThemeColor(Context ctx, @AttrRes int attr) {
TypedValue tv = new TypedValue();
if (ctx.getTheme().resolveAttribute(attr, tv, true)) {
return tv.resourceId != 0 ? ContextCompat.getColor(ctx, tv.resourceId) : tv.data;
}
return 0;
} | java | public static int getThemeColor(Context ctx, @AttrRes int attr) {
TypedValue tv = new TypedValue();
if (ctx.getTheme().resolveAttribute(attr, tv, true)) {
return tv.resourceId != 0 ? ContextCompat.getColor(ctx, tv.resourceId) : tv.data;
}
return 0;
} | [
"public",
"static",
"int",
"getThemeColor",
"(",
"Context",
"ctx",
",",
"@",
"AttrRes",
"int",
"attr",
")",
"{",
"TypedValue",
"tv",
"=",
"new",
"TypedValue",
"(",
")",
";",
"if",
"(",
"ctx",
".",
"getTheme",
"(",
")",
".",
"resolveAttribute",
"(",
"at... | a helper method to get the color from an attribute
@param ctx
@param attr
@return | [
"a",
"helper",
"method",
"to",
"get",
"the",
"color",
"from",
"an",
"attribute"
] | train | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/util/UIUtils.java#L39-L45 |
soi-toolkit/soi-toolkit-mule | commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/sftp/SftpUtil.java | SftpUtil.getSftpClient | static protected SftpClient getSftpClient(MuleContext muleContext,
String endpointName) throws IOException {
ImmutableEndpoint endpoint = getImmutableEndpoint(muleContext,
endpointName);
try {
SftpClient sftpClient = SftpConnectionFactory.createClient(endpoint);
return sftpClient;
} catch (Exception e) {
throw new RuntimeException("Login failed", e);
}
/*
EndpointURI endpointURI = endpoint.getEndpointURI();
SftpClient sftpClient = new SftpClient(endpointURI.getHost());
SftpConnector sftpConnector = (SftpConnector) endpoint.getConnector();
if (sftpConnector.getIdentityFile() != null) {
try {
sftpClient.login(endpointURI.getUser(),
sftpConnector.getIdentityFile(),
sftpConnector.getPassphrase());
} catch (Exception e) {
throw new RuntimeException("Login failed", e);
}
} else {
try {
sftpClient.login(endpointURI.getUser(),
endpointURI.getPassword());
} catch (Exception e) {
throw new RuntimeException("Login failed", e);
}
}
return sftpClient;
*/
} | java | static protected SftpClient getSftpClient(MuleContext muleContext,
String endpointName) throws IOException {
ImmutableEndpoint endpoint = getImmutableEndpoint(muleContext,
endpointName);
try {
SftpClient sftpClient = SftpConnectionFactory.createClient(endpoint);
return sftpClient;
} catch (Exception e) {
throw new RuntimeException("Login failed", e);
}
/*
EndpointURI endpointURI = endpoint.getEndpointURI();
SftpClient sftpClient = new SftpClient(endpointURI.getHost());
SftpConnector sftpConnector = (SftpConnector) endpoint.getConnector();
if (sftpConnector.getIdentityFile() != null) {
try {
sftpClient.login(endpointURI.getUser(),
sftpConnector.getIdentityFile(),
sftpConnector.getPassphrase());
} catch (Exception e) {
throw new RuntimeException("Login failed", e);
}
} else {
try {
sftpClient.login(endpointURI.getUser(),
endpointURI.getPassword());
} catch (Exception e) {
throw new RuntimeException("Login failed", e);
}
}
return sftpClient;
*/
} | [
"static",
"protected",
"SftpClient",
"getSftpClient",
"(",
"MuleContext",
"muleContext",
",",
"String",
"endpointName",
")",
"throws",
"IOException",
"{",
"ImmutableEndpoint",
"endpoint",
"=",
"getImmutableEndpoint",
"(",
"muleContext",
",",
"endpointName",
")",
";",
... | Returns a SftpClient that is logged in to the sftp server that the
endpoint is configured against.
@param muleContext
@param endpointName
@return
@throws IOException | [
"Returns",
"a",
"SftpClient",
"that",
"is",
"logged",
"in",
"to",
"the",
"sftp",
"server",
"that",
"the",
"endpoint",
"is",
"configured",
"against",
"."
] | train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/sftp/SftpUtil.java#L208-L244 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java | CPMeasurementUnitPersistenceImpl.findByG_T | @Override
public List<CPMeasurementUnit> findByG_T(long groupId, int type, int start,
int end, OrderByComparator<CPMeasurementUnit> orderByComparator) {
return findByG_T(groupId, type, start, end, orderByComparator, true);
} | java | @Override
public List<CPMeasurementUnit> findByG_T(long groupId, int type, int start,
int end, OrderByComparator<CPMeasurementUnit> orderByComparator) {
return findByG_T(groupId, type, start, end, orderByComparator, true);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPMeasurementUnit",
">",
"findByG_T",
"(",
"long",
"groupId",
",",
"int",
"type",
",",
"int",
"start",
",",
"int",
"end",
",",
"OrderByComparator",
"<",
"CPMeasurementUnit",
">",
"orderByComparator",
")",
"{",
"return",... | Returns an ordered range of all the cp measurement units where groupId = ? and type = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPMeasurementUnitModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param type the type
@param start the lower bound of the range of cp measurement units
@param end the upper bound of the range of cp measurement units (not inclusive)
@param orderByComparator the comparator to order the results by (optionally <code>null</code>)
@return the ordered range of matching cp measurement units | [
"Returns",
"an",
"ordered",
"range",
"of",
"all",
"the",
"cp",
"measurement",
"units",
"where",
"groupId",
"=",
"?",
";",
"and",
"type",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java#L2064-L2068 |
h2oai/h2o-3 | h2o-algos/src/main/java/hex/deepwater/DeepWaterTask2.java | DeepWaterTask2.postGlobal | @Override
protected void postGlobal() {
assert(_res.model_info().get_params()._replicate_training_data);
super.postGlobal();
// model averaging (DeepWaterTask only computed the per-node models, each on all the data)
// _res.model_info().div(_res._chunk_node_count);
_res.model_info().add_processed_global(_res.model_info().get_processed_local()); //switch from local counters to global counters
_res.model_info().set_processed_local(0L);
_sharedmodel = _res.model_info();
} | java | @Override
protected void postGlobal() {
assert(_res.model_info().get_params()._replicate_training_data);
super.postGlobal();
// model averaging (DeepWaterTask only computed the per-node models, each on all the data)
// _res.model_info().div(_res._chunk_node_count);
_res.model_info().add_processed_global(_res.model_info().get_processed_local()); //switch from local counters to global counters
_res.model_info().set_processed_local(0L);
_sharedmodel = _res.model_info();
} | [
"@",
"Override",
"protected",
"void",
"postGlobal",
"(",
")",
"{",
"assert",
"(",
"_res",
".",
"model_info",
"(",
")",
".",
"get_params",
"(",
")",
".",
"_replicate_training_data",
")",
";",
"super",
".",
"postGlobal",
"(",
")",
";",
"// model averaging (Dee... | Finish up the work after all nodes have reduced their models via the above reduce() method.
All we do is average the models and add to the global training sample counter.
After this returns, model_info() can be queried for the updated model. | [
"Finish",
"up",
"the",
"work",
"after",
"all",
"nodes",
"have",
"reduced",
"their",
"models",
"via",
"the",
"above",
"reduce",
"()",
"method",
".",
"All",
"we",
"do",
"is",
"average",
"the",
"models",
"and",
"add",
"to",
"the",
"global",
"training",
"sam... | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-algos/src/main/java/hex/deepwater/DeepWaterTask2.java#L74-L83 |
Azure/azure-sdk-for-java | locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java | ManagementLocksInner.createOrUpdateAtSubscriptionLevelAsync | public Observable<ManagementLockObjectInner> createOrUpdateAtSubscriptionLevelAsync(String lockName, ManagementLockObjectInner parameters) {
return createOrUpdateAtSubscriptionLevelWithServiceResponseAsync(lockName, parameters).map(new Func1<ServiceResponse<ManagementLockObjectInner>, ManagementLockObjectInner>() {
@Override
public ManagementLockObjectInner call(ServiceResponse<ManagementLockObjectInner> response) {
return response.body();
}
});
} | java | public Observable<ManagementLockObjectInner> createOrUpdateAtSubscriptionLevelAsync(String lockName, ManagementLockObjectInner parameters) {
return createOrUpdateAtSubscriptionLevelWithServiceResponseAsync(lockName, parameters).map(new Func1<ServiceResponse<ManagementLockObjectInner>, ManagementLockObjectInner>() {
@Override
public ManagementLockObjectInner call(ServiceResponse<ManagementLockObjectInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ManagementLockObjectInner",
">",
"createOrUpdateAtSubscriptionLevelAsync",
"(",
"String",
"lockName",
",",
"ManagementLockObjectInner",
"parameters",
")",
"{",
"return",
"createOrUpdateAtSubscriptionLevelWithServiceResponseAsync",
"(",
"lockName",
",... | Creates or updates a management lock at the subscription level.
When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
@param lockName The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters.
@param parameters The management lock parameters.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ManagementLockObjectInner object | [
"Creates",
"or",
"updates",
"a",
"management",
"lock",
"at",
"the",
"subscription",
"level",
".",
"When",
"you",
"apply",
"a",
"lock",
"at",
"a",
"parent",
"scope",
"all",
"child",
"resources",
"inherit",
"the",
"same",
"lock",
".",
"To",
"create",
"manage... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L1070-L1077 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.data_afnicAssociationInformation_associationInformationId_GET | public OvhAssociationContact data_afnicAssociationInformation_associationInformationId_GET(Long associationInformationId) throws IOException {
String qPath = "/domain/data/afnicAssociationInformation/{associationInformationId}";
StringBuilder sb = path(qPath, associationInformationId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAssociationContact.class);
} | java | public OvhAssociationContact data_afnicAssociationInformation_associationInformationId_GET(Long associationInformationId) throws IOException {
String qPath = "/domain/data/afnicAssociationInformation/{associationInformationId}";
StringBuilder sb = path(qPath, associationInformationId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAssociationContact.class);
} | [
"public",
"OvhAssociationContact",
"data_afnicAssociationInformation_associationInformationId_GET",
"(",
"Long",
"associationInformationId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/data/afnicAssociationInformation/{associationInformationId}\"",
";",
"Strin... | Retrieve an association information according to Afnic
REST: GET /domain/data/afnicAssociationInformation/{associationInformationId}
@param associationInformationId [required] Association Information ID | [
"Retrieve",
"an",
"association",
"information",
"according",
"to",
"Afnic"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L217-L222 |
aalmiray/Json-lib | src/main/jdk15/net/sf/json/JSONObject.java | JSONObject.element | public JSONObject element( String key, Collection value, JsonConfig jsonConfig ) {
if( !(value instanceof JSONArray) ){
value = JSONArray.fromObject( value, jsonConfig );
}
return setInternal( key, value, jsonConfig );
} | java | public JSONObject element( String key, Collection value, JsonConfig jsonConfig ) {
if( !(value instanceof JSONArray) ){
value = JSONArray.fromObject( value, jsonConfig );
}
return setInternal( key, value, jsonConfig );
} | [
"public",
"JSONObject",
"element",
"(",
"String",
"key",
",",
"Collection",
"value",
",",
"JsonConfig",
"jsonConfig",
")",
"{",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"JSONArray",
")",
")",
"{",
"value",
"=",
"JSONArray",
".",
"fromObject",
"(",
"valu... | Put a key/value pair in the JSONObject, where the value will be a
JSONArray which is produced from a Collection.
@param key A key string.
@param value A Collection value.
@return this.
@throws JSONException | [
"Put",
"a",
"key",
"/",
"value",
"pair",
"in",
"the",
"JSONObject",
"where",
"the",
"value",
"will",
"be",
"a",
"JSONArray",
"which",
"is",
"produced",
"from",
"a",
"Collection",
"."
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/jdk15/net/sf/json/JSONObject.java#L1672-L1677 |
pietermartin/sqlg | sqlg-core/src/main/java/org/umlg/sqlg/predicate/FullText.java | FullText.fullTextMatch | public static P<String> fullTextMatch(String configuration, boolean plain, final String query, final String value){
return new P<>(new FullText(configuration,query,plain),value);
} | java | public static P<String> fullTextMatch(String configuration, boolean plain, final String query, final String value){
return new P<>(new FullText(configuration,query,plain),value);
} | [
"public",
"static",
"P",
"<",
"String",
">",
"fullTextMatch",
"(",
"String",
"configuration",
",",
"boolean",
"plain",
",",
"final",
"String",
"query",
",",
"final",
"String",
"value",
")",
"{",
"return",
"new",
"P",
"<>",
"(",
"new",
"FullText",
"(",
"c... | Build full text matching predicate (use in where(...))
@param configuration the full text configuration to use
@param plain should we use plain mode?
@param query the actual query (left hand side)
@param value the value to search for
@return the predicate | [
"Build",
"full",
"text",
"matching",
"predicate",
"(",
"use",
"in",
"where",
"(",
"...",
"))"
] | train | https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/predicate/FullText.java#L65-L67 |
sannies/mp4parser | isoparser/src/main/java/org/mp4parser/boxes/microsoft/XtraBox.java | XtraBox.setTagValue | public void setTagValue(String name, Date date) {
removeTag(name);
XtraTag tag = new XtraTag(name);
tag.values.addElement(new XtraValue(date));
tags.addElement(tag);
} | java | public void setTagValue(String name, Date date) {
removeTag(name);
XtraTag tag = new XtraTag(name);
tag.values.addElement(new XtraValue(date));
tags.addElement(tag);
} | [
"public",
"void",
"setTagValue",
"(",
"String",
"name",
",",
"Date",
"date",
")",
"{",
"removeTag",
"(",
"name",
")",
";",
"XtraTag",
"tag",
"=",
"new",
"XtraTag",
"(",
"name",
")",
";",
"tag",
".",
"values",
".",
"addElement",
"(",
"new",
"XtraValue",... | Removes and recreates tag using specified Date value
@param name Tag name to replace
@param date New Date value | [
"Removes",
"and",
"recreates",
"tag",
"using",
"specified",
"Date",
"value"
] | train | https://github.com/sannies/mp4parser/blob/3382ff5d489363900f352a8da0f794a20ad3b063/isoparser/src/main/java/org/mp4parser/boxes/microsoft/XtraBox.java#L316-L321 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java | AbstractTagLibrary.addComponent | protected final void addComponent(String name, String componentType, String rendererType)
{
_factories.put(name, new ComponentHandlerFactory(componentType, rendererType));
} | java | protected final void addComponent(String name, String componentType, String rendererType)
{
_factories.put(name, new ComponentHandlerFactory(componentType, rendererType));
} | [
"protected",
"final",
"void",
"addComponent",
"(",
"String",
"name",
",",
"String",
"componentType",
",",
"String",
"rendererType",
")",
"{",
"_factories",
".",
"put",
"(",
"name",
",",
"new",
"ComponentHandlerFactory",
"(",
"componentType",
",",
"rendererType",
... | Add a ComponentHandler with the specified componentType and rendererType, aliased by the tag name.
@see ComponentHandler
@see javax.faces.application.Application#createComponent(java.lang.String)
@param name
name to use, "foo" would be <my:foo />
@param componentType
componentType to use
@param rendererType
rendererType to use | [
"Add",
"a",
"ComponentHandler",
"with",
"the",
"specified",
"componentType",
"and",
"rendererType",
"aliased",
"by",
"the",
"tag",
"name",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java#L157-L160 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AlertResources.java | AlertResources.getSharedAlerts | @GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/shared")
@Description("Returns all shared alerts.")
public List<AlertDto> getSharedAlerts(@Context HttpServletRequest req,
@QueryParam("ownername") String ownerName,
@QueryParam("limit") Integer limit){
PrincipalUser owner = null;
if(ownerName != null){
owner = userService.findUserByUsername(ownerName);
if(owner == null){
throw new WebApplicationException("Owner not found", Response.Status.NOT_FOUND);
}
}
List<Alert> result = getSharedAlertsObj(false, owner, limit);
return AlertDto.transformToDto(result);
} | java | @GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/shared")
@Description("Returns all shared alerts.")
public List<AlertDto> getSharedAlerts(@Context HttpServletRequest req,
@QueryParam("ownername") String ownerName,
@QueryParam("limit") Integer limit){
PrincipalUser owner = null;
if(ownerName != null){
owner = userService.findUserByUsername(ownerName);
if(owner == null){
throw new WebApplicationException("Owner not found", Response.Status.NOT_FOUND);
}
}
List<Alert> result = getSharedAlertsObj(false, owner, limit);
return AlertDto.transformToDto(result);
} | [
"@",
"GET",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Path",
"(",
"\"/shared\"",
")",
"@",
"Description",
"(",
"\"Returns all shared alerts.\"",
")",
"public",
"List",
"<",
"AlertDto",
">",
"getSharedAlerts",
"(",
"@",
"Context",
"... | Returns the list of shared alerts
@param req The HttpServlet request object. Cannot be null.
@param ownerName Name of the owner. It is optional.
@param limit The maximum number of results to return.
@return The list of alerts created by the user. | [
"Returns",
"the",
"list",
"of",
"shared",
"alerts"
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AlertResources.java#L292-L308 |
owetterau/neo4j-websockets | client/src/main/java/de/oliverwetterau/neo4j/websockets/client/server/Database.java | Database.onServerReconnected | public synchronized void onServerReconnected(final String id, final String uri) {
logger.debug("[onServerReconnected] id = {}, uri = {}", id, uri);
if (id.length() == 0) {
Server server = getServerByUri(uri);
server.register();
server.setAvailable(true);
}
refreshServers();
} | java | public synchronized void onServerReconnected(final String id, final String uri) {
logger.debug("[onServerReconnected] id = {}, uri = {}", id, uri);
if (id.length() == 0) {
Server server = getServerByUri(uri);
server.register();
server.setAvailable(true);
}
refreshServers();
} | [
"public",
"synchronized",
"void",
"onServerReconnected",
"(",
"final",
"String",
"id",
",",
"final",
"String",
"uri",
")",
"{",
"logger",
".",
"debug",
"(",
"\"[onServerReconnected] id = {}, uri = {}\"",
",",
"id",
",",
"uri",
")",
";",
"if",
"(",
"id",
".",
... | Add a server to the list of available servers.
@param id Neo4j cluster id
@param uri websocket uri | [
"Add",
"a",
"server",
"to",
"the",
"list",
"of",
"available",
"servers",
"."
] | train | https://github.com/owetterau/neo4j-websockets/blob/ca3481066819d01169873aeb145ab3bf5c736afe/client/src/main/java/de/oliverwetterau/neo4j/websockets/client/server/Database.java#L173-L183 |
j-a-w-r/jawr | jawr-core/src/main/java/net/jawr/web/resource/bundle/css/CssDebugUrlRewriter.java | CssDebugUrlRewriter.rewriteGeneratedBinaryResourceDebugUrl | public static String rewriteGeneratedBinaryResourceDebugUrl(String requestPath, String content, String binaryServletMapping) {
// Write the content of the CSS in the Stringwriter
if (binaryServletMapping == null) {
binaryServletMapping = "";
}
// Define the replacement pattern for the generated binary resource
// (like jar:img/myImg.png)
String relativeRootUrlPath = PathNormalizer.getRootRelativePath(requestPath);
String replacementPattern = PathNormalizer
.normalizePath("$1" + relativeRootUrlPath + binaryServletMapping + "/$5_cbDebug/$7$8");
Matcher matcher = GENERATED_BINARY_RESOURCE_PATTERN.matcher(content);
// Rewrite the images define in the classpath, to point to the image
// servlet
StringBuffer result = new StringBuffer();
while (matcher.find()) {
matcher.appendReplacement(result, replacementPattern);
}
matcher.appendTail(result);
return result.toString();
} | java | public static String rewriteGeneratedBinaryResourceDebugUrl(String requestPath, String content, String binaryServletMapping) {
// Write the content of the CSS in the Stringwriter
if (binaryServletMapping == null) {
binaryServletMapping = "";
}
// Define the replacement pattern for the generated binary resource
// (like jar:img/myImg.png)
String relativeRootUrlPath = PathNormalizer.getRootRelativePath(requestPath);
String replacementPattern = PathNormalizer
.normalizePath("$1" + relativeRootUrlPath + binaryServletMapping + "/$5_cbDebug/$7$8");
Matcher matcher = GENERATED_BINARY_RESOURCE_PATTERN.matcher(content);
// Rewrite the images define in the classpath, to point to the image
// servlet
StringBuffer result = new StringBuffer();
while (matcher.find()) {
matcher.appendReplacement(result, replacementPattern);
}
matcher.appendTail(result);
return result.toString();
} | [
"public",
"static",
"String",
"rewriteGeneratedBinaryResourceDebugUrl",
"(",
"String",
"requestPath",
",",
"String",
"content",
",",
"String",
"binaryServletMapping",
")",
"{",
"// Write the content of the CSS in the Stringwriter",
"if",
"(",
"binaryServletMapping",
"==",
"nu... | Rewrites the generated binary resource URL for debug mode
@param requestPath
the request path
@param content
the content to rewrite
@param binaryServletMapping
the binary servlet mapping
@return the rewritten content | [
"Rewrites",
"the",
"generated",
"binary",
"resource",
"URL",
"for",
"debug",
"mode"
] | train | https://github.com/j-a-w-r/jawr/blob/1fa7cd46ebcd36908bd90b298ca316fa5b0c1b0d/jawr-core/src/main/java/net/jawr/web/resource/bundle/css/CssDebugUrlRewriter.java#L44-L68 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/MediaApi.java | MediaApi.attachMediaUserData | public ApiSuccessResponse attachMediaUserData(String mediatype, String id, UserDataOperationId userData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = attachMediaUserDataWithHttpInfo(mediatype, id, userData);
return resp.getData();
} | java | public ApiSuccessResponse attachMediaUserData(String mediatype, String id, UserDataOperationId userData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = attachMediaUserDataWithHttpInfo(mediatype, id, userData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"attachMediaUserData",
"(",
"String",
"mediatype",
",",
"String",
"id",
",",
"UserDataOperationId",
"userData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"attachMediaUserDataWithHttpInfo... | Attach user data to an interaction
Attach the provided data to the specified interaction.
@param mediatype The media channel. (required)
@param id The ID of the interaction. (required)
@param userData The data to attach to the interaction. This is an array of objects with the properties key, type, and value. (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Attach",
"user",
"data",
"to",
"an",
"interaction",
"Attach",
"the",
"provided",
"data",
"to",
"the",
"specified",
"interaction",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L1015-L1018 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java | CmsGalleryControllerHandler.onUpdateGalleryTree | public void onUpdateGalleryTree(List<CmsGalleryTreeEntry> galleryTreeEntries, List<String> selectedGalleries) {
m_galleryDialog.getGalleriesTab().updateTreeContent(galleryTreeEntries, selectedGalleries);
} | java | public void onUpdateGalleryTree(List<CmsGalleryTreeEntry> galleryTreeEntries, List<String> selectedGalleries) {
m_galleryDialog.getGalleriesTab().updateTreeContent(galleryTreeEntries, selectedGalleries);
} | [
"public",
"void",
"onUpdateGalleryTree",
"(",
"List",
"<",
"CmsGalleryTreeEntry",
">",
"galleryTreeEntries",
",",
"List",
"<",
"String",
">",
"selectedGalleries",
")",
"{",
"m_galleryDialog",
".",
"getGalleriesTab",
"(",
")",
".",
"updateTreeContent",
"(",
"galleryT... | Updates the gallery tree.<p>
@param galleryTreeEntries the gallery tree entries
@param selectedGalleries the selected galleries | [
"Updates",
"the",
"gallery",
"tree",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java#L396-L399 |
wirecardBrasil/moip-sdk-java | src/main/java/br/com/moip/api/request/RequestMaker.java | RequestMaker.doRequest | public Map<String, Object> doRequest(final RequestProperties requestProps) {
try {
URL url = new URL(moipEnvironment + requestProps.endpoint);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("User-Agent", getUserAgent());
connection.setRequestProperty("Content-type", requestProps.getContentType().getMimeType());
if (requestProps.hasAccept()) connection.setRequestProperty("Accept", requestProps.accept);
connection.setRequestMethod(requestProps.method);
// This validation disable the TLS 1.0
if (connection instanceof HttpsURLConnection) {
((HttpsURLConnection) connection).setSSLSocketFactory(new SSLSupport());
}
if (this.authentication != null) authentication.authenticate(connection);
LOGGER.debug("---> {} {}", requestProps.method, connection.getURL().toString());
logHeaders(connection.getRequestProperties().entrySet());
if (requestProps.body != null) {
connection.setDoOutput(true);
String body = tools.getBody(requestProps.body, requestProps.contentType);
LOGGER.debug("{}", body);
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(wr, "UTF-8"));
writer.write(body);
writer.close();
wr.flush();
wr.close();
}
LOGGER.debug("---> END HTTP");
int responseCode = connection.getResponseCode();
LOGGER.debug("<--- {} {}", responseCode, connection.getResponseMessage());
logHeaders(connection.getHeaderFields().entrySet());
StringBuilder responseBody = new StringBuilder();
responseBody = responseBodyTreatment(responseBody, responseCode, connection);
LOGGER.debug("{}", responseBody.toString());
LOGGER.debug("<-- END HTTP ({}-byte body)", connection.getContentLength());
// Return the parsed response from JSON to Map.
return this.response.jsonToMap(responseBody.toString());
} catch(IOException | KeyManagementException | NoSuchAlgorithmException e){
throw new MoipAPIException("Error occurred connecting to Moip API: " + e.getMessage(), e);
}
} | java | public Map<String, Object> doRequest(final RequestProperties requestProps) {
try {
URL url = new URL(moipEnvironment + requestProps.endpoint);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("User-Agent", getUserAgent());
connection.setRequestProperty("Content-type", requestProps.getContentType().getMimeType());
if (requestProps.hasAccept()) connection.setRequestProperty("Accept", requestProps.accept);
connection.setRequestMethod(requestProps.method);
// This validation disable the TLS 1.0
if (connection instanceof HttpsURLConnection) {
((HttpsURLConnection) connection).setSSLSocketFactory(new SSLSupport());
}
if (this.authentication != null) authentication.authenticate(connection);
LOGGER.debug("---> {} {}", requestProps.method, connection.getURL().toString());
logHeaders(connection.getRequestProperties().entrySet());
if (requestProps.body != null) {
connection.setDoOutput(true);
String body = tools.getBody(requestProps.body, requestProps.contentType);
LOGGER.debug("{}", body);
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(wr, "UTF-8"));
writer.write(body);
writer.close();
wr.flush();
wr.close();
}
LOGGER.debug("---> END HTTP");
int responseCode = connection.getResponseCode();
LOGGER.debug("<--- {} {}", responseCode, connection.getResponseMessage());
logHeaders(connection.getHeaderFields().entrySet());
StringBuilder responseBody = new StringBuilder();
responseBody = responseBodyTreatment(responseBody, responseCode, connection);
LOGGER.debug("{}", responseBody.toString());
LOGGER.debug("<-- END HTTP ({}-byte body)", connection.getContentLength());
// Return the parsed response from JSON to Map.
return this.response.jsonToMap(responseBody.toString());
} catch(IOException | KeyManagementException | NoSuchAlgorithmException e){
throw new MoipAPIException("Error occurred connecting to Moip API: " + e.getMessage(), e);
}
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"doRequest",
"(",
"final",
"RequestProperties",
"requestProps",
")",
"{",
"try",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"moipEnvironment",
"+",
"requestProps",
".",
"endpoint",
")",
";",
"HttpURLConnect... | This method is used to build the request, it set the environment (Sandbox or Production)
and the headers, create the {@code connection} object to establish connection with Moip
APIResources, authenticate the connection, load the request properties received from parameter,
serialize the request object and send it to the API. Finally, this method receive the
response JSON and deserialize it into the respective model object, sending the response
code and response body to {@code responseBodyTreatment} method to treat the response.
@param requestProps
{@code RequestProperties} the object containing the properties of
request, its like request method, endpoint, object, type, content type
and if it accepts another JSON version.
@return {@code Map<String, Object>} | [
"This",
"method",
"is",
"used",
"to",
"build",
"the",
"request",
"it",
"set",
"the",
"environment",
"(",
"Sandbox",
"or",
"Production",
")",
"and",
"the",
"headers",
"create",
"the",
"{",
"@code",
"connection",
"}",
"object",
"to",
"establish",
"connection",... | train | https://github.com/wirecardBrasil/moip-sdk-java/blob/5bee84fa9457d7becfd18954bf5105037f49829c/src/main/java/br/com/moip/api/request/RequestMaker.java#L71-L129 |
HubSpot/Singularity | SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java | SingularityClient.getActiveSingularityRequests | public Collection<SingularityRequestParent> getActiveSingularityRequests() {
final Function<String, String> requestUri = (host) -> String.format(REQUESTS_GET_ACTIVE_FORMAT, getApiBase(host));
return getCollection(requestUri, "ACTIVE requests", REQUESTS_COLLECTION);
} | java | public Collection<SingularityRequestParent> getActiveSingularityRequests() {
final Function<String, String> requestUri = (host) -> String.format(REQUESTS_GET_ACTIVE_FORMAT, getApiBase(host));
return getCollection(requestUri, "ACTIVE requests", REQUESTS_COLLECTION);
} | [
"public",
"Collection",
"<",
"SingularityRequestParent",
">",
"getActiveSingularityRequests",
"(",
")",
"{",
"final",
"Function",
"<",
"String",
",",
"String",
">",
"requestUri",
"=",
"(",
"host",
")",
"-",
">",
"String",
".",
"format",
"(",
"REQUESTS_GET_ACTIVE... | Get all requests that their state is ACTIVE
@return
All ACTIVE {@link SingularityRequestParent} instances | [
"Get",
"all",
"requests",
"that",
"their",
"state",
"is",
"ACTIVE"
] | train | https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java#L765-L769 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java | DirectoryServiceClient.getService | public void getService(String serviceName, final GetServiceCallback cb, Object context){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.GetService);
GetServiceProtocol p = new GetServiceProtocol(serviceName);
p.setWatcher(false);
ProtocolCallback pcb = new ProtocolCallback(){
@Override
public void call(boolean result, Response response,
ErrorCode error, Object ctx) {
ModelService rsp = null;
if(response != null){
rsp = ((GetServiceResponse) response).getService();
}
cb.call(result, rsp, error, ctx);
}
};
connection.submitCallbackRequest(header, p, pcb, context);
} | java | public void getService(String serviceName, final GetServiceCallback cb, Object context){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.GetService);
GetServiceProtocol p = new GetServiceProtocol(serviceName);
p.setWatcher(false);
ProtocolCallback pcb = new ProtocolCallback(){
@Override
public void call(boolean result, Response response,
ErrorCode error, Object ctx) {
ModelService rsp = null;
if(response != null){
rsp = ((GetServiceResponse) response).getService();
}
cb.call(result, rsp, error, ctx);
}
};
connection.submitCallbackRequest(header, p, pcb, context);
} | [
"public",
"void",
"getService",
"(",
"String",
"serviceName",
",",
"final",
"GetServiceCallback",
"cb",
",",
"Object",
"context",
")",
"{",
"ProtocolHeader",
"header",
"=",
"new",
"ProtocolHeader",
"(",
")",
";",
"header",
".",
"setType",
"(",
"ProtocolType",
... | Get Service in Callback.
@param serviceName
the serviceName.
@param cb
the Callback.
@param context
the callback context object. | [
"Get",
"Service",
"in",
"Callback",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L712-L734 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java | ImageModerationsImpl.findFacesFileInputWithServiceResponseAsync | public Observable<ServiceResponse<FoundFaces>> findFacesFileInputWithServiceResponseAsync(byte[] imageStream, FindFacesFileInputOptionalParameter findFacesFileInputOptionalParameter) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (imageStream == null) {
throw new IllegalArgumentException("Parameter imageStream is required and cannot be null.");
}
final Boolean cacheImage = findFacesFileInputOptionalParameter != null ? findFacesFileInputOptionalParameter.cacheImage() : null;
return findFacesFileInputWithServiceResponseAsync(imageStream, cacheImage);
} | java | public Observable<ServiceResponse<FoundFaces>> findFacesFileInputWithServiceResponseAsync(byte[] imageStream, FindFacesFileInputOptionalParameter findFacesFileInputOptionalParameter) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (imageStream == null) {
throw new IllegalArgumentException("Parameter imageStream is required and cannot be null.");
}
final Boolean cacheImage = findFacesFileInputOptionalParameter != null ? findFacesFileInputOptionalParameter.cacheImage() : null;
return findFacesFileInputWithServiceResponseAsync(imageStream, cacheImage);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"FoundFaces",
">",
">",
"findFacesFileInputWithServiceResponseAsync",
"(",
"byte",
"[",
"]",
"imageStream",
",",
"FindFacesFileInputOptionalParameter",
"findFacesFileInputOptionalParameter",
")",
"{",
"if",
"(",
"this",
... | Returns the list of faces found.
@param imageStream The image file.
@param findFacesFileInputOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FoundFaces object | [
"Returns",
"the",
"list",
"of",
"faces",
"found",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java#L764-L774 |
tango-controls/JTango | server/src/main/java/org/tango/server/cache/PollingManager.java | PollingManager.addCommandPolling | public void addCommandPolling(final String commandName, final int pollingPeriod) throws DevFailed {
checkPollingLimits(commandName, pollingPeriod, minCommandPolling);
final CommandImpl command = CommandGetter.getCommand(commandName, commandList);
if (!command.getName().equals(DeviceImpl.INIT_CMD) && command.getInType().equals(CommandTangoType.VOID)) {
command.configurePolling(pollingPeriod);
if (command.getName().equals(DeviceImpl.STATE_NAME) || command.getName().equals(DeviceImpl.STATUS_NAME)) {
// command is also set as polled
final AttributeImpl attribute = AttributeGetterSetter.getAttribute(command.getName(), attributeList);
attribute.configurePolling(pollingPeriod);
pollAttributes.put(attribute.getName().toLowerCase(Locale.ENGLISH), pollingPeriod);
cacheManager.startStateStatusPolling(command, attribute);
pollAttributes.put(attribute.getName().toLowerCase(Locale.ENGLISH), pollingPeriod);
savePollingConfig();
} else {
cacheManager.startCommandPolling(command);
}
}
} | java | public void addCommandPolling(final String commandName, final int pollingPeriod) throws DevFailed {
checkPollingLimits(commandName, pollingPeriod, minCommandPolling);
final CommandImpl command = CommandGetter.getCommand(commandName, commandList);
if (!command.getName().equals(DeviceImpl.INIT_CMD) && command.getInType().equals(CommandTangoType.VOID)) {
command.configurePolling(pollingPeriod);
if (command.getName().equals(DeviceImpl.STATE_NAME) || command.getName().equals(DeviceImpl.STATUS_NAME)) {
// command is also set as polled
final AttributeImpl attribute = AttributeGetterSetter.getAttribute(command.getName(), attributeList);
attribute.configurePolling(pollingPeriod);
pollAttributes.put(attribute.getName().toLowerCase(Locale.ENGLISH), pollingPeriod);
cacheManager.startStateStatusPolling(command, attribute);
pollAttributes.put(attribute.getName().toLowerCase(Locale.ENGLISH), pollingPeriod);
savePollingConfig();
} else {
cacheManager.startCommandPolling(command);
}
}
} | [
"public",
"void",
"addCommandPolling",
"(",
"final",
"String",
"commandName",
",",
"final",
"int",
"pollingPeriod",
")",
"throws",
"DevFailed",
"{",
"checkPollingLimits",
"(",
"commandName",
",",
"pollingPeriod",
",",
"minCommandPolling",
")",
";",
"final",
"Command... | Add command polling. Init command cannot be polled. Only command with
parameter void can be polled
@param commandName the command to poll
@param pollingPeriod the polling period
@throws DevFailed | [
"Add",
"command",
"polling",
".",
"Init",
"command",
"cannot",
"be",
"polled",
".",
"Only",
"command",
"with",
"parameter",
"void",
"can",
"be",
"polled"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/cache/PollingManager.java#L239-L257 |
aws/aws-cloudtrail-processing-library | src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java | AbstractEventSerializer.parseResources | private void parseResources(CloudTrailEventData eventData) throws IOException {
JsonToken nextToken = jsonParser.nextToken();
if (nextToken == JsonToken.VALUE_NULL) {
eventData.add(CloudTrailEventField.resources.name(), null);
return;
}
if (nextToken != JsonToken.START_ARRAY) {
throw new JsonParseException("Not a list of resources object", jsonParser.getCurrentLocation());
}
List<Resource> resources = new ArrayList<Resource>();
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
resources.add(parseResource());
}
eventData.add(CloudTrailEventField.resources.name(), resources);
} | java | private void parseResources(CloudTrailEventData eventData) throws IOException {
JsonToken nextToken = jsonParser.nextToken();
if (nextToken == JsonToken.VALUE_NULL) {
eventData.add(CloudTrailEventField.resources.name(), null);
return;
}
if (nextToken != JsonToken.START_ARRAY) {
throw new JsonParseException("Not a list of resources object", jsonParser.getCurrentLocation());
}
List<Resource> resources = new ArrayList<Resource>();
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
resources.add(parseResource());
}
eventData.add(CloudTrailEventField.resources.name(), resources);
} | [
"private",
"void",
"parseResources",
"(",
"CloudTrailEventData",
"eventData",
")",
"throws",
"IOException",
"{",
"JsonToken",
"nextToken",
"=",
"jsonParser",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"nextToken",
"==",
"JsonToken",
".",
"VALUE_NULL",
")",
"{",... | Parses a list of Resource.
@param eventData the resources belong to
@throws IOException | [
"Parses",
"a",
"list",
"of",
"Resource",
"."
] | train | https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java#L419-L437 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/status/StatusObjectService.java | StatusObjectService.serializeStatusObject | public void serializeStatusObject(IoBuffer out, StatusObject statusObject) {
Map<?, ?> statusMap = new BeanMap(statusObject);
Output output = new Output(out);
Serializer.serialize(output, statusMap);
} | java | public void serializeStatusObject(IoBuffer out, StatusObject statusObject) {
Map<?, ?> statusMap = new BeanMap(statusObject);
Output output = new Output(out);
Serializer.serialize(output, statusMap);
} | [
"public",
"void",
"serializeStatusObject",
"(",
"IoBuffer",
"out",
",",
"StatusObject",
"statusObject",
")",
"{",
"Map",
"<",
"?",
",",
"?",
">",
"statusMap",
"=",
"new",
"BeanMap",
"(",
"statusObject",
")",
";",
"Output",
"output",
"=",
"new",
"Output",
"... | Serializes status object
@param out
Byte buffer for output object
@param statusObject
Status object to serialize | [
"Serializes",
"status",
"object"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/status/StatusObjectService.java#L158-L162 |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.onMeasure | @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
LOGGER.trace("Called Action Button onMeasure");
setMeasuredDimension(calculateMeasuredWidth(), calculateMeasuredHeight());
LOGGER.trace("Measured the Action Button size: height = {}, width = {}", getHeight(), getWidth());
} | java | @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
LOGGER.trace("Called Action Button onMeasure");
setMeasuredDimension(calculateMeasuredWidth(), calculateMeasuredHeight());
LOGGER.trace("Measured the Action Button size: height = {}, width = {}", getHeight(), getWidth());
} | [
"@",
"Override",
"protected",
"void",
"onMeasure",
"(",
"int",
"widthMeasureSpec",
",",
"int",
"heightMeasureSpec",
")",
"{",
"super",
".",
"onMeasure",
"(",
"widthMeasureSpec",
",",
"heightMeasureSpec",
")",
";",
"LOGGER",
".",
"trace",
"(",
"\"Called Action Butt... | Sets the measured dimension for the entire view
@param widthMeasureSpec horizontal space requirements as imposed by the parent.
The requirements are encoded with
{@link android.view.View.MeasureSpec}
@param heightMeasureSpec vertical space requirements as imposed by the parent.
The requirements are encoded with
{@link android.view.View.MeasureSpec} | [
"Sets",
"the",
"measured",
"dimension",
"for",
"the",
"entire",
"view"
] | train | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L1613-L1619 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWSelectList.java | AbstractWSelectList.getOptionIndex | protected int getOptionIndex(final Object option) {
int optionCount = 0;
List<?> options = getOptions();
if (options != null) {
for (Object obj : getOptions()) {
if (obj instanceof OptionGroup) {
List<?> groupOptions = ((OptionGroup) obj).getOptions();
int groupIndex = groupOptions.indexOf(option);
if (groupIndex != -1) {
return optionCount + groupIndex;
}
optionCount += groupOptions.size();
} else if (Util.equals(option, obj)) {
return optionCount;
} else {
optionCount++;
}
}
}
return -1;
} | java | protected int getOptionIndex(final Object option) {
int optionCount = 0;
List<?> options = getOptions();
if (options != null) {
for (Object obj : getOptions()) {
if (obj instanceof OptionGroup) {
List<?> groupOptions = ((OptionGroup) obj).getOptions();
int groupIndex = groupOptions.indexOf(option);
if (groupIndex != -1) {
return optionCount + groupIndex;
}
optionCount += groupOptions.size();
} else if (Util.equals(option, obj)) {
return optionCount;
} else {
optionCount++;
}
}
}
return -1;
} | [
"protected",
"int",
"getOptionIndex",
"(",
"final",
"Object",
"option",
")",
"{",
"int",
"optionCount",
"=",
"0",
";",
"List",
"<",
"?",
">",
"options",
"=",
"getOptions",
"(",
")",
";",
"if",
"(",
"options",
"!=",
"null",
")",
"{",
"for",
"(",
"Obje... | Retrieves the index of the given option. The index is not necessarily the index of the option in the options
list, as there may be options nested in OptionGroups.
@param option the option
@return the index of the given option, or -1 if there is no matching option. | [
"Retrieves",
"the",
"index",
"of",
"the",
"given",
"option",
".",
"The",
"index",
"is",
"not",
"necessarily",
"the",
"index",
"of",
"the",
"option",
"in",
"the",
"options",
"list",
"as",
"there",
"may",
"be",
"options",
"nested",
"in",
"OptionGroups",
"."
... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWSelectList.java#L172-L197 |
demidenko05/beigesoft-orm | src/main/java/org/beigesoft/orm/service/ASrvOrm.java | ASrvOrm.evalRowCountWhere | @Override
public final <T> Integer evalRowCountWhere(
final Map<String, Object> pAddParam,
final Class<T> pEntityClass, final String pWhere) throws Exception {
if (pWhere == null) {
throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
"param_null_not_accepted");
}
String query = "select count(*) as TOTALROWS from " + pEntityClass
.getSimpleName().toUpperCase() + " where " + pWhere + ";";
return evalRowCountByQuery(pAddParam, pEntityClass, query);
} | java | @Override
public final <T> Integer evalRowCountWhere(
final Map<String, Object> pAddParam,
final Class<T> pEntityClass, final String pWhere) throws Exception {
if (pWhere == null) {
throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
"param_null_not_accepted");
}
String query = "select count(*) as TOTALROWS from " + pEntityClass
.getSimpleName().toUpperCase() + " where " + pWhere + ";";
return evalRowCountByQuery(pAddParam, pEntityClass, query);
} | [
"@",
"Override",
"public",
"final",
"<",
"T",
">",
"Integer",
"evalRowCountWhere",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"pAddParam",
",",
"final",
"Class",
"<",
"T",
">",
"pEntityClass",
",",
"final",
"String",
"pWhere",
")",
"throws",
... | <p>Calculate total rows for pagination.</p>
@param <T> - type of business object,
@param pAddParam additional param
@param pEntityClass entity class
@param pWhere not null e.g. "ITSID > 33"
@return Integer row count
@throws Exception - an exception | [
"<p",
">",
"Calculate",
"total",
"rows",
"for",
"pagination",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/demidenko05/beigesoft-orm/blob/f1b2c70701a111741a436911ca24ef9d38eba0b9/src/main/java/org/beigesoft/orm/service/ASrvOrm.java#L537-L548 |
kiswanij/jk-util | src/main/java/com/jk/util/JKHttpUtil.java | JKHttpUtil.downloadFile | public static void downloadFile(final String fileUrl, final String localFile) throws IOException {
final URL url = new URL(fileUrl);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
final byte[] data = JKIOUtil.readStream(connection.getInputStream());
JKIOUtil.writeBytesToFile(data, localFile);
} | java | public static void downloadFile(final String fileUrl, final String localFile) throws IOException {
final URL url = new URL(fileUrl);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
final byte[] data = JKIOUtil.readStream(connection.getInputStream());
JKIOUtil.writeBytesToFile(data, localFile);
} | [
"public",
"static",
"void",
"downloadFile",
"(",
"final",
"String",
"fileUrl",
",",
"final",
"String",
"localFile",
")",
"throws",
"IOException",
"{",
"final",
"URL",
"url",
"=",
"new",
"URL",
"(",
"fileUrl",
")",
";",
"final",
"HttpURLConnection",
"connection... | Download file.
@param fileUrl the file url
@param localFile the local file
@throws IOException Signals that an I/O exception has occurred. | [
"Download",
"file",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKHttpUtil.java#L68-L73 |
matomo-org/piwik-java-tracker | src/main/java/org/piwik/java/tracking/PiwikRequest.java | PiwikRequest.setParameter | private void setParameter(String key, Object value){
if (value == null){
parameters.remove(key);
}
else{
parameters.put(key, value);
}
} | java | private void setParameter(String key, Object value){
if (value == null){
parameters.remove(key);
}
else{
parameters.put(key, value);
}
} | [
"private",
"void",
"setParameter",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"parameters",
".",
"remove",
"(",
"key",
")",
";",
"}",
"else",
"{",
"parameters",
".",
"put",
"(",
"key",
",",
"... | Set a stored parameter.
@param key the parameter's key
@param value the parameter's value. Removes the parameter if null | [
"Set",
"a",
"stored",
"parameter",
"."
] | train | https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L1757-L1764 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/ser/xml/JodaBeanXmlWriter.java | JodaBeanXmlWriter.writeToBuilder | @Deprecated
public StringBuilder writeToBuilder(Bean bean, boolean rootType) {
try {
write(bean, rootType, this.builder);
} catch (IOException ex) {
throw new IllegalStateException(ex);
}
return builder;
} | java | @Deprecated
public StringBuilder writeToBuilder(Bean bean, boolean rootType) {
try {
write(bean, rootType, this.builder);
} catch (IOException ex) {
throw new IllegalStateException(ex);
}
return builder;
} | [
"@",
"Deprecated",
"public",
"StringBuilder",
"writeToBuilder",
"(",
"Bean",
"bean",
",",
"boolean",
"rootType",
")",
"{",
"try",
"{",
"write",
"(",
"bean",
",",
"rootType",
",",
"this",
".",
"builder",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
"... | Writes the bean to the {@code StringBuilder}.
@param bean the bean to output, not null
@param rootType true to output the root type
@return the builder, not null
@deprecated Use {@link #write(Bean, boolean, Appendable)} | [
"Writes",
"the",
"bean",
"to",
"the",
"{",
"@code",
"StringBuilder",
"}",
"."
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/xml/JodaBeanXmlWriter.java#L160-L168 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java | JobStepsInner.getByVersion | public JobStepInner getByVersion(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) {
return getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName).toBlocking().single().body();
} | java | public JobStepInner getByVersion(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) {
return getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName).toBlocking().single().body();
} | [
"public",
"JobStepInner",
"getByVersion",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"jobAgentName",
",",
"String",
"jobName",
",",
"int",
"jobVersion",
",",
"String",
"stepName",
")",
"{",
"return",
"getByVersionWithServiceRespons... | Gets the specified version of a job step.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param jobName The name of the job.
@param jobVersion The version of the job to get.
@param stepName The name of the job step.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the JobStepInner object if successful. | [
"Gets",
"the",
"specified",
"version",
"of",
"a",
"job",
"step",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java#L256-L258 |
sahan/IckleBot | icklebot/src/main/java/com/lonepulse/icklebot/util/TypeUtils.java | TypeUtils.getAnnotation | public static <T extends Annotation> T getAnnotation(Object context, Class<T> annotation) {
Class<?> contextClass = context.getClass();
if(contextClass.isAnnotationPresent(annotation)) {
return contextClass.getAnnotation(annotation);
}
else {
return null;
}
} | java | public static <T extends Annotation> T getAnnotation(Object context, Class<T> annotation) {
Class<?> contextClass = context.getClass();
if(contextClass.isAnnotationPresent(annotation)) {
return contextClass.getAnnotation(annotation);
}
else {
return null;
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"getAnnotation",
"(",
"Object",
"context",
",",
"Class",
"<",
"T",
">",
"annotation",
")",
"{",
"Class",
"<",
"?",
">",
"contextClass",
"=",
"context",
".",
"getClass",
"(",
")",
";",
"if... | <p>Takes the target {@link IckleActivity} and finds the given
annotation (if any).</p>
@param injectorActivity
the {@link IckleActivity} whose metadata is searched
<br><br>
@param annotation
the {@link Class} of the {@link Annotation} to look for
<br><br>
@since 1.0.0 | [
"<p",
">",
"Takes",
"the",
"target",
"{",
"@link",
"IckleActivity",
"}",
"and",
"finds",
"the",
"given",
"annotation",
"(",
"if",
"any",
")",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/sahan/IckleBot/blob/a19003ceb3ad7c7ee508dc23a8cb31b5676aa499/icklebot/src/main/java/com/lonepulse/icklebot/util/TypeUtils.java#L58-L70 |
azkaban/azkaban | azkaban-common/src/main/java/azkaban/project/FlowLoaderUtils.java | FlowLoaderUtils.setPropsInYamlFile | public static void setPropsInYamlFile(final String path, final File flowFile, final Props prop) {
final DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(FlowStyle.BLOCK);
final NodeBean nodeBean = FlowLoaderUtils.setPropsInNodeBean(path, flowFile, prop);
try (final BufferedWriter writer = Files
.newBufferedWriter(flowFile.toPath(), StandardCharsets.UTF_8)) {
new Yaml(options).dump(nodeBean, writer);
} catch (final IOException e) {
throw new ProjectManagerException(
"Failed to set properties in flow file " + flowFile.getName());
}
} | java | public static void setPropsInYamlFile(final String path, final File flowFile, final Props prop) {
final DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(FlowStyle.BLOCK);
final NodeBean nodeBean = FlowLoaderUtils.setPropsInNodeBean(path, flowFile, prop);
try (final BufferedWriter writer = Files
.newBufferedWriter(flowFile.toPath(), StandardCharsets.UTF_8)) {
new Yaml(options).dump(nodeBean, writer);
} catch (final IOException e) {
throw new ProjectManagerException(
"Failed to set properties in flow file " + flowFile.getName());
}
} | [
"public",
"static",
"void",
"setPropsInYamlFile",
"(",
"final",
"String",
"path",
",",
"final",
"File",
"flowFile",
",",
"final",
"Props",
"prop",
")",
"{",
"final",
"DumperOptions",
"options",
"=",
"new",
"DumperOptions",
"(",
")",
";",
"options",
".",
"set... | Sets props in flow yaml file.
@param path the flow or job path delimited by ":", e.g. "flow:subflow1:subflow2:job3"
@param flowFile the flow yaml file
@param prop the props to set | [
"Sets",
"props",
"in",
"flow",
"yaml",
"file",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/project/FlowLoaderUtils.java#L61-L72 |
schallee/alib4j | jvm/src/main/java/net/darkmist/alib/jvm/JVMLauncher.java | JVMLauncher.getProcessBuilder | @Deprecated
public static ProcessBuilder getProcessBuilder(String mainClass, String...args) throws LauncherException
{
return getProcessBuilder(findClass(mainClass), Arrays.asList(args));
} | java | @Deprecated
public static ProcessBuilder getProcessBuilder(String mainClass, String...args) throws LauncherException
{
return getProcessBuilder(findClass(mainClass), Arrays.asList(args));
} | [
"@",
"Deprecated",
"public",
"static",
"ProcessBuilder",
"getProcessBuilder",
"(",
"String",
"mainClass",
",",
"String",
"...",
"args",
")",
"throws",
"LauncherException",
"{",
"return",
"getProcessBuilder",
"(",
"findClass",
"(",
"mainClass",
")",
",",
"Arrays",
... | Get a process loader for a JVM. The class path for the JVM
is computed based on the class loaders for the main class.
@param mainClass Fully qualified class name of the main class
@param args Additional command line parameters
@return ProcessBuilder that has not been started.
@deprecated This acquires the mainClass class by using the
{@link Thread#getContextClassLoader() thread context class loader}
or this class's class loader. Depending on where mainClass
was loaded from neither of these may work.
@see #getProcessBuilder(Class, String[]) | [
"Get",
"a",
"process",
"loader",
"for",
"a",
"JVM",
".",
"The",
"class",
"path",
"for",
"the",
"JVM",
"is",
"computed",
"based",
"on",
"the",
"class",
"loaders",
"for",
"the",
"main",
"class",
"."
] | train | https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/jvm/src/main/java/net/darkmist/alib/jvm/JVMLauncher.java#L169-L173 |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/core/internal/utils/BeanUtils.java | BeanUtils.getProperty | public static String getProperty(Object bean, String field) {
Object property = PropertyUtils.getProperty(bean, field);
if (property == null) {
return "null";
}
return property.toString();
} | java | public static String getProperty(Object bean, String field) {
Object property = PropertyUtils.getProperty(bean, field);
if (property == null) {
return "null";
}
return property.toString();
} | [
"public",
"static",
"String",
"getProperty",
"(",
"Object",
"bean",
",",
"String",
"field",
")",
"{",
"Object",
"property",
"=",
"PropertyUtils",
".",
"getProperty",
"(",
"bean",
",",
"field",
")",
";",
"if",
"(",
"property",
"==",
"null",
")",
"{",
"ret... | Get bean's property value and maps to String
@see io.katharsis.core.internal.utils.PropertyUtils#getProperty(Object, String)
@param bean bean to be accessed
@param field bean's field
@return bean's property value | [
"Get",
"bean",
"s",
"property",
"value",
"and",
"maps",
"to",
"String"
] | train | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/utils/BeanUtils.java#L17-L24 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_server_serviceName_ip_duration_POST | public OvhOrder dedicated_server_serviceName_ip_duration_POST(String serviceName, String duration, OvhIpBlockSizeEnum blockSize, OvhIpCountryEnum country, String organisationId, OvhIpTypeOrderableEnum type) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/ip/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "blockSize", blockSize);
addBody(o, "country", country);
addBody(o, "organisationId", organisationId);
addBody(o, "type", type);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder dedicated_server_serviceName_ip_duration_POST(String serviceName, String duration, OvhIpBlockSizeEnum blockSize, OvhIpCountryEnum country, String organisationId, OvhIpTypeOrderableEnum type) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/ip/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "blockSize", blockSize);
addBody(o, "country", country);
addBody(o, "organisationId", organisationId);
addBody(o, "type", type);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"dedicated_server_serviceName_ip_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhIpBlockSizeEnum",
"blockSize",
",",
"OvhIpCountryEnum",
"country",
",",
"String",
"organisationId",
",",
"OvhIpTypeOrderableEnum",
"type",
... | Create order
REST: POST /order/dedicated/server/{serviceName}/ip/{duration}
@param blockSize [required] IP block size
@param organisationId [required] Your organisation id to add on block informations
@param country [required] IP localization
@param type [required] The type of IP
@param serviceName [required] The internal name of your dedicated server
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2432-L2442 |
google/closure-compiler | src/com/google/javascript/jscomp/MustBeReachingVariableDef.java | MustBeReachingVariableDef.computeDependence | private void computeDependence(final Definition def, Node rValue) {
NodeTraversal.traverse(
compiler,
rValue,
new AbstractCfgNodeTraversalCallback() {
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
if (n.isName()) {
Var dep = allVarsInFn.get(n.getString());
if (dep == null) {
def.unknownDependencies = true;
} else {
def.depends.add(dep);
}
}
}
});
} | java | private void computeDependence(final Definition def, Node rValue) {
NodeTraversal.traverse(
compiler,
rValue,
new AbstractCfgNodeTraversalCallback() {
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
if (n.isName()) {
Var dep = allVarsInFn.get(n.getString());
if (dep == null) {
def.unknownDependencies = true;
} else {
def.depends.add(dep);
}
}
}
});
} | [
"private",
"void",
"computeDependence",
"(",
"final",
"Definition",
"def",
",",
"Node",
"rValue",
")",
"{",
"NodeTraversal",
".",
"traverse",
"(",
"compiler",
",",
"rValue",
",",
"new",
"AbstractCfgNodeTraversalCallback",
"(",
")",
"{",
"@",
"Override",
"public"... | Computes all the local variables that rValue reads from and store that
in the def's depends set. | [
"Computes",
"all",
"the",
"local",
"variables",
"that",
"rValue",
"reads",
"from",
"and",
"store",
"that",
"in",
"the",
"def",
"s",
"depends",
"set",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/MustBeReachingVariableDef.java#L442-L459 |
jenkinsci/jenkins | core/src/main/java/jenkins/model/Jenkins.java | Jenkins.getRootUrl | public @Nullable String getRootUrl() throws IllegalStateException {
final JenkinsLocationConfiguration config = JenkinsLocationConfiguration.get();
if (config == null) {
// Try to get standard message if possible
final Jenkins j = Jenkins.getInstance();
throw new IllegalStateException("Jenkins instance " + j + " has been successfully initialized, but JenkinsLocationConfiguration is undefined.");
}
String url = config.getUrl();
if(url!=null) {
return Util.ensureEndsWith(url,"/");
}
StaplerRequest req = Stapler.getCurrentRequest();
if(req!=null)
return getRootUrlFromRequest();
return null;
} | java | public @Nullable String getRootUrl() throws IllegalStateException {
final JenkinsLocationConfiguration config = JenkinsLocationConfiguration.get();
if (config == null) {
// Try to get standard message if possible
final Jenkins j = Jenkins.getInstance();
throw new IllegalStateException("Jenkins instance " + j + " has been successfully initialized, but JenkinsLocationConfiguration is undefined.");
}
String url = config.getUrl();
if(url!=null) {
return Util.ensureEndsWith(url,"/");
}
StaplerRequest req = Stapler.getCurrentRequest();
if(req!=null)
return getRootUrlFromRequest();
return null;
} | [
"public",
"@",
"Nullable",
"String",
"getRootUrl",
"(",
")",
"throws",
"IllegalStateException",
"{",
"final",
"JenkinsLocationConfiguration",
"config",
"=",
"JenkinsLocationConfiguration",
".",
"get",
"(",
")",
";",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"... | Gets the absolute URL of Jenkins, such as {@code http://localhost/jenkins/}.
<p>
This method first tries to use the manually configured value, then
fall back to {@link #getRootUrlFromRequest}.
It is done in this order so that it can work correctly even in the face
of a reverse proxy.
@return {@code null} if this parameter is not configured by the user and the calling thread is not in an HTTP request;
otherwise the returned URL will always have the trailing {@code /}
@throws IllegalStateException {@link JenkinsLocationConfiguration} cannot be retrieved.
Jenkins instance may be not ready, or there is an extension loading glitch.
@since 1.66
@see <a href="https://wiki.jenkins-ci.org/display/JENKINS/Hyperlinks+in+HTML">Hyperlinks in HTML</a> | [
"Gets",
"the",
"absolute",
"URL",
"of",
"Jenkins",
"such",
"as",
"{",
"@code",
"http",
":",
"//",
"localhost",
"/",
"jenkins",
"/",
"}",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/Jenkins.java#L2272-L2287 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/view/ExpandableGridView.java | ExpandableGridView.getPackedPosition | private int getPackedPosition(final int position) {
if (position < getHeaderViewsCount()) {
return position;
} else {
Pair<Integer, Integer> pair = getItemPosition(position - getHeaderViewsCount());
int groupIndex = pair.first;
int childIndex = pair.second;
if (childIndex == -1 && groupIndex == -1) {
int childCount = 0;
for (int i = 0; i < getExpandableListAdapter().getGroupCount(); i++) {
childCount += getExpandableListAdapter().getChildrenCount(i);
}
return getHeaderViewsCount() + getExpandableListAdapter().getGroupCount() +
childCount + position - (getHeaderViewsCount() + adapter.getCount());
} else if (childIndex != -1) {
return getPackedChildPosition(groupIndex, childIndex);
} else {
return getPackedGroupPosition(groupIndex);
}
}
} | java | private int getPackedPosition(final int position) {
if (position < getHeaderViewsCount()) {
return position;
} else {
Pair<Integer, Integer> pair = getItemPosition(position - getHeaderViewsCount());
int groupIndex = pair.first;
int childIndex = pair.second;
if (childIndex == -1 && groupIndex == -1) {
int childCount = 0;
for (int i = 0; i < getExpandableListAdapter().getGroupCount(); i++) {
childCount += getExpandableListAdapter().getChildrenCount(i);
}
return getHeaderViewsCount() + getExpandableListAdapter().getGroupCount() +
childCount + position - (getHeaderViewsCount() + adapter.getCount());
} else if (childIndex != -1) {
return getPackedChildPosition(groupIndex, childIndex);
} else {
return getPackedGroupPosition(groupIndex);
}
}
} | [
"private",
"int",
"getPackedPosition",
"(",
"final",
"int",
"position",
")",
"{",
"if",
"(",
"position",
"<",
"getHeaderViewsCount",
"(",
")",
")",
"{",
"return",
"position",
";",
"}",
"else",
"{",
"Pair",
"<",
"Integer",
",",
"Integer",
">",
"pair",
"="... | Returns the packed position of an item, which corresponds to a specific position.
@param position
The position of the item, whose packed position should be returned, as an {@link
Integer} value
@return The packed position, which corresponds to the given position, as an {@link Integer}
value | [
"Returns",
"the",
"packed",
"position",
"of",
"an",
"item",
"which",
"corresponds",
"to",
"a",
"specific",
"position",
"."
] | train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/view/ExpandableGridView.java#L397-L420 |
wcm-io/wcm-io-wcm | commons/src/main/java/io/wcm/wcm/commons/util/RunMode.java | RunMode.disableIfNotAuthor | @Deprecated
public static boolean disableIfNotAuthor(Set<String> runModes, ComponentContext componentContext, Logger log) {
return disableIfNoRunModeActive(runModes, new String[] {
AUTHOR
}, componentContext, log);
} | java | @Deprecated
public static boolean disableIfNotAuthor(Set<String> runModes, ComponentContext componentContext, Logger log) {
return disableIfNoRunModeActive(runModes, new String[] {
AUTHOR
}, componentContext, log);
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"disableIfNotAuthor",
"(",
"Set",
"<",
"String",
">",
"runModes",
",",
"ComponentContext",
"componentContext",
",",
"Logger",
"log",
")",
"{",
"return",
"disableIfNoRunModeActive",
"(",
"runModes",
",",
"new",
"Str... | Use this to disable a component if the runmode "author" is not active. Component activation status is logged
with DEBUG level.
This method is a replacement for the
<code>com.day.cq.commons.RunModeUtil#disableIfNoRunModeActive(RunMode, String[], ComponentContext, Logger)</code>
method which is deprecated.
@param runModes Run modes
@param componentContext OSGI component context
@param log Logger
@return true if component was disabled
@deprecated Instead of directly using the run modes, it is better to make the component in question require a
configuration (see OSGI Declarative Services Spec: configuration policy). In this case, a component
gets only active if a configuration is available. Such a configuration can be put into the repository
for the specific run mode. | [
"Use",
"this",
"to",
"disable",
"a",
"component",
"if",
"the",
"runmode",
"author",
"is",
"not",
"active",
".",
"Component",
"activation",
"status",
"is",
"logged",
"with",
"DEBUG",
"level",
".",
"This",
"method",
"is",
"a",
"replacement",
"for",
"the",
"<... | train | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/commons/src/main/java/io/wcm/wcm/commons/util/RunMode.java#L165-L170 |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.getString | public static String getString(InputStream in, Charset charset, boolean isGetCharsetFromContent) throws IOException {
final byte[] contentBytes = IoUtil.readBytes(in);
return getString(contentBytes, charset, isGetCharsetFromContent);
} | java | public static String getString(InputStream in, Charset charset, boolean isGetCharsetFromContent) throws IOException {
final byte[] contentBytes = IoUtil.readBytes(in);
return getString(contentBytes, charset, isGetCharsetFromContent);
} | [
"public",
"static",
"String",
"getString",
"(",
"InputStream",
"in",
",",
"Charset",
"charset",
",",
"boolean",
"isGetCharsetFromContent",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"contentBytes",
"=",
"IoUtil",
".",
"readBytes",
"(",
"in",
... | 从流中读取内容<br>
首先尝试使用charset编码读取内容(如果为空默认UTF-8),如果isGetCharsetFromContent为true,则通过正则在正文中获取编码信息,转换为指定编码;
@param in 输入流
@param charset 字符集
@param isGetCharsetFromContent 是否从返回内容中获得编码信息
@return 内容
@throws IOException IO异常 | [
"从流中读取内容<br",
">",
"首先尝试使用charset编码读取内容(如果为空默认UTF",
"-",
"8),如果isGetCharsetFromContent为true,则通过正则在正文中获取编码信息,转换为指定编码;"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L679-L682 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bos/BosClient.java | BosClient.appendObject | public AppendObjectResponse appendObject(String bucketName, String key, InputStream input) {
return this.appendObject(new AppendObjectRequest(bucketName, key, input));
} | java | public AppendObjectResponse appendObject(String bucketName, String key, InputStream input) {
return this.appendObject(new AppendObjectRequest(bucketName, key, input));
} | [
"public",
"AppendObjectResponse",
"appendObject",
"(",
"String",
"bucketName",
",",
"String",
"key",
",",
"InputStream",
"input",
")",
"{",
"return",
"this",
".",
"appendObject",
"(",
"new",
"AppendObjectRequest",
"(",
"bucketName",
",",
"key",
",",
"input",
")"... | Uploads the appendable input stream to Bos under the specified bucket and key name.
@param bucketName The name of an existing bucket, to which you have Write permission.
@param key The key under which to store the specified file.
@param input The input stream containing the value to be uploaded to Bos.
@return An AppendObjectResponse object containing the information returned by Bos for the newly created object. | [
"Uploads",
"the",
"appendable",
"input",
"stream",
"to",
"Bos",
"under",
"the",
"specified",
"bucket",
"and",
"key",
"name",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L1765-L1767 |
jMotif/SAX | src/main/java/net/seninp/jmotif/distance/EuclideanDistance.java | EuclideanDistance.normalizedDistance | public double normalizedDistance(double[] point1, double[] point2) throws Exception {
return Math.sqrt(distance2(point1, point2)) / point1.length;
} | java | public double normalizedDistance(double[] point1, double[] point2) throws Exception {
return Math.sqrt(distance2(point1, point2)) / point1.length;
} | [
"public",
"double",
"normalizedDistance",
"(",
"double",
"[",
"]",
"point1",
",",
"double",
"[",
"]",
"point2",
")",
"throws",
"Exception",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"distance2",
"(",
"point1",
",",
"point2",
")",
")",
"/",
"point1",
".",
... | Calculates the Normalized Euclidean distance between two points.
@param point1 The first point.
@param point2 The second point.
@return The Euclidean distance.
@throws Exception In the case of error. | [
"Calculates",
"the",
"Normalized",
"Euclidean",
"distance",
"between",
"two",
"points",
"."
] | train | https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/distance/EuclideanDistance.java#L140-L142 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.accessRestriction_u2f_id_PUT | public void accessRestriction_u2f_id_PUT(Long id, OvhU2FAccount body) throws IOException {
String qPath = "/me/accessRestriction/u2f/{id}";
StringBuilder sb = path(qPath, id);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void accessRestriction_u2f_id_PUT(Long id, OvhU2FAccount body) throws IOException {
String qPath = "/me/accessRestriction/u2f/{id}";
StringBuilder sb = path(qPath, id);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"accessRestriction_u2f_id_PUT",
"(",
"Long",
"id",
",",
"OvhU2FAccount",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/accessRestriction/u2f/{id}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"id",
")... | Alter this object properties
REST: PUT /me/accessRestriction/u2f/{id}
@param body [required] New object properties
@param id [required] The Id of the restriction | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L4244-L4248 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.