repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/bzip/BlockSort.java | BlockSort.vswap | private static void vswap(int[] fmap, int p1, int p2, int n) {
n += p1;
while (p1 < n) {
int t = fmap[p1];
fmap[p1++] = fmap[p2];
fmap[p2++] = t;
}
} | java | private static void vswap(int[] fmap, int p1, int p2, int n) {
n += p1;
while (p1 < n) {
int t = fmap[p1];
fmap[p1++] = fmap[p2];
fmap[p2++] = t;
}
} | [
"private",
"static",
"void",
"vswap",
"(",
"int",
"[",
"]",
"fmap",
",",
"int",
"p1",
",",
"int",
"p2",
",",
"int",
"n",
")",
"{",
"n",
"+=",
"p1",
";",
"while",
"(",
"p1",
"<",
"n",
")",
"{",
"int",
"t",
"=",
"fmap",
"[",
"p1",
"]",
";",
... | /*--
LBZ2: The following is an implementation of
an elegant 3-way quicksort for strings,
described in a paper "Fast Algorithms for
Sorting and Searching Strings", by Robert
Sedgewick and Jon L. Bentley.
-- | [
"/",
"*",
"--",
"LBZ2",
":",
"The",
"following",
"is",
"an",
"implementation",
"of",
"an",
"elegant",
"3",
"-",
"way",
"quicksort",
"for",
"strings",
"described",
"in",
"a",
"paper",
"Fast",
"Algorithms",
"for",
"Sorting",
"and",
"Searching",
"Strings",
"b... | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/bzip/BlockSort.java#L790-L797 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.zone_zoneName_dynHost_record_id_GET | public OvhDynHostRecord zone_zoneName_dynHost_record_id_GET(String zoneName, Long id) throws IOException {
String qPath = "/domain/zone/{zoneName}/dynHost/record/{id}";
StringBuilder sb = path(qPath, zoneName, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDynHostRecord.class);
} | java | public OvhDynHostRecord zone_zoneName_dynHost_record_id_GET(String zoneName, Long id) throws IOException {
String qPath = "/domain/zone/{zoneName}/dynHost/record/{id}";
StringBuilder sb = path(qPath, zoneName, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDynHostRecord.class);
} | [
"public",
"OvhDynHostRecord",
"zone_zoneName_dynHost_record_id_GET",
"(",
"String",
"zoneName",
",",
"Long",
"id",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/zone/{zoneName}/dynHost/record/{id}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
... | Get this object properties
REST: GET /domain/zone/{zoneName}/dynHost/record/{id}
@param zoneName [required] The internal name of your zone
@param id [required] Id of the object | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L397-L402 |
JakeWharton/NineOldAndroids | library/src/com/nineoldandroids/animation/ObjectAnimator.java | ObjectAnimator.ofFloat | public static <T> ObjectAnimator ofFloat(T target, Property<T, Float> property,
float... values) {
ObjectAnimator anim = new ObjectAnimator(target, property);
anim.setFloatValues(values);
return anim;
} | java | public static <T> ObjectAnimator ofFloat(T target, Property<T, Float> property,
float... values) {
ObjectAnimator anim = new ObjectAnimator(target, property);
anim.setFloatValues(values);
return anim;
} | [
"public",
"static",
"<",
"T",
">",
"ObjectAnimator",
"ofFloat",
"(",
"T",
"target",
",",
"Property",
"<",
"T",
",",
"Float",
">",
"property",
",",
"float",
"...",
"values",
")",
"{",
"ObjectAnimator",
"anim",
"=",
"new",
"ObjectAnimator",
"(",
"target",
... | Constructs and returns an ObjectAnimator that animates between float values. A single
value implies that that value is the one being animated to. Two values imply a starting
and ending values. More than two values imply a starting value, values to animate through
along the way, and an ending value (these values will be distributed evenly across
the duration of the animation).
@param target The object whose property is to be animated.
@param property The property being animated.
@param values A set of values that the animation will animate between over time.
@return An ObjectAnimator object that is set up to animate between the given values. | [
"Constructs",
"and",
"returns",
"an",
"ObjectAnimator",
"that",
"animates",
"between",
"float",
"values",
".",
"A",
"single",
"value",
"implies",
"that",
"that",
"value",
"is",
"the",
"one",
"being",
"animated",
"to",
".",
"Two",
"values",
"imply",
"a",
"sta... | train | https://github.com/JakeWharton/NineOldAndroids/blob/d582f0ec8e79013e9fa96c07986160b52e662e63/library/src/com/nineoldandroids/animation/ObjectAnimator.java#L248-L253 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/svm/SupportVectorLearner.java | SupportVectorLearner.setCacheSize | public void setCacheSize(long N, long bytes)
{
int DS = Double.SIZE/8;
bytes /= DS;//Gets the total number of doubles we can store
if(bytes > N*N/2)
setCacheMode(CacheMode.FULL);
else//How many rows can we handle?
{
//guessing 2 work overhead for object header + one pointer reference to the array, asusming 64 bit
long bytesPerRow = N*DS+3*Long.SIZE/8;
int rows = (int) Math.min(Math.max(1, bytes/bytesPerRow), Integer.MAX_VALUE);
if(rows > 25)
setCacheValue(rows);
else//why bother? just use NONE
setCacheMode(CacheMode.NONE);
}
} | java | public void setCacheSize(long N, long bytes)
{
int DS = Double.SIZE/8;
bytes /= DS;//Gets the total number of doubles we can store
if(bytes > N*N/2)
setCacheMode(CacheMode.FULL);
else//How many rows can we handle?
{
//guessing 2 work overhead for object header + one pointer reference to the array, asusming 64 bit
long bytesPerRow = N*DS+3*Long.SIZE/8;
int rows = (int) Math.min(Math.max(1, bytes/bytesPerRow), Integer.MAX_VALUE);
if(rows > 25)
setCacheValue(rows);
else//why bother? just use NONE
setCacheMode(CacheMode.NONE);
}
} | [
"public",
"void",
"setCacheSize",
"(",
"long",
"N",
",",
"long",
"bytes",
")",
"{",
"int",
"DS",
"=",
"Double",
".",
"SIZE",
"/",
"8",
";",
"bytes",
"/=",
"DS",
";",
"//Gets the total number of doubles we can store",
"if",
"(",
"bytes",
">",
"N",
"*",
"N... | Sets the {@link #setCacheValue(int) cache value} to one that will use the
specified amount of memory. If the amount of memory specified is great
enough, this method will automatically set the
{@link #setCacheMode(jsat.classifiers.svm.SupportVectorLearner.CacheMode)
cache mode} to {@link CacheMode#FULL}.
@param N the number of data points
@param bytes the number of bytes of memory to make the cache | [
"Sets",
"the",
"{",
"@link",
"#setCacheValue",
"(",
"int",
")",
"cache",
"value",
"}",
"to",
"one",
"that",
"will",
"use",
"the",
"specified",
"amount",
"of",
"memory",
".",
"If",
"the",
"amount",
"of",
"memory",
"specified",
"is",
"great",
"enough",
"th... | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/SupportVectorLearner.java#L219-L235 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroupJComponentBuilder.java | CommandGroupJComponentBuilder.buildChildModel | protected final Object buildChildModel(Object parentModel, AbstractCommand command, int level)
{
return buildChildComponent((JComponent) parentModel, command, level);
} | java | protected final Object buildChildModel(Object parentModel, AbstractCommand command, int level)
{
return buildChildComponent((JComponent) parentModel, command, level);
} | [
"protected",
"final",
"Object",
"buildChildModel",
"(",
"Object",
"parentModel",
",",
"AbstractCommand",
"command",
",",
"int",
"level",
")",
"{",
"return",
"buildChildComponent",
"(",
"(",
"JComponent",
")",
"parentModel",
",",
"command",
",",
"level",
")",
";"... | Implementation wrapping around the
{@link #buildChildComponent(JComponent, AbstractCommand, int)} | [
"Implementation",
"wrapping",
"around",
"the",
"{"
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroupJComponentBuilder.java#L87-L90 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/BloomFilter.java | BloomFilter.getFalsePositiveRate | public double getFalsePositiveRate(int elements) {
return pow(1 - pow(E, -1.0 * (hashFuncs * elements) / (data.length * 8)), hashFuncs);
} | java | public double getFalsePositiveRate(int elements) {
return pow(1 - pow(E, -1.0 * (hashFuncs * elements) / (data.length * 8)), hashFuncs);
} | [
"public",
"double",
"getFalsePositiveRate",
"(",
"int",
"elements",
")",
"{",
"return",
"pow",
"(",
"1",
"-",
"pow",
"(",
"E",
",",
"-",
"1.0",
"*",
"(",
"hashFuncs",
"*",
"elements",
")",
"/",
"(",
"data",
".",
"length",
"*",
"8",
")",
")",
",",
... | Returns the theoretical false positive rate of this filter if were to contain the given number of elements. | [
"Returns",
"the",
"theoretical",
"false",
"positive",
"rate",
"of",
"this",
"filter",
"if",
"were",
"to",
"contain",
"the",
"given",
"number",
"of",
"elements",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/BloomFilter.java#L129-L131 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/res/XSLMessages.java | XSLMessages.createMessage | public static final String createMessage(String msgKey, Object args[]) //throws Exception
{
// BEGIN android-changed
// don't localize resources
return createMsg(XSLTBundle, msgKey, args);
// END android-changed
} | java | public static final String createMessage(String msgKey, Object args[]) //throws Exception
{
// BEGIN android-changed
// don't localize resources
return createMsg(XSLTBundle, msgKey, args);
// END android-changed
} | [
"public",
"static",
"final",
"String",
"createMessage",
"(",
"String",
"msgKey",
",",
"Object",
"args",
"[",
"]",
")",
"//throws Exception",
"{",
"// BEGIN android-changed",
"// don't localize resources",
"return",
"createMsg",
"(",
"XSLTBundle",
",",
"msgKey",
",... | Creates a message from the specified key and replacement
arguments, localized to the given locale.
@param msgKey The key for the message text.
@param args The arguments to be used as replacement text
in the message created.
@return The formatted message string. | [
"Creates",
"a",
"message",
"from",
"the",
"specified",
"key",
"and",
"replacement",
"arguments",
"localized",
"to",
"the",
"given",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/res/XSLMessages.java#L48-L54 |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/conventions/DocumentConventions.java | DocumentConventions.generateDocumentId | @SuppressWarnings("unchecked")
public String generateDocumentId(String databaseName, Object entity) {
Class<?> clazz = entity.getClass();
for (Tuple<Class, BiFunction<String, Object, String>> listOfRegisteredIdConvention : _listOfRegisteredIdConventions) {
if (listOfRegisteredIdConvention.first.isAssignableFrom(clazz)) {
return listOfRegisteredIdConvention.second.apply(databaseName, entity);
}
}
return _documentIdGenerator.apply(databaseName, entity);
} | java | @SuppressWarnings("unchecked")
public String generateDocumentId(String databaseName, Object entity) {
Class<?> clazz = entity.getClass();
for (Tuple<Class, BiFunction<String, Object, String>> listOfRegisteredIdConvention : _listOfRegisteredIdConventions) {
if (listOfRegisteredIdConvention.first.isAssignableFrom(clazz)) {
return listOfRegisteredIdConvention.second.apply(databaseName, entity);
}
}
return _documentIdGenerator.apply(databaseName, entity);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"String",
"generateDocumentId",
"(",
"String",
"databaseName",
",",
"Object",
"entity",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"entity",
".",
"getClass",
"(",
")",
";",
"for",
"(",
"Tup... | Generates the document id.
@param databaseName Database name
@param entity Entity
@return document id | [
"Generates",
"the",
"document",
"id",
"."
] | train | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/conventions/DocumentConventions.java#L354-L365 |
nats-io/java-nats | src/main/java/io/nats/client/impl/NatsDispatcher.java | NatsDispatcher.subscribeImpl | Dispatcher subscribeImpl(String subject, String queueName) {
if (!this.running.get()) {
throw new IllegalStateException("Dispatcher is closed");
}
if (this.isDraining()) {
throw new IllegalStateException("Dispatcher is draining");
}
NatsSubscription sub = subscriptions.get(subject);
if (sub == null) {
sub = connection.createSubscription(subject, queueName, this);
NatsSubscription actual = subscriptions.putIfAbsent(subject, sub);
if (actual != null) {
this.connection.unsubscribe(sub, -1); // Could happen on very bad timing
}
}
return this;
} | java | Dispatcher subscribeImpl(String subject, String queueName) {
if (!this.running.get()) {
throw new IllegalStateException("Dispatcher is closed");
}
if (this.isDraining()) {
throw new IllegalStateException("Dispatcher is draining");
}
NatsSubscription sub = subscriptions.get(subject);
if (sub == null) {
sub = connection.createSubscription(subject, queueName, this);
NatsSubscription actual = subscriptions.putIfAbsent(subject, sub);
if (actual != null) {
this.connection.unsubscribe(sub, -1); // Could happen on very bad timing
}
}
return this;
} | [
"Dispatcher",
"subscribeImpl",
"(",
"String",
"subject",
",",
"String",
"queueName",
")",
"{",
"if",
"(",
"!",
"this",
".",
"running",
".",
"get",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Dispatcher is closed\"",
")",
";",
"}",
... | Assumes the subj/queuename checks are done, does check for closed status | [
"Assumes",
"the",
"subj",
"/",
"queuename",
"checks",
"are",
"done",
"does",
"check",
"for",
"closed",
"status"
] | train | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/impl/NatsDispatcher.java#L172-L192 |
CloudSlang/cs-actions | cs-date-time/src/main/java/io/cloudslang/content/datetime/utils/DateTimeUtils.java | DateTimeUtils.isDateValid | public static boolean isDateValid(String date, Locale locale) {
try {
DateFormat format = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, locale);
format.parse(date);
return true;
} catch (ParseException e) {
return false;
}
} | java | public static boolean isDateValid(String date, Locale locale) {
try {
DateFormat format = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, locale);
format.parse(date);
return true;
} catch (ParseException e) {
return false;
}
} | [
"public",
"static",
"boolean",
"isDateValid",
"(",
"String",
"date",
",",
"Locale",
"locale",
")",
"{",
"try",
"{",
"DateFormat",
"format",
"=",
"DateFormat",
".",
"getDateTimeInstance",
"(",
"DateFormat",
".",
"DEFAULT",
",",
"DateFormat",
".",
"DEFAULT",
","... | Because the date passed as argument can be in java format, and because not all formats are compatible
with joda-time, this method checks if the date string is valid with java. In this way we can use the
proper DateTime without changing the output.
@param date date passed as argument
@return true if is a java date | [
"Because",
"the",
"date",
"passed",
"as",
"argument",
"can",
"be",
"in",
"java",
"format",
"and",
"because",
"not",
"all",
"formats",
"are",
"compatible",
"with",
"joda",
"-",
"time",
"this",
"method",
"checks",
"if",
"the",
"date",
"string",
"is",
"valid"... | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-date-time/src/main/java/io/cloudslang/content/datetime/utils/DateTimeUtils.java#L51-L59 |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/EvenMoreObjects.java | EvenMoreObjects.make | public static <B, C> @NonNull C make(final @NonNull B builder, final @NonNull Consumer<B> consumer, final @NonNull Function<B, C> creator) {
return creator.apply(make(builder, consumer));
} | java | public static <B, C> @NonNull C make(final @NonNull B builder, final @NonNull Consumer<B> consumer, final @NonNull Function<B, C> creator) {
return creator.apply(make(builder, consumer));
} | [
"public",
"static",
"<",
"B",
",",
"C",
">",
"@",
"NonNull",
"C",
"make",
"(",
"final",
"@",
"NonNull",
"B",
"builder",
",",
"final",
"@",
"NonNull",
"Consumer",
"<",
"B",
">",
"consumer",
",",
"final",
"@",
"NonNull",
"Function",
"<",
"B",
",",
"C... | Configures {@code builder} using {@code consumer} and then builds it using {@code creator}.
@param builder the builder
@param consumer the consumer
@param creator the creator
@param <B> the builder type
@param <C> the creator type
@return the value | [
"Configures",
"{",
"@code",
"builder",
"}",
"using",
"{",
"@code",
"consumer",
"}",
"and",
"then",
"builds",
"it",
"using",
"{",
"@code",
"creator",
"}",
"."
] | train | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/EvenMoreObjects.java#L75-L77 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java | ProcessGroovyMethods.waitForProcessOutput | public static void waitForProcessOutput(Process self, Appendable output, Appendable error) {
Thread tout = consumeProcessOutputStream(self, output);
Thread terr = consumeProcessErrorStream(self, error);
try { tout.join(); } catch (InterruptedException ignore) {}
try { terr.join(); } catch (InterruptedException ignore) {}
try { self.waitFor(); } catch (InterruptedException ignore) {}
closeStreams(self);
} | java | public static void waitForProcessOutput(Process self, Appendable output, Appendable error) {
Thread tout = consumeProcessOutputStream(self, output);
Thread terr = consumeProcessErrorStream(self, error);
try { tout.join(); } catch (InterruptedException ignore) {}
try { terr.join(); } catch (InterruptedException ignore) {}
try { self.waitFor(); } catch (InterruptedException ignore) {}
closeStreams(self);
} | [
"public",
"static",
"void",
"waitForProcessOutput",
"(",
"Process",
"self",
",",
"Appendable",
"output",
",",
"Appendable",
"error",
")",
"{",
"Thread",
"tout",
"=",
"consumeProcessOutputStream",
"(",
"self",
",",
"output",
")",
";",
"Thread",
"terr",
"=",
"co... | Gets the output and error streams from a process and reads them
to keep the process from blocking due to a full output buffer.
The processed stream data is appended to the supplied Appendable.
For this, two Threads are started, but join()ed, so we wait.
As implied by the waitFor... name, we also wait until we finish
as well. Finally, the input, output and error streams are closed.
@param self a Process
@param output an Appendable to capture the process stdout
@param error an Appendable to capture the process stderr
@since 1.7.5 | [
"Gets",
"the",
"output",
"and",
"error",
"streams",
"from",
"a",
"process",
"and",
"reads",
"them",
"to",
"keep",
"the",
"process",
"from",
"blocking",
"due",
"to",
"a",
"full",
"output",
"buffer",
".",
"The",
"processed",
"stream",
"data",
"is",
"appended... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java#L241-L248 |
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor | MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/facet/FacetBuilder.java | FacetBuilder.setItemsList | public FacetBuilder setItemsList(Map<String, String> items) {
ArrayList<FacetWidgetItem> facetWidgetItems = new ArrayList<FacetWidgetItem>();
for (String key : items.keySet()){
String label = items.get(key);
FacetWidgetItem facetWidgetItem = new FacetWidgetItem(key, label);
facetWidgetItems.add(facetWidgetItem);
}
this.listItems = facetWidgetItems;
return this;
} | java | public FacetBuilder setItemsList(Map<String, String> items) {
ArrayList<FacetWidgetItem> facetWidgetItems = new ArrayList<FacetWidgetItem>();
for (String key : items.keySet()){
String label = items.get(key);
FacetWidgetItem facetWidgetItem = new FacetWidgetItem(key, label);
facetWidgetItems.add(facetWidgetItem);
}
this.listItems = facetWidgetItems;
return this;
} | [
"public",
"FacetBuilder",
"setItemsList",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"items",
")",
"{",
"ArrayList",
"<",
"FacetWidgetItem",
">",
"facetWidgetItems",
"=",
"new",
"ArrayList",
"<",
"FacetWidgetItem",
">",
"(",
")",
";",
"for",
"(",
"String... | Takes a map of value to labels and the unique name of the list
@param items map of value to labels
@return a Builder instance to allow chaining | [
"Takes",
"a",
"map",
"of",
"value",
"to",
"labels",
"and",
"the",
"unique",
"name",
"of",
"the",
"list"
] | train | https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/facet/FacetBuilder.java#L113-L123 |
WolfgangFahl/Mediawiki-Japi | src/main/java/com/bitplan/mediawiki/japi/Mediawiki.java | Mediawiki.getResponse | public ClientResponse getResponse(String url, Method method)
throws Exception {
Builder resource = getResource(url);
ClientResponse response = null;
switch (method) {
case Get:
response = resource.get(ClientResponse.class);
break;
case Post:
response = resource.post(ClientResponse.class);
break;
case Head:
response = resource.head();
break;
case Put:
response = resource.put(ClientResponse.class);
break;
}
return response;
} | java | public ClientResponse getResponse(String url, Method method)
throws Exception {
Builder resource = getResource(url);
ClientResponse response = null;
switch (method) {
case Get:
response = resource.get(ClientResponse.class);
break;
case Post:
response = resource.post(ClientResponse.class);
break;
case Head:
response = resource.head();
break;
case Put:
response = resource.put(ClientResponse.class);
break;
}
return response;
} | [
"public",
"ClientResponse",
"getResponse",
"(",
"String",
"url",
",",
"Method",
"method",
")",
"throws",
"Exception",
"{",
"Builder",
"resource",
"=",
"getResource",
"(",
"url",
")",
";",
"ClientResponse",
"response",
"=",
"null",
";",
"switch",
"(",
"method",... | get a response for the given url and method
@param url
@param method
@return
@throws Exception | [
"get",
"a",
"response",
"for",
"the",
"given",
"url",
"and",
"method"
] | train | https://github.com/WolfgangFahl/Mediawiki-Japi/blob/78d0177ebfe02eb05da5550839727861f1e888a5/src/main/java/com/bitplan/mediawiki/japi/Mediawiki.java#L333-L352 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/RandomMatrices_ZDRM.java | RandomMatrices_ZDRM.hermitianPosDef | public static ZMatrixRMaj hermitianPosDef(int width, Random rand) {
// This is not formally proven to work. It just seems to work.
ZMatrixRMaj a = RandomMatrices_ZDRM.rectangle(width,1,rand);
ZMatrixRMaj b = new ZMatrixRMaj(1,width);
ZMatrixRMaj c = new ZMatrixRMaj(width,width);
CommonOps_ZDRM.transposeConjugate(a,b);
CommonOps_ZDRM.mult(a, b, c);
for( int i = 0; i < width; i++ ) {
c.data[2*(i*width+i)] += 1;
}
return c;
} | java | public static ZMatrixRMaj hermitianPosDef(int width, Random rand) {
// This is not formally proven to work. It just seems to work.
ZMatrixRMaj a = RandomMatrices_ZDRM.rectangle(width,1,rand);
ZMatrixRMaj b = new ZMatrixRMaj(1,width);
ZMatrixRMaj c = new ZMatrixRMaj(width,width);
CommonOps_ZDRM.transposeConjugate(a,b);
CommonOps_ZDRM.mult(a, b, c);
for( int i = 0; i < width; i++ ) {
c.data[2*(i*width+i)] += 1;
}
return c;
} | [
"public",
"static",
"ZMatrixRMaj",
"hermitianPosDef",
"(",
"int",
"width",
",",
"Random",
"rand",
")",
"{",
"// This is not formally proven to work. It just seems to work.",
"ZMatrixRMaj",
"a",
"=",
"RandomMatrices_ZDRM",
".",
"rectangle",
"(",
"width",
",",
"1",
",",
... | Creates a random symmetric positive definite matrix.
@param width The width of the square matrix it returns.
@param rand Random number generator used to make the matrix.
@return The random symmetric positive definite matrix. | [
"Creates",
"a",
"random",
"symmetric",
"positive",
"definite",
"matrix",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/RandomMatrices_ZDRM.java#L110-L124 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotoUtils.java | PhotoUtils.getAttribute | private static String getAttribute(String name, Element firstElement, Element secondElement) {
String val = firstElement.getAttribute(name);
if (val.length() == 0 && secondElement != null) {
val = secondElement.getAttribute(name);
}
return val;
} | java | private static String getAttribute(String name, Element firstElement, Element secondElement) {
String val = firstElement.getAttribute(name);
if (val.length() == 0 && secondElement != null) {
val = secondElement.getAttribute(name);
}
return val;
} | [
"private",
"static",
"String",
"getAttribute",
"(",
"String",
"name",
",",
"Element",
"firstElement",
",",
"Element",
"secondElement",
")",
"{",
"String",
"val",
"=",
"firstElement",
".",
"getAttribute",
"(",
"name",
")",
";",
"if",
"(",
"val",
".",
"length"... | Try to get an attribute value from two elements.
@param firstElement
@param secondElement
@return attribute value | [
"Try",
"to",
"get",
"an",
"attribute",
"value",
"from",
"two",
"elements",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotoUtils.java#L33-L39 |
square/tape | tape/src/main/java/com/squareup/tape2/QueueFile.java | QueueFile.writeInt | private static void writeInt(byte[] buffer, int offset, int value) {
buffer[offset ] = (byte) (value >> 24);
buffer[offset + 1] = (byte) (value >> 16);
buffer[offset + 2] = (byte) (value >> 8);
buffer[offset + 3] = (byte) value;
} | java | private static void writeInt(byte[] buffer, int offset, int value) {
buffer[offset ] = (byte) (value >> 24);
buffer[offset + 1] = (byte) (value >> 16);
buffer[offset + 2] = (byte) (value >> 8);
buffer[offset + 3] = (byte) value;
} | [
"private",
"static",
"void",
"writeInt",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"value",
")",
"{",
"buffer",
"[",
"offset",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>",
"24",
")",
";",
"buffer",
"[",
"offset",
"+",
... | Stores an {@code int} in the {@code byte[]}. The behavior is equivalent to calling
{@link RandomAccessFile#writeInt}. | [
"Stores",
"an",
"{"
] | train | https://github.com/square/tape/blob/445cd3fd0a7b3ec48c9ea3e0e86663fe6d3735d8/tape/src/main/java/com/squareup/tape2/QueueFile.java#L217-L222 |
jamesagnew/hapi-fhir | restful-server-example/src/main/java/ca/uhn/example/provider/PatientResourceProvider.java | PatientResourceProvider.updatePatient | @Update()
public MethodOutcome updatePatient(@IdParam IdDt theId, @ResourceParam Patient thePatient) {
validateResource(thePatient);
Long id;
try {
id = theId.getIdPartAsLong();
} catch (DataFormatException e) {
throw new InvalidRequestException("Invalid ID " + theId.getValue() + " - Must be numeric");
}
/*
* Throw an exception (HTTP 404) if the ID is not known
*/
if (!myIdToPatientVersions.containsKey(id)) {
throw new ResourceNotFoundException(theId);
}
addNewVersion(thePatient, id);
return new MethodOutcome();
} | java | @Update()
public MethodOutcome updatePatient(@IdParam IdDt theId, @ResourceParam Patient thePatient) {
validateResource(thePatient);
Long id;
try {
id = theId.getIdPartAsLong();
} catch (DataFormatException e) {
throw new InvalidRequestException("Invalid ID " + theId.getValue() + " - Must be numeric");
}
/*
* Throw an exception (HTTP 404) if the ID is not known
*/
if (!myIdToPatientVersions.containsKey(id)) {
throw new ResourceNotFoundException(theId);
}
addNewVersion(thePatient, id);
return new MethodOutcome();
} | [
"@",
"Update",
"(",
")",
"public",
"MethodOutcome",
"updatePatient",
"(",
"@",
"IdParam",
"IdDt",
"theId",
",",
"@",
"ResourceParam",
"Patient",
"thePatient",
")",
"{",
"validateResource",
"(",
"thePatient",
")",
";",
"Long",
"id",
";",
"try",
"{",
"id",
"... | The "@Update" annotation indicates that this method supports replacing an existing
resource (by ID) with a new instance of that resource.
@param theId
This is the ID of the patient to update
@param thePatient
This is the actual resource to save
@return This method returns a "MethodOutcome" | [
"The",
"@Update",
"annotation",
"indicates",
"that",
"this",
"method",
"supports",
"replacing",
"an",
"existing",
"resource",
"(",
"by",
"ID",
")",
"with",
"a",
"new",
"instance",
"of",
"that",
"resource",
"."
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/restful-server-example/src/main/java/ca/uhn/example/provider/PatientResourceProvider.java#L225-L246 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java | Gen.endFinalizerGaps | void endFinalizerGaps(Env<GenContext> from, Env<GenContext> to) {
Env<GenContext> last = null;
while (last != to) {
endFinalizerGap(from);
last = from;
from = from.next;
}
} | java | void endFinalizerGaps(Env<GenContext> from, Env<GenContext> to) {
Env<GenContext> last = null;
while (last != to) {
endFinalizerGap(from);
last = from;
from = from.next;
}
} | [
"void",
"endFinalizerGaps",
"(",
"Env",
"<",
"GenContext",
">",
"from",
",",
"Env",
"<",
"GenContext",
">",
"to",
")",
"{",
"Env",
"<",
"GenContext",
">",
"last",
"=",
"null",
";",
"while",
"(",
"last",
"!=",
"to",
")",
"{",
"endFinalizerGap",
"(",
"... | Mark end of all gaps in catch-all ranges for finalizers of environments
lying between, and including to two environments.
@param from the most deeply nested environment to mark
@param to the least deeply nested environment to mark | [
"Mark",
"end",
"of",
"all",
"gaps",
"in",
"catch",
"-",
"all",
"ranges",
"for",
"finalizers",
"of",
"environments",
"lying",
"between",
"and",
"including",
"to",
"two",
"environments",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L372-L379 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/map/AbstractLongIntMap.java | AbstractLongIntMap.pairsMatching | public void pairsMatching(final LongIntProcedure condition, final LongArrayList keyList, final IntArrayList valueList) {
keyList.clear();
valueList.clear();
forEachPair(
new LongIntProcedure() {
public boolean apply(long key, int value) {
if (condition.apply(key,value)) {
keyList.add(key);
valueList.add(value);
}
return true;
}
}
);
} | java | public void pairsMatching(final LongIntProcedure condition, final LongArrayList keyList, final IntArrayList valueList) {
keyList.clear();
valueList.clear();
forEachPair(
new LongIntProcedure() {
public boolean apply(long key, int value) {
if (condition.apply(key,value)) {
keyList.add(key);
valueList.add(value);
}
return true;
}
}
);
} | [
"public",
"void",
"pairsMatching",
"(",
"final",
"LongIntProcedure",
"condition",
",",
"final",
"LongArrayList",
"keyList",
",",
"final",
"IntArrayList",
"valueList",
")",
"{",
"keyList",
".",
"clear",
"(",
")",
";",
"valueList",
".",
"clear",
"(",
")",
";",
... | Fills all pairs satisfying a given condition into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists both have a new size, the number of pairs satisfying the condition.
Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(LongProcedure)}.
<p>
<b>Example:</b>
<br>
<pre>
LongIntProcedure condition = new LongIntProcedure() { // match even keys only
public boolean apply(long key, int value) { return key%2==0; }
}
keys = (8,7,6), values = (1,2,2) --> keyList = (6,8), valueList = (2,1)</tt>
</pre>
@param condition the condition to be matched. Takes the current key as first and the current value as second argument.
@param keyList the list to be filled with keys, can have any size.
@param valueList the list to be filled with values, can have any size. | [
"Fills",
"all",
"pairs",
"satisfying",
"a",
"given",
"condition",
"into",
"the",
"specified",
"lists",
".",
"Fills",
"into",
"the",
"lists",
"starting",
"at",
"index",
"0",
".",
"After",
"this",
"call",
"returns",
"the",
"specified",
"lists",
"both",
"have",... | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/map/AbstractLongIntMap.java#L254-L269 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java | TimeFinder.findAdjacentCue | private CueList.Entry findAdjacentCue(CdjStatus update, BeatGrid beatGrid) {
if (!MetadataFinder.getInstance().isRunning()) return null;
final TrackMetadata metadata = MetadataFinder.getInstance().getLatestMetadataFor(update);
final int newBeat = update.getBeatNumber();
if (metadata != null && metadata.getCueList() != null) {
for (CueList.Entry entry : metadata.getCueList().entries) {
final int entryBeat = beatGrid.findBeatAtTime(entry.cueTime);
if (Math.abs(newBeat - entryBeat) < 2) {
return entry; // We have found a cue we likely jumped to
}
if (entryBeat > newBeat) {
break; // We have moved past our location, no point scanning further.
}
}
}
return null;
} | java | private CueList.Entry findAdjacentCue(CdjStatus update, BeatGrid beatGrid) {
if (!MetadataFinder.getInstance().isRunning()) return null;
final TrackMetadata metadata = MetadataFinder.getInstance().getLatestMetadataFor(update);
final int newBeat = update.getBeatNumber();
if (metadata != null && metadata.getCueList() != null) {
for (CueList.Entry entry : metadata.getCueList().entries) {
final int entryBeat = beatGrid.findBeatAtTime(entry.cueTime);
if (Math.abs(newBeat - entryBeat) < 2) {
return entry; // We have found a cue we likely jumped to
}
if (entryBeat > newBeat) {
break; // We have moved past our location, no point scanning further.
}
}
}
return null;
} | [
"private",
"CueList",
".",
"Entry",
"findAdjacentCue",
"(",
"CdjStatus",
"update",
",",
"BeatGrid",
"beatGrid",
")",
"{",
"if",
"(",
"!",
"MetadataFinder",
".",
"getInstance",
"(",
")",
".",
"isRunning",
"(",
")",
")",
"return",
"null",
";",
"final",
"Trac... | Checks whether a CDJ status update seems to be close enough to a cue that if we just jumped there (or just
loaded the track) it would be a reasonable assumption that we jumped to the cue.
@param update the status update to check for proximity to hot cues and memory points
@param beatGrid the beat grid of the track being played
@return a matching memory point if we had a cue list available and were within a beat of one, or {@code null} | [
"Checks",
"whether",
"a",
"CDJ",
"status",
"update",
"seems",
"to",
"be",
"close",
"enough",
"to",
"a",
"cue",
"that",
"if",
"we",
"just",
"jumped",
"there",
"(",
"or",
"just",
"loaded",
"the",
"track",
")",
"it",
"would",
"be",
"a",
"reasonable",
"ass... | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java#L171-L187 |
alkacon/opencms-core | src/org/opencms/ui/apps/resourcetypes/CmsResourceTypesTable.java | CmsResourceTypesTable.filterTable | public void filterTable(String text) {
m_container.removeAllContainerFilters();
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(text)) {
m_container.addContainerFilter(
new Or(
new SimpleStringFilter(TableProperty.Name, text, true, false),
new SimpleStringFilter(TableProperty.ShortName, text, true, false),
new SimpleStringFilter(TableProperty.Module, text, true, false)));
}
} | java | public void filterTable(String text) {
m_container.removeAllContainerFilters();
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(text)) {
m_container.addContainerFilter(
new Or(
new SimpleStringFilter(TableProperty.Name, text, true, false),
new SimpleStringFilter(TableProperty.ShortName, text, true, false),
new SimpleStringFilter(TableProperty.Module, text, true, false)));
}
} | [
"public",
"void",
"filterTable",
"(",
"String",
"text",
")",
"{",
"m_container",
".",
"removeAllContainerFilters",
"(",
")",
";",
"if",
"(",
"!",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"text",
")",
")",
"{",
"m_container",
".",
"addContainerFilter... | Filters the table according to given string.<p>
@param text to filter | [
"Filters",
"the",
"table",
"according",
"to",
"given",
"string",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/resourcetypes/CmsResourceTypesTable.java#L626-L637 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java | PackageSummaryBuilder.buildInterfaceSummary | public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
String interfaceTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Interface_Summary"),
configuration.getText("doclet.interfaces"));
List<String> interfaceTableHeader = Arrays.asList(configuration.getText("doclet.Interface"),
configuration.getText("doclet.Description"));
SortedSet<TypeElement> ilist = utils.isSpecified(packageElement)
? utils.getTypeElementsAsSortedSet(utils.getInterfaces(packageElement))
: configuration.typeElementCatalog.interfaces(packageElement);
SortedSet<TypeElement> interfaces = utils.filterOutPrivateClasses(ilist, configuration.javafx);
if (!interfaces.isEmpty()) {
packageWriter.addClassesSummary(interfaces,
configuration.getText("doclet.Interface_Summary"),
interfaceTableSummary, interfaceTableHeader, summaryContentTree);
}
} | java | public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
String interfaceTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Interface_Summary"),
configuration.getText("doclet.interfaces"));
List<String> interfaceTableHeader = Arrays.asList(configuration.getText("doclet.Interface"),
configuration.getText("doclet.Description"));
SortedSet<TypeElement> ilist = utils.isSpecified(packageElement)
? utils.getTypeElementsAsSortedSet(utils.getInterfaces(packageElement))
: configuration.typeElementCatalog.interfaces(packageElement);
SortedSet<TypeElement> interfaces = utils.filterOutPrivateClasses(ilist, configuration.javafx);
if (!interfaces.isEmpty()) {
packageWriter.addClassesSummary(interfaces,
configuration.getText("doclet.Interface_Summary"),
interfaceTableSummary, interfaceTableHeader, summaryContentTree);
}
} | [
"public",
"void",
"buildInterfaceSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"summaryContentTree",
")",
"{",
"String",
"interfaceTableSummary",
"=",
"configuration",
".",
"getText",
"(",
"\"doclet.Member_Table_Summary\"",
",",
"configuration",
".",
"getText",
"(",... | Build the summary for the interfaces in this package.
@param node the XML element that specifies which components to document
@param summaryContentTree the summary tree to which the interface summary
will be added | [
"Build",
"the",
"summary",
"for",
"the",
"interfaces",
"in",
"this",
"package",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java#L176-L193 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsResourceTypeConfig.java | CmsResourceTypeConfig.updateBasePath | protected void updateBasePath(String basePath) {
if (m_folderOrName != null) {
if (m_folderOrName.isName()) {
m_folderOrName = new CmsContentFolderDescriptor(basePath, m_folderOrName.getFolderName());
}
} else {
m_folderOrName = new CmsContentFolderDescriptor(basePath, m_typeName);
}
} | java | protected void updateBasePath(String basePath) {
if (m_folderOrName != null) {
if (m_folderOrName.isName()) {
m_folderOrName = new CmsContentFolderDescriptor(basePath, m_folderOrName.getFolderName());
}
} else {
m_folderOrName = new CmsContentFolderDescriptor(basePath, m_typeName);
}
} | [
"protected",
"void",
"updateBasePath",
"(",
"String",
"basePath",
")",
"{",
"if",
"(",
"m_folderOrName",
"!=",
"null",
")",
"{",
"if",
"(",
"m_folderOrName",
".",
"isName",
"(",
")",
")",
"{",
"m_folderOrName",
"=",
"new",
"CmsContentFolderDescriptor",
"(",
... | Updates the base path for the folder information.<p>
@param basePath the new base path | [
"Updates",
"the",
"base",
"path",
"for",
"the",
"folder",
"information",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsResourceTypeConfig.java#L774-L783 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ImageSegmentationOps.java | ImageSegmentationOps.countRegionPixels | public static int countRegionPixels(GrayS32 labeled , int which ) {
int total = 0;
for( int y = 0; y < labeled.height; y++ ) {
int index = labeled.startIndex + y*labeled.stride;
for( int x = 0; x < labeled.width; x++ ) {
if( labeled.data[index++] == which ) {
total++;
}
}
}
return total;
} | java | public static int countRegionPixels(GrayS32 labeled , int which ) {
int total = 0;
for( int y = 0; y < labeled.height; y++ ) {
int index = labeled.startIndex + y*labeled.stride;
for( int x = 0; x < labeled.width; x++ ) {
if( labeled.data[index++] == which ) {
total++;
}
}
}
return total;
} | [
"public",
"static",
"int",
"countRegionPixels",
"(",
"GrayS32",
"labeled",
",",
"int",
"which",
")",
"{",
"int",
"total",
"=",
"0",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"labeled",
".",
"height",
";",
"y",
"++",
")",
"{",
"int",
"... | Counts the number of instances of 'which' inside the labeled image.
@param labeled Image which has been labeled
@param which The label being searched for
@return Number of instances of 'which' in 'labeled' | [
"Counts",
"the",
"number",
"of",
"instances",
"of",
"which",
"inside",
"the",
"labeled",
"image",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ImageSegmentationOps.java#L44-L55 |
prestodb/presto | presto-spi/src/main/java/com/facebook/presto/spi/type/TypeUtils.java | TypeUtils.readNativeValue | public static Object readNativeValue(Type type, Block block, int position)
{
Class<?> javaType = type.getJavaType();
if (block.isNull(position)) {
return null;
}
if (javaType == long.class) {
return type.getLong(block, position);
}
if (javaType == double.class) {
return type.getDouble(block, position);
}
if (javaType == boolean.class) {
return type.getBoolean(block, position);
}
if (javaType == Slice.class) {
return type.getSlice(block, position);
}
return type.getObject(block, position);
} | java | public static Object readNativeValue(Type type, Block block, int position)
{
Class<?> javaType = type.getJavaType();
if (block.isNull(position)) {
return null;
}
if (javaType == long.class) {
return type.getLong(block, position);
}
if (javaType == double.class) {
return type.getDouble(block, position);
}
if (javaType == boolean.class) {
return type.getBoolean(block, position);
}
if (javaType == Slice.class) {
return type.getSlice(block, position);
}
return type.getObject(block, position);
} | [
"public",
"static",
"Object",
"readNativeValue",
"(",
"Type",
"type",
",",
"Block",
"block",
",",
"int",
"position",
")",
"{",
"Class",
"<",
"?",
">",
"javaType",
"=",
"type",
".",
"getJavaType",
"(",
")",
";",
"if",
"(",
"block",
".",
"isNull",
"(",
... | Get the native value as an object in the value at {@code position} of {@code block}. | [
"Get",
"the",
"native",
"value",
"as",
"an",
"object",
"in",
"the",
"value",
"at",
"{"
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/type/TypeUtils.java#L35-L55 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/URLMatchingUtils.java | URLMatchingUtils.isExtensionMatch | public static boolean isExtensionMatch(String uriName, String urlPattern) {
if (urlPattern.startsWith("*.")) {
String ext = urlPattern.substring(1);
if (uriName.endsWith(ext)) {
return true;
}
}
return false;
} | java | public static boolean isExtensionMatch(String uriName, String urlPattern) {
if (urlPattern.startsWith("*.")) {
String ext = urlPattern.substring(1);
if (uriName.endsWith(ext)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isExtensionMatch",
"(",
"String",
"uriName",
",",
"String",
"urlPattern",
")",
"{",
"if",
"(",
"urlPattern",
".",
"startsWith",
"(",
"\"*.\"",
")",
")",
"{",
"String",
"ext",
"=",
"urlPattern",
".",
"substring",
"(",
"1",
")... | Determine if the urlPattern is an extension match for the uriName.
@param uriName
@param urlPattern
@return | [
"Determine",
"if",
"the",
"urlPattern",
"is",
"an",
"extension",
"match",
"for",
"the",
"uriName",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/URLMatchingUtils.java#L122-L130 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCamera.java | GVRCamera.addPostEffect | public void addPostEffect(GVRMaterial postEffectData) {
GVRContext ctx = getGVRContext();
if (mPostEffects == null)
{
mPostEffects = new GVRRenderData(ctx, postEffectData);
GVRMesh dummyMesh = new GVRMesh(getGVRContext(),"float3 a_position float2 a_texcoord");
mPostEffects.setMesh(dummyMesh);
NativeCamera.setPostEffect(getNative(), mPostEffects.getNative());
mPostEffects.setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
}
else
{
GVRRenderPass rpass = new GVRRenderPass(ctx, postEffectData);
rpass.setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
mPostEffects.addPass(rpass);
}
} | java | public void addPostEffect(GVRMaterial postEffectData) {
GVRContext ctx = getGVRContext();
if (mPostEffects == null)
{
mPostEffects = new GVRRenderData(ctx, postEffectData);
GVRMesh dummyMesh = new GVRMesh(getGVRContext(),"float3 a_position float2 a_texcoord");
mPostEffects.setMesh(dummyMesh);
NativeCamera.setPostEffect(getNative(), mPostEffects.getNative());
mPostEffects.setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
}
else
{
GVRRenderPass rpass = new GVRRenderPass(ctx, postEffectData);
rpass.setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
mPostEffects.addPass(rpass);
}
} | [
"public",
"void",
"addPostEffect",
"(",
"GVRMaterial",
"postEffectData",
")",
"{",
"GVRContext",
"ctx",
"=",
"getGVRContext",
"(",
")",
";",
"if",
"(",
"mPostEffects",
"==",
"null",
")",
"{",
"mPostEffects",
"=",
"new",
"GVRRenderData",
"(",
"ctx",
",",
"pos... | Add a post-effect to this camera's render chain.
Post-effects are GL shaders, applied to the texture (hardware bitmap)
containing the rendered scene graph. Each post-effect combines a shader
selector with a set of parameters: This lets you pass different
parameters to the shaders for each eye.
@param postEffectData
Post-effect to append to this camera's render chain | [
"Add",
"a",
"post",
"-",
"effect",
"to",
"this",
"camera",
"s",
"render",
"chain",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCamera.java#L214-L231 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/requests/restaction/InviteAction.java | InviteAction.setMaxAge | @CheckReturnValue
public final InviteAction setMaxAge(final Long maxAge, final TimeUnit timeUnit)
{
if (maxAge == null)
return this.setMaxAge(null);
Checks.notNegative(maxAge, "maxAge");
Checks.notNull(timeUnit, "timeUnit");
return this.setMaxAge(Math.toIntExact(timeUnit.toSeconds(maxAge)));
} | java | @CheckReturnValue
public final InviteAction setMaxAge(final Long maxAge, final TimeUnit timeUnit)
{
if (maxAge == null)
return this.setMaxAge(null);
Checks.notNegative(maxAge, "maxAge");
Checks.notNull(timeUnit, "timeUnit");
return this.setMaxAge(Math.toIntExact(timeUnit.toSeconds(maxAge)));
} | [
"@",
"CheckReturnValue",
"public",
"final",
"InviteAction",
"setMaxAge",
"(",
"final",
"Long",
"maxAge",
",",
"final",
"TimeUnit",
"timeUnit",
")",
"{",
"if",
"(",
"maxAge",
"==",
"null",
")",
"return",
"this",
".",
"setMaxAge",
"(",
"null",
")",
";",
"Che... | Sets the max age for the invite. Set this to {@code 0} if the invite should never expire. Default is {@code 86400} (24 hours).
{@code null} will reset this to the default value.
@param maxAge
The max age for this invite or {@code null} to use the default value.
@param timeUnit
The {@link java.util.concurrent.TimeUnit TimeUnit} type of {@code maxAge}.
@throws IllegalArgumentException
If maxAge is negative or maxAge is positive and timeUnit is null.
@return The current InviteAction for chaining. | [
"Sets",
"the",
"max",
"age",
"for",
"the",
"invite",
".",
"Set",
"this",
"to",
"{",
"@code",
"0",
"}",
"if",
"the",
"invite",
"should",
"never",
"expire",
".",
"Default",
"is",
"{",
"@code",
"86400",
"}",
"(",
"24",
"hours",
")",
".",
"{",
"@code",... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/restaction/InviteAction.java#L116-L126 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java | Utilities.incrComputeSpecs | public static void incrComputeSpecs(ComputeSpecs target, ComputeSpecs incr) {
target.numCpus += incr.numCpus;
target.memoryMB += incr.memoryMB;
target.diskGB += incr.diskGB;
} | java | public static void incrComputeSpecs(ComputeSpecs target, ComputeSpecs incr) {
target.numCpus += incr.numCpus;
target.memoryMB += incr.memoryMB;
target.diskGB += incr.diskGB;
} | [
"public",
"static",
"void",
"incrComputeSpecs",
"(",
"ComputeSpecs",
"target",
",",
"ComputeSpecs",
"incr",
")",
"{",
"target",
".",
"numCpus",
"+=",
"incr",
".",
"numCpus",
";",
"target",
".",
"memoryMB",
"+=",
"incr",
".",
"memoryMB",
";",
"target",
".",
... | Increase the compute specs
@param target the compute specs to increase
@param incr the increment | [
"Increase",
"the",
"compute",
"specs"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/Utilities.java#L88-L92 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java | DocEnv.makeMethodDoc | protected void makeMethodDoc(MethodSymbol meth, TreePath treePath) {
MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
if (result != null) {
if (treePath != null) result.setTreePath(treePath);
} else {
result = new MethodDocImpl(this, meth, treePath);
methodMap.put(meth, result);
}
} | java | protected void makeMethodDoc(MethodSymbol meth, TreePath treePath) {
MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
if (result != null) {
if (treePath != null) result.setTreePath(treePath);
} else {
result = new MethodDocImpl(this, meth, treePath);
methodMap.put(meth, result);
}
} | [
"protected",
"void",
"makeMethodDoc",
"(",
"MethodSymbol",
"meth",
",",
"TreePath",
"treePath",
")",
"{",
"MethodDocImpl",
"result",
"=",
"(",
"MethodDocImpl",
")",
"methodMap",
".",
"get",
"(",
"meth",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{"... | Create a MethodDoc for this MethodSymbol.
Should be called only on symbols representing methods. | [
"Create",
"a",
"MethodDoc",
"for",
"this",
"MethodSymbol",
".",
"Should",
"be",
"called",
"only",
"on",
"symbols",
"representing",
"methods",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L661-L669 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/ScreenSteps.java | ScreenSteps.saveWebElementInScreenshot | @Conditioned
@Et("Je sauvegarde une capture d'écran de '(.*)-(.*)' dans '(.*)'[\\.|\\?]")
@And("I save a screenshot of '(.*)-(.*)' in '(.*)'[\\.|\\?]")
public void saveWebElementInScreenshot(String page, String element, String screenName, List<GherkinStepCondition> conditions) throws IOException, FailureException, TechnicalException {
logger.debug("I save a screenshot of [{}-{}] in [{}.jpg]", page, element, screenName);
try {
screenService.saveScreenshot(screenName, Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(Page.getInstance(page).getPageElementByKey('-' + element)))));
} catch (Exception e) {
new Result.Failure<>(e.getMessage(), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, Page.getInstance(page).getCallBack());
}
} | java | @Conditioned
@Et("Je sauvegarde une capture d'écran de '(.*)-(.*)' dans '(.*)'[\\.|\\?]")
@And("I save a screenshot of '(.*)-(.*)' in '(.*)'[\\.|\\?]")
public void saveWebElementInScreenshot(String page, String element, String screenName, List<GherkinStepCondition> conditions) throws IOException, FailureException, TechnicalException {
logger.debug("I save a screenshot of [{}-{}] in [{}.jpg]", page, element, screenName);
try {
screenService.saveScreenshot(screenName, Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(Page.getInstance(page).getPageElementByKey('-' + element)))));
} catch (Exception e) {
new Result.Failure<>(e.getMessage(), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, Page.getInstance(page).getCallBack());
}
} | [
"@",
"Conditioned",
"@",
"Et",
"(",
"\"Je sauvegarde une capture d'écran de '(.*)-(.*)' dans '(.*)'[\\\\.|\\\\?]\")",
"",
"@",
"And",
"(",
"\"I save a screenshot of '(.*)-(.*)' in '(.*)'[\\\\.|\\\\?]\"",
")",
"public",
"void",
"saveWebElementInScreenshot",
"(",
"String",
"page",
... | Save a screenshot of one element only and add to DOWNLOAD_FILES_FOLDER folder.
@param page
The concerned page of field
@param element
is key of PageElement concerned
@param conditions
list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). * list of 'expected' values condition and 'actual' values
({@link com.github.noraui.gherkin.GherkinStepCondition}).
@throws IOException
if file or directory is wrong.
@throws TechnicalException
@throws FailureException | [
"Save",
"a",
"screenshot",
"of",
"one",
"element",
"only",
"and",
"add",
"to",
"DOWNLOAD_FILES_FOLDER",
"folder",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/ScreenSteps.java#L92-L102 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java | ExceptionUtil.getCausedBy | @SuppressWarnings("unchecked")
public static Throwable getCausedBy(Throwable throwable, Class<? extends Exception>... causeClasses) {
Throwable cause = throwable;
while (cause != null) {
for (Class<? extends Exception> causeClass : causeClasses) {
if (causeClass.isInstance(cause)) {
return cause;
}
}
cause = cause.getCause();
}
return null;
} | java | @SuppressWarnings("unchecked")
public static Throwable getCausedBy(Throwable throwable, Class<? extends Exception>... causeClasses) {
Throwable cause = throwable;
while (cause != null) {
for (Class<? extends Exception> causeClass : causeClasses) {
if (causeClass.isInstance(cause)) {
return cause;
}
}
cause = cause.getCause();
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Throwable",
"getCausedBy",
"(",
"Throwable",
"throwable",
",",
"Class",
"<",
"?",
"extends",
"Exception",
">",
"...",
"causeClasses",
")",
"{",
"Throwable",
"cause",
"=",
"throwable",
";",
... | 获取由指定异常类引起的异常
@param throwable 异常
@param causeClasses 定义的引起异常的类
@return 是否由指定异常类引起
@since 4.1.13 | [
"获取由指定异常类引起的异常"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java#L234-L246 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/StratifiedSampling.java | StratifiedSampling.weightedProbabilitySampling | public static TransposeDataCollection weightedProbabilitySampling(AssociativeArray2D strataFrequencyTable, AssociativeArray nh, boolean withReplacement) {
TransposeDataCollection sampledIds = new TransposeDataCollection();
for(Map.Entry<Object, AssociativeArray> entry : strataFrequencyTable.entrySet()) {
Object strata = entry.getKey();
Number sampleN = ((Number)nh.get(strata));
if(sampleN==null) {
continue;
}
sampledIds.put(strata, SimpleRandomSampling.weightedSampling(entry.getValue(), sampleN.intValue(), withReplacement));
}
return sampledIds;
} | java | public static TransposeDataCollection weightedProbabilitySampling(AssociativeArray2D strataFrequencyTable, AssociativeArray nh, boolean withReplacement) {
TransposeDataCollection sampledIds = new TransposeDataCollection();
for(Map.Entry<Object, AssociativeArray> entry : strataFrequencyTable.entrySet()) {
Object strata = entry.getKey();
Number sampleN = ((Number)nh.get(strata));
if(sampleN==null) {
continue;
}
sampledIds.put(strata, SimpleRandomSampling.weightedSampling(entry.getValue(), sampleN.intValue(), withReplacement));
}
return sampledIds;
} | [
"public",
"static",
"TransposeDataCollection",
"weightedProbabilitySampling",
"(",
"AssociativeArray2D",
"strataFrequencyTable",
",",
"AssociativeArray",
"nh",
",",
"boolean",
"withReplacement",
")",
"{",
"TransposeDataCollection",
"sampledIds",
"=",
"new",
"TransposeDataCollec... | Samples nh ids from each strata based on their Frequency Table
@param strataFrequencyTable
@param nh
@param withReplacement
@return | [
"Samples",
"nh",
"ids",
"from",
"each",
"strata",
"based",
"on",
"their",
"Frequency",
"Table"
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/StratifiedSampling.java#L38-L53 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v1/DbxClientV1.java | DbxClientV1.getDeltaCWithPathPrefix | public <C> DbxDeltaC<C> getDeltaCWithPathPrefix(Collector<DbxDeltaC.Entry<DbxEntry>, C> collector,
/*@Nullable*/String cursor, String pathPrefix,
boolean includeMediaInfo)
throws DbxException
{
DbxPathV1.checkArg("path", pathPrefix);
return _getDeltaC(collector, cursor, pathPrefix, includeMediaInfo);
} | java | public <C> DbxDeltaC<C> getDeltaCWithPathPrefix(Collector<DbxDeltaC.Entry<DbxEntry>, C> collector,
/*@Nullable*/String cursor, String pathPrefix,
boolean includeMediaInfo)
throws DbxException
{
DbxPathV1.checkArg("path", pathPrefix);
return _getDeltaC(collector, cursor, pathPrefix, includeMediaInfo);
} | [
"public",
"<",
"C",
">",
"DbxDeltaC",
"<",
"C",
">",
"getDeltaCWithPathPrefix",
"(",
"Collector",
"<",
"DbxDeltaC",
".",
"Entry",
"<",
"DbxEntry",
">",
",",
"C",
">",
"collector",
",",
"/*@Nullable*/",
"String",
"cursor",
",",
"String",
"pathPrefix",
",",
... | A more generic version of {@link #getDeltaWithPathPrefix}. You provide a <em>collector</em>,
which lets you process the delta entries as they arrive over the network. | [
"A",
"more",
"generic",
"version",
"of",
"{"
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L1550-L1557 |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.convertToJavaIdentifier | public static String convertToJavaIdentifier( String key, JsonConfig jsonConfig ) {
try{
return jsonConfig.getJavaIdentifierTransformer()
.transformToJavaIdentifier( key );
}catch( JSONException jsone ){
throw jsone;
}catch( Exception e ){
throw new JSONException( e );
}
} | java | public static String convertToJavaIdentifier( String key, JsonConfig jsonConfig ) {
try{
return jsonConfig.getJavaIdentifierTransformer()
.transformToJavaIdentifier( key );
}catch( JSONException jsone ){
throw jsone;
}catch( Exception e ){
throw new JSONException( e );
}
} | [
"public",
"static",
"String",
"convertToJavaIdentifier",
"(",
"String",
"key",
",",
"JsonConfig",
"jsonConfig",
")",
"{",
"try",
"{",
"return",
"jsonConfig",
".",
"getJavaIdentifierTransformer",
"(",
")",
".",
"transformToJavaIdentifier",
"(",
"key",
")",
";",
"}"... | Transforms the string into a valid Java Identifier.<br>
The default strategy is JavaIdentifierTransformer.NOOP
@throws JSONException if the string can not be transformed. | [
"Transforms",
"the",
"string",
"into",
"a",
"valid",
"Java",
"Identifier",
".",
"<br",
">",
"The",
"default",
"strategy",
"is",
"JavaIdentifierTransformer",
".",
"NOOP"
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L84-L93 |
Azure/azure-sdk-for-java | compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java | SnapshotsInner.beginUpdate | public SnapshotInner beginUpdate(String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, snapshotName, snapshot).toBlocking().single().body();
} | java | public SnapshotInner beginUpdate(String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, snapshotName, snapshot).toBlocking().single().body();
} | [
"public",
"SnapshotInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"snapshotName",
",",
"SnapshotUpdate",
"snapshot",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"snapshotName",
",",
"snapshot",
")",
... | Updates (patches) a snapshot.
@param resourceGroupName The name of the resource group.
@param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
@param snapshot Snapshot object supplied in the body of the Patch snapshot operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SnapshotInner object if successful. | [
"Updates",
"(",
"patches",
")",
"a",
"snapshot",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java#L393-L395 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/sql/gen/BytecodeGeneratorContext.java | BytecodeGeneratorContext.generateCall | public BytecodeNode generateCall(
String name,
ScalarFunctionImplementation function,
List<BytecodeNode> arguments,
Optional<OutputBlockVariableAndType> outputBlockVariableAndType)
{
Optional<BytecodeNode> instance = Optional.empty();
if (function.getInstanceFactory().isPresent()) {
FieldDefinition field = cachedInstanceBinder.getCachedInstance(function.getInstanceFactory().get());
instance = Optional.of(scope.getThis().getField(field));
}
return generateInvocation(scope, name, function, instance, arguments, callSiteBinder, outputBlockVariableAndType);
} | java | public BytecodeNode generateCall(
String name,
ScalarFunctionImplementation function,
List<BytecodeNode> arguments,
Optional<OutputBlockVariableAndType> outputBlockVariableAndType)
{
Optional<BytecodeNode> instance = Optional.empty();
if (function.getInstanceFactory().isPresent()) {
FieldDefinition field = cachedInstanceBinder.getCachedInstance(function.getInstanceFactory().get());
instance = Optional.of(scope.getThis().getField(field));
}
return generateInvocation(scope, name, function, instance, arguments, callSiteBinder, outputBlockVariableAndType);
} | [
"public",
"BytecodeNode",
"generateCall",
"(",
"String",
"name",
",",
"ScalarFunctionImplementation",
"function",
",",
"List",
"<",
"BytecodeNode",
">",
"arguments",
",",
"Optional",
"<",
"OutputBlockVariableAndType",
">",
"outputBlockVariableAndType",
")",
"{",
"Option... | Generates a function call with null handling, automatic binding of session parameter, etc. | [
"Generates",
"a",
"function",
"call",
"with",
"null",
"handling",
"automatic",
"binding",
"of",
"session",
"parameter",
"etc",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/gen/BytecodeGeneratorContext.java#L94-L106 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.getType | public String getType (String uri, String localName)
{
int max = length * 5;
for (int i = 0; i < max; i += 5) {
if (data[i].equals(uri) && data[i+1].equals(localName)) {
return data[i+3];
}
}
return null;
} | java | public String getType (String uri, String localName)
{
int max = length * 5;
for (int i = 0; i < max; i += 5) {
if (data[i].equals(uri) && data[i+1].equals(localName)) {
return data[i+3];
}
}
return null;
} | [
"public",
"String",
"getType",
"(",
"String",
"uri",
",",
"String",
"localName",
")",
"{",
"int",
"max",
"=",
"length",
"*",
"5",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"+=",
"5",
")",
"{",
"if",
"(",
"data",
"... | Look up an attribute's type by Namespace-qualified name.
@param uri The Namespace URI, or the empty string for a name
with no explicit Namespace URI.
@param localName The local name.
@return The attribute's type, or null if there is no
matching attribute.
@see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String) | [
"Look",
"up",
"an",
"attribute",
"s",
"type",
"by",
"Namespace",
"-",
"qualified",
"name",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L240-L249 |
rapidoid/rapidoid | rapidoid-rest/src/main/java/org/rapidoid/setup/App.java | App.run | public static synchronized void run(String[] args, String... extraArgs) {
AppStarter.startUp(args, extraArgs);
// no implicit classpath scanning here
boot();
// finish initialization and start the application
onAppReady();
boot();
} | java | public static synchronized void run(String[] args, String... extraArgs) {
AppStarter.startUp(args, extraArgs);
// no implicit classpath scanning here
boot();
// finish initialization and start the application
onAppReady();
boot();
} | [
"public",
"static",
"synchronized",
"void",
"run",
"(",
"String",
"[",
"]",
"args",
",",
"String",
"...",
"extraArgs",
")",
"{",
"AppStarter",
".",
"startUp",
"(",
"args",
",",
"extraArgs",
")",
";",
"// no implicit classpath scanning here",
"boot",
"(",
")",
... | Initializes the app in non-atomic way.
Then starts serving requests immediately when routes are configured. | [
"Initializes",
"the",
"app",
"in",
"non",
"-",
"atomic",
"way",
".",
"Then",
"starts",
"serving",
"requests",
"immediately",
"when",
"routes",
"are",
"configured",
"."
] | train | https://github.com/rapidoid/rapidoid/blob/1775344bcf4abbee289d474b34d553ff6bc821b0/rapidoid-rest/src/main/java/org/rapidoid/setup/App.java#L90-L100 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.pathString | protected DocPath pathString(TypeElement te, DocPath name) {
return pathString(utils.containingPackage(te), name);
} | java | protected DocPath pathString(TypeElement te, DocPath name) {
return pathString(utils.containingPackage(te), name);
} | [
"protected",
"DocPath",
"pathString",
"(",
"TypeElement",
"te",
",",
"DocPath",
"name",
")",
"{",
"return",
"pathString",
"(",
"utils",
".",
"containingPackage",
"(",
"te",
")",
",",
"name",
")",
";",
"}"
] | Return the path to the class page for a typeElement.
@param te TypeElement for which the path is requested.
@param name Name of the file(doesn't include path). | [
"Return",
"the",
"path",
"to",
"the",
"class",
"page",
"for",
"a",
"typeElement",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L1061-L1063 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/Log.java | Log.logInfo | public void logInfo(String message, Exception exception) {
if (!(logInfo || globalLog.logInfo))
return;
if (infoLog != null)
log(infoLog, "INFO", owner, message, exception);
else
log(globalLog.infoLog, "INFO", owner, message, exception);
} | java | public void logInfo(String message, Exception exception) {
if (!(logInfo || globalLog.logInfo))
return;
if (infoLog != null)
log(infoLog, "INFO", owner, message, exception);
else
log(globalLog.infoLog, "INFO", owner, message, exception);
} | [
"public",
"void",
"logInfo",
"(",
"String",
"message",
",",
"Exception",
"exception",
")",
"{",
"if",
"(",
"!",
"(",
"logInfo",
"||",
"globalLog",
".",
"logInfo",
")",
")",
"return",
";",
"if",
"(",
"infoLog",
"!=",
"null",
")",
"log",
"(",
"infoLog",
... | Prints info info to the current infoLog
@param message The message to log
@param exception An Exception | [
"Prints",
"info",
"info",
"to",
"the",
"current",
"infoLog"
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/Log.java#L591-L599 |
rometools/rome | rome/src/main/java/com/rometools/rome/io/impl/DateParser.java | DateParser.parseRFC822 | public static Date parseRFC822(String sDate, final Locale locale) {
sDate = convertUnsupportedTimeZones(sDate);
return parseUsingMask(RFC822_MASKS, sDate, locale);
} | java | public static Date parseRFC822(String sDate, final Locale locale) {
sDate = convertUnsupportedTimeZones(sDate);
return parseUsingMask(RFC822_MASKS, sDate, locale);
} | [
"public",
"static",
"Date",
"parseRFC822",
"(",
"String",
"sDate",
",",
"final",
"Locale",
"locale",
")",
"{",
"sDate",
"=",
"convertUnsupportedTimeZones",
"(",
"sDate",
")",
";",
"return",
"parseUsingMask",
"(",
"RFC822_MASKS",
",",
"sDate",
",",
"locale",
")... | Parses a Date out of a String with a date in RFC822 format.
<p/>
It parsers the following formats:
<ul>
<li>"EEE, dd MMM yyyy HH:mm:ss z"</li>
<li>"EEE, dd MMM yyyy HH:mm z"</li>
<li>"EEE, dd MMM yy HH:mm:ss z"</li>
<li>"EEE, dd MMM yy HH:mm z"</li>
<li>"dd MMM yyyy HH:mm:ss z"</li>
<li>"dd MMM yyyy HH:mm z"</li>
<li>"dd MMM yy HH:mm:ss z"</li>
<li>"dd MMM yy HH:mm z"</li>
</ul>
<p/>
Refer to the java.text.SimpleDateFormat javadocs for details on the format of each element.
<p/>
@param sDate string to parse for a date.
@return the Date represented by the given RFC822 string. It returns <b>null</b> if it was not
possible to parse the given string into a Date. | [
"Parses",
"a",
"Date",
"out",
"of",
"a",
"String",
"with",
"a",
"date",
"in",
"RFC822",
"format",
".",
"<p",
"/",
">",
"It",
"parsers",
"the",
"following",
"formats",
":",
"<ul",
">",
"<li",
">",
"EEE",
"dd",
"MMM",
"yyyy",
"HH",
":",
"mm",
":",
... | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/impl/DateParser.java#L145-L148 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/style/stylers/ImportTiff.java | ImportTiff.createImage | @Override
protected com.itextpdf.text.Image createImage(PdfContentByte canvas, Object data, float opacity) throws VectorPrintException, BadElementException {
if (imageBeingProcessed!=null) {
return imageBeingProcessed;
}
this.data = data;
boolean doFooter = getSettings().getBooleanProperty(Boolean.FALSE, ReportConstants.PRINTFOOTER);
// remember page size
Rectangle r = getDocument().getPageSize();
getImageLoader().loadTiff(getValue(Image.URLPARAM, URL.class), this, ArrayHelper.unWrap(getValue(NumberCondition.NUMBERS, Integer[].class)));
// restore settings
getDocument().setPageSize(r);
if (getValue(FINALNEWPAGE, Boolean.class)) {
getDocument().newPage();
}
if (doFooter && getValue(NOFOOTER, Boolean.class)) {
getSettings().put(ReportConstants.PRINTFOOTER, "true");
}
return null;
} | java | @Override
protected com.itextpdf.text.Image createImage(PdfContentByte canvas, Object data, float opacity) throws VectorPrintException, BadElementException {
if (imageBeingProcessed!=null) {
return imageBeingProcessed;
}
this.data = data;
boolean doFooter = getSettings().getBooleanProperty(Boolean.FALSE, ReportConstants.PRINTFOOTER);
// remember page size
Rectangle r = getDocument().getPageSize();
getImageLoader().loadTiff(getValue(Image.URLPARAM, URL.class), this, ArrayHelper.unWrap(getValue(NumberCondition.NUMBERS, Integer[].class)));
// restore settings
getDocument().setPageSize(r);
if (getValue(FINALNEWPAGE, Boolean.class)) {
getDocument().newPage();
}
if (doFooter && getValue(NOFOOTER, Boolean.class)) {
getSettings().put(ReportConstants.PRINTFOOTER, "true");
}
return null;
} | [
"@",
"Override",
"protected",
"com",
".",
"itextpdf",
".",
"text",
".",
"Image",
"createImage",
"(",
"PdfContentByte",
"canvas",
",",
"Object",
"data",
",",
"float",
"opacity",
")",
"throws",
"VectorPrintException",
",",
"BadElementException",
"{",
"if",
"(",
... | calls {@link #processImage(com.itextpdf.text.Image) } on pages imported from the tiff in the URL, always returns
null, because each page from a tiff is imported as an image.
@param canvas
@param data
@param opacity the value of opacity
@throws VectorPrintException
@throws BadElementException
@return the com.itextpdf.text.Image | [
"calls",
"{",
"@link",
"#processImage",
"(",
"com",
".",
"itextpdf",
".",
"text",
".",
"Image",
")",
"}",
"on",
"pages",
"imported",
"from",
"the",
"tiff",
"in",
"the",
"URL",
"always",
"returns",
"null",
"because",
"each",
"page",
"from",
"a",
"tiff",
... | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/stylers/ImportTiff.java#L196-L218 |
Azure/azure-sdk-for-java | resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java | ResourcesInner.deleteAsync | public Observable<Void> deleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) {
return deleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> deleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) {
return deleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"deleteAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceProviderNamespace",
",",
"String",
"parentResourcePath",
",",
"String",
"resourceType",
",",
"String",
"resourceName",
",",
"String",
"apiVersion",
")"... | Deletes a resource.
@param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive.
@param resourceProviderNamespace The namespace of the resource provider.
@param parentResourcePath The parent resource identity.
@param resourceType The resource type.
@param resourceName The name of the resource to delete.
@param apiVersion The API version to use for the operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Deletes",
"a",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L1120-L1127 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_statistics_memory_GET | public ArrayList<OvhRtmMemory> serviceName_statistics_memory_GET(String serviceName) throws IOException {
String qPath = "/dedicated/server/{serviceName}/statistics/memory";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t9);
} | java | public ArrayList<OvhRtmMemory> serviceName_statistics_memory_GET(String serviceName) throws IOException {
String qPath = "/dedicated/server/{serviceName}/statistics/memory";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t9);
} | [
"public",
"ArrayList",
"<",
"OvhRtmMemory",
">",
"serviceName_statistics_memory_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/statistics/memory\"",
";",
"StringBuilder",
"sb",
"=",
"path",
... | Get server memory informations
REST: GET /dedicated/server/{serviceName}/statistics/memory
@param serviceName [required] The internal name of your dedicated server | [
"Get",
"server",
"memory",
"informations"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1304-L1309 |
trellis-ldp/trellis | core/http/src/main/java/org/trellisldp/http/impl/HttpUtils.java | HttpUtils.checkIfNoneMatch | public static void checkIfNoneMatch(final String method, final String ifNoneMatch, final EntityTag etag) {
if (ifNoneMatch == null) {
return;
}
final Set<String> items = stream(ifNoneMatch.split(",")).map(String::trim).collect(toSet());
if (isGetOrHead(method)) {
if ("*".equals(ifNoneMatch) || items.stream().map(EntityTag::valueOf)
.anyMatch(e -> e.equals(etag) || e.equals(new EntityTag(etag.getValue(), !etag.isWeak())))) {
throw new RedirectionException(notModified().build());
}
} else {
if ("*".equals(ifNoneMatch) || items.stream().map(EntityTag::valueOf).anyMatch(isEqual(etag))) {
throw new ClientErrorException(status(PRECONDITION_FAILED).build());
}
}
} | java | public static void checkIfNoneMatch(final String method, final String ifNoneMatch, final EntityTag etag) {
if (ifNoneMatch == null) {
return;
}
final Set<String> items = stream(ifNoneMatch.split(",")).map(String::trim).collect(toSet());
if (isGetOrHead(method)) {
if ("*".equals(ifNoneMatch) || items.stream().map(EntityTag::valueOf)
.anyMatch(e -> e.equals(etag) || e.equals(new EntityTag(etag.getValue(), !etag.isWeak())))) {
throw new RedirectionException(notModified().build());
}
} else {
if ("*".equals(ifNoneMatch) || items.stream().map(EntityTag::valueOf).anyMatch(isEqual(etag))) {
throw new ClientErrorException(status(PRECONDITION_FAILED).build());
}
}
} | [
"public",
"static",
"void",
"checkIfNoneMatch",
"(",
"final",
"String",
"method",
",",
"final",
"String",
"ifNoneMatch",
",",
"final",
"EntityTag",
"etag",
")",
"{",
"if",
"(",
"ifNoneMatch",
"==",
"null",
")",
"{",
"return",
";",
"}",
"final",
"Set",
"<",... | Check for a conditional operation.
@param method the HTTP method
@param ifNoneMatch the If-None-Match header
@param etag the resource etag | [
"Check",
"for",
"a",
"conditional",
"operation",
"."
] | train | https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/core/http/src/main/java/org/trellisldp/http/impl/HttpUtils.java#L359-L375 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationPropertyImpl_CustomFieldSerializer.java | OWLAnnotationPropertyImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLAnnotationPropertyImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLAnnotationPropertyImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLAnnotationPropertyImpl",
"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/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationPropertyImpl_CustomFieldSerializer.java#L63-L66 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.convertCharset | public static File convertCharset(File file, Charset srcCharset, Charset destCharset) {
return CharsetUtil.convert(file, srcCharset, destCharset);
} | java | public static File convertCharset(File file, Charset srcCharset, Charset destCharset) {
return CharsetUtil.convert(file, srcCharset, destCharset);
} | [
"public",
"static",
"File",
"convertCharset",
"(",
"File",
"file",
",",
"Charset",
"srcCharset",
",",
"Charset",
"destCharset",
")",
"{",
"return",
"CharsetUtil",
".",
"convert",
"(",
"file",
",",
"srcCharset",
",",
"destCharset",
")",
";",
"}"
] | 转换文件编码<br>
此方法用于转换文件编码,读取的文件实际编码必须与指定的srcCharset编码一致,否则导致乱码
@param file 文件
@param srcCharset 原文件的编码,必须与文件内容的编码保持一致
@param destCharset 转码后的编码
@return 被转换编码的文件
@see CharsetUtil#convert(File, Charset, Charset)
@since 3.1.0 | [
"转换文件编码<br",
">",
"此方法用于转换文件编码,读取的文件实际编码必须与指定的srcCharset编码一致,否则导致乱码"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3229-L3231 |
aws/aws-sdk-java | aws-java-sdk-kinesis/src/main/java/com/amazonaws/services/kinesis/model/AddTagsToStreamRequest.java | AddTagsToStreamRequest.withTags | public AddTagsToStreamRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public AddTagsToStreamRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"AddTagsToStreamRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A set of up to 10 key-value pairs to use to create the tags.
</p>
@param tags
A set of up to 10 key-value pairs to use to create the tags.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"set",
"of",
"up",
"to",
"10",
"key",
"-",
"value",
"pairs",
"to",
"use",
"to",
"create",
"the",
"tags",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kinesis/src/main/java/com/amazonaws/services/kinesis/model/AddTagsToStreamRequest.java#L122-L125 |
EsfingeFramework/ClassMock | ClassMock/src/main/java/net/sf/esfinge/classmock/ClassMockUtils.java | ClassMockUtils.newInstance | public static Object newInstance(final IClassWriter classMock) {
try {
final Class<?> clazz = classMock.build();
return clazz.newInstance();
} catch (final Exception e) {
throw new RuntimeException("Can't intanciate class", e);
}
} | java | public static Object newInstance(final IClassWriter classMock) {
try {
final Class<?> clazz = classMock.build();
return clazz.newInstance();
} catch (final Exception e) {
throw new RuntimeException("Can't intanciate class", e);
}
} | [
"public",
"static",
"Object",
"newInstance",
"(",
"final",
"IClassWriter",
"classMock",
")",
"{",
"try",
"{",
"final",
"Class",
"<",
"?",
">",
"clazz",
"=",
"classMock",
".",
"build",
"(",
")",
";",
"return",
"clazz",
".",
"newInstance",
"(",
")",
";",
... | Creates a new instance from class generated by IClassWriter
@param classMock
the class definition
@return instance of your class defined by IClassWriter | [
"Creates",
"a",
"new",
"instance",
"from",
"class",
"generated",
"by",
"IClassWriter"
] | train | https://github.com/EsfingeFramework/ClassMock/blob/a354c9dc68e8813fc4e995eef13e34796af58892/ClassMock/src/main/java/net/sf/esfinge/classmock/ClassMockUtils.java#L184-L196 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/BetaDistribution.java | BetaDistribution.logBeta | public static double logBeta(double alpha, double beta) {
return GammaDistribution.logGamma(alpha) + GammaDistribution.logGamma(beta) - GammaDistribution.logGamma(alpha + beta);
} | java | public static double logBeta(double alpha, double beta) {
return GammaDistribution.logGamma(alpha) + GammaDistribution.logGamma(beta) - GammaDistribution.logGamma(alpha + beta);
} | [
"public",
"static",
"double",
"logBeta",
"(",
"double",
"alpha",
",",
"double",
"beta",
")",
"{",
"return",
"GammaDistribution",
".",
"logGamma",
"(",
"alpha",
")",
"+",
"GammaDistribution",
".",
"logGamma",
"(",
"beta",
")",
"-",
"GammaDistribution",
".",
"... | Compute log beta(a,b)
@param alpha Shape parameter a
@param beta Shape parameter b
@return Logarithm of result | [
"Compute",
"log",
"beta",
"(",
"a",
"b",
")"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/BetaDistribution.java#L228-L230 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java | BlobContainersInner.extendImmutabilityPolicyAsync | public Observable<ImmutabilityPolicyInner> extendImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, String ifMatch, int immutabilityPeriodSinceCreationInDays) {
return extendImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays).map(new Func1<ServiceResponseWithHeaders<ImmutabilityPolicyInner, BlobContainersExtendImmutabilityPolicyHeaders>, ImmutabilityPolicyInner>() {
@Override
public ImmutabilityPolicyInner call(ServiceResponseWithHeaders<ImmutabilityPolicyInner, BlobContainersExtendImmutabilityPolicyHeaders> response) {
return response.body();
}
});
} | java | public Observable<ImmutabilityPolicyInner> extendImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, String ifMatch, int immutabilityPeriodSinceCreationInDays) {
return extendImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays).map(new Func1<ServiceResponseWithHeaders<ImmutabilityPolicyInner, BlobContainersExtendImmutabilityPolicyHeaders>, ImmutabilityPolicyInner>() {
@Override
public ImmutabilityPolicyInner call(ServiceResponseWithHeaders<ImmutabilityPolicyInner, BlobContainersExtendImmutabilityPolicyHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImmutabilityPolicyInner",
">",
"extendImmutabilityPolicyAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"containerName",
",",
"String",
"ifMatch",
",",
"int",
"immutabilityPeriodSinceCreationInDays",
")"... | Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.
@param ifMatch The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied.
@param immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImmutabilityPolicyInner object | [
"Extends",
"the",
"immutabilityPeriodSinceCreationInDays",
"of",
"a",
"locked",
"immutabilityPolicy",
".",
"The",
"only",
"action",
"allowed",
"on",
"a",
"Locked",
"policy",
"will",
"be",
"this",
"action",
".",
"ETag",
"in",
"If",
"-",
"Match",
"is",
"required",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L1618-L1625 |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/util/Args.java | Args.checkPositive | public static void checkPositive(int number, String message, Object... args) {
if (number < 0) {
throw new IllegalArgumentException(String.format(message, args));
}
} | java | public static void checkPositive(int number, String message, Object... args) {
if (number < 0) {
throw new IllegalArgumentException(String.format(message, args));
}
} | [
"public",
"static",
"void",
"checkPositive",
"(",
"int",
"number",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"number",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"... | Validates that an argument is positive.
@param value The value to check.
@param message An exception message.
@param args Exception message arguments. | [
"Validates",
"that",
"an",
"argument",
"is",
"positive",
"."
] | train | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/Args.java#L94-L98 |
line/armeria | core/src/main/java/com/linecorp/armeria/internal/ChannelUtil.java | ChannelUtil.findSslSession | @Nullable
public static SSLSession findSslSession(@Nullable Channel channel, SessionProtocol sessionProtocol) {
if (!sessionProtocol.isTls()) {
return null;
}
return findSslSession(channel);
} | java | @Nullable
public static SSLSession findSslSession(@Nullable Channel channel, SessionProtocol sessionProtocol) {
if (!sessionProtocol.isTls()) {
return null;
}
return findSslSession(channel);
} | [
"@",
"Nullable",
"public",
"static",
"SSLSession",
"findSslSession",
"(",
"@",
"Nullable",
"Channel",
"channel",
",",
"SessionProtocol",
"sessionProtocol",
")",
"{",
"if",
"(",
"!",
"sessionProtocol",
".",
"isTls",
"(",
")",
")",
"{",
"return",
"null",
";",
... | Finds the {@link SSLSession} of the current TLS connection.
@return the {@link SSLSession} if found, or {@code null} if {@link SessionProtocol} is not TLS,
the {@link SSLSession} is not found or {@link Channel} is {@code null}. | [
"Finds",
"the",
"{",
"@link",
"SSLSession",
"}",
"of",
"the",
"current",
"TLS",
"connection",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/ChannelUtil.java#L94-L101 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/ProtocolSignature.java | ProtocolSignature.getSigFingerprint | private static ProtocolSigFingerprint getSigFingerprint(
Class <? extends VersionedProtocol> protocol, long serverVersion) {
String protocolName = protocol.getName();
synchronized (PROTOCOL_FINGERPRINT_CACHE) {
ProtocolSigFingerprint sig = PROTOCOL_FINGERPRINT_CACHE.get(protocolName);
if (sig == null) {
int[] serverMethodHashcodes = getFingerprints(protocol.getMethods());
sig = new ProtocolSigFingerprint(
new ProtocolSignature(serverVersion, serverMethodHashcodes),
getFingerprint(serverMethodHashcodes));
PROTOCOL_FINGERPRINT_CACHE.put(protocolName, sig);
}
return sig;
}
} | java | private static ProtocolSigFingerprint getSigFingerprint(
Class <? extends VersionedProtocol> protocol, long serverVersion) {
String protocolName = protocol.getName();
synchronized (PROTOCOL_FINGERPRINT_CACHE) {
ProtocolSigFingerprint sig = PROTOCOL_FINGERPRINT_CACHE.get(protocolName);
if (sig == null) {
int[] serverMethodHashcodes = getFingerprints(protocol.getMethods());
sig = new ProtocolSigFingerprint(
new ProtocolSignature(serverVersion, serverMethodHashcodes),
getFingerprint(serverMethodHashcodes));
PROTOCOL_FINGERPRINT_CACHE.put(protocolName, sig);
}
return sig;
}
} | [
"private",
"static",
"ProtocolSigFingerprint",
"getSigFingerprint",
"(",
"Class",
"<",
"?",
"extends",
"VersionedProtocol",
">",
"protocol",
",",
"long",
"serverVersion",
")",
"{",
"String",
"protocolName",
"=",
"protocol",
".",
"getName",
"(",
")",
";",
"synchron... | Return a protocol's signature and finger print from cache
@param protocol a protocol class
@param serverVersion protocol version
@return its signature and finger print | [
"Return",
"a",
"protocol",
"s",
"signature",
"and",
"finger",
"print",
"from",
"cache"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/ProtocolSignature.java#L183-L197 |
jlinn/quartz-redis-jobstore | src/main/java/net/joelinn/quartz/jobstore/RedisClusterStorage.java | RedisClusterStorage.resumeTrigger | @Override
public void resumeTrigger(TriggerKey triggerKey, JedisCluster jedis) throws JobPersistenceException {
final String triggerHashKey = redisSchema.triggerHashKey(triggerKey);
Boolean exists = jedis.sismember(redisSchema.triggersSet(), triggerHashKey);
Double isPaused = jedis.zscore(redisSchema.triggerStateKey(RedisTriggerState.PAUSED), triggerHashKey);
Double isPausedBlocked = jedis.zscore(redisSchema.triggerStateKey(RedisTriggerState.PAUSED_BLOCKED), triggerHashKey);
if (!exists) {
// Trigger does not exist. Nothing to do.
return;
}
if (isPaused == null && isPausedBlocked == null) {
// Trigger is not paused. Nothing to do.
return;
}
OperableTrigger trigger = retrieveTrigger(triggerKey, jedis);
final String jobHashKey = redisSchema.jobHashKey(trigger.getJobKey());
final Date nextFireTime = trigger.getNextFireTime();
if (nextFireTime != null) {
if (isBlockedJob(jobHashKey, jedis)) {
setTriggerState(RedisTriggerState.BLOCKED, (double) nextFireTime.getTime(), triggerHashKey, jedis);
} else {
setTriggerState(RedisTriggerState.WAITING, (double) nextFireTime.getTime(), triggerHashKey, jedis);
}
}
applyMisfire(trigger, jedis);
} | java | @Override
public void resumeTrigger(TriggerKey triggerKey, JedisCluster jedis) throws JobPersistenceException {
final String triggerHashKey = redisSchema.triggerHashKey(triggerKey);
Boolean exists = jedis.sismember(redisSchema.triggersSet(), triggerHashKey);
Double isPaused = jedis.zscore(redisSchema.triggerStateKey(RedisTriggerState.PAUSED), triggerHashKey);
Double isPausedBlocked = jedis.zscore(redisSchema.triggerStateKey(RedisTriggerState.PAUSED_BLOCKED), triggerHashKey);
if (!exists) {
// Trigger does not exist. Nothing to do.
return;
}
if (isPaused == null && isPausedBlocked == null) {
// Trigger is not paused. Nothing to do.
return;
}
OperableTrigger trigger = retrieveTrigger(triggerKey, jedis);
final String jobHashKey = redisSchema.jobHashKey(trigger.getJobKey());
final Date nextFireTime = trigger.getNextFireTime();
if (nextFireTime != null) {
if (isBlockedJob(jobHashKey, jedis)) {
setTriggerState(RedisTriggerState.BLOCKED, (double) nextFireTime.getTime(), triggerHashKey, jedis);
} else {
setTriggerState(RedisTriggerState.WAITING, (double) nextFireTime.getTime(), triggerHashKey, jedis);
}
}
applyMisfire(trigger, jedis);
} | [
"@",
"Override",
"public",
"void",
"resumeTrigger",
"(",
"TriggerKey",
"triggerKey",
",",
"JedisCluster",
"jedis",
")",
"throws",
"JobPersistenceException",
"{",
"final",
"String",
"triggerHashKey",
"=",
"redisSchema",
".",
"triggerHashKey",
"(",
"triggerKey",
")",
... | Resume (un-pause) a {@link Trigger}
@param triggerKey the key of the trigger to be resumed
@param jedis a thread-safe Redis connection | [
"Resume",
"(",
"un",
"-",
"pause",
")",
"a",
"{",
"@link",
"Trigger",
"}"
] | train | https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/RedisClusterStorage.java#L532-L559 |
doanduyhai/Achilles | achilles-core/src/main/java/info/archinnov/achilles/bootstrap/AbstractManagerFactoryBuilder.java | AbstractManagerFactoryBuilder.withDefaultSerialConsistencyMap | public T withDefaultSerialConsistencyMap(Map<String, ConsistencyLevel> serialConsistencyMap) {
configMap.put(CONSISTENCY_LEVEL_SERIAL_MAP, serialConsistencyMap);
return getThis();
} | java | public T withDefaultSerialConsistencyMap(Map<String, ConsistencyLevel> serialConsistencyMap) {
configMap.put(CONSISTENCY_LEVEL_SERIAL_MAP, serialConsistencyMap);
return getThis();
} | [
"public",
"T",
"withDefaultSerialConsistencyMap",
"(",
"Map",
"<",
"String",
",",
"ConsistencyLevel",
">",
"serialConsistencyMap",
")",
"{",
"configMap",
".",
"put",
"(",
"CONSISTENCY_LEVEL_SERIAL_MAP",
",",
"serialConsistencyMap",
")",
";",
"return",
"getThis",
"(",
... | Define the default Consistency level map to be used for all LightWeightTransaction operations
operations The map keys represent table names and values represent
the corresponding consistency level
@return ManagerFactoryBuilder
@see <a href="https://github.com/doanduyhai/Achilles/wiki/Configuration-Parameters#consistency-level" target="_blank">Consistency configuration</a> | [
"Define",
"the",
"default",
"Consistency",
"level",
"map",
"to",
"be",
"used",
"for",
"all",
"LightWeightTransaction",
"operations",
"operations",
"The",
"map",
"keys",
"represent",
"table",
"names",
"and",
"values",
"represent",
"the",
"corresponding",
"consistency... | train | https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/bootstrap/AbstractManagerFactoryBuilder.java#L161-L164 |
realtime-framework/RealtimeMessaging-Android | library/src/main/java/ibt/ortc/extensibility/GcmRegistration.java | GcmRegistration.storeRegistrationId | private static void storeRegistrationId(Context context, String regId) {
final SharedPreferences prefs = getGcmPreferences(context);
int appVersion = getAppVersion(context);
SharedPreferences.Editor editor = prefs.edit();
editor.putString(PROPERTY_REG_ID, regId);
editor.putInt(PROPERTY_APP_VERSION, appVersion);
editor.commit();
} | java | private static void storeRegistrationId(Context context, String regId) {
final SharedPreferences prefs = getGcmPreferences(context);
int appVersion = getAppVersion(context);
SharedPreferences.Editor editor = prefs.edit();
editor.putString(PROPERTY_REG_ID, regId);
editor.putInt(PROPERTY_APP_VERSION, appVersion);
editor.commit();
} | [
"private",
"static",
"void",
"storeRegistrationId",
"(",
"Context",
"context",
",",
"String",
"regId",
")",
"{",
"final",
"SharedPreferences",
"prefs",
"=",
"getGcmPreferences",
"(",
"context",
")",
";",
"int",
"appVersion",
"=",
"getAppVersion",
"(",
"context",
... | Stores the registration ID and the app versionCode in the application's
{@code SharedPreferences}.
@param context application's context.
@param regId registration ID | [
"Stores",
"the",
"registration",
"ID",
"and",
"the",
"app",
"versionCode",
"in",
"the",
"application",
"s",
"{",
"@code",
"SharedPreferences",
"}",
"."
] | train | https://github.com/realtime-framework/RealtimeMessaging-Android/blob/f0d87b92ed7c591bcfe2b9cf45b947865570e061/library/src/main/java/ibt/ortc/extensibility/GcmRegistration.java#L156-L163 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/BooleanUtils.java | BooleanUtils.toBoolean | public static boolean toBoolean(final String str, final String trueString, final String falseString) {
if (str == trueString) {
return true;
} else if (str == falseString) {
return false;
} else if (str != null) {
if (str.equals(trueString)) {
return true;
} else if (str.equals(falseString)) {
return false;
}
}
// no match
throw new IllegalArgumentException("The String did not match either specified value");
} | java | public static boolean toBoolean(final String str, final String trueString, final String falseString) {
if (str == trueString) {
return true;
} else if (str == falseString) {
return false;
} else if (str != null) {
if (str.equals(trueString)) {
return true;
} else if (str.equals(falseString)) {
return false;
}
}
// no match
throw new IllegalArgumentException("The String did not match either specified value");
} | [
"public",
"static",
"boolean",
"toBoolean",
"(",
"final",
"String",
"str",
",",
"final",
"String",
"trueString",
",",
"final",
"String",
"falseString",
")",
"{",
"if",
"(",
"str",
"==",
"trueString",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(... | <p>Converts a String to a Boolean throwing an exception if no match found.</p>
<pre>
BooleanUtils.toBoolean("true", "true", "false") = true
BooleanUtils.toBoolean("false", "true", "false") = false
</pre>
@param str the String to check
@param trueString the String to match for {@code true} (case sensitive), may be {@code null}
@param falseString the String to match for {@code false} (case sensitive), may be {@code null}
@return the boolean value of the string
@throws IllegalArgumentException if the String doesn't match | [
"<p",
">",
"Converts",
"a",
"String",
"to",
"a",
"Boolean",
"throwing",
"an",
"exception",
"if",
"no",
"match",
"found",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/BooleanUtils.java#L726-L740 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/ZipShort.java | ZipShort.getValue | public static int getValue(byte[] bytes, int offset) {
int value = (bytes[offset + 1] << BYTE_1_SHIFT) & BYTE_1_MASK;
value += (bytes[offset] & BYTE_MASK);
return value;
} | java | public static int getValue(byte[] bytes, int offset) {
int value = (bytes[offset + 1] << BYTE_1_SHIFT) & BYTE_1_MASK;
value += (bytes[offset] & BYTE_MASK);
return value;
} | [
"public",
"static",
"int",
"getValue",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"int",
"value",
"=",
"(",
"bytes",
"[",
"offset",
"+",
"1",
"]",
"<<",
"BYTE_1_SHIFT",
")",
"&",
"BYTE_1_MASK",
";",
"value",
"+=",
"(",
"bytes",
... | Helper method to get the value as a java int from two bytes starting at given array offset
@param bytes the array of bytes
@param offset the offset to start
@return the corresponding java int value | [
"Helper",
"method",
"to",
"get",
"the",
"value",
"as",
"a",
"java",
"int",
"from",
"two",
"bytes",
"starting",
"at",
"given",
"array",
"offset"
] | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/ZipShort.java#L112-L116 |
morimekta/utils | console-util/src/main/java/net/morimekta/console/args/SubCommandSet.java | SubCommandSet.printUsage | public void printUsage(PrintWriter writer, String name, boolean showHidden) {
for (SubCommand<SubCommandDef> cmd : subCommands) {
if (name.equals(cmd.getName())) {
cmd.getArgumentParser(cmd.newInstance()).printUsage(writer, showHidden);
return;
}
}
throw new ArgumentException("No such " + getName() + " " + name);
} | java | public void printUsage(PrintWriter writer, String name, boolean showHidden) {
for (SubCommand<SubCommandDef> cmd : subCommands) {
if (name.equals(cmd.getName())) {
cmd.getArgumentParser(cmd.newInstance()).printUsage(writer, showHidden);
return;
}
}
throw new ArgumentException("No such " + getName() + " " + name);
} | [
"public",
"void",
"printUsage",
"(",
"PrintWriter",
"writer",
",",
"String",
"name",
",",
"boolean",
"showHidden",
")",
"{",
"for",
"(",
"SubCommand",
"<",
"SubCommandDef",
">",
"cmd",
":",
"subCommands",
")",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
... | Print the option usage list. Essentially printed as a list of options
with the description indented where it overflows the available line
width.
@param writer The output printer.
@param name The sub-command to print help for.
@param showHidden Whether to show hidden options. | [
"Print",
"the",
"option",
"usage",
"list",
".",
"Essentially",
"printed",
"as",
"a",
"list",
"of",
"options",
"with",
"the",
"description",
"indented",
"where",
"it",
"overflows",
"the",
"available",
"line",
"width",
"."
] | train | https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/console-util/src/main/java/net/morimekta/console/args/SubCommandSet.java#L252-L260 |
attribyte/wpdb | src/main/java/org/attribyte/wp/db/DB.java | DB.updatePostContent | public boolean updatePostContent(long postId, final String content) throws SQLException {
Connection conn = null;
PreparedStatement stmt = null;
Timer.Context ctx = metrics.updatePostTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(updatePostContentSQL);
stmt.setString(1, content);
stmt.setLong(2, postId);
return stmt.executeUpdate() > 0;
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt);
}
} | java | public boolean updatePostContent(long postId, final String content) throws SQLException {
Connection conn = null;
PreparedStatement stmt = null;
Timer.Context ctx = metrics.updatePostTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(updatePostContentSQL);
stmt.setString(1, content);
stmt.setLong(2, postId);
return stmt.executeUpdate() > 0;
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt);
}
} | [
"public",
"boolean",
"updatePostContent",
"(",
"long",
"postId",
",",
"final",
"String",
"content",
")",
"throws",
"SQLException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"PreparedStatement",
"stmt",
"=",
"null",
";",
"Timer",
".",
"Context",
"ctx",
"=",
... | Updates the content for a post.
@param postId The post to update.
@param content The new content.
@return Was the post modified?
@throws SQLException on database error or missing post id. | [
"Updates",
"the",
"content",
"for",
"a",
"post",
"."
] | train | https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L1525-L1539 |
dwdyer/watchmaker | swing/src/java/main/org/uncommons/swing/SwingBackgroundTask.java | SwingBackgroundTask.execute | public void execute()
{
Runnable task = new Runnable()
{
public void run()
{
try
{
final V result = performTask();
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
postProcessing(result);
latch.countDown();
}
});
}
// If an exception occurs performing the task, we need
// to handle it.
catch (final Throwable throwable)
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
onError(throwable);
latch.countDown();
}
});
}
}
};
new Thread(task, "SwingBackgroundTask-" + id).start();
} | java | public void execute()
{
Runnable task = new Runnable()
{
public void run()
{
try
{
final V result = performTask();
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
postProcessing(result);
latch.countDown();
}
});
}
// If an exception occurs performing the task, we need
// to handle it.
catch (final Throwable throwable)
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
onError(throwable);
latch.countDown();
}
});
}
}
};
new Thread(task, "SwingBackgroundTask-" + id).start();
} | [
"public",
"void",
"execute",
"(",
")",
"{",
"Runnable",
"task",
"=",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"final",
"V",
"result",
"=",
"performTask",
"(",
")",
";",
"SwingUtilities",
".",
"invokeLater",
... | Asynchronous call that begins execution of the task and returns immediately.
The {@link #performTask()} method will be invoked on a background thread and,
when it has completed, {@link #postProcessing(Object)} will be invoked on the
Event Dispatch Thread (or, if there is an exception, {@link #onError(Throwable)}
will be invoked instead - also on the EDT).
@see #performTask()
@see #postProcessing(Object)
@see #onError(Throwable)
@see #waitForCompletion() | [
"Asynchronous",
"call",
"that",
"begins",
"execution",
"of",
"the",
"task",
"and",
"returns",
"immediately",
".",
"The",
"{"
] | train | https://github.com/dwdyer/watchmaker/blob/33d942350e6bf7d9a17b9262a4f898158530247e/swing/src/java/main/org/uncommons/swing/SwingBackgroundTask.java#L55-L89 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksInner.java | ServerCommunicationLinksInner.createOrUpdate | public ServerCommunicationLinkInner createOrUpdate(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).toBlocking().last().body();
} | java | public ServerCommunicationLinkInner createOrUpdate(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).toBlocking().last().body();
} | [
"public",
"ServerCommunicationLinkInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"communicationLinkName",
",",
"String",
"partnerServer",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGro... | Creates a server communication link.
@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 communicationLinkName The name of the server communication link.
@param partnerServer The name of the partner server.
@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 ServerCommunicationLinkInner object if successful. | [
"Creates",
"a",
"server",
"communication",
"link",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksInner.java#L277-L279 |
Cornutum/tcases | tcases-maven-plugin/src/main/java/org/cornutum/tcases/maven/TcasesMojo.java | TcasesMojo.getProjectFile | private String getProjectFile( String projectName, String filePattern)
{
String projectFile = null;
if( !StringUtils.isBlank( filePattern))
{
Matcher matcher = projectFilePattern_.matcher( filePattern);
if( matcher.matches())
{
projectFile =
StringUtils.isBlank( matcher.group(2))
? filePattern
: matcher.group(1) + projectName + matcher.group(3);
}
}
return projectFile;
} | java | private String getProjectFile( String projectName, String filePattern)
{
String projectFile = null;
if( !StringUtils.isBlank( filePattern))
{
Matcher matcher = projectFilePattern_.matcher( filePattern);
if( matcher.matches())
{
projectFile =
StringUtils.isBlank( matcher.group(2))
? filePattern
: matcher.group(1) + projectName + matcher.group(3);
}
}
return projectFile;
} | [
"private",
"String",
"getProjectFile",
"(",
"String",
"projectName",
",",
"String",
"filePattern",
")",
"{",
"String",
"projectFile",
"=",
"null",
";",
"if",
"(",
"!",
"StringUtils",
".",
"isBlank",
"(",
"filePattern",
")",
")",
"{",
"Matcher",
"matcher",
"=... | Returns the file name defined by applying the given pattern to the project name.
Returns null if the file pattern is invalid. | [
"Returns",
"the",
"file",
"name",
"defined",
"by",
"applying",
"the",
"given",
"pattern",
"to",
"the",
"project",
"name",
".",
"Returns",
"null",
"if",
"the",
"file",
"pattern",
"is",
"invalid",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-maven-plugin/src/main/java/org/cornutum/tcases/maven/TcasesMojo.java#L159-L175 |
rhuss/jolokia | agent/jvm/src/main/java/org/jolokia/jvmagent/JvmAgent.java | JvmAgent.agentmain | public static void agentmain(String agentArgs, Instrumentation instrumentation) {
JvmAgentConfig config = new JvmAgentConfig(agentArgs);
if (!config.isModeStop()) {
startAgent(config,false, instrumentation);
} else {
stopAgent();
}
} | java | public static void agentmain(String agentArgs, Instrumentation instrumentation) {
JvmAgentConfig config = new JvmAgentConfig(agentArgs);
if (!config.isModeStop()) {
startAgent(config,false, instrumentation);
} else {
stopAgent();
}
} | [
"public",
"static",
"void",
"agentmain",
"(",
"String",
"agentArgs",
",",
"Instrumentation",
"instrumentation",
")",
"{",
"JvmAgentConfig",
"config",
"=",
"new",
"JvmAgentConfig",
"(",
"agentArgs",
")",
";",
"if",
"(",
"!",
"config",
".",
"isModeStop",
"(",
")... | Entry point for the agent, using dynamic attach
(this is post VM initialisation attachment, via com.sun.attach)
@param agentArgs arguments as given on the command line | [
"Entry",
"point",
"for",
"the",
"agent",
"using",
"dynamic",
"attach",
"(",
"this",
"is",
"post",
"VM",
"initialisation",
"attachment",
"via",
"com",
".",
"sun",
".",
"attach",
")"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/JvmAgent.java#L81-L88 |
Azure/azure-sdk-for-java | cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountsInner.java | CognitiveServicesAccountsInner.regenerateKey | public CognitiveServicesAccountKeysInner regenerateKey(String resourceGroupName, String accountName) {
return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body();
} | java | public CognitiveServicesAccountKeysInner regenerateKey(String resourceGroupName, String accountName) {
return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body();
} | [
"public",
"CognitiveServicesAccountKeysInner",
"regenerateKey",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
")",
"{",
"return",
"regenerateKeyWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
")",
".",
"toBlocking",
"(",
")",
"... | Regenerates the specified account key for the specified Cognitive Services account.
@param resourceGroupName The name of the resource group within the user's subscription.
@param accountName The name of the cognitive services account within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CognitiveServicesAccountKeysInner object if successful. | [
"Regenerates",
"the",
"specified",
"account",
"key",
"for",
"the",
"specified",
"Cognitive",
"Services",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountsInner.java#L825-L827 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsVfsDriver.java | CmsVfsDriver.internalReadCounter | protected Integer internalReadCounter(CmsDbContext dbc, String name) throws CmsDbSqlException {
PreparedStatement stmt = null;
Connection conn = null;
ResultSet resultSet = null;
try {
conn = m_sqlManager.getConnection(dbc);
stmt = m_sqlManager.getPreparedStatement(conn, CmsProject.ONLINE_PROJECT_ID, "C_READ_COUNTER");
stmt.setString(1, name);
resultSet = stmt.executeQuery();
Integer result = null;
if (resultSet.next()) {
int counter = resultSet.getInt(1);
result = new Integer(counter);
while (resultSet.next()) {
// for MSSQL
}
}
return result;
} catch (SQLException e) {
throw wrapException(stmt, e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, resultSet);
}
} | java | protected Integer internalReadCounter(CmsDbContext dbc, String name) throws CmsDbSqlException {
PreparedStatement stmt = null;
Connection conn = null;
ResultSet resultSet = null;
try {
conn = m_sqlManager.getConnection(dbc);
stmt = m_sqlManager.getPreparedStatement(conn, CmsProject.ONLINE_PROJECT_ID, "C_READ_COUNTER");
stmt.setString(1, name);
resultSet = stmt.executeQuery();
Integer result = null;
if (resultSet.next()) {
int counter = resultSet.getInt(1);
result = new Integer(counter);
while (resultSet.next()) {
// for MSSQL
}
}
return result;
} catch (SQLException e) {
throw wrapException(stmt, e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, resultSet);
}
} | [
"protected",
"Integer",
"internalReadCounter",
"(",
"CmsDbContext",
"dbc",
",",
"String",
"name",
")",
"throws",
"CmsDbSqlException",
"{",
"PreparedStatement",
"stmt",
"=",
"null",
";",
"Connection",
"conn",
"=",
"null",
";",
"ResultSet",
"resultSet",
"=",
"null",... | Reads the current value of a counter.<p>
@param dbc the database context
@param name the name of the counter
@return the current value of the counter, or null if the counter was not found
@throws CmsDbSqlException if something goes wrong | [
"Reads",
"the",
"current",
"value",
"of",
"a",
"counter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsVfsDriver.java#L3801-L3825 |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/DualInputSemanticProperties.java | DualInputSemanticProperties.addForwardedField | public void addForwardedField(int input, int sourceField, int targetField) {
Map<Integer, FieldSet> fieldMapping;
if (input != 0 && input != 1) {
throw new IndexOutOfBoundsException();
} else if (input == 0) {
fieldMapping = this.fieldMapping1;
} else {
fieldMapping = this.fieldMapping2;
}
if(isTargetFieldPresent(targetField, fieldMapping)) {
throw new InvalidSemanticAnnotationException("Target field "+targetField+" was added twice to input "+input);
}
FieldSet targetFields = fieldMapping.get(sourceField);
if (targetFields != null) {
fieldMapping.put(sourceField, targetFields.addField(targetField));
} else {
fieldMapping.put(sourceField, new FieldSet(targetField));
}
} | java | public void addForwardedField(int input, int sourceField, int targetField) {
Map<Integer, FieldSet> fieldMapping;
if (input != 0 && input != 1) {
throw new IndexOutOfBoundsException();
} else if (input == 0) {
fieldMapping = this.fieldMapping1;
} else {
fieldMapping = this.fieldMapping2;
}
if(isTargetFieldPresent(targetField, fieldMapping)) {
throw new InvalidSemanticAnnotationException("Target field "+targetField+" was added twice to input "+input);
}
FieldSet targetFields = fieldMapping.get(sourceField);
if (targetFields != null) {
fieldMapping.put(sourceField, targetFields.addField(targetField));
} else {
fieldMapping.put(sourceField, new FieldSet(targetField));
}
} | [
"public",
"void",
"addForwardedField",
"(",
"int",
"input",
",",
"int",
"sourceField",
",",
"int",
"targetField",
")",
"{",
"Map",
"<",
"Integer",
",",
"FieldSet",
">",
"fieldMapping",
";",
"if",
"(",
"input",
"!=",
"0",
"&&",
"input",
"!=",
"1",
")",
... | Adds, to the existing information, a field that is forwarded directly
from the source record(s) in the first input to the destination
record(s).
@param input the input of the source field
@param sourceField the position in the source record
@param targetField the position in the destination record | [
"Adds",
"to",
"the",
"existing",
"information",
"a",
"field",
"that",
"is",
"forwarded",
"directly",
"from",
"the",
"source",
"record",
"(",
"s",
")",
"in",
"the",
"first",
"input",
"to",
"the",
"destination",
"record",
"(",
"s",
")",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/DualInputSemanticProperties.java#L122-L144 |
jayantk/jklol | src/com/jayantkrish/jklol/models/TableFactorBuilder.java | TableFactorBuilder.maxWeight | public void maxWeight(Assignment assignment, double weight) {
setWeight(assignment, Math.max(getWeight(assignment), weight));
} | java | public void maxWeight(Assignment assignment, double weight) {
setWeight(assignment, Math.max(getWeight(assignment), weight));
} | [
"public",
"void",
"maxWeight",
"(",
"Assignment",
"assignment",
",",
"double",
"weight",
")",
"{",
"setWeight",
"(",
"assignment",
",",
"Math",
".",
"max",
"(",
"getWeight",
"(",
"assignment",
")",
",",
"weight",
")",
")",
";",
"}"
] | Sets the weight of {@code assignment} to
{@code Math.max(getWeight(assignment), weight)}.
@param assignment
@param weight | [
"Sets",
"the",
"weight",
"of",
"{",
"@code",
"assignment",
"}",
"to",
"{",
"@code",
"Math",
".",
"max",
"(",
"getWeight",
"(",
"assignment",
")",
"weight",
")",
"}",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/TableFactorBuilder.java#L217-L219 |
baasbox/Android-SDK | library/src/main/java/com/baasbox/android/BaasDocument.java | BaasDocument.fetchAll | public static RequestToken fetchAll(String collection, BaasQuery.Criteria filter, BaasHandler<List<BaasDocument>> handler) {
return fetchAll(collection, filter, RequestOptions.DEFAULT, handler);
} | java | public static RequestToken fetchAll(String collection, BaasQuery.Criteria filter, BaasHandler<List<BaasDocument>> handler) {
return fetchAll(collection, filter, RequestOptions.DEFAULT, handler);
} | [
"public",
"static",
"RequestToken",
"fetchAll",
"(",
"String",
"collection",
",",
"BaasQuery",
".",
"Criteria",
"filter",
",",
"BaasHandler",
"<",
"List",
"<",
"BaasDocument",
">",
">",
"handler",
")",
"{",
"return",
"fetchAll",
"(",
"collection",
",",
"filter... | Asynchronously retrieves the list of documents readable to the user that match <code>filter</code>
in <code>collection</code>
@param collection the collection to retrieve not <code>null</code>
@param filter a filter to apply to the request
@param handler a callback to be invoked with the result of the request
@return a {@link com.baasbox.android.RequestToken} to handle the asynchronous request | [
"Asynchronously",
"retrieves",
"the",
"list",
"of",
"documents",
"readable",
"to",
"the",
"user",
"that",
"match",
"<code",
">",
"filter<",
"/",
"code",
">",
"in",
"<code",
">",
"collection<",
"/",
"code",
">"
] | train | https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasDocument.java#L245-L247 |
nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.getKeyPair | public KeyPair getKeyPair() throws GeneralSecurityException, IOException {
if (privateKeyAsSeed == null) {
throw new IllegalStateException("Public-only NKey");
}
DecodedSeed decoded = decodeSeed(privateKeyAsSeed);
byte[] seedBytes = new byte[ED25519_SEED_SIZE];
byte[] pubBytes = new byte[ED25519_PUBLIC_KEYSIZE];
System.arraycopy(decoded.bytes, 0, seedBytes, 0, seedBytes.length);
System.arraycopy(decoded.bytes, seedBytes.length, pubBytes, 0, pubBytes.length);
EdDSAPrivateKeySpec privKeySpec = new EdDSAPrivateKeySpec(seedBytes, NKey.ed25519);
EdDSAPrivateKey privKey = new EdDSAPrivateKey(privKeySpec);
EdDSAPublicKeySpec pubKeySpec = new EdDSAPublicKeySpec(pubBytes, NKey.ed25519);
EdDSAPublicKey pubKey = new EdDSAPublicKey(pubKeySpec);
return new KeyPair(pubKey, privKey);
} | java | public KeyPair getKeyPair() throws GeneralSecurityException, IOException {
if (privateKeyAsSeed == null) {
throw new IllegalStateException("Public-only NKey");
}
DecodedSeed decoded = decodeSeed(privateKeyAsSeed);
byte[] seedBytes = new byte[ED25519_SEED_SIZE];
byte[] pubBytes = new byte[ED25519_PUBLIC_KEYSIZE];
System.arraycopy(decoded.bytes, 0, seedBytes, 0, seedBytes.length);
System.arraycopy(decoded.bytes, seedBytes.length, pubBytes, 0, pubBytes.length);
EdDSAPrivateKeySpec privKeySpec = new EdDSAPrivateKeySpec(seedBytes, NKey.ed25519);
EdDSAPrivateKey privKey = new EdDSAPrivateKey(privKeySpec);
EdDSAPublicKeySpec pubKeySpec = new EdDSAPublicKeySpec(pubBytes, NKey.ed25519);
EdDSAPublicKey pubKey = new EdDSAPublicKey(pubKeySpec);
return new KeyPair(pubKey, privKey);
} | [
"public",
"KeyPair",
"getKeyPair",
"(",
")",
"throws",
"GeneralSecurityException",
",",
"IOException",
"{",
"if",
"(",
"privateKeyAsSeed",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Public-only NKey\"",
")",
";",
"}",
"DecodedSeed",
"... | @return A Java security keypair that represents this NKey in Java security
form.
@throws GeneralSecurityException if there is an encryption problem
@throws IOException if there is a problem encoding or decoding | [
"@return",
"A",
"Java",
"security",
"keypair",
"that",
"represents",
"this",
"NKey",
"in",
"Java",
"security",
"form",
"."
] | train | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L732-L750 |
jamesdbloom/mockserver | mockserver-core/src/main/java/org/mockserver/socket/tls/KeyAndCertificateFactory.java | KeyAndCertificateFactory.createCACert | private X509Certificate createCACert(PublicKey publicKey, PrivateKey privateKey) throws Exception {
// signers name
X500Name issuerName = new X500Name("CN=www.mockserver.com, O=MockServer, L=London, ST=England, C=UK");
// subjects name - the same as we are self signed.
X500Name subjectName = issuerName;
// serial
BigInteger serial = BigInteger.valueOf(new Random().nextInt(Integer.MAX_VALUE));
// create the certificate - version 3
X509v3CertificateBuilder builder = new JcaX509v3CertificateBuilder(issuerName, serial, NOT_BEFORE, NOT_AFTER, subjectName, publicKey);
builder.addExtension(Extension.subjectKeyIdentifier, false, createSubjectKeyIdentifier(publicKey));
builder.addExtension(Extension.basicConstraints, true, new BasicConstraints(true));
KeyUsage usage = new KeyUsage(KeyUsage.keyCertSign | KeyUsage.digitalSignature | KeyUsage.keyEncipherment | KeyUsage.dataEncipherment | KeyUsage.cRLSign);
builder.addExtension(Extension.keyUsage, false, usage);
ASN1EncodableVector purposes = new ASN1EncodableVector();
purposes.add(KeyPurposeId.id_kp_serverAuth);
purposes.add(KeyPurposeId.id_kp_clientAuth);
purposes.add(KeyPurposeId.anyExtendedKeyUsage);
builder.addExtension(Extension.extendedKeyUsage, false, new DERSequence(purposes));
X509Certificate cert = signCertificate(builder, privateKey);
cert.checkValidity(new Date());
cert.verify(publicKey);
return cert;
} | java | private X509Certificate createCACert(PublicKey publicKey, PrivateKey privateKey) throws Exception {
// signers name
X500Name issuerName = new X500Name("CN=www.mockserver.com, O=MockServer, L=London, ST=England, C=UK");
// subjects name - the same as we are self signed.
X500Name subjectName = issuerName;
// serial
BigInteger serial = BigInteger.valueOf(new Random().nextInt(Integer.MAX_VALUE));
// create the certificate - version 3
X509v3CertificateBuilder builder = new JcaX509v3CertificateBuilder(issuerName, serial, NOT_BEFORE, NOT_AFTER, subjectName, publicKey);
builder.addExtension(Extension.subjectKeyIdentifier, false, createSubjectKeyIdentifier(publicKey));
builder.addExtension(Extension.basicConstraints, true, new BasicConstraints(true));
KeyUsage usage = new KeyUsage(KeyUsage.keyCertSign | KeyUsage.digitalSignature | KeyUsage.keyEncipherment | KeyUsage.dataEncipherment | KeyUsage.cRLSign);
builder.addExtension(Extension.keyUsage, false, usage);
ASN1EncodableVector purposes = new ASN1EncodableVector();
purposes.add(KeyPurposeId.id_kp_serverAuth);
purposes.add(KeyPurposeId.id_kp_clientAuth);
purposes.add(KeyPurposeId.anyExtendedKeyUsage);
builder.addExtension(Extension.extendedKeyUsage, false, new DERSequence(purposes));
X509Certificate cert = signCertificate(builder, privateKey);
cert.checkValidity(new Date());
cert.verify(publicKey);
return cert;
} | [
"private",
"X509Certificate",
"createCACert",
"(",
"PublicKey",
"publicKey",
",",
"PrivateKey",
"privateKey",
")",
"throws",
"Exception",
"{",
"// signers name",
"X500Name",
"issuerName",
"=",
"new",
"X500Name",
"(",
"\"CN=www.mockserver.com, O=MockServer, L=London, ST=Englan... | Create a certificate to use by a Certificate Authority, signed by a self signed certificate. | [
"Create",
"a",
"certificate",
"to",
"use",
"by",
"a",
"Certificate",
"Authority",
"signed",
"by",
"a",
"self",
"signed",
"certificate",
"."
] | train | https://github.com/jamesdbloom/mockserver/blob/8b84fdd877e57b4eb780c9f8c8b1d65bcb448025/mockserver-core/src/main/java/org/mockserver/socket/tls/KeyAndCertificateFactory.java#L138-L168 |
nemerosa/ontrack | ontrack-service/src/main/java/net/nemerosa/ontrack/service/security/FileConfidentialStore.java | FileConfidentialStore.load | @Override
public byte[] load(String key) throws IOException {
try {
File f = getFileFor(key);
if (!f.exists()) return null;
Cipher sym = Cipher.getInstance("AES");
sym.init(Cipher.DECRYPT_MODE, masterKey);
try (
FileInputStream fis = new FileInputStream(f);
CipherInputStream cis = new CipherInputStream(fis, sym)
) {
byte[] bytes = IOUtils.toByteArray(cis);
return verifyMagic(bytes);
}
} catch (GeneralSecurityException e) {
throw new IOException("Failed to persist the key: " + key, e);
}
} | java | @Override
public byte[] load(String key) throws IOException {
try {
File f = getFileFor(key);
if (!f.exists()) return null;
Cipher sym = Cipher.getInstance("AES");
sym.init(Cipher.DECRYPT_MODE, masterKey);
try (
FileInputStream fis = new FileInputStream(f);
CipherInputStream cis = new CipherInputStream(fis, sym)
) {
byte[] bytes = IOUtils.toByteArray(cis);
return verifyMagic(bytes);
}
} catch (GeneralSecurityException e) {
throw new IOException("Failed to persist the key: " + key, e);
}
} | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"load",
"(",
"String",
"key",
")",
"throws",
"IOException",
"{",
"try",
"{",
"File",
"f",
"=",
"getFileFor",
"(",
"key",
")",
";",
"if",
"(",
"!",
"f",
".",
"exists",
"(",
")",
")",
"return",
"null",
"... | Reverse operation of {@link #store(String, byte[])}
@return null the data has not been previously persisted. | [
"Reverse",
"operation",
"of",
"{",
"@link",
"#store",
"(",
"String",
"byte",
"[]",
")",
"}"
] | train | https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-service/src/main/java/net/nemerosa/ontrack/service/security/FileConfidentialStore.java#L93-L111 |
hageldave/ImagingKit | ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/Fourier.java | Fourier.verticalTransform | public static ComplexImg verticalTransform(ColorImg img, int channel) {
sanityCheckForward(img, channel);
// make transforms
ComplexImg transformed = new ComplexImg(img.getDimension());
try(
NativeRealArray col = new NativeRealArray(img.getHeight());
NativeRealArray fft_r = new NativeRealArray(col.length);
NativeRealArray fft_i = new NativeRealArray(col.length);
) {
ColorPixel px = img.getPixel();
ComplexPixel tpx = transformed.getPixel();
for(int x = 0; x < img.getWidth(); x++){
for(int y = 0; y < img.getHeight(); y++){
px.setPosition(x, y);
col.set(y, px.getValue(channel));
}
FFTW_Guru.execute_split_r2c(col, fft_r, fft_i, img.getHeight());
for(int y = 0; y < img.getHeight(); y++){
tpx.setPosition(x, y);
tpx.setComplex(fft_r.get(y), fft_i.get(y));
}
}
}
return transformed;
} | java | public static ComplexImg verticalTransform(ColorImg img, int channel) {
sanityCheckForward(img, channel);
// make transforms
ComplexImg transformed = new ComplexImg(img.getDimension());
try(
NativeRealArray col = new NativeRealArray(img.getHeight());
NativeRealArray fft_r = new NativeRealArray(col.length);
NativeRealArray fft_i = new NativeRealArray(col.length);
) {
ColorPixel px = img.getPixel();
ComplexPixel tpx = transformed.getPixel();
for(int x = 0; x < img.getWidth(); x++){
for(int y = 0; y < img.getHeight(); y++){
px.setPosition(x, y);
col.set(y, px.getValue(channel));
}
FFTW_Guru.execute_split_r2c(col, fft_r, fft_i, img.getHeight());
for(int y = 0; y < img.getHeight(); y++){
tpx.setPosition(x, y);
tpx.setComplex(fft_r.get(y), fft_i.get(y));
}
}
}
return transformed;
} | [
"public",
"static",
"ComplexImg",
"verticalTransform",
"(",
"ColorImg",
"img",
",",
"int",
"channel",
")",
"{",
"sanityCheckForward",
"(",
"img",
",",
"channel",
")",
";",
"// make transforms",
"ComplexImg",
"transformed",
"=",
"new",
"ComplexImg",
"(",
"img",
"... | Executes column wise Fourier transforms of the specified channel of the specified {@link ColorImg}.
A 1-dimensional Fourier transform is done for each column of the image's channel.
@param img of which one channel is to be transformed
@param channel the channel which will be transformed
@return transform as ComplexImg
@throws IllegalArgumentException if the specified channel is out of range ([0..3]) or is alpha (3)
but the specified image does not have an alpha channel | [
"Executes",
"column",
"wise",
"Fourier",
"transforms",
"of",
"the",
"specified",
"channel",
"of",
"the",
"specified",
"{",
"@link",
"ColorImg",
"}",
".",
"A",
"1",
"-",
"dimensional",
"Fourier",
"transform",
"is",
"done",
"for",
"each",
"column",
"of",
"the"... | train | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/Fourier.java#L300-L324 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java | CommonOps_DDF2.fill | public static void fill( DMatrix2x2 a , double v ) {
a.a11 = v; a.a12 = v;
a.a21 = v; a.a22 = v;
} | java | public static void fill( DMatrix2x2 a , double v ) {
a.a11 = v; a.a12 = v;
a.a21 = v; a.a22 = v;
} | [
"public",
"static",
"void",
"fill",
"(",
"DMatrix2x2",
"a",
",",
"double",
"v",
")",
"{",
"a",
".",
"a11",
"=",
"v",
";",
"a",
".",
"a12",
"=",
"v",
";",
"a",
".",
"a21",
"=",
"v",
";",
"a",
".",
"a22",
"=",
"v",
";",
"}"
] | <p>
Sets every element in the matrix to the specified value.<br>
<br>
a<sub>ij</sub> = value
<p>
@param a A matrix whose elements are about to be set. Modified.
@param v The value each element will have. | [
"<p",
">",
"Sets",
"every",
"element",
"in",
"the",
"matrix",
"to",
"the",
"specified",
"value",
".",
"<br",
">",
"<br",
">",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
"=",
"value",
"<p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java#L1130-L1133 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java | CommonExpectations.getJwtPrincipalExpectations | public static Expectations getJwtPrincipalExpectations(String testAction, String user, String issuer) {
Expectations expectations = new Expectations();
expectations.addExpectation(new JwtExpectation(testAction, "token_type", JwtFatConstants.TOKEN_TYPE_BEARER));
expectations.addExpectation(new JwtExpectation(testAction, "sub", user));
expectations.addExpectation(new JwtExpectation(testAction, "upn", user));
expectations.addExpectation(new JwtExpectation(testAction, "iss", issuer));
return expectations;
} | java | public static Expectations getJwtPrincipalExpectations(String testAction, String user, String issuer) {
Expectations expectations = new Expectations();
expectations.addExpectation(new JwtExpectation(testAction, "token_type", JwtFatConstants.TOKEN_TYPE_BEARER));
expectations.addExpectation(new JwtExpectation(testAction, "sub", user));
expectations.addExpectation(new JwtExpectation(testAction, "upn", user));
expectations.addExpectation(new JwtExpectation(testAction, "iss", issuer));
return expectations;
} | [
"public",
"static",
"Expectations",
"getJwtPrincipalExpectations",
"(",
"String",
"testAction",
",",
"String",
"user",
",",
"String",
"issuer",
")",
"{",
"Expectations",
"expectations",
"=",
"new",
"Expectations",
"(",
")",
";",
"expectations",
".",
"addExpectation"... | Sets expectations that will check various claims within the subject JWT. | [
"Sets",
"expectations",
"that",
"will",
"check",
"various",
"claims",
"within",
"the",
"subject",
"JWT",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java#L196-L203 |
iipc/webarchive-commons | src/main/java/org/archive/util/zip/GzipHeader.java | GzipHeader.readByte | protected int readByte(InputStream in, CRC32 crc) throws IOException {
int b = in.read();
if (b == -1) {
throw new EOFException();
}
if (crc != null) {
crc.update(b);
}
return b & 0xff;
} | java | protected int readByte(InputStream in, CRC32 crc) throws IOException {
int b = in.read();
if (b == -1) {
throw new EOFException();
}
if (crc != null) {
crc.update(b);
}
return b & 0xff;
} | [
"protected",
"int",
"readByte",
"(",
"InputStream",
"in",
",",
"CRC32",
"crc",
")",
"throws",
"IOException",
"{",
"int",
"b",
"=",
"in",
".",
"read",
"(",
")",
";",
"if",
"(",
"b",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"EOFException",
"(",
")",... | Read a byte.
We do not expect to get a -1 reading. If we do, we throw exception.
Update the crc as we go.
@param in InputStream to read.
@param crc CRC to update.
@return Byte read.
@throws IOException | [
"Read",
"a",
"byte",
"."
] | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/zip/GzipHeader.java#L262-L271 |
OpenBEL/openbel-framework | org.openbel.framework.core/src/main/java/org/openbel/framework/core/cache/DefaultCacheManagerService.java | DefaultCacheManagerService.logExceptionSimple | private void logExceptionSimple(String location, Exception e) {
StringBuilder bldr = new StringBuilder();
bldr.append("ERROR UPDATING CACHE");
if (location != null) {
bldr.append(" for ");
bldr.append(location);
}
bldr.append("\n\treason: ");
final String msg = e.getMessage();
if (msg != null)
bldr.append(msg);
else
bldr.append("Unknown");
bldr.append("\n");
reportable.error(bldr.toString());
} | java | private void logExceptionSimple(String location, Exception e) {
StringBuilder bldr = new StringBuilder();
bldr.append("ERROR UPDATING CACHE");
if (location != null) {
bldr.append(" for ");
bldr.append(location);
}
bldr.append("\n\treason: ");
final String msg = e.getMessage();
if (msg != null)
bldr.append(msg);
else
bldr.append("Unknown");
bldr.append("\n");
reportable.error(bldr.toString());
} | [
"private",
"void",
"logExceptionSimple",
"(",
"String",
"location",
",",
"Exception",
"e",
")",
"{",
"StringBuilder",
"bldr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"bldr",
".",
"append",
"(",
"\"ERROR UPDATING CACHE\"",
")",
";",
"if",
"(",
"location",
... | Reports an {@link Exception} as an error to the {@link Reportable}.
The error output logged will use the <tt>location</tt> and the
exception's message if it is not null.
@param location {@link String}, the resource location behind the
exception
@param e {@link Exception}, the exception to output message from | [
"Reports",
"an",
"{",
"@link",
"Exception",
"}",
"as",
"an",
"error",
"to",
"the",
"{",
"@link",
"Reportable",
"}",
".",
"The",
"error",
"output",
"logged",
"will",
"use",
"the",
"<tt",
">",
"location<",
"/",
"tt",
">",
"and",
"the",
"exception",
"s",
... | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/cache/DefaultCacheManagerService.java#L234-L252 |
whizzosoftware/WZWave | src/main/java/com/whizzosoftware/wzwave/commandclass/MultiInstanceCommandClass.java | MultiInstanceCommandClass.createMultiChannelCapabilityGet | public DataFrame createMultiChannelCapabilityGet(byte nodeId, byte endPoint) {
if (getVersion() < 2) {
throw new ZWaveRuntimeException("MULTI_CHANNEL_CAPABILITY_GET is not available in command class version 1");
}
return createSendDataFrame(
"MULTI_CHANNEL_CAPABILITY_GET",
nodeId,
new byte[] {
MultiInstanceCommandClass.ID,
MULTI_CHANNEL_CAPABILITY_GET,
endPoint
},
true
);
} | java | public DataFrame createMultiChannelCapabilityGet(byte nodeId, byte endPoint) {
if (getVersion() < 2) {
throw new ZWaveRuntimeException("MULTI_CHANNEL_CAPABILITY_GET is not available in command class version 1");
}
return createSendDataFrame(
"MULTI_CHANNEL_CAPABILITY_GET",
nodeId,
new byte[] {
MultiInstanceCommandClass.ID,
MULTI_CHANNEL_CAPABILITY_GET,
endPoint
},
true
);
} | [
"public",
"DataFrame",
"createMultiChannelCapabilityGet",
"(",
"byte",
"nodeId",
",",
"byte",
"endPoint",
")",
"{",
"if",
"(",
"getVersion",
"(",
")",
"<",
"2",
")",
"{",
"throw",
"new",
"ZWaveRuntimeException",
"(",
"\"MULTI_CHANNEL_CAPABILITY_GET is not available in... | Create a MULTI_CHANNEL_CAPABILITY_GET command.
@param nodeId the target node ID
@param endPoint the endpoint ID
@return a DataFrame instance | [
"Create",
"a",
"MULTI_CHANNEL_CAPABILITY_GET",
"command",
"."
] | train | https://github.com/whizzosoftware/WZWave/blob/b9dfec6b55515226edf9d772a89933b336397501/src/main/java/com/whizzosoftware/wzwave/commandclass/MultiInstanceCommandClass.java#L296-L310 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java | XpathUtils.asByteBuffer | public static ByteBuffer asByteBuffer(String expression, Node node, XPath xpath)
throws XPathExpressionException {
String base64EncodedString = evaluateAsString(expression, node, xpath);
if (isEmptyString(base64EncodedString)) return null;
if (!isEmpty(node)) {
byte[] decodedBytes = Base64.decode(base64EncodedString);
return ByteBuffer.wrap(decodedBytes);
}
return null;
} | java | public static ByteBuffer asByteBuffer(String expression, Node node, XPath xpath)
throws XPathExpressionException {
String base64EncodedString = evaluateAsString(expression, node, xpath);
if (isEmptyString(base64EncodedString)) return null;
if (!isEmpty(node)) {
byte[] decodedBytes = Base64.decode(base64EncodedString);
return ByteBuffer.wrap(decodedBytes);
}
return null;
} | [
"public",
"static",
"ByteBuffer",
"asByteBuffer",
"(",
"String",
"expression",
",",
"Node",
"node",
",",
"XPath",
"xpath",
")",
"throws",
"XPathExpressionException",
"{",
"String",
"base64EncodedString",
"=",
"evaluateAsString",
"(",
"expression",
",",
"node",
",",
... | Same as {@link #asByteBuffer(String, Node)} but allows an xpath to be
passed in explicitly for reuse. | [
"Same",
"as",
"{"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java#L504-L514 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java | PersonGroupPersonsImpl.updateFace | public void updateFace(String personGroupId, UUID personId, UUID persistedFaceId, UpdateFaceOptionalParameter updateFaceOptionalParameter) {
updateFaceWithServiceResponseAsync(personGroupId, personId, persistedFaceId, updateFaceOptionalParameter).toBlocking().single().body();
} | java | public void updateFace(String personGroupId, UUID personId, UUID persistedFaceId, UpdateFaceOptionalParameter updateFaceOptionalParameter) {
updateFaceWithServiceResponseAsync(personGroupId, personId, persistedFaceId, updateFaceOptionalParameter).toBlocking().single().body();
} | [
"public",
"void",
"updateFace",
"(",
"String",
"personGroupId",
",",
"UUID",
"personId",
",",
"UUID",
"persistedFaceId",
",",
"UpdateFaceOptionalParameter",
"updateFaceOptionalParameter",
")",
"{",
"updateFaceWithServiceResponseAsync",
"(",
"personGroupId",
",",
"personId",... | Update a person persisted face's userData field.
@param personGroupId Id referencing a particular person group.
@param personId Id referencing a particular person.
@param persistedFaceId Id referencing a particular persistedFaceId of an existing face.
@param updateFaceOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Update",
"a",
"person",
"persisted",
"face",
"s",
"userData",
"field",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java#L982-L984 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java | ControlBean.firePropertyChange | protected void firePropertyChange(PropertyKey propertyKey, Object oldValue, Object newValue)
{
// No change support instance means no listeners
if (_changeSupport == null)
return;
_changeSupport.firePropertyChange(propertyKey.getPropertyName(), oldValue, newValue);
} | java | protected void firePropertyChange(PropertyKey propertyKey, Object oldValue, Object newValue)
{
// No change support instance means no listeners
if (_changeSupport == null)
return;
_changeSupport.firePropertyChange(propertyKey.getPropertyName(), oldValue, newValue);
} | [
"protected",
"void",
"firePropertyChange",
"(",
"PropertyKey",
"propertyKey",
",",
"Object",
"oldValue",
",",
"Object",
"newValue",
")",
"{",
"// No change support instance means no listeners",
"if",
"(",
"_changeSupport",
"==",
"null",
")",
"return",
";",
"_changeSuppo... | Delivers a PropertyChangeEvent to any registered PropertyChangeListeners associated
with the property referenced by the specified key.
This method *should not* be synchronized, as the PropertyChangeSupport has its own
built in synchronization mechanisms. | [
"Delivers",
"a",
"PropertyChangeEvent",
"to",
"any",
"registered",
"PropertyChangeListeners",
"associated",
"with",
"the",
"property",
"referenced",
"by",
"the",
"specified",
"key",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java#L779-L786 |
joniles/mpxj | src/main/java/net/sf/mpxj/TaskContainer.java | TaskContainer.synchroizeTaskIDToHierarchy | private int synchroizeTaskIDToHierarchy(Task parentTask, int currentID)
{
for (Task task : parentTask.getChildTasks())
{
task.setID(Integer.valueOf(currentID++));
add(task);
currentID = synchroizeTaskIDToHierarchy(task, currentID);
}
return currentID;
} | java | private int synchroizeTaskIDToHierarchy(Task parentTask, int currentID)
{
for (Task task : parentTask.getChildTasks())
{
task.setID(Integer.valueOf(currentID++));
add(task);
currentID = synchroizeTaskIDToHierarchy(task, currentID);
}
return currentID;
} | [
"private",
"int",
"synchroizeTaskIDToHierarchy",
"(",
"Task",
"parentTask",
",",
"int",
"currentID",
")",
"{",
"for",
"(",
"Task",
"task",
":",
"parentTask",
".",
"getChildTasks",
"(",
")",
")",
"{",
"task",
".",
"setID",
"(",
"Integer",
".",
"valueOf",
"(... | Called recursively to renumber child task IDs.
@param parentTask parent task instance
@param currentID current task ID
@return updated current task ID | [
"Called",
"recursively",
"to",
"renumber",
"child",
"task",
"IDs",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/TaskContainer.java#L142-L151 |
nakamura5akihito/six-util | src/main/java/jp/go/aist/six/util/core/xml/spring327/AbstractMarshaller.java | AbstractMarshaller.marshalDomResult | protected void marshalDomResult(Object graph, DOMResult domResult) throws XmlMappingException {
if (domResult.getNode() == null) {
try {
synchronized (this.documentBuilderFactoryMonitor) {
if (this.documentBuilderFactory == null) {
this.documentBuilderFactory = createDocumentBuilderFactory();
}
}
DocumentBuilder documentBuilder = createDocumentBuilder(this.documentBuilderFactory);
domResult.setNode(documentBuilder.newDocument());
}
catch (ParserConfigurationException ex) {
throw new UnmarshallingFailureException(
"Could not create document placeholder for DOMResult: " + ex.getMessage(), ex);
}
}
marshalDomNode(graph, domResult.getNode());
} | java | protected void marshalDomResult(Object graph, DOMResult domResult) throws XmlMappingException {
if (domResult.getNode() == null) {
try {
synchronized (this.documentBuilderFactoryMonitor) {
if (this.documentBuilderFactory == null) {
this.documentBuilderFactory = createDocumentBuilderFactory();
}
}
DocumentBuilder documentBuilder = createDocumentBuilder(this.documentBuilderFactory);
domResult.setNode(documentBuilder.newDocument());
}
catch (ParserConfigurationException ex) {
throw new UnmarshallingFailureException(
"Could not create document placeholder for DOMResult: " + ex.getMessage(), ex);
}
}
marshalDomNode(graph, domResult.getNode());
} | [
"protected",
"void",
"marshalDomResult",
"(",
"Object",
"graph",
",",
"DOMResult",
"domResult",
")",
"throws",
"XmlMappingException",
"{",
"if",
"(",
"domResult",
".",
"getNode",
"(",
")",
"==",
"null",
")",
"{",
"try",
"{",
"synchronized",
"(",
"this",
".",... | Template method for handling {@code DOMResult}s.
<p>This implementation delegates to {@code marshalDomNode}.
@param graph the root of the object graph to marshal
@param domResult the {@code DOMResult}
@throws XmlMappingException if the given object cannot be marshalled to the result
@throws IllegalArgumentException if the {@code domResult} is empty
@see #marshalDomNode(Object, org.w3c.dom.Node) | [
"Template",
"method",
"for",
"handling",
"{"
] | train | https://github.com/nakamura5akihito/six-util/blob/a6db388a345e220cea2b1fa6324d15c80c6278b6/src/main/java/jp/go/aist/six/util/core/xml/spring327/AbstractMarshaller.java#L193-L210 |
wisdom-framework/wisdom-jcr | wisdom-jcr-core/src/main/java/org/wisdom/jcrom/runtime/JcrTools.java | JcrTools.registerAndAddMixinType | public static void registerAndAddMixinType(Session session, Node node, String mixin) throws RepositoryException {
registerMixinType(session, mixin);
if (!Arrays.asList(node.getMixinNodeTypes()).contains(mixin)) {
node.addMixin(mixin);
}
} | java | public static void registerAndAddMixinType(Session session, Node node, String mixin) throws RepositoryException {
registerMixinType(session, mixin);
if (!Arrays.asList(node.getMixinNodeTypes()).contains(mixin)) {
node.addMixin(mixin);
}
} | [
"public",
"static",
"void",
"registerAndAddMixinType",
"(",
"Session",
"session",
",",
"Node",
"node",
",",
"String",
"mixin",
")",
"throws",
"RepositoryException",
"{",
"registerMixinType",
"(",
"session",
",",
"mixin",
")",
";",
"if",
"(",
"!",
"Arrays",
"."... | Register new mixin type if does not exists on workspace the add it to the given node
@param session the JCR session
@param node the node where to add the mixin
@param mixin the mixin name to add
@throws RepositoryException | [
"Register",
"new",
"mixin",
"type",
"if",
"does",
"not",
"exists",
"on",
"workspace",
"the",
"add",
"it",
"to",
"the",
"given",
"node"
] | train | https://github.com/wisdom-framework/wisdom-jcr/blob/2711383dde2239a19b90c226b3fd2aecab5715e4/wisdom-jcr-core/src/main/java/org/wisdom/jcrom/runtime/JcrTools.java#L1008-L1013 |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/entity/message/MessageBuilder.java | MessageBuilder.addFileAsSpoiler | public MessageBuilder addFileAsSpoiler(BufferedImage image, String fileName) {
delegate.addFile(image, "SPOILER_" + fileName);
return this;
} | java | public MessageBuilder addFileAsSpoiler(BufferedImage image, String fileName) {
delegate.addFile(image, "SPOILER_" + fileName);
return this;
} | [
"public",
"MessageBuilder",
"addFileAsSpoiler",
"(",
"BufferedImage",
"image",
",",
"String",
"fileName",
")",
"{",
"delegate",
".",
"addFile",
"(",
"image",
",",
"\"SPOILER_\"",
"+",
"fileName",
")",
";",
"return",
"this",
";",
"}"
] | Adds a file to the message and marks it as spoiler.
@param image The image to add as an attachment.
@param fileName The file name of the image.
@return The current instance in order to chain call methods.
@see #addAttachmentAsSpoiler(BufferedImage, String) | [
"Adds",
"a",
"file",
"to",
"the",
"message",
"and",
"marks",
"it",
"as",
"spoiler",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/message/MessageBuilder.java#L221-L224 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslWithProvider.java | PactDslWithProvider.given | public PactDslWithState given(String state, Map<String, Object> params) {
return new PactDslWithState(consumerPactBuilder, consumerPactBuilder.getConsumerName(), providerName,
new ProviderState(state, params), defaultRequestValues, defaultResponseValues);
} | java | public PactDslWithState given(String state, Map<String, Object> params) {
return new PactDslWithState(consumerPactBuilder, consumerPactBuilder.getConsumerName(), providerName,
new ProviderState(state, params), defaultRequestValues, defaultResponseValues);
} | [
"public",
"PactDslWithState",
"given",
"(",
"String",
"state",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
")",
"{",
"return",
"new",
"PactDslWithState",
"(",
"consumerPactBuilder",
",",
"consumerPactBuilder",
".",
"getConsumerName",
"(",
")",
",",
... | Describe the state the provider needs to be in for the pact test to be verified.
@param state Provider state
@param params Data parameters for the state | [
"Describe",
"the",
"state",
"the",
"provider",
"needs",
"to",
"be",
"in",
"for",
"the",
"pact",
"test",
"to",
"be",
"verified",
"."
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslWithProvider.java#L37-L40 |
jtrfp/javamod | src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java | ID3v2Tag.setUserDefinedTextFrame | public void setUserDefinedTextFrame(String description, String value)
{
try
{
byte[] b = new byte[description.length() + value.length() + 2];
int bytesCopied = 0;
b[bytesCopied++] = 0;
System.arraycopy(description.getBytes(ENC_TYPE), 0, b, bytesCopied, description.length());
bytesCopied += description.length();
b[bytesCopied++] = 0;
System.arraycopy(value.getBytes(ENC_TYPE), 0, b, bytesCopied, value.length());
bytesCopied += value.length();
updateFrameData(ID3v2Frames.USER_DEFINED_TEXT_INFO, b);
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
} | java | public void setUserDefinedTextFrame(String description, String value)
{
try
{
byte[] b = new byte[description.length() + value.length() + 2];
int bytesCopied = 0;
b[bytesCopied++] = 0;
System.arraycopy(description.getBytes(ENC_TYPE), 0, b, bytesCopied, description.length());
bytesCopied += description.length();
b[bytesCopied++] = 0;
System.arraycopy(value.getBytes(ENC_TYPE), 0, b, bytesCopied, value.length());
bytesCopied += value.length();
updateFrameData(ID3v2Frames.USER_DEFINED_TEXT_INFO, b);
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
} | [
"public",
"void",
"setUserDefinedTextFrame",
"(",
"String",
"description",
",",
"String",
"value",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"description",
".",
"length",
"(",
")",
"+",
"value",
".",
"length",
"(",
")",
"+",... | Sets the data contained in the user defined text frame (TXXX).
@param description a description of the data
@param value the data for the frame | [
"Sets",
"the",
"data",
"contained",
"in",
"the",
"user",
"defined",
"text",
"frame",
"(",
"TXXX",
")",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L341-L360 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/VisualizerParameterizer.java | VisualizerParameterizer.shortenClassname | protected static String shortenClassname(String nam, char c) {
final int lastdot = nam.lastIndexOf(c);
if(lastdot >= 0) {
nam = nam.substring(lastdot + 1);
}
return nam;
} | java | protected static String shortenClassname(String nam, char c) {
final int lastdot = nam.lastIndexOf(c);
if(lastdot >= 0) {
nam = nam.substring(lastdot + 1);
}
return nam;
} | [
"protected",
"static",
"String",
"shortenClassname",
"(",
"String",
"nam",
",",
"char",
"c",
")",
"{",
"final",
"int",
"lastdot",
"=",
"nam",
".",
"lastIndexOf",
"(",
"c",
")",
";",
"if",
"(",
"lastdot",
">=",
"0",
")",
"{",
"nam",
"=",
"nam",
".",
... | Shorten the class name.
@param nam Class name
@param c Splitting character
@return Shortened name | [
"Shorten",
"the",
"class",
"name",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/VisualizerParameterizer.java#L205-L211 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/view/facelets/MetaTagHandler.java | MetaTagHandler.setAttributes | protected void setAttributes(FaceletContext ctx, Object instance)
{
if (instance != null)
{
Class<?> type = instance.getClass();
if (_mapper == null || !_lastType.equals(type))
{
_lastType = type;
_mapper = createMetaRuleset(type).finish();
}
_mapper.applyMetadata(ctx, instance);
}
} | java | protected void setAttributes(FaceletContext ctx, Object instance)
{
if (instance != null)
{
Class<?> type = instance.getClass();
if (_mapper == null || !_lastType.equals(type))
{
_lastType = type;
_mapper = createMetaRuleset(type).finish();
}
_mapper.applyMetadata(ctx, instance);
}
} | [
"protected",
"void",
"setAttributes",
"(",
"FaceletContext",
"ctx",
",",
"Object",
"instance",
")",
"{",
"if",
"(",
"instance",
"!=",
"null",
")",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"instance",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"_mapper... | Invoking/extending this method will cause the results of the created MetaRuleset to auto-wire state to
the passed instance.
@param ctx
@param instance | [
"Invoking",
"/",
"extending",
"this",
"method",
"will",
"cause",
"the",
"results",
"of",
"the",
"created",
"MetaRuleset",
"to",
"auto",
"-",
"wire",
"state",
"to",
"the",
"passed",
"instance",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/view/facelets/MetaTagHandler.java#L52-L65 |
redbox-mint/redbox | plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java | CurationManager.updateDataPayload | private void updateDataPayload(DigitalObject object, String input)
throws StorageException {
try {
for (String pid : object.getPayloadIdList()) {
if (pid.endsWith(DATA_PAYLOAD_SUFFIX)) {
InputStream inStream = new ByteArrayInputStream(
input.getBytes("UTF-8"));
object.updatePayload(pid, inStream);
return;
}
}
throw new StorageException("Data payload not found on storage!");
} catch (Exception ex) {
throw new StorageException("Error storing payload data!", ex);
}
} | java | private void updateDataPayload(DigitalObject object, String input)
throws StorageException {
try {
for (String pid : object.getPayloadIdList()) {
if (pid.endsWith(DATA_PAYLOAD_SUFFIX)) {
InputStream inStream = new ByteArrayInputStream(
input.getBytes("UTF-8"));
object.updatePayload(pid, inStream);
return;
}
}
throw new StorageException("Data payload not found on storage!");
} catch (Exception ex) {
throw new StorageException("Error storing payload data!", ex);
}
} | [
"private",
"void",
"updateDataPayload",
"(",
"DigitalObject",
"object",
",",
"String",
"input",
")",
"throws",
"StorageException",
"{",
"try",
"{",
"for",
"(",
"String",
"pid",
":",
"object",
".",
"getPayloadIdList",
"(",
")",
")",
"{",
"if",
"(",
"pid",
"... | Update the data payload (ending in '.tfpackage') in the provided object.
@param object
The digital object holding our payload
@param input
The String to store
@throws StorageException
if an errors occurs or the payload is not found | [
"Update",
"the",
"data",
"payload",
"(",
"ending",
"in",
".",
"tfpackage",
")",
"in",
"the",
"provided",
"object",
"."
] | train | https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java#L2009-L2024 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QRDecompositionHouseholder_ZDRM.java | QRDecompositionHouseholder_ZDRM.getQ | @Override
public ZMatrixRMaj getQ(ZMatrixRMaj Q , boolean compact ) {
if( compact )
Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,minLength);
else
Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,numRows);
for( int j = minLength-1; j >= 0; j-- ) {
QrHelperFunctions_ZDRM.extractHouseholderColumn(QR,j,numRows,j,u,0);
QrHelperFunctions_ZDRM.rank1UpdateMultR(Q,u,0,gammas[j],j,j,numRows,v);
}
return Q;
} | java | @Override
public ZMatrixRMaj getQ(ZMatrixRMaj Q , boolean compact ) {
if( compact )
Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,minLength);
else
Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,numRows);
for( int j = minLength-1; j >= 0; j-- ) {
QrHelperFunctions_ZDRM.extractHouseholderColumn(QR,j,numRows,j,u,0);
QrHelperFunctions_ZDRM.rank1UpdateMultR(Q,u,0,gammas[j],j,j,numRows,v);
}
return Q;
} | [
"@",
"Override",
"public",
"ZMatrixRMaj",
"getQ",
"(",
"ZMatrixRMaj",
"Q",
",",
"boolean",
"compact",
")",
"{",
"if",
"(",
"compact",
")",
"Q",
"=",
"UtilDecompositons_ZDRM",
".",
"checkIdentity",
"(",
"Q",
",",
"numRows",
",",
"minLength",
")",
";",
"else... | Computes the Q matrix from the information stored in the QR matrix. This
operation requires about 4(m<sup>2</sup>n-mn<sup>2</sup>+n<sup>3</sup>/3) flops.
@param Q The orthogonal Q matrix. | [
"Computes",
"the",
"Q",
"matrix",
"from",
"the",
"information",
"stored",
"in",
"the",
"QR",
"matrix",
".",
"This",
"operation",
"requires",
"about",
"4",
"(",
"m<sup",
">",
"2<",
"/",
"sup",
">",
"n",
"-",
"mn<sup",
">",
"2<",
"/",
"sup",
">",
"+",
... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QRDecompositionHouseholder_ZDRM.java#L125-L138 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/CommonUtils.java | CommonUtils.stripPrefixIfPresent | public static String stripPrefixIfPresent(final String key, final String prefix) {
if (key.startsWith(prefix)) {
return key.substring(prefix.length());
}
return key;
} | java | public static String stripPrefixIfPresent(final String key, final String prefix) {
if (key.startsWith(prefix)) {
return key.substring(prefix.length());
}
return key;
} | [
"public",
"static",
"String",
"stripPrefixIfPresent",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"prefix",
")",
"{",
"if",
"(",
"key",
".",
"startsWith",
"(",
"prefix",
")",
")",
"{",
"return",
"key",
".",
"substring",
"(",
"prefix",
".",
"le... | Strips the prefix from the key if it is present. For example, for input key
ufs://my-bucket-name/my-key/file and prefix ufs://my-bucket-name/, the output would be
my-key/file. This method will leave keys without a prefix unaltered, ie. my-key/file
returns my-key/file.
@param key the key to strip
@param prefix prefix to remove
@return the key without the prefix | [
"Strips",
"the",
"prefix",
"from",
"the",
"key",
"if",
"it",
"is",
"present",
".",
"For",
"example",
"for",
"input",
"key",
"ufs",
":",
"//",
"my",
"-",
"bucket",
"-",
"name",
"/",
"my",
"-",
"key",
"/",
"file",
"and",
"prefix",
"ufs",
":",
"//",
... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/CommonUtils.java#L364-L369 |
openbase/jul | extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/LabelProcessor.java | LabelProcessor.getLabelByLanguage | public static String getLabelByLanguage(final Locale locale, final LabelOrBuilder label) throws NotAvailableException {
return getLabelByLanguage(locale.getLanguage(), label);
} | java | public static String getLabelByLanguage(final Locale locale, final LabelOrBuilder label) throws NotAvailableException {
return getLabelByLanguage(locale.getLanguage(), label);
} | [
"public",
"static",
"String",
"getLabelByLanguage",
"(",
"final",
"Locale",
"locale",
",",
"final",
"LabelOrBuilder",
"label",
")",
"throws",
"NotAvailableException",
"{",
"return",
"getLabelByLanguage",
"(",
"locale",
".",
"getLanguage",
"(",
")",
",",
"label",
"... | Get the first label for a languageCode from a label type. This is equivalent to calling
{@link #getLabelByLanguage(String, LabelOrBuilder)} but the language code is extracted from the locale by calling
{@link Locale#getLanguage()}.
@param locale the locale from which a language code is extracted
@param label the label type which is searched for labels in the language
@return the first label from the label type for the locale
@throws NotAvailableException if no label list for the locale exists of if the list is empty | [
"Get",
"the",
"first",
"label",
"for",
"a",
"languageCode",
"from",
"a",
"label",
"type",
".",
"This",
"is",
"equivalent",
"to",
"calling",
"{",
"@link",
"#getLabelByLanguage",
"(",
"String",
"LabelOrBuilder",
")",
"}",
"but",
"the",
"language",
"code",
"is"... | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/LabelProcessor.java#L275-L277 |
alkacon/opencms-core | src-setup/org/opencms/setup/db/CmsUpdateDBManager.java | CmsUpdateDBManager.getMySqlEngine | protected void getMySqlEngine(Map<String, String> dbPoolData) {
String engine = "MYISAM";
CmsSetupDb setupDb = new CmsSetupDb(null);
CmsSetupDBWrapper db = null;
try {
setupDb.setConnection(
dbPoolData.get("driver"),
dbPoolData.get("url"),
dbPoolData.get("params"),
dbPoolData.get("user"),
dbPoolData.get("pwd"));
db = setupDb.executeSqlStatement("SHOW TABLE STATUS LIKE 'CMS_GROUPS';", null);
if (db.getResultSet().next()) {
engine = db.getResultSet().getString("Engine").toUpperCase();
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (db != null) {
db.close();
}
setupDb.closeConnection();
}
dbPoolData.put("engine", engine);
System.out.println("Table engine: " + engine);
} | java | protected void getMySqlEngine(Map<String, String> dbPoolData) {
String engine = "MYISAM";
CmsSetupDb setupDb = new CmsSetupDb(null);
CmsSetupDBWrapper db = null;
try {
setupDb.setConnection(
dbPoolData.get("driver"),
dbPoolData.get("url"),
dbPoolData.get("params"),
dbPoolData.get("user"),
dbPoolData.get("pwd"));
db = setupDb.executeSqlStatement("SHOW TABLE STATUS LIKE 'CMS_GROUPS';", null);
if (db.getResultSet().next()) {
engine = db.getResultSet().getString("Engine").toUpperCase();
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (db != null) {
db.close();
}
setupDb.closeConnection();
}
dbPoolData.put("engine", engine);
System.out.println("Table engine: " + engine);
} | [
"protected",
"void",
"getMySqlEngine",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"dbPoolData",
")",
"{",
"String",
"engine",
"=",
"\"MYISAM\"",
";",
"CmsSetupDb",
"setupDb",
"=",
"new",
"CmsSetupDb",
"(",
"null",
")",
";",
"CmsSetupDBWrapper",
"db",
"="... | Retrieves the mysql engine name.<p>
@param dbPoolData the database pool data | [
"Retrieves",
"the",
"mysql",
"engine",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/CmsUpdateDBManager.java#L389-L417 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateExplicitListItemAsync | public Observable<OperationStatus> updateExplicitListItemAsync(UUID appId, String versionId, UUID entityId, long itemId, UpdateExplicitListItemOptionalParameter updateExplicitListItemOptionalParameter) {
return updateExplicitListItemWithServiceResponseAsync(appId, versionId, entityId, itemId, updateExplicitListItemOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | java | public Observable<OperationStatus> updateExplicitListItemAsync(UUID appId, String versionId, UUID entityId, long itemId, UpdateExplicitListItemOptionalParameter updateExplicitListItemOptionalParameter) {
return updateExplicitListItemWithServiceResponseAsync(appId, versionId, entityId, itemId, updateExplicitListItemOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatus",
">",
"updateExplicitListItemAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"long",
"itemId",
",",
"UpdateExplicitListItemOptionalParameter",
"updateExplicitListItemOptionalParameter",
"... | Updates an explicit list item for a Pattern.Any entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The Pattern.Any entity extractor ID.
@param itemId The explicit list item ID.
@param updateExplicitListItemOptionalParameter 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 OperationStatus object | [
"Updates",
"an",
"explicit",
"list",
"item",
"for",
"a",
"Pattern",
".",
"Any",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L14094-L14101 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java | SynchronousRequest.searchRecipes | public List<Integer> searchRecipes(boolean isInput, int id) throws GuildWars2Exception {
try {
Response<List<Integer>> response = (isInput) ?
gw2API.searchInputRecipes(Integer.toString(id)).execute() :
gw2API.searchOutputRecipes(Integer.toString(id)).execute();
if (!response.isSuccessful()) throwError(response.code(), response.errorBody());
return response.body();
} catch (IOException e) {
throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage());
}
} | java | public List<Integer> searchRecipes(boolean isInput, int id) throws GuildWars2Exception {
try {
Response<List<Integer>> response = (isInput) ?
gw2API.searchInputRecipes(Integer.toString(id)).execute() :
gw2API.searchOutputRecipes(Integer.toString(id)).execute();
if (!response.isSuccessful()) throwError(response.code(), response.errorBody());
return response.body();
} catch (IOException e) {
throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage());
}
} | [
"public",
"List",
"<",
"Integer",
">",
"searchRecipes",
"(",
"boolean",
"isInput",
",",
"int",
"id",
")",
"throws",
"GuildWars2Exception",
"{",
"try",
"{",
"Response",
"<",
"List",
"<",
"Integer",
">>",
"response",
"=",
"(",
"isInput",
")",
"?",
"gw2API",
... | For more info on Recipes search API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes/search">here</a><br/>
@param isInput is given id an ingredient
@param id recipe id
@return list of recipe id
@throws GuildWars2Exception see {@link ErrorCode} for detail | [
"For",
"more",
"info",
"on",
"Recipes",
"search",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"recipes",
"/",
"search",
">",
"here<",
"/",
"a",
">",
"<br",
"/"... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L3134-L3144 |
Crab2died/Excel4J | src/main/java/com/github/crab2died/utils/Utils.java | Utils.copyProperty | public static void copyProperty(Object bean, String name, Object value)
throws Excel4JException {
if (null == name || null == value)
return;
Field field = matchClassField(bean.getClass(), name);
if (null == field)
return;
Method method;
try {
method = getterOrSetter(bean.getClass(), name, FieldAccessType.SETTER);
if (value.getClass() == field.getType()) {
method.invoke(bean, value);
} else {
method.invoke(bean, str2TargetClass(value.toString(), field.getType()));
}
} catch (IntrospectionException | IllegalAccessException | InvocationTargetException e) {
throw new Excel4JException(e);
}
} | java | public static void copyProperty(Object bean, String name, Object value)
throws Excel4JException {
if (null == name || null == value)
return;
Field field = matchClassField(bean.getClass(), name);
if (null == field)
return;
Method method;
try {
method = getterOrSetter(bean.getClass(), name, FieldAccessType.SETTER);
if (value.getClass() == field.getType()) {
method.invoke(bean, value);
} else {
method.invoke(bean, str2TargetClass(value.toString(), field.getType()));
}
} catch (IntrospectionException | IllegalAccessException | InvocationTargetException e) {
throw new Excel4JException(e);
}
} | [
"public",
"static",
"void",
"copyProperty",
"(",
"Object",
"bean",
",",
"String",
"name",
",",
"Object",
"value",
")",
"throws",
"Excel4JException",
"{",
"if",
"(",
"null",
"==",
"name",
"||",
"null",
"==",
"value",
")",
"return",
";",
"Field",
"field",
... | 根据属性名与属性类型获取字段内容
@param bean 对象
@param name 字段名
@param value 字段类型 | [
"根据属性名与属性类型获取字段内容"
] | train | https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/utils/Utils.java#L309-L330 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.