repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAIntrospection.java | JPAIntrospection.reflectObjValue | private static Object reflectObjValue(Object o, String field) throws Exception {
final Class<?> c = o.getClass();
final Field f = findField(c, field); // c.getField(field);
if (f == null) {
return null;
}
final boolean accessible = f.isAccessible();
try {
f.setAccessible(true);
return f.get(o);
} finally {
f.setAccessible(accessible);
}
} | java | private static Object reflectObjValue(Object o, String field) throws Exception {
final Class<?> c = o.getClass();
final Field f = findField(c, field); // c.getField(field);
if (f == null) {
return null;
}
final boolean accessible = f.isAccessible();
try {
f.setAccessible(true);
return f.get(o);
} finally {
f.setAccessible(accessible);
}
} | [
"private",
"static",
"Object",
"reflectObjValue",
"(",
"Object",
"o",
",",
"String",
"field",
")",
"throws",
"Exception",
"{",
"final",
"Class",
"<",
"?",
">",
"c",
"=",
"o",
".",
"getClass",
"(",
")",
";",
"final",
"Field",
"f",
"=",
"findField",
"(",... | /*
Utility methods used for introspecting JPA Persistence Provider Implementation Data Structures | [
"/",
"*",
"Utility",
"methods",
"used",
"for",
"introspecting",
"JPA",
"Persistence",
"Provider",
"Implementation",
"Data",
"Structures"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAIntrospection.java#L747-L760 |
iron-io/iron_mq_java | src/main/java/io/iron/ironmq/Queues.java | Queues.getQueues | public static ArrayList<QueueModel> getQueues(Client client) throws IOException {
return getQueues(client, null, null, null);
} | java | public static ArrayList<QueueModel> getQueues(Client client) throws IOException {
return getQueues(client, null, null, null);
} | [
"public",
"static",
"ArrayList",
"<",
"QueueModel",
">",
"getQueues",
"(",
"Client",
"client",
")",
"throws",
"IOException",
"{",
"return",
"getQueues",
"(",
"client",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}"
] | Retrieves queues in alphabetical order.
@throws HTTPException If the IronMQ service returns a status other than 200 OK.
@throws java.io.IOException If there is an error accessing the IronMQ server. | [
"Retrieves",
"queues",
"in",
"alphabetical",
"order",
"."
] | train | https://github.com/iron-io/iron_mq_java/blob/62d6a86545ca7ef31b7b4797aae0c5b31394a507/src/main/java/io/iron/ironmq/Queues.java#L36-L38 |
undertow-io/undertow | core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/MCMPHandler.java | MCMPHandler.processError | static void processError(String type, String errString, HttpServerExchange exchange) {
exchange.setStatusCode(StatusCodes.INTERNAL_SERVER_ERROR);
exchange.getResponseHeaders().add(Headers.CONTENT_TYPE, CONTENT_TYPE);
exchange.getResponseHeaders().add(new HttpString("Version"), VERSION_PROTOCOL);
exchange.getResponseHeaders().add(new HttpString("Type"), type);
exchange.getResponseHeaders().add(new HttpString("Mess"), errString);
exchange.endExchange();
UndertowLogger.ROOT_LOGGER.mcmpProcessingError(type, errString);
} | java | static void processError(String type, String errString, HttpServerExchange exchange) {
exchange.setStatusCode(StatusCodes.INTERNAL_SERVER_ERROR);
exchange.getResponseHeaders().add(Headers.CONTENT_TYPE, CONTENT_TYPE);
exchange.getResponseHeaders().add(new HttpString("Version"), VERSION_PROTOCOL);
exchange.getResponseHeaders().add(new HttpString("Type"), type);
exchange.getResponseHeaders().add(new HttpString("Mess"), errString);
exchange.endExchange();
UndertowLogger.ROOT_LOGGER.mcmpProcessingError(type, errString);
} | [
"static",
"void",
"processError",
"(",
"String",
"type",
",",
"String",
"errString",
",",
"HttpServerExchange",
"exchange",
")",
"{",
"exchange",
".",
"setStatusCode",
"(",
"StatusCodes",
".",
"INTERNAL_SERVER_ERROR",
")",
";",
"exchange",
".",
"getResponseHeaders",... | Send an error message.
@param type the error type
@param errString the error string
@param exchange the http server exchange | [
"Send",
"an",
"error",
"message",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/MCMPHandler.java#L739-L747 |
aol/cyclops | cyclops/src/main/java/cyclops/companion/Streams.java | Streams.forEach | public static <T, X extends Throwable> Subscription forEach(final Stream<T> stream, final long x,
final Consumer<? super T> consumerElement, final Consumer<? super Throwable> consumerError, final Runnable onComplete) {
val t2 = FutureStreamUtils.forEachXEvents(stream, x, consumerElement, consumerError, onComplete);
t2._2().run();
return t2._1().join();
} | java | public static <T, X extends Throwable> Subscription forEach(final Stream<T> stream, final long x,
final Consumer<? super T> consumerElement, final Consumer<? super Throwable> consumerError, final Runnable onComplete) {
val t2 = FutureStreamUtils.forEachXEvents(stream, x, consumerElement, consumerError, onComplete);
t2._2().run();
return t2._1().join();
} | [
"public",
"static",
"<",
"T",
",",
"X",
"extends",
"Throwable",
">",
"Subscription",
"forEach",
"(",
"final",
"Stream",
"<",
"T",
">",
"stream",
",",
"final",
"long",
"x",
",",
"final",
"Consumer",
"<",
"?",
"super",
"T",
">",
"consumerElement",
",",
"... | Perform a forEach operation over the Stream without closing it, capturing any elements and errors in the supplied consumers, but only consuming
the specified number of elements from the Stream, at this time. More elements can be consumed later, by called request on the returned Subscription,
when the entire Stream has been processed an onComplete event will be recieved.
<pre>
@{code
Subscription next = Streams.forEach(Stream.of(()->1,()->2,()->{throw new RuntimeException()},()->4)
.map(Supplier::getValue) ,System.out::println, e->e.printStackTrace(),()->System.out.println("the take!"));
System.out.println("First batch processed!");
next.request(2);
System.out.println("Second batch processed!");
//prints
1
2
First batch processed!
RuntimeException Stack Trace on System.err
4
Second batch processed!
The take!
}
</pre>
@param stream - the Stream to consume data from
@param x To consume from the Stream at this time
@param consumerElement To accept incoming elements from the Stream
@param consumerError To accept incoming processing errors from the Stream
@param onComplete To run after an onComplete event
@return Subscription so that further processing can be continued or cancelled. | [
"Perform",
"a",
"forEach",
"operation",
"over",
"the",
"Stream",
"without",
"closing",
"it",
"capturing",
"any",
"elements",
"and",
"errors",
"in",
"the",
"supplied",
"consumers",
"but",
"only",
"consuming",
"the",
"specified",
"number",
"of",
"elements",
"from"... | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L634-L639 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java | PageInBrowserStats.getDomMaxLoadTime | public long getDomMaxLoadTime(final String intervalName, final TimeUnit unit) {
final long max = domMaxLoadTime.getValueAsLong(intervalName);
return max == Constants.MAX_TIME_DEFAULT ? max : unit.transformMillis(max);
} | java | public long getDomMaxLoadTime(final String intervalName, final TimeUnit unit) {
final long max = domMaxLoadTime.getValueAsLong(intervalName);
return max == Constants.MAX_TIME_DEFAULT ? max : unit.transformMillis(max);
} | [
"public",
"long",
"getDomMaxLoadTime",
"(",
"final",
"String",
"intervalName",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"final",
"long",
"max",
"=",
"domMaxLoadTime",
".",
"getValueAsLong",
"(",
"intervalName",
")",
";",
"return",
"max",
"==",
"Constants",
... | Returns DOM maximum load time for given interval and time unit.
@param intervalName name of the interval
@param unit {@link TimeUnit}
@return DOM maximum load time | [
"Returns",
"DOM",
"maximum",
"load",
"time",
"for",
"given",
"interval",
"and",
"time",
"unit",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java#L141-L144 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/builder/LazyBeanMappingFactory.java | LazyBeanMappingFactory.create | @Override
public <T> BeanMapping<T> create(final Class<T> beanType, final Class<?>... groups) {
Objects.requireNonNull(beanType);
final Configuration configuration = getConfiguration();
final BeanMapping<T> beanMapping = new BeanMapping<>(beanType);
beanMapping.setConfiguration(configuration);
// アノテーション @CsvBeanの取得
final CsvBean beanAnno = beanType.getAnnotation(CsvBean.class);
if(beanAnno == null) {
throw new SuperCsvInvalidAnnotationException(beanAnno, MessageBuilder.create("anno.notFound")
.varWithClass("property", beanType)
.varWithAnno("anno", CsvBean.class)
.format());
}
// ヘッダーの設定情報の組み立て
buildHeaderMapper(beanMapping, beanAnno);
// 入力値検証の設定を組み立てます。
buildValidators(beanMapping, beanAnno, groups);
// アノテーション @CsvColumn を元にしたカラム情報の組み立て
buildColumnMappingList(beanMapping, beanType, groups);
// コールバックメソッドの設定
buildCallbackMethods(beanMapping, beanType, beanAnno);
return beanMapping;
} | java | @Override
public <T> BeanMapping<T> create(final Class<T> beanType, final Class<?>... groups) {
Objects.requireNonNull(beanType);
final Configuration configuration = getConfiguration();
final BeanMapping<T> beanMapping = new BeanMapping<>(beanType);
beanMapping.setConfiguration(configuration);
// アノテーション @CsvBeanの取得
final CsvBean beanAnno = beanType.getAnnotation(CsvBean.class);
if(beanAnno == null) {
throw new SuperCsvInvalidAnnotationException(beanAnno, MessageBuilder.create("anno.notFound")
.varWithClass("property", beanType)
.varWithAnno("anno", CsvBean.class)
.format());
}
// ヘッダーの設定情報の組み立て
buildHeaderMapper(beanMapping, beanAnno);
// 入力値検証の設定を組み立てます。
buildValidators(beanMapping, beanAnno, groups);
// アノテーション @CsvColumn を元にしたカラム情報の組み立て
buildColumnMappingList(beanMapping, beanType, groups);
// コールバックメソッドの設定
buildCallbackMethods(beanMapping, beanType, beanAnno);
return beanMapping;
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"BeanMapping",
"<",
"T",
">",
"create",
"(",
"final",
"Class",
"<",
"T",
">",
"beanType",
",",
"final",
"Class",
"<",
"?",
">",
"...",
"groups",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"beanType",
")... | Beanクラスから、CSVのマッピング情報を作成します。
@param <T> Beanのタイプ
@param beanType 作成元のBeanクラス。
@param groups グループ情報。
アノテーションを指定したグループで切り替える際に指定します。
何も指定しない場合は、デフォルトグループの{@link DefaultGroup}のクラスが指定されたとして処理します。
@return CSVのマッピング情報。
@throws NullPointerException {@literal beanType == null.}
@throws SuperCsvInvalidAnnotationException アノテーションの定義が不正な場合。 | [
"Beanクラスから、CSVのマッピング情報を作成します。"
] | train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/builder/LazyBeanMappingFactory.java#L42-L73 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java | TypeConverter.convertToBoolean | public static boolean convertToBoolean (@Nullable final Object aSrcValue, final boolean bDefault)
{
final Boolean aValue = convert (aSrcValue, Boolean.class, null);
return aValue == null ? bDefault : aValue.booleanValue ();
} | java | public static boolean convertToBoolean (@Nullable final Object aSrcValue, final boolean bDefault)
{
final Boolean aValue = convert (aSrcValue, Boolean.class, null);
return aValue == null ? bDefault : aValue.booleanValue ();
} | [
"public",
"static",
"boolean",
"convertToBoolean",
"(",
"@",
"Nullable",
"final",
"Object",
"aSrcValue",
",",
"final",
"boolean",
"bDefault",
")",
"{",
"final",
"Boolean",
"aValue",
"=",
"convert",
"(",
"aSrcValue",
",",
"Boolean",
".",
"class",
",",
"null",
... | Convert the passed source value to boolean
@param aSrcValue
The source value. May be <code>null</code>.
@param bDefault
The default value to be returned if an error occurs during type
conversion.
@return <code>null</code> if the source value was <code>null</code>.
@throws RuntimeException
If the converter itself throws an exception
@see TypeConverterProviderBestMatch | [
"Convert",
"the",
"passed",
"source",
"value",
"to",
"boolean"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java#L135-L139 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java | InternalUtils.addParam | public static String addParam( String url, String paramName, String paramVal )
{
return url + ( url.indexOf( '?' ) != -1 ? '&' : '?' ) + paramName + '=' + paramVal;
} | java | public static String addParam( String url, String paramName, String paramVal )
{
return url + ( url.indexOf( '?' ) != -1 ? '&' : '?' ) + paramName + '=' + paramVal;
} | [
"public",
"static",
"String",
"addParam",
"(",
"String",
"url",
",",
"String",
"paramName",
",",
"String",
"paramVal",
")",
"{",
"return",
"url",
"+",
"(",
"url",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
"?",
"'",
"'",
":",
"'",
"'",
"... | Add a parameter to the given URL. Assumes there is no trailing
anchor/fragment indicated with a '#'.
@param url the URL to which to append.
@param paramName the name of the parameter to add.
@param paramVal the value of the parameter to add.
@return the URL, with the given parameter added. | [
"Add",
"a",
"parameter",
"to",
"the",
"given",
"URL",
".",
"Assumes",
"there",
"is",
"no",
"trailing",
"anchor",
"/",
"fragment",
"indicated",
"with",
"a",
"#",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L897-L900 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java | StringBuilders.appendKeyDqValue | public static StringBuilder appendKeyDqValue(final StringBuilder sb, final String key, final Object value) {
return sb.append(key).append(Chars.EQ).append(Chars.DQUOTE).append(value).append(Chars.DQUOTE);
} | java | public static StringBuilder appendKeyDqValue(final StringBuilder sb, final String key, final Object value) {
return sb.append(key).append(Chars.EQ).append(Chars.DQUOTE).append(value).append(Chars.DQUOTE);
} | [
"public",
"static",
"StringBuilder",
"appendKeyDqValue",
"(",
"final",
"StringBuilder",
"sb",
",",
"final",
"String",
"key",
",",
"final",
"Object",
"value",
")",
"{",
"return",
"sb",
".",
"append",
"(",
"key",
")",
".",
"append",
"(",
"Chars",
".",
"EQ",
... | Appends in the following format: key=double quoted value.
@param sb a string builder
@param key a key
@param value a value
@return the specified StringBuilder | [
"Appends",
"in",
"the",
"following",
"format",
":",
"key",
"=",
"double",
"quoted",
"value",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java#L60-L62 |
OpenLiberty/open-liberty | dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java | MailSessionService.createResource | @Override
public Object createResource(ResourceInfo info) throws Exception {
Properties propertyNames = createPropertyNames();
Properties props = createProperties(propertyNames);
// The listOfPropMap is how the nested properties (name, value pairs) are
// pulled from the Nester class. This iterates the map and stores them in the
// props object
if (listOfPropMap != null)
{
for (Map<String, Object> nestedProperties : listOfPropMap)
{
props.put(nestedProperties.get(NAME), nestedProperties.get(VALUE));
}
}
Session session = createSession(props);
return session;
} | java | @Override
public Object createResource(ResourceInfo info) throws Exception {
Properties propertyNames = createPropertyNames();
Properties props = createProperties(propertyNames);
// The listOfPropMap is how the nested properties (name, value pairs) are
// pulled from the Nester class. This iterates the map and stores them in the
// props object
if (listOfPropMap != null)
{
for (Map<String, Object> nestedProperties : listOfPropMap)
{
props.put(nestedProperties.get(NAME), nestedProperties.get(VALUE));
}
}
Session session = createSession(props);
return session;
} | [
"@",
"Override",
"public",
"Object",
"createResource",
"(",
"ResourceInfo",
"info",
")",
"throws",
"Exception",
"{",
"Properties",
"propertyNames",
"=",
"createPropertyNames",
"(",
")",
";",
"Properties",
"props",
"=",
"createProperties",
"(",
"propertyNames",
")",
... | The createResource uses the sessionProperties to create a javax.mail.Session
object and return it to the caller. The caller uses JNDI look up with the
JNDI name defined in the server.xml. | [
"The",
"createResource",
"uses",
"the",
"sessionProperties",
"to",
"create",
"a",
"javax",
".",
"mail",
".",
"Session",
"object",
"and",
"return",
"it",
"to",
"the",
"caller",
".",
"The",
"caller",
"uses",
"JNDI",
"look",
"up",
"with",
"the",
"JNDI",
"name... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javamail.1.6/src/com/ibm/ws/javamail/internal/MailSessionService.java#L159-L178 |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ClassUtils.java | ClassUtils.matchesTypeName | public static boolean matchesTypeName(Class<?> clazz, String typeName) {
return (typeName != null &&
(typeName.equals(clazz.getName()) || typeName.equals(clazz.getSimpleName()) ||
(clazz.isArray() && typeName.equals(getQualifiedNameForArray(clazz)))));
} | java | public static boolean matchesTypeName(Class<?> clazz, String typeName) {
return (typeName != null &&
(typeName.equals(clazz.getName()) || typeName.equals(clazz.getSimpleName()) ||
(clazz.isArray() && typeName.equals(getQualifiedNameForArray(clazz)))));
} | [
"public",
"static",
"boolean",
"matchesTypeName",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"typeName",
")",
"{",
"return",
"(",
"typeName",
"!=",
"null",
"&&",
"(",
"typeName",
".",
"equals",
"(",
"clazz",
".",
"getName",
"(",
")",
")",
"||... | Check whether the given class matches the user-specified type name.
@param clazz the class to check
@param typeName the type name to match | [
"Check",
"whether",
"the",
"given",
"class",
"matches",
"the",
"user",
"-",
"specified",
"type",
"name",
"."
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L567-L571 |
vkostyukov/la4j | src/main/java/org/la4j/Vectors.java | Vectors.asSumFunctionAccumulator | public static VectorAccumulator asSumFunctionAccumulator(final double neutral,
final VectorFunction function) {
return new VectorAccumulator() {
private final VectorAccumulator sumAccumulator = Vectors.asSumAccumulator(neutral);
@Override
public void update(int i, double value) {
sumAccumulator.update(i, function.evaluate(i, value));
}
@Override
public double accumulate() {
return sumAccumulator.accumulate();
}
};
} | java | public static VectorAccumulator asSumFunctionAccumulator(final double neutral,
final VectorFunction function) {
return new VectorAccumulator() {
private final VectorAccumulator sumAccumulator = Vectors.asSumAccumulator(neutral);
@Override
public void update(int i, double value) {
sumAccumulator.update(i, function.evaluate(i, value));
}
@Override
public double accumulate() {
return sumAccumulator.accumulate();
}
};
} | [
"public",
"static",
"VectorAccumulator",
"asSumFunctionAccumulator",
"(",
"final",
"double",
"neutral",
",",
"final",
"VectorFunction",
"function",
")",
"{",
"return",
"new",
"VectorAccumulator",
"(",
")",
"{",
"private",
"final",
"VectorAccumulator",
"sumAccumulator",
... | Creates a sum function accumulator, that calculates the sum of all
elements in the vector after applying given {@code function} to each of them.
@param neutral the neutral value
@param function the vector function
@return a sum function accumulator | [
"Creates",
"a",
"sum",
"function",
"accumulator",
"that",
"calculates",
"the",
"sum",
"of",
"all",
"elements",
"in",
"the",
"vector",
"after",
"applying",
"given",
"{",
"@code",
"function",
"}",
"to",
"each",
"of",
"them",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L404-L419 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.addOrReplaceEntries | public static void addOrReplaceEntries(final File zip, final ZipEntrySource[] entries) {
operateInPlace(zip, new InPlaceAction() {
public boolean act(File tmpFile) {
addOrReplaceEntries(zip, entries, tmpFile);
return true;
}
});
} | java | public static void addOrReplaceEntries(final File zip, final ZipEntrySource[] entries) {
operateInPlace(zip, new InPlaceAction() {
public boolean act(File tmpFile) {
addOrReplaceEntries(zip, entries, tmpFile);
return true;
}
});
} | [
"public",
"static",
"void",
"addOrReplaceEntries",
"(",
"final",
"File",
"zip",
",",
"final",
"ZipEntrySource",
"[",
"]",
"entries",
")",
"{",
"operateInPlace",
"(",
"zip",
",",
"new",
"InPlaceAction",
"(",
")",
"{",
"public",
"boolean",
"act",
"(",
"File",
... | Changes a ZIP file: adds/replaces the given entries in it.
@param zip
an existing ZIP file (only read).
@param entries
ZIP entries to be replaced or added. | [
"Changes",
"a",
"ZIP",
"file",
":",
"adds",
"/",
"replaces",
"the",
"given",
"entries",
"in",
"it",
"."
] | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2742-L2749 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/payments/PaymentSession.java | PaymentSession.createFromBitcoinUri | public static ListenableFuture<PaymentSession> createFromBitcoinUri(final BitcoinURI uri, final boolean verifyPki)
throws PaymentProtocolException {
return createFromBitcoinUri(uri, verifyPki, null);
} | java | public static ListenableFuture<PaymentSession> createFromBitcoinUri(final BitcoinURI uri, final boolean verifyPki)
throws PaymentProtocolException {
return createFromBitcoinUri(uri, verifyPki, null);
} | [
"public",
"static",
"ListenableFuture",
"<",
"PaymentSession",
">",
"createFromBitcoinUri",
"(",
"final",
"BitcoinURI",
"uri",
",",
"final",
"boolean",
"verifyPki",
")",
"throws",
"PaymentProtocolException",
"{",
"return",
"createFromBitcoinUri",
"(",
"uri",
",",
"ver... | Returns a future that will be notified with a PaymentSession object after it is fetched using the provided uri.
uri is a BIP-72-style BitcoinURI object that specifies where the {@link Protos.PaymentRequest} object may
be fetched in the r= parameter.
If verifyPki is specified and the payment request object specifies a PKI method, then the system trust store will
be used to verify the signature provided by the payment request. An exception is thrown by the future if the
signature cannot be verified. | [
"Returns",
"a",
"future",
"that",
"will",
"be",
"notified",
"with",
"a",
"PaymentSession",
"object",
"after",
"it",
"is",
"fetched",
"using",
"the",
"provided",
"uri",
".",
"uri",
"is",
"a",
"BIP",
"-",
"72",
"-",
"style",
"BitcoinURI",
"object",
"that",
... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/payments/PaymentSession.java#L105-L108 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java | CloudMe.scanFolderLevel | private void scanFolderLevel( Element element, CMFolder cmFolder )
{
NodeList nodeList = element.getChildNodes();
for ( int i = 0; i < nodeList.getLength(); i++ ) {
Node currentNode = nodeList.item( i );
if ( currentNode.getNodeType() != Node.ELEMENT_NODE ) {
continue;
}
Element currentElement = ( Element ) currentNode;
if ( !currentElement.getLocalName().equals( "folder" ) ) {
continue;
}
//calls this method for all the children which is Element
CMFolder childFolder = cmFolder.addChild( currentElement.getAttribute( "id" ),
currentElement.getAttribute( "name" ) );
scanFolderLevel( currentElement, childFolder );
}
} | java | private void scanFolderLevel( Element element, CMFolder cmFolder )
{
NodeList nodeList = element.getChildNodes();
for ( int i = 0; i < nodeList.getLength(); i++ ) {
Node currentNode = nodeList.item( i );
if ( currentNode.getNodeType() != Node.ELEMENT_NODE ) {
continue;
}
Element currentElement = ( Element ) currentNode;
if ( !currentElement.getLocalName().equals( "folder" ) ) {
continue;
}
//calls this method for all the children which is Element
CMFolder childFolder = cmFolder.addChild( currentElement.getAttribute( "id" ),
currentElement.getAttribute( "name" ) );
scanFolderLevel( currentElement, childFolder );
}
} | [
"private",
"void",
"scanFolderLevel",
"(",
"Element",
"element",
",",
"CMFolder",
"cmFolder",
")",
"{",
"NodeList",
"nodeList",
"=",
"element",
".",
"getChildNodes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nodeList",
".",
"getLen... | Recursive method that parses folders XML and builds CMFolder structure.
@param element
@param cmFolder | [
"Recursive",
"method",
"that",
"parses",
"folders",
"XML",
"and",
"builds",
"CMFolder",
"structure",
"."
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java#L289-L312 |
m-m-m/util | date/src/main/java/net/sf/mmm/util/date/base/Iso8601UtilImpl.java | Iso8601UtilImpl.parseTimezone | private TimeZone parseTimezone(CharSequenceScanner scanner) {
int pos = scanner.getCurrentIndex();
Integer offset = parseTimezoneOffset(scanner);
// has offset?
if (offset != null) {
int offsetMs = offset.intValue();
String tzName = "GMT";
if (offsetMs != 0) {
if (offsetMs < 0) {
tzName += "-";
} else {
tzName += "+";
}
tzName += scanner.substring(pos, scanner.getCurrentIndex());
}
return new SimpleTimeZone(offsetMs, tzName);
} else if (scanner.getCurrentIndex() == pos) {
return null;
} else {
// UTC
return TZ_UTC;
}
} | java | private TimeZone parseTimezone(CharSequenceScanner scanner) {
int pos = scanner.getCurrentIndex();
Integer offset = parseTimezoneOffset(scanner);
// has offset?
if (offset != null) {
int offsetMs = offset.intValue();
String tzName = "GMT";
if (offsetMs != 0) {
if (offsetMs < 0) {
tzName += "-";
} else {
tzName += "+";
}
tzName += scanner.substring(pos, scanner.getCurrentIndex());
}
return new SimpleTimeZone(offsetMs, tzName);
} else if (scanner.getCurrentIndex() == pos) {
return null;
} else {
// UTC
return TZ_UTC;
}
} | [
"private",
"TimeZone",
"parseTimezone",
"(",
"CharSequenceScanner",
"scanner",
")",
"{",
"int",
"pos",
"=",
"scanner",
".",
"getCurrentIndex",
"(",
")",
";",
"Integer",
"offset",
"=",
"parseTimezoneOffset",
"(",
"scanner",
")",
";",
"// has offset?",
"if",
"(",
... | This method parses the timezone from the given {@code parser}.
@param scanner is the parser pointing to the timezone or at the end of the string
@return the parsed timezone or {@code null} if parser already at the end of the string. | [
"This",
"method",
"parses",
"the",
"timezone",
"from",
"the",
"given",
"{",
"@code",
"parser",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/date/src/main/java/net/sf/mmm/util/date/base/Iso8601UtilImpl.java#L176-L199 |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/Kickflip.java | Kickflip.setup | public static KickflipApiClient setup(Context context, String key, String secret, KickflipCallback cb) {
sContext = context;
setApiCredentials(key, secret);
return getApiClient(context, cb);
} | java | public static KickflipApiClient setup(Context context, String key, String secret, KickflipCallback cb) {
sContext = context;
setApiCredentials(key, secret);
return getApiClient(context, cb);
} | [
"public",
"static",
"KickflipApiClient",
"setup",
"(",
"Context",
"context",
",",
"String",
"key",
",",
"String",
"secret",
",",
"KickflipCallback",
"cb",
")",
"{",
"sContext",
"=",
"context",
";",
"setApiCredentials",
"(",
"key",
",",
"secret",
")",
";",
"r... | Register with Kickflip, creating a new user identity per app installation.
@param context the host application's {@link android.content.Context}
@param key your Kickflip Client Key
@param secret your Kickflip Client Secret
@param cb A callback to be invoked when Kickflip user credentials are available.
@return a {@link io.kickflip.sdk.api.KickflipApiClient} used to perform actions on behalf of
a {@link io.kickflip.sdk.api.json.User}. | [
"Register",
"with",
"Kickflip",
"creating",
"a",
"new",
"user",
"identity",
"per",
"app",
"installation",
"."
] | train | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/Kickflip.java#L113-L117 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/AGNES.java | AGNES.initializeDistanceMatrix | protected static void initializeDistanceMatrix(MatrixParadigm mat, DistanceQuery<?> dq, Linkage linkage) {
final DBIDArrayIter ix = mat.ix, iy = mat.iy;
final double[] matrix = mat.matrix;
final boolean issquare = dq.getDistanceFunction().isSquared();
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Distance matrix computation", matrix.length, LOG) : null;
int pos = 0;
for(ix.seek(0); ix.valid(); ix.advance()) {
final int x = ix.getOffset();
assert (pos == MatrixParadigm.triangleSize(x));
for(iy.seek(0); iy.getOffset() < x; iy.advance()) {
matrix[pos++] = linkage.initial(dq.distance(ix, iy), issquare);
}
if(prog != null) {
prog.setProcessed(pos, LOG);
}
}
// Avoid logging errors in case scratch space was too large:
if(prog != null) {
prog.setProcessed(matrix.length, LOG);
}
LOG.ensureCompleted(prog);
} | java | protected static void initializeDistanceMatrix(MatrixParadigm mat, DistanceQuery<?> dq, Linkage linkage) {
final DBIDArrayIter ix = mat.ix, iy = mat.iy;
final double[] matrix = mat.matrix;
final boolean issquare = dq.getDistanceFunction().isSquared();
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Distance matrix computation", matrix.length, LOG) : null;
int pos = 0;
for(ix.seek(0); ix.valid(); ix.advance()) {
final int x = ix.getOffset();
assert (pos == MatrixParadigm.triangleSize(x));
for(iy.seek(0); iy.getOffset() < x; iy.advance()) {
matrix[pos++] = linkage.initial(dq.distance(ix, iy), issquare);
}
if(prog != null) {
prog.setProcessed(pos, LOG);
}
}
// Avoid logging errors in case scratch space was too large:
if(prog != null) {
prog.setProcessed(matrix.length, LOG);
}
LOG.ensureCompleted(prog);
} | [
"protected",
"static",
"void",
"initializeDistanceMatrix",
"(",
"MatrixParadigm",
"mat",
",",
"DistanceQuery",
"<",
"?",
">",
"dq",
",",
"Linkage",
"linkage",
")",
"{",
"final",
"DBIDArrayIter",
"ix",
"=",
"mat",
".",
"ix",
",",
"iy",
"=",
"mat",
".",
"iy"... | Initialize a distance matrix.
@param mat Matrix
@param dq Distance query
@param linkage Linkage method | [
"Initialize",
"a",
"distance",
"matrix",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/AGNES.java#L193-L214 |
johncarl81/transfuse | transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java | InjectionPointFactory.buildInjectionPoint | public MethodInjectionPoint buildInjectionPoint(ASTType rootContainingType, ASTType containingType, ASTMethod astMethod, AnalysisContext context) {
MethodInjectionPoint methodInjectionPoint = new MethodInjectionPoint(rootContainingType, containingType, astMethod);
methodInjectionPoint.addThrows(astMethod.getThrowsTypes());
List<ASTAnnotation> methodAnnotations = new ArrayList<ASTAnnotation>();
//bindingAnnotations for single parameter from method level
if (astMethod.getParameters().size() == 1) {
methodAnnotations.addAll(astMethod.getAnnotations());
}
for (ASTParameter astParameter : astMethod.getParameters()) {
List<ASTAnnotation> parameterAnnotations = new ArrayList<ASTAnnotation>(methodAnnotations);
parameterAnnotations.addAll(astParameter.getAnnotations());
methodInjectionPoint.addInjectionNode(buildInjectionNode(parameterAnnotations, astParameter, astParameter.getASTType(), context));
}
return methodInjectionPoint;
} | java | public MethodInjectionPoint buildInjectionPoint(ASTType rootContainingType, ASTType containingType, ASTMethod astMethod, AnalysisContext context) {
MethodInjectionPoint methodInjectionPoint = new MethodInjectionPoint(rootContainingType, containingType, astMethod);
methodInjectionPoint.addThrows(astMethod.getThrowsTypes());
List<ASTAnnotation> methodAnnotations = new ArrayList<ASTAnnotation>();
//bindingAnnotations for single parameter from method level
if (astMethod.getParameters().size() == 1) {
methodAnnotations.addAll(astMethod.getAnnotations());
}
for (ASTParameter astParameter : astMethod.getParameters()) {
List<ASTAnnotation> parameterAnnotations = new ArrayList<ASTAnnotation>(methodAnnotations);
parameterAnnotations.addAll(astParameter.getAnnotations());
methodInjectionPoint.addInjectionNode(buildInjectionNode(parameterAnnotations, astParameter, astParameter.getASTType(), context));
}
return methodInjectionPoint;
} | [
"public",
"MethodInjectionPoint",
"buildInjectionPoint",
"(",
"ASTType",
"rootContainingType",
",",
"ASTType",
"containingType",
",",
"ASTMethod",
"astMethod",
",",
"AnalysisContext",
"context",
")",
"{",
"MethodInjectionPoint",
"methodInjectionPoint",
"=",
"new",
"MethodIn... | Build a Method Injection Point from the given ASTMethod
@param containingType
@param astMethod required ASTMethod
@param context analysis context
@return MethodInjectionPoint | [
"Build",
"a",
"Method",
"Injection",
"Point",
"from",
"the",
"given",
"ASTMethod"
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java#L98-L116 |
lessthanoptimal/BoofCV | integration/boofcv-android/src/main/java/boofcv/android/camera2/SimpleCamera2Activity.java | SimpleCamera2Activity.selectCamera | protected boolean selectCamera( String id , CameraCharacteristics characteristics ) {
if( verbose )
Log.i(TAG,"selectCamera() default function");
Integer facing = characteristics.get(CameraCharacteristics.LENS_FACING);
return facing == null || facing != CameraCharacteristics.LENS_FACING_FRONT;
} | java | protected boolean selectCamera( String id , CameraCharacteristics characteristics ) {
if( verbose )
Log.i(TAG,"selectCamera() default function");
Integer facing = characteristics.get(CameraCharacteristics.LENS_FACING);
return facing == null || facing != CameraCharacteristics.LENS_FACING_FRONT;
} | [
"protected",
"boolean",
"selectCamera",
"(",
"String",
"id",
",",
"CameraCharacteristics",
"characteristics",
")",
"{",
"if",
"(",
"verbose",
")",
"Log",
".",
"i",
"(",
"TAG",
",",
"\"selectCamera() default function\"",
")",
";",
"Integer",
"facing",
"=",
"chara... | By default this will select the backfacing camera. override to change the camera it selects. | [
"By",
"default",
"this",
"will",
"select",
"the",
"backfacing",
"camera",
".",
"override",
"to",
"change",
"the",
"camera",
"it",
"selects",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera2/SimpleCamera2Activity.java#L320-L325 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java | Whitebox.setInternalState | public static void setInternalState(Object object, Object value, Object... additionalValues) {
WhiteboxImpl.setInternalState(object, value, additionalValues);
} | java | public static void setInternalState(Object object, Object value, Object... additionalValues) {
WhiteboxImpl.setInternalState(object, value, additionalValues);
} | [
"public",
"static",
"void",
"setInternalState",
"(",
"Object",
"object",
",",
"Object",
"value",
",",
"Object",
"...",
"additionalValues",
")",
"{",
"WhiteboxImpl",
".",
"setInternalState",
"(",
"object",
",",
"value",
",",
"additionalValues",
")",
";",
"}"
] | Set the value of a field using reflection. This method will traverse the
super class hierarchy until the first field assignable to the
<tt>value</tt> type is found. The <tt>value</tt> (or
<tt>additionaValues</tt> if present) will then be assigned to this field.
@param object
the object to modify
@param value
the new value of the field
@param additionalValues
Additional values to set on the object | [
"Set",
"the",
"value",
"of",
"a",
"field",
"using",
"reflection",
".",
"This",
"method",
"will",
"traverse",
"the",
"super",
"class",
"hierarchy",
"until",
"the",
"first",
"field",
"assignable",
"to",
"the",
"<tt",
">",
"value<",
"/",
"tt",
">",
"type",
... | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java#L206-L208 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.readAncestor | @SuppressWarnings("deprecation")
public CmsFolder readAncestor(String resourcename, int type) throws CmsException {
return readAncestor(resourcename, CmsResourceFilter.requireType(type));
} | java | @SuppressWarnings("deprecation")
public CmsFolder readAncestor(String resourcename, int type) throws CmsException {
return readAncestor(resourcename, CmsResourceFilter.requireType(type));
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"CmsFolder",
"readAncestor",
"(",
"String",
"resourcename",
",",
"int",
"type",
")",
"throws",
"CmsException",
"{",
"return",
"readAncestor",
"(",
"resourcename",
",",
"CmsResourceFilter",
".",
"require... | Returns the first ancestor folder matching the resource type.<p>
If no folder with the requested resource type is found, null is returned.<p>
@param resourcename the name of the resource to start (full current site relative path)
@param type the resource type of the folder to match
@return the first ancestor folder matching the filter criteria or null if no folder was found
@throws CmsException if something goes wrong | [
"Returns",
"the",
"first",
"ancestor",
"folder",
"matching",
"the",
"resource",
"type",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L2343-L2347 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java | GlobalUsersInner.startEnvironmentAsync | public Observable<Void> startEnvironmentAsync(String userName, String environmentId) {
return startEnvironmentWithServiceResponseAsync(userName, environmentId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> startEnvironmentAsync(String userName, String environmentId) {
return startEnvironmentWithServiceResponseAsync(userName, environmentId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"startEnvironmentAsync",
"(",
"String",
"userName",
",",
"String",
"environmentId",
")",
"{",
"return",
"startEnvironmentWithServiceResponseAsync",
"(",
"userName",
",",
"environmentId",
")",
".",
"map",
"(",
"new",
"Func1",... | Starts an environment by starting all resources inside the environment. This operation can take a while to complete.
@param userName The name of the user.
@param environmentId The resourceId of the environment
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Starts",
"an",
"environment",
"by",
"starting",
"all",
"resources",
"inside",
"the",
"environment",
".",
"This",
"operation",
"can",
"take",
"a",
"while",
"to",
"complete",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L1107-L1114 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaGraphicsSubResourceGetMappedArray | public static int cudaGraphicsSubResourceGetMappedArray(cudaArray arrayPtr, cudaGraphicsResource resource, int arrayIndex, int mipLevel)
{
return checkResult(cudaGraphicsSubResourceGetMappedArrayNative(arrayPtr, resource, arrayIndex, mipLevel));
} | java | public static int cudaGraphicsSubResourceGetMappedArray(cudaArray arrayPtr, cudaGraphicsResource resource, int arrayIndex, int mipLevel)
{
return checkResult(cudaGraphicsSubResourceGetMappedArrayNative(arrayPtr, resource, arrayIndex, mipLevel));
} | [
"public",
"static",
"int",
"cudaGraphicsSubResourceGetMappedArray",
"(",
"cudaArray",
"arrayPtr",
",",
"cudaGraphicsResource",
"resource",
",",
"int",
"arrayIndex",
",",
"int",
"mipLevel",
")",
"{",
"return",
"checkResult",
"(",
"cudaGraphicsSubResourceGetMappedArrayNative"... | Get an array through which to access a subresource of a mapped graphics resource.
<pre>
cudaError_t cudaGraphicsSubResourceGetMappedArray (
cudaArray_t* array,
cudaGraphicsResource_t resource,
unsigned int arrayIndex,
unsigned int mipLevel )
</pre>
<div>
<p>Get an array through which to access a
subresource of a mapped graphics resource. Returns in <tt>*array</tt>
an array through which the subresource of the mapped graphics resource
<tt>resource</tt> which corresponds to array index <tt>arrayIndex</tt>
and mipmap level <tt>mipLevel</tt> may be accessed. The value set in
<tt>array</tt> may change every time that <tt>resource</tt> is
mapped.
</p>
<p>If <tt>resource</tt> is not a texture
then it cannot be accessed via an array and cudaErrorUnknown is
returned. If <tt>arrayIndex</tt> is not a valid array index for <tt>resource</tt> then cudaErrorInvalidValue is returned. If <tt>mipLevel</tt> is not a valid mipmap level for <tt>resource</tt> then
cudaErrorInvalidValue is returned. If <tt>resource</tt> is not mapped
then cudaErrorUnknown is returned.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param array Returned array through which a subresource of resource may be accessed
@param resource Mapped resource to access
@param arrayIndex Array index for array textures or cubemap face index as defined by cudaGraphicsCubeFace for cubemap textures for the subresource to access
@param mipLevel Mipmap level for the subresource to access
@return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidResourceHandle,
cudaErrorUnknown
@see JCuda#cudaGraphicsResourceGetMappedPointer | [
"Get",
"an",
"array",
"through",
"which",
"to",
"access",
"a",
"subresource",
"of",
"a",
"mapped",
"graphics",
"resource",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L11659-L11662 |
HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/dom/CSSMediaRuleImpl.java | CSSMediaRuleImpl.insertRule | public void insertRule(final String rule, final int index) throws DOMException {
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
try {
final CSSOMParser parser = new CSSOMParser();
parser.setParentStyleSheet(parentStyleSheet);
parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE);
final AbstractCSSRuleImpl r = parser.parseRule(rule);
// Insert the rule into the list of rules
getCssRules().insert(r, index);
}
catch (final IndexOutOfBoundsException e) {
throw new DOMExceptionImpl(
DOMException.INDEX_SIZE_ERR,
DOMExceptionImpl.INDEX_OUT_OF_BOUNDS,
e.getMessage());
}
catch (final CSSException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
catch (final IOException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
} | java | public void insertRule(final String rule, final int index) throws DOMException {
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
try {
final CSSOMParser parser = new CSSOMParser();
parser.setParentStyleSheet(parentStyleSheet);
parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE);
final AbstractCSSRuleImpl r = parser.parseRule(rule);
// Insert the rule into the list of rules
getCssRules().insert(r, index);
}
catch (final IndexOutOfBoundsException e) {
throw new DOMExceptionImpl(
DOMException.INDEX_SIZE_ERR,
DOMExceptionImpl.INDEX_OUT_OF_BOUNDS,
e.getMessage());
}
catch (final CSSException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
catch (final IOException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
} | [
"public",
"void",
"insertRule",
"(",
"final",
"String",
"rule",
",",
"final",
"int",
"index",
")",
"throws",
"DOMException",
"{",
"final",
"CSSStyleSheetImpl",
"parentStyleSheet",
"=",
"getParentStyleSheet",
"(",
")",
";",
"try",
"{",
"final",
"CSSOMParser",
"pa... | Insert a new rule at the given index.
@param rule the rule to be inserted
@param index the insert pos
@throws DOMException in case of error | [
"Insert",
"a",
"new",
"rule",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/dom/CSSMediaRuleImpl.java#L126-L157 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java | SlotPoolImpl.releaseTaskManager | @Override
public boolean releaseTaskManager(final ResourceID resourceId, final Exception cause) {
componentMainThreadExecutor.assertRunningInMainThread();
if (registeredTaskManagers.remove(resourceId)) {
releaseTaskManagerInternal(resourceId, cause);
return true;
} else {
return false;
}
} | java | @Override
public boolean releaseTaskManager(final ResourceID resourceId, final Exception cause) {
componentMainThreadExecutor.assertRunningInMainThread();
if (registeredTaskManagers.remove(resourceId)) {
releaseTaskManagerInternal(resourceId, cause);
return true;
} else {
return false;
}
} | [
"@",
"Override",
"public",
"boolean",
"releaseTaskManager",
"(",
"final",
"ResourceID",
"resourceId",
",",
"final",
"Exception",
"cause",
")",
"{",
"componentMainThreadExecutor",
".",
"assertRunningInMainThread",
"(",
")",
";",
"if",
"(",
"registeredTaskManagers",
"."... | Unregister TaskManager from this pool, all the related slots will be released and tasks be canceled. Called
when we find some TaskManager becomes "dead" or "abnormal", and we decide to not using slots from it anymore.
@param resourceId The id of the TaskManager
@param cause for the releasing of the TaskManager | [
"Unregister",
"TaskManager",
"from",
"this",
"pool",
"all",
"the",
"related",
"slots",
"will",
"be",
"released",
"and",
"tasks",
"be",
"canceled",
".",
"Called",
"when",
"we",
"find",
"some",
"TaskManager",
"becomes",
"dead",
"or",
"abnormal",
"and",
"we",
"... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java#L705-L716 |
google/closure-compiler | src/com/google/javascript/jscomp/TypedScopeCreator.java | TypedScopeCreator.patchGlobalScope | void patchGlobalScope(TypedScope globalScope, Node scriptRoot) {
// Preconditions: This is supposed to be called only on (named) SCRIPT nodes
// and a global typed scope should have been generated already.
checkState(scriptRoot.isScript());
checkNotNull(globalScope);
checkState(globalScope.isGlobal());
String scriptName = NodeUtil.getSourceName(scriptRoot);
checkNotNull(scriptName);
Predicate<Node> inScript = n -> scriptName.equals(NodeUtil.getSourceName(n));
escapedVarNames.removeIf(var -> inScript.test(var.getScopeRoot()));
assignedVarNames.removeIf(var -> inScript.test(var.getScopeRoot()));
functionsWithNonEmptyReturns.removeIf(inScript);
new FirstOrderFunctionAnalyzer().process(null, scriptRoot);
// TODO(bashir): Variable declaration is not the only side effect of last
// global scope generation but here we only wipe that part off.
// Remove all variables that were previously declared in this scripts.
// First find all vars to remove then remove them because of iterator.
List<TypedVar> varsToRemove = new ArrayList<>();
for (TypedVar oldVar : globalScope.getVarIterable()) {
if (scriptName.equals(oldVar.getInputName())) {
varsToRemove.add(oldVar);
}
}
for (TypedVar var : varsToRemove) {
// By removing the type here, we're potentially invalidating any files that contain
// references to this type. Those files will need to be recompiled. Ideally, this
// was handled by the compiler (see b/29121507), but in the meantime users of incremental
// compilation will need to manage it themselves (e.g., by recompiling dependent files
// based on the dep graph).
String typeName = var.getName();
globalScope.undeclare(var);
globalScope.getTypeOfThis().toObjectType().removeProperty(typeName);
if (typeRegistry.getType(globalScope, typeName) != null) {
typeRegistry.removeType(globalScope, typeName);
}
}
// Now re-traverse the given script.
NormalScopeBuilder scopeBuilder = new NormalScopeBuilder(globalScope, null);
NodeTraversal.traverse(compiler, scriptRoot, scopeBuilder);
} | java | void patchGlobalScope(TypedScope globalScope, Node scriptRoot) {
// Preconditions: This is supposed to be called only on (named) SCRIPT nodes
// and a global typed scope should have been generated already.
checkState(scriptRoot.isScript());
checkNotNull(globalScope);
checkState(globalScope.isGlobal());
String scriptName = NodeUtil.getSourceName(scriptRoot);
checkNotNull(scriptName);
Predicate<Node> inScript = n -> scriptName.equals(NodeUtil.getSourceName(n));
escapedVarNames.removeIf(var -> inScript.test(var.getScopeRoot()));
assignedVarNames.removeIf(var -> inScript.test(var.getScopeRoot()));
functionsWithNonEmptyReturns.removeIf(inScript);
new FirstOrderFunctionAnalyzer().process(null, scriptRoot);
// TODO(bashir): Variable declaration is not the only side effect of last
// global scope generation but here we only wipe that part off.
// Remove all variables that were previously declared in this scripts.
// First find all vars to remove then remove them because of iterator.
List<TypedVar> varsToRemove = new ArrayList<>();
for (TypedVar oldVar : globalScope.getVarIterable()) {
if (scriptName.equals(oldVar.getInputName())) {
varsToRemove.add(oldVar);
}
}
for (TypedVar var : varsToRemove) {
// By removing the type here, we're potentially invalidating any files that contain
// references to this type. Those files will need to be recompiled. Ideally, this
// was handled by the compiler (see b/29121507), but in the meantime users of incremental
// compilation will need to manage it themselves (e.g., by recompiling dependent files
// based on the dep graph).
String typeName = var.getName();
globalScope.undeclare(var);
globalScope.getTypeOfThis().toObjectType().removeProperty(typeName);
if (typeRegistry.getType(globalScope, typeName) != null) {
typeRegistry.removeType(globalScope, typeName);
}
}
// Now re-traverse the given script.
NormalScopeBuilder scopeBuilder = new NormalScopeBuilder(globalScope, null);
NodeTraversal.traverse(compiler, scriptRoot, scopeBuilder);
} | [
"void",
"patchGlobalScope",
"(",
"TypedScope",
"globalScope",
",",
"Node",
"scriptRoot",
")",
"{",
"// Preconditions: This is supposed to be called only on (named) SCRIPT nodes",
"// and a global typed scope should have been generated already.",
"checkState",
"(",
"scriptRoot",
".",
... | Patches a given global scope by removing variables previously declared in a script and
re-traversing a new version of that script.
@param globalScope The global scope generated by {@code createScope}.
@param scriptRoot The script that is modified. | [
"Patches",
"a",
"given",
"global",
"scope",
"by",
"removing",
"variables",
"previously",
"declared",
"in",
"a",
"script",
"and",
"re",
"-",
"traversing",
"a",
"new",
"version",
"of",
"that",
"script",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypedScopeCreator.java#L558-L603 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotationXYZ | public Matrix4f rotationXYZ(float angleX, float angleY, float angleZ) {
float sinX = (float) Math.sin(angleX);
float cosX = (float) Math.cosFromSin(sinX, angleX);
float sinY = (float) Math.sin(angleY);
float cosY = (float) Math.cosFromSin(sinY, angleY);
float sinZ = (float) Math.sin(angleZ);
float cosZ = (float) Math.cosFromSin(sinZ, angleZ);
float m_sinX = -sinX;
float m_sinY = -sinY;
float m_sinZ = -sinZ;
if ((properties & PROPERTY_IDENTITY) == 0)
MemUtil.INSTANCE.identity(this);
// rotateX
float nm11 = cosX;
float nm12 = sinX;
float nm21 = m_sinX;
float nm22 = cosX;
// rotateY
float nm00 = cosY;
float nm01 = nm21 * m_sinY;
float nm02 = nm22 * m_sinY;
this._m20(sinY);
this._m21(nm21 * cosY);
this._m22(nm22 * cosY);
// rotateZ
this._m00(nm00 * cosZ);
this._m01(nm01 * cosZ + nm11 * sinZ);
this._m02(nm02 * cosZ + nm12 * sinZ);
this._m10(nm00 * m_sinZ);
this._m11(nm01 * m_sinZ + nm11 * cosZ);
this._m12(nm02 * m_sinZ + nm12 * cosZ);
_properties(PROPERTY_AFFINE | PROPERTY_ORTHONORMAL);
return this;
} | java | public Matrix4f rotationXYZ(float angleX, float angleY, float angleZ) {
float sinX = (float) Math.sin(angleX);
float cosX = (float) Math.cosFromSin(sinX, angleX);
float sinY = (float) Math.sin(angleY);
float cosY = (float) Math.cosFromSin(sinY, angleY);
float sinZ = (float) Math.sin(angleZ);
float cosZ = (float) Math.cosFromSin(sinZ, angleZ);
float m_sinX = -sinX;
float m_sinY = -sinY;
float m_sinZ = -sinZ;
if ((properties & PROPERTY_IDENTITY) == 0)
MemUtil.INSTANCE.identity(this);
// rotateX
float nm11 = cosX;
float nm12 = sinX;
float nm21 = m_sinX;
float nm22 = cosX;
// rotateY
float nm00 = cosY;
float nm01 = nm21 * m_sinY;
float nm02 = nm22 * m_sinY;
this._m20(sinY);
this._m21(nm21 * cosY);
this._m22(nm22 * cosY);
// rotateZ
this._m00(nm00 * cosZ);
this._m01(nm01 * cosZ + nm11 * sinZ);
this._m02(nm02 * cosZ + nm12 * sinZ);
this._m10(nm00 * m_sinZ);
this._m11(nm01 * m_sinZ + nm11 * cosZ);
this._m12(nm02 * m_sinZ + nm12 * cosZ);
_properties(PROPERTY_AFFINE | PROPERTY_ORTHONORMAL);
return this;
} | [
"public",
"Matrix4f",
"rotationXYZ",
"(",
"float",
"angleX",
",",
"float",
"angleY",
",",
"float",
"angleZ",
")",
"{",
"float",
"sinX",
"=",
"(",
"float",
")",
"Math",
".",
"sin",
"(",
"angleX",
")",
";",
"float",
"cosX",
"=",
"(",
"float",
")",
"Mat... | Set this matrix to a rotation of <code>angleX</code> radians about the X axis, followed by a rotation
of <code>angleY</code> radians about the Y axis and followed by a rotation of <code>angleZ</code> radians about the Z axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
This method is equivalent to calling: <code>rotationX(angleX).rotateY(angleY).rotateZ(angleZ)</code>
@param angleX
the angle to rotate about X
@param angleY
the angle to rotate about Y
@param angleZ
the angle to rotate about Z
@return this | [
"Set",
"this",
"matrix",
"to",
"a",
"rotation",
"of",
"<code",
">",
"angleX<",
"/",
"code",
">",
"radians",
"about",
"the",
"X",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angleY<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L3611-L3644 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Address.java | Address.fromString | public static Address fromString(@Nullable NetworkParameters params, String str)
throws AddressFormatException {
try {
return LegacyAddress.fromBase58(params, str);
} catch (AddressFormatException.WrongNetwork x) {
throw x;
} catch (AddressFormatException x) {
try {
return SegwitAddress.fromBech32(params, str);
} catch (AddressFormatException.WrongNetwork x2) {
throw x;
} catch (AddressFormatException x2) {
throw new AddressFormatException(str);
}
}
} | java | public static Address fromString(@Nullable NetworkParameters params, String str)
throws AddressFormatException {
try {
return LegacyAddress.fromBase58(params, str);
} catch (AddressFormatException.WrongNetwork x) {
throw x;
} catch (AddressFormatException x) {
try {
return SegwitAddress.fromBech32(params, str);
} catch (AddressFormatException.WrongNetwork x2) {
throw x;
} catch (AddressFormatException x2) {
throw new AddressFormatException(str);
}
}
} | [
"public",
"static",
"Address",
"fromString",
"(",
"@",
"Nullable",
"NetworkParameters",
"params",
",",
"String",
"str",
")",
"throws",
"AddressFormatException",
"{",
"try",
"{",
"return",
"LegacyAddress",
".",
"fromBase58",
"(",
"params",
",",
"str",
")",
";",
... | Construct an address from its textual form.
@param params
the expected network this address is valid for, or null if the network should be derived from the
textual form
@param str
the textual form of the address, such as "17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL" or
"bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"
@return constructed address
@throws AddressFormatException
if the given string doesn't parse or the checksum is invalid
@throws AddressFormatException.WrongNetwork
if the given string is valid but not for the expected network (eg testnet vs mainnet) | [
"Construct",
"an",
"address",
"from",
"its",
"textual",
"form",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Address.java#L54-L69 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java | UCharacter.toLowerCase | public static String toLowerCase(Locale locale, String str)
{
return toLowerCase(getCaseLocale(locale), str);
} | java | public static String toLowerCase(Locale locale, String str)
{
return toLowerCase(getCaseLocale(locale), str);
} | [
"public",
"static",
"String",
"toLowerCase",
"(",
"Locale",
"locale",
",",
"String",
"str",
")",
"{",
"return",
"toLowerCase",
"(",
"getCaseLocale",
"(",
"locale",
")",
",",
"str",
")",
";",
"}"
] | Returns the lowercase version of the argument string.
Casing is dependent on the argument locale and context-sensitive
@param locale which string is to be converted in
@param str source string to be performed on
@return lowercase version of the argument string | [
"Returns",
"the",
"lowercase",
"version",
"of",
"the",
"argument",
"string",
".",
"Casing",
"is",
"dependent",
"on",
"the",
"argument",
"locale",
"and",
"context",
"-",
"sensitive"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L4432-L4435 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/MergeRequestApi.java | MergeRequestApi.updateMergeRequest | @Deprecated
public MergeRequest updateMergeRequest(Object projectIdOrPath, Integer mergeRequestIid, String sourceBranch, String targetBranch, String title, String description,
Integer assigneeId) throws GitLabApiException {
Form formData = new Form();
addFormParam(formData, "source_branch", sourceBranch, false);
addFormParam(formData, "target_branch", targetBranch, false);
addFormParam(formData, "title", title, false);
addFormParam(formData, "description", description, false);
addFormParam(formData, "assignee_id", assigneeId, false);
return updateMergeRequest(projectIdOrPath, mergeRequestIid, formData);
} | java | @Deprecated
public MergeRequest updateMergeRequest(Object projectIdOrPath, Integer mergeRequestIid, String sourceBranch, String targetBranch, String title, String description,
Integer assigneeId) throws GitLabApiException {
Form formData = new Form();
addFormParam(formData, "source_branch", sourceBranch, false);
addFormParam(formData, "target_branch", targetBranch, false);
addFormParam(formData, "title", title, false);
addFormParam(formData, "description", description, false);
addFormParam(formData, "assignee_id", assigneeId, false);
return updateMergeRequest(projectIdOrPath, mergeRequestIid, formData);
} | [
"@",
"Deprecated",
"public",
"MergeRequest",
"updateMergeRequest",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"mergeRequestIid",
",",
"String",
"sourceBranch",
",",
"String",
"targetBranch",
",",
"String",
"title",
",",
"String",
"description",
",",
"Integer",
... | Updates an existing merge request. You can change branches, title, or even close the MR.
<p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p>
<pre><code>GitLab Endpoint: PUT /projects/:id/merge_requests/:merge_request_iid</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param mergeRequestIid the internal ID of the merge request to update
@param sourceBranch the source branch
@param targetBranch the target branch
@param title the title for the merge request
@param description the description of the merge request
@param assigneeId the Assignee user ID, optional
@return the updated merge request
@throws GitLabApiException if any exception occurs
@deprecated as of release 4.4.3 | [
"Updates",
"an",
"existing",
"merge",
"request",
".",
"You",
"can",
"change",
"branches",
"title",
"or",
"even",
"close",
"the",
"MR",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/MergeRequestApi.java#L521-L533 |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.setDefaultContentMimeTypeVnd | public MatcherController setDefaultContentMimeTypeVnd(String name, String type) {
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
this.lastAddTableInfo.setDefaultContentMimeTypeVndInfo(new ContentMimeTypeVndInfo(name, type));
return this;
} | java | public MatcherController setDefaultContentMimeTypeVnd(String name, String type) {
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
this.lastAddTableInfo.setDefaultContentMimeTypeVndInfo(new ContentMimeTypeVndInfo(name, type));
return this;
} | [
"public",
"MatcherController",
"setDefaultContentMimeTypeVnd",
"(",
"String",
"name",
",",
"String",
"type",
")",
"{",
"if",
"(",
"this",
".",
"lastAddTableInfo",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"There is a problem with the orde... | Set the DefaultContentMimeTypeVnd. If you did not use the DefaultContentMimeTypeVnd
annotation, you must call this method.
@see com.tojc.ormlite.android.annotation.AdditionalAnnotation.DefaultContentMimeTypeVnd
@param name
@param type
@return Instance of the MatcherController class. | [
"Set",
"the",
"DefaultContentMimeTypeVnd",
".",
"If",
"you",
"did",
"not",
"use",
"the",
"DefaultContentMimeTypeVnd",
"annotation",
"you",
"must",
"call",
"this",
"method",
"."
] | train | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L160-L166 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/source/util/TreePath.java | TreePath.getPath | public static TreePath getPath(TreePath path, Tree target) {
path.getClass();
target.getClass();
class Result extends Error {
static final long serialVersionUID = -5942088234594905625L;
TreePath path;
Result(TreePath path) {
this.path = path;
}
}
class PathFinder extends TreePathScanner<TreePath,Tree> {
public TreePath scan(Tree tree, Tree target) {
if (tree == target) {
throw new Result(new TreePath(getCurrentPath(), target));
}
return super.scan(tree, target);
}
}
if (path.getLeaf() == target) {
return path;
}
try {
new PathFinder().scan(path, target);
} catch (Result result) {
return result.path;
}
return null;
} | java | public static TreePath getPath(TreePath path, Tree target) {
path.getClass();
target.getClass();
class Result extends Error {
static final long serialVersionUID = -5942088234594905625L;
TreePath path;
Result(TreePath path) {
this.path = path;
}
}
class PathFinder extends TreePathScanner<TreePath,Tree> {
public TreePath scan(Tree tree, Tree target) {
if (tree == target) {
throw new Result(new TreePath(getCurrentPath(), target));
}
return super.scan(tree, target);
}
}
if (path.getLeaf() == target) {
return path;
}
try {
new PathFinder().scan(path, target);
} catch (Result result) {
return result.path;
}
return null;
} | [
"public",
"static",
"TreePath",
"getPath",
"(",
"TreePath",
"path",
",",
"Tree",
"target",
")",
"{",
"path",
".",
"getClass",
"(",
")",
";",
"target",
".",
"getClass",
"(",
")",
";",
"class",
"Result",
"extends",
"Error",
"{",
"static",
"final",
"long",
... | Gets a tree path for a tree node within a subtree identified by a TreePath object.
@return null if the node is not found | [
"Gets",
"a",
"tree",
"path",
"for",
"a",
"tree",
"node",
"within",
"a",
"subtree",
"identified",
"by",
"a",
"TreePath",
"object",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/source/util/TreePath.java#L53-L84 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.createRemoteEnvironment | public static StreamExecutionEnvironment createRemoteEnvironment(
String host, int port, int parallelism, String... jarFiles) {
RemoteStreamEnvironment env = new RemoteStreamEnvironment(host, port, jarFiles);
env.setParallelism(parallelism);
return env;
} | java | public static StreamExecutionEnvironment createRemoteEnvironment(
String host, int port, int parallelism, String... jarFiles) {
RemoteStreamEnvironment env = new RemoteStreamEnvironment(host, port, jarFiles);
env.setParallelism(parallelism);
return env;
} | [
"public",
"static",
"StreamExecutionEnvironment",
"createRemoteEnvironment",
"(",
"String",
"host",
",",
"int",
"port",
",",
"int",
"parallelism",
",",
"String",
"...",
"jarFiles",
")",
"{",
"RemoteStreamEnvironment",
"env",
"=",
"new",
"RemoteStreamEnvironment",
"(",... | Creates a {@link RemoteStreamEnvironment}. The remote environment sends
(parts of) the program to a cluster for execution. Note that all file
paths used in the program must be accessible from the cluster. The
execution will use the specified parallelism.
@param host
The host name or address of the master (JobManager), where the
program should be executed.
@param port
The port of the master (JobManager), where the program should
be executed.
@param parallelism
The parallelism to use during the execution.
@param jarFiles
The JAR files with code that needs to be shipped to the
cluster. If the program uses user-defined functions,
user-defined input formats, or any libraries, those must be
provided in the JAR files.
@return A remote environment that executes the program on a cluster. | [
"Creates",
"a",
"{",
"@link",
"RemoteStreamEnvironment",
"}",
".",
"The",
"remote",
"environment",
"sends",
"(",
"parts",
"of",
")",
"the",
"program",
"to",
"a",
"cluster",
"for",
"execution",
".",
"Note",
"that",
"all",
"file",
"paths",
"used",
"in",
"the... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1708-L1713 |
nabedge/mixer2 | src/main/java/org/mixer2/xhtml/AbstractJaxb.java | AbstractJaxb.getByName | public <T extends AbstractJaxb> T getByName(String name, Class<T> tagType) {
return GetByNameUtil.getByName((T) this, name, tagType);
} | java | public <T extends AbstractJaxb> T getByName(String name, Class<T> tagType) {
return GetByNameUtil.getByName((T) this, name, tagType);
} | [
"public",
"<",
"T",
"extends",
"AbstractJaxb",
">",
"T",
"getByName",
"(",
"String",
"name",
",",
"Class",
"<",
"T",
">",
"tagType",
")",
"{",
"return",
"GetByNameUtil",
".",
"getByName",
"(",
"(",
"T",
")",
"this",
",",
"name",
",",
"tagType",
")",
... | <p>find tag by "name" property. (the first one in this tag)</p>
@param name
@param tagType
@param <T>
@return null if not found. | [
"<p",
">",
"find",
"tag",
"by",
"name",
"property",
".",
"(",
"the",
"first",
"one",
"in",
"this",
"tag",
")",
"<",
"/",
"p",
">"
] | train | https://github.com/nabedge/mixer2/blob/8c2db27cfcd65bf0b1e0242ef9362ebd8033777c/src/main/java/org/mixer2/xhtml/AbstractJaxb.java#L895-L897 |
beangle/beangle3 | ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java | BeanDefinitionParser.checkNameUniqueness | protected void checkNameUniqueness(String beanName, List<String> aliases, Element beanElement) {
String foundName = null;
if (StringUtils.hasText(beanName) && this.usedNames.contains(beanName)) foundName = beanName;
if (foundName == null) foundName = (String) CollectionUtils.findFirstMatch(this.usedNames, aliases);
if (foundName != null) error("Bean name '" + foundName + "' is already used in this file", beanElement);
this.usedNames.add(beanName);
this.usedNames.addAll(aliases);
} | java | protected void checkNameUniqueness(String beanName, List<String> aliases, Element beanElement) {
String foundName = null;
if (StringUtils.hasText(beanName) && this.usedNames.contains(beanName)) foundName = beanName;
if (foundName == null) foundName = (String) CollectionUtils.findFirstMatch(this.usedNames, aliases);
if (foundName != null) error("Bean name '" + foundName + "' is already used in this file", beanElement);
this.usedNames.add(beanName);
this.usedNames.addAll(aliases);
} | [
"protected",
"void",
"checkNameUniqueness",
"(",
"String",
"beanName",
",",
"List",
"<",
"String",
">",
"aliases",
",",
"Element",
"beanElement",
")",
"{",
"String",
"foundName",
"=",
"null",
";",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"beanName",
")... | Validate that the specified bean name and aliases have not been used
already.
@param beanName a {@link java.lang.String} object.
@param aliases a {@link java.util.List} object.
@param beanElement a {@link org.w3c.dom.Element} object. | [
"Validate",
"that",
"the",
"specified",
"bean",
"name",
"and",
"aliases",
"have",
"not",
"been",
"used",
"already",
"."
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java#L179-L190 |
anothem/android-range-seek-bar | rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java | RangeSeekBar.drawThumbShadow | private void drawThumbShadow(float screenCoord, Canvas canvas) {
thumbShadowMatrix.setTranslate(screenCoord + thumbShadowXOffset, textOffset + thumbHalfHeight + thumbShadowYOffset);
translatedThumbShadowPath.set(thumbShadowPath);
translatedThumbShadowPath.transform(thumbShadowMatrix);
canvas.drawPath(translatedThumbShadowPath, shadowPaint);
} | java | private void drawThumbShadow(float screenCoord, Canvas canvas) {
thumbShadowMatrix.setTranslate(screenCoord + thumbShadowXOffset, textOffset + thumbHalfHeight + thumbShadowYOffset);
translatedThumbShadowPath.set(thumbShadowPath);
translatedThumbShadowPath.transform(thumbShadowMatrix);
canvas.drawPath(translatedThumbShadowPath, shadowPaint);
} | [
"private",
"void",
"drawThumbShadow",
"(",
"float",
"screenCoord",
",",
"Canvas",
"canvas",
")",
"{",
"thumbShadowMatrix",
".",
"setTranslate",
"(",
"screenCoord",
"+",
"thumbShadowXOffset",
",",
"textOffset",
"+",
"thumbHalfHeight",
"+",
"thumbShadowYOffset",
")",
... | Draws a drop shadow beneath the slider thumb.
@param screenCoord the x-coordinate of the slider thumb
@param canvas the canvas on which to draw the shadow | [
"Draws",
"a",
"drop",
"shadow",
"beneath",
"the",
"slider",
"thumb",
"."
] | train | https://github.com/anothem/android-range-seek-bar/blob/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java#L754-L759 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java | Validator.expectRange | public void expectRange(String name, int minLength, int maxLength, String message) {
String value = Optional.ofNullable(get(name)).orElse("");
if (StringUtils.isNumeric(value)) {
double doubleValue = Double.parseDouble(value);
if (doubleValue < minLength || doubleValue > maxLength) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.RANGE_KEY.name(), name, minLength, maxLength)));
}
} else {
if (value.length() < minLength || value.length() > maxLength) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.RANGE_KEY.name(), name, minLength, maxLength)));
}
}
} | java | public void expectRange(String name, int minLength, int maxLength, String message) {
String value = Optional.ofNullable(get(name)).orElse("");
if (StringUtils.isNumeric(value)) {
double doubleValue = Double.parseDouble(value);
if (doubleValue < minLength || doubleValue > maxLength) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.RANGE_KEY.name(), name, minLength, maxLength)));
}
} else {
if (value.length() < minLength || value.length() > maxLength) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.RANGE_KEY.name(), name, minLength, maxLength)));
}
}
} | [
"public",
"void",
"expectRange",
"(",
"String",
"name",
",",
"int",
"minLength",
",",
"int",
"maxLength",
",",
"String",
"message",
")",
"{",
"String",
"value",
"=",
"Optional",
".",
"ofNullable",
"(",
"get",
"(",
"name",
")",
")",
".",
"orElse",
"(",
... | Validates a field to be in a certain range
@param name The field to check
@param minLength The minimum length
@param maxLength The maximum length
@param message A custom error message instead of the default one | [
"Validates",
"a",
"field",
"to",
"be",
"in",
"a",
"certain",
"range"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L353-L366 |
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallPlanSummary | public static PlanSummaryBean unmarshallPlanSummary(Map<String, Object> source) {
if (source == null) {
return null;
}
PlanSummaryBean bean = new PlanSummaryBean();
bean.setOrganizationId(asString(source.get("organizationId")));
bean.setOrganizationName(asString(source.get("organizationName")));
bean.setId(asString(source.get("id")));
bean.setName(asString(source.get("name")));
bean.setDescription(asString(source.get("description")));
postMarshall(bean);
return bean;
} | java | public static PlanSummaryBean unmarshallPlanSummary(Map<String, Object> source) {
if (source == null) {
return null;
}
PlanSummaryBean bean = new PlanSummaryBean();
bean.setOrganizationId(asString(source.get("organizationId")));
bean.setOrganizationName(asString(source.get("organizationName")));
bean.setId(asString(source.get("id")));
bean.setName(asString(source.get("name")));
bean.setDescription(asString(source.get("description")));
postMarshall(bean);
return bean;
} | [
"public",
"static",
"PlanSummaryBean",
"unmarshallPlanSummary",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"PlanSummaryBean",
"bean",
"=",
"new",
"PlanSummaryBea... | Unmarshals the given map source into a bean.
@param source the source
@return the plan summary | [
"Unmarshals",
"the",
"given",
"map",
"source",
"into",
"a",
"bean",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L845-L857 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Point.java | Point.setAttribute | public void setAttribute(int semantics, int ordinate, double value) {
_touch();
int ncomps = VertexDescription.getComponentCount(semantics);
if (ncomps < ordinate)
throw new IndexOutOfBoundsException();
int attributeIndex = m_description.getAttributeIndex(semantics);
if (attributeIndex < 0) {
addAttribute(semantics);
attributeIndex = m_description.getAttributeIndex(semantics);
}
if (m_attributes == null)
_setToDefault();
m_attributes[m_description._getPointAttributeOffset(attributeIndex)
+ ordinate] = value;
} | java | public void setAttribute(int semantics, int ordinate, double value) {
_touch();
int ncomps = VertexDescription.getComponentCount(semantics);
if (ncomps < ordinate)
throw new IndexOutOfBoundsException();
int attributeIndex = m_description.getAttributeIndex(semantics);
if (attributeIndex < 0) {
addAttribute(semantics);
attributeIndex = m_description.getAttributeIndex(semantics);
}
if (m_attributes == null)
_setToDefault();
m_attributes[m_description._getPointAttributeOffset(attributeIndex)
+ ordinate] = value;
} | [
"public",
"void",
"setAttribute",
"(",
"int",
"semantics",
",",
"int",
"ordinate",
",",
"double",
"value",
")",
"{",
"_touch",
"(",
")",
";",
"int",
"ncomps",
"=",
"VertexDescription",
".",
"getComponentCount",
"(",
"semantics",
")",
";",
"if",
"(",
"ncomp... | Sets the value of the attribute.
@param semantics
The attribute semantics.
@param ordinate
The ordinate of the attribute.
@param value
Is the array to write values to. The attribute type and the
number of elements must match the persistence type, as well as
the number of components of the attribute. | [
"Sets",
"the",
"value",
"of",
"the",
"attribute",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Point.java#L341-L358 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java | FlowController.addValidationError | protected void addValidationError( String propertyName, String messageKey, Object[] messageArgs )
{
PageFlowUtils.addValidationError( propertyName, messageKey, messageArgs, getRequest() );
} | java | protected void addValidationError( String propertyName, String messageKey, Object[] messageArgs )
{
PageFlowUtils.addValidationError( propertyName, messageKey, messageArgs, getRequest() );
} | [
"protected",
"void",
"addValidationError",
"(",
"String",
"propertyName",
",",
"String",
"messageKey",
",",
"Object",
"[",
"]",
"messageArgs",
")",
"{",
"PageFlowUtils",
".",
"addValidationError",
"(",
"propertyName",
",",
"messageKey",
",",
"messageArgs",
",",
"g... | Add a validation error that will be shown with the Errors and Error tags.
@deprecated Use {@link #addActionError} instead.
@param propertyName the name of the property with which to associate this error.
@param messageKey the message-resources key for the error message.
@param messageArgs an array of arguments for the error message. | [
"Add",
"a",
"validation",
"error",
"that",
"will",
"be",
"shown",
"with",
"the",
"Errors",
"and",
"Error",
"tags",
".",
"@deprecated",
"Use",
"{",
"@link",
"#addActionError",
"}",
"instead",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L1496-L1499 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java | ExpressRouteCrossConnectionPeeringsInner.createOrUpdate | public ExpressRouteCrossConnectionPeeringInner createOrUpdate(String resourceGroupName, String crossConnectionName, String peeringName, ExpressRouteCrossConnectionPeeringInner peeringParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, peeringParameters).toBlocking().last().body();
} | java | public ExpressRouteCrossConnectionPeeringInner createOrUpdate(String resourceGroupName, String crossConnectionName, String peeringName, ExpressRouteCrossConnectionPeeringInner peeringParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, peeringParameters).toBlocking().last().body();
} | [
"public",
"ExpressRouteCrossConnectionPeeringInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"crossConnectionName",
",",
"String",
"peeringName",
",",
"ExpressRouteCrossConnectionPeeringInner",
"peeringParameters",
")",
"{",
"return",
"createOrUpdateW... | Creates or updates a peering in the specified ExpressRouteCrossConnection.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the ExpressRouteCrossConnection.
@param peeringName The name of the peering.
@param peeringParameters Parameters supplied to the create or update ExpressRouteCrossConnection peering 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 ExpressRouteCrossConnectionPeeringInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"peering",
"in",
"the",
"specified",
"ExpressRouteCrossConnection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java#L483-L485 |
OpenFeign/feign | core/src/main/java/feign/template/UriUtils.java | UriUtils.queryEncode | public static String queryEncode(String query, Charset charset) {
return encodeReserved(query, FragmentType.QUERY, charset);
/* spaces will be encoded as 'plus' symbols here, we want them pct-encoded */
// return encoded.replaceAll("\\+", "%20");
} | java | public static String queryEncode(String query, Charset charset) {
return encodeReserved(query, FragmentType.QUERY, charset);
/* spaces will be encoded as 'plus' symbols here, we want them pct-encoded */
// return encoded.replaceAll("\\+", "%20");
} | [
"public",
"static",
"String",
"queryEncode",
"(",
"String",
"query",
",",
"Charset",
"charset",
")",
"{",
"return",
"encodeReserved",
"(",
"query",
",",
"FragmentType",
".",
"QUERY",
",",
"charset",
")",
";",
"/* spaces will be encoded as 'plus' symbols here, we want ... | Uri Encode a Query Fragment.
@param query containing the query fragment
@param charset to use.
@return the encoded query fragment. | [
"Uri",
"Encode",
"a",
"Query",
"Fragment",
"."
] | train | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/core/src/main/java/feign/template/UriUtils.java#L103-L108 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/links/ItemStreamLink.java | ItemStreamLink.addItem | public final void addItem(Item item, long lockID, Transaction transaction) throws OutOfCacheSpace, ProtocolException, StreamIsFull, TransactionException, PersistenceException, SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "addItem", new Object[] { item, Long.valueOf(lockID), transaction});
_items();
// Defect 410652
// Check the transaction being used is from the same MessageStore as
// ours so that we don't get a mismatch and run the possibility of
// hitting a DuplicateKeyException at persistence time. If the MS's
// don't match then the unique key generator being used for this
// add could be using a range that has already been used in the MS
// that will be used to persist the transaction.
final MessageStoreImpl messageStore = getMessageStoreImpl();
final MessageStore tranStore = ((PersistentTransaction)transaction).getOwningMessageStore();
// We only need to do a simple equality check as all that we really
// care about is that the same MS instance in memory is being used.
if (messageStore != tranStore)
{
MismatchedMessageStoreException mmse = new MismatchedMessageStoreException("Transaction supplied on add does not originate from this MessageStore! MS: "+messageStore+", Tran.MS: "+tranStore);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.event(this, tc, "Transaction supplied on add does not originate from this MessageStore! MS: "+messageStore+", Tran.MS: "+tranStore, mmse);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "addItem");
throw mmse;
}
int strategy = item.getStorageStrategy();
final long itemID = messageStore.getUniqueValue(strategy);
TupleTypeEnum type = TupleTypeEnum.ITEM;
Persistable childPersistable = getTuple().createPersistable(itemID, type);
final AbstractItemLink link = new ItemLink(item, this, childPersistable);
// Defect 463642
// Revert to using spill limits previously removed in SIB0112d.ms.2
link.setParentWasSpillingAtAddTime(getListStatistics().isSpilling());
messageStore.registerLink(link, item);
link.cmdAdd(this, lockID, (PersistentTransaction)transaction);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "addItem", new Object[]{"Item: "+item, "Item Link: "+link});
} | java | public final void addItem(Item item, long lockID, Transaction transaction) throws OutOfCacheSpace, ProtocolException, StreamIsFull, TransactionException, PersistenceException, SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "addItem", new Object[] { item, Long.valueOf(lockID), transaction});
_items();
// Defect 410652
// Check the transaction being used is from the same MessageStore as
// ours so that we don't get a mismatch and run the possibility of
// hitting a DuplicateKeyException at persistence time. If the MS's
// don't match then the unique key generator being used for this
// add could be using a range that has already been used in the MS
// that will be used to persist the transaction.
final MessageStoreImpl messageStore = getMessageStoreImpl();
final MessageStore tranStore = ((PersistentTransaction)transaction).getOwningMessageStore();
// We only need to do a simple equality check as all that we really
// care about is that the same MS instance in memory is being used.
if (messageStore != tranStore)
{
MismatchedMessageStoreException mmse = new MismatchedMessageStoreException("Transaction supplied on add does not originate from this MessageStore! MS: "+messageStore+", Tran.MS: "+tranStore);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.event(this, tc, "Transaction supplied on add does not originate from this MessageStore! MS: "+messageStore+", Tran.MS: "+tranStore, mmse);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "addItem");
throw mmse;
}
int strategy = item.getStorageStrategy();
final long itemID = messageStore.getUniqueValue(strategy);
TupleTypeEnum type = TupleTypeEnum.ITEM;
Persistable childPersistable = getTuple().createPersistable(itemID, type);
final AbstractItemLink link = new ItemLink(item, this, childPersistable);
// Defect 463642
// Revert to using spill limits previously removed in SIB0112d.ms.2
link.setParentWasSpillingAtAddTime(getListStatistics().isSpilling());
messageStore.registerLink(link, item);
link.cmdAdd(this, lockID, (PersistentTransaction)transaction);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "addItem", new Object[]{"Item: "+item, "Item Link: "+link});
} | [
"public",
"final",
"void",
"addItem",
"(",
"Item",
"item",
",",
"long",
"lockID",
",",
"Transaction",
"transaction",
")",
"throws",
"OutOfCacheSpace",
",",
"ProtocolException",
",",
"StreamIsFull",
",",
"TransactionException",
",",
"PersistenceException",
",",
"Seve... | @see com.ibm.ws.sib.msgstore.ItemCollection#addItem(com.ibm.ws.sib.msgstore.Item, com.ibm.ws.sib.msgstore.Transaction)
@throws OutOfCacheSpace if there is not enough space in the
unstoredCache and the storage strategy is AbstractItem.STORE_NEVER.
@throws StreamIsFull if the size of the stream would exceed the
maximum permissable size if an add were performed.
@throws SevereMessageStoreException
@throws {@ProtocolException} Thrown if an add is attempted when the
transaction cannot allow any further work to be added i.e. after
completion of the transaction.
@throws {@TransactionException} Thrown if an unexpected error occurs. | [
"@see",
"com",
".",
"ibm",
".",
"ws",
".",
"sib",
".",
"msgstore",
".",
"ItemCollection#addItem",
"(",
"com",
".",
"ibm",
".",
"ws",
".",
"sib",
".",
"msgstore",
".",
"Item",
"com",
".",
"ibm",
".",
"ws",
".",
"sib",
".",
"msgstore",
".",
"Transact... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/links/ItemStreamLink.java#L270-L307 |
Netflix/spectator | spectator-api/src/main/java/com/netflix/spectator/api/patterns/PolledMeter.java | PolledMeter.monitorMeter | @Deprecated
public static void monitorMeter(Registry registry, Meter meter) {
ConcurrentMap<Id, Object> state = registry.state();
Object c = Utils.computeIfAbsent(state, meter.id(), MeterState::new);
if (!(c instanceof MeterState)) {
Utils.propagateTypeError(registry, meter.id(), MeterState.class, c.getClass());
} else {
MeterState t = (MeterState) c;
t.add(meter);
long delay = registry.config().gaugePollingFrequency().toMillis();
t.schedule(registry, null, delay);
}
} | java | @Deprecated
public static void monitorMeter(Registry registry, Meter meter) {
ConcurrentMap<Id, Object> state = registry.state();
Object c = Utils.computeIfAbsent(state, meter.id(), MeterState::new);
if (!(c instanceof MeterState)) {
Utils.propagateTypeError(registry, meter.id(), MeterState.class, c.getClass());
} else {
MeterState t = (MeterState) c;
t.add(meter);
long delay = registry.config().gaugePollingFrequency().toMillis();
t.schedule(registry, null, delay);
}
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"monitorMeter",
"(",
"Registry",
"registry",
",",
"Meter",
"meter",
")",
"{",
"ConcurrentMap",
"<",
"Id",
",",
"Object",
">",
"state",
"=",
"registry",
".",
"state",
"(",
")",
";",
"Object",
"c",
"=",
"Utils... | Provided for backwards compatibility to support the {@link Registry#register(Meter)}
method. Use the builder created with {@link #using(Registry)} instead.
@deprecated This method only exists to allow for backwards compatibility and should
be considered an internal detail. Scheduled to be removed in 2.0. | [
"Provided",
"for",
"backwards",
"compatibility",
"to",
"support",
"the",
"{",
"@link",
"Registry#register",
"(",
"Meter",
")",
"}",
"method",
".",
"Use",
"the",
"builder",
"created",
"with",
"{",
"@link",
"#using",
"(",
"Registry",
")",
"}",
"instead",
"."
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/patterns/PolledMeter.java#L352-L364 |
orhanobut/dialogplus | dialogplus/src/main/java/com/orhanobut/dialogplus/DialogPlusBuilder.java | DialogPlusBuilder.setMargin | public DialogPlusBuilder setMargin(int left, int top, int right, int bottom) {
this.margin[0] = left;
this.margin[1] = top;
this.margin[2] = right;
this.margin[3] = bottom;
return this;
} | java | public DialogPlusBuilder setMargin(int left, int top, int right, int bottom) {
this.margin[0] = left;
this.margin[1] = top;
this.margin[2] = right;
this.margin[3] = bottom;
return this;
} | [
"public",
"DialogPlusBuilder",
"setMargin",
"(",
"int",
"left",
",",
"int",
"top",
",",
"int",
"right",
",",
"int",
"bottom",
")",
"{",
"this",
".",
"margin",
"[",
"0",
"]",
"=",
"left",
";",
"this",
".",
"margin",
"[",
"1",
"]",
"=",
"top",
";",
... | Add margins to your dialog. They are set to 0 except when gravity is center. In that case basic margins
are applied | [
"Add",
"margins",
"to",
"your",
"dialog",
".",
"They",
"are",
"set",
"to",
"0",
"except",
"when",
"gravity",
"is",
"center",
".",
"In",
"that",
"case",
"basic",
"margins",
"are",
"applied"
] | train | https://github.com/orhanobut/dialogplus/blob/291bf4daaa3c81bf5537125f547913beb8ee2c17/dialogplus/src/main/java/com/orhanobut/dialogplus/DialogPlusBuilder.java#L220-L226 |
JodaOrg/joda-time | src/main/java/org/joda/time/DateMidnight.java | DateMidnight.withField | public DateMidnight withField(DateTimeFieldType fieldType, int value) {
if (fieldType == null) {
throw new IllegalArgumentException("Field must not be null");
}
long instant = fieldType.getField(getChronology()).set(getMillis(), value);
return withMillis(instant);
} | java | public DateMidnight withField(DateTimeFieldType fieldType, int value) {
if (fieldType == null) {
throw new IllegalArgumentException("Field must not be null");
}
long instant = fieldType.getField(getChronology()).set(getMillis(), value);
return withMillis(instant);
} | [
"public",
"DateMidnight",
"withField",
"(",
"DateTimeFieldType",
"fieldType",
",",
"int",
"value",
")",
"{",
"if",
"(",
"fieldType",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Field must not be null\"",
")",
";",
"}",
"long",
"in... | Returns a copy of this date with the specified field set to a new value.
<p>
For example, if the field type is <code>dayOfMonth</code> then the day of month
field would be changed in the returned instance.
If the field type is null, then <code>this</code> is returned.
<p>
These three lines are equivalent:
<pre>
DateTime updated = dt.withField(DateTimeFieldType.dayOfMonth(), 6);
DateTime updated = dt.dayOfMonth().setCopy(6);
DateTime updated = dt.property(DateTimeFieldType.dayOfMonth()).setCopy(6);
</pre>
@param fieldType the field type to set, not null
@param value the value to set
@return a copy of this datetime with the field set
@throws IllegalArgumentException if the value is null or invalid | [
"Returns",
"a",
"copy",
"of",
"this",
"date",
"with",
"the",
"specified",
"field",
"set",
"to",
"a",
"new",
"value",
".",
"<p",
">",
"For",
"example",
"if",
"the",
"field",
"type",
"is",
"<code",
">",
"dayOfMonth<",
"/",
"code",
">",
"then",
"the",
"... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateMidnight.java#L464-L470 |
OnyxDevTools/onyx-database-parent | onyx-database-examples/relationships/src/main/java/com/onyxdevtools/relationship/AbstractDemo.java | AbstractDemo.assertNotNull | static void assertNotNull(String message, Object nonNullObject)
{
if(nonNullObject == null)
{
System.err.println(message);
}
} | java | static void assertNotNull(String message, Object nonNullObject)
{
if(nonNullObject == null)
{
System.err.println(message);
}
} | [
"static",
"void",
"assertNotNull",
"(",
"String",
"message",
",",
"Object",
"nonNullObject",
")",
"{",
"if",
"(",
"nonNullObject",
"==",
"null",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"message",
")",
";",
"}",
"}"
] | Helper method to verify an the object is not null.
@param message Message displayed if the object is null
@param nonNullObject Object to assert | [
"Helper",
"method",
"to",
"verify",
"an",
"the",
"object",
"is",
"not",
"null",
"."
] | train | https://github.com/OnyxDevTools/onyx-database-parent/blob/474dfc273a094dbc2ca08fcc08a2858cd538c920/onyx-database-examples/relationships/src/main/java/com/onyxdevtools/relationship/AbstractDemo.java#L12-L18 |
brianwhu/xillium | core/src/main/java/org/xillium/core/util/Scriptable.java | Scriptable.setObjects | public void setObjects(Map<String, Object> objects) {
for (Map.Entry<String, Object> entry: objects.entrySet()) {
js.put(entry.getKey(), entry.getValue());
}
} | java | public void setObjects(Map<String, Object> objects) {
for (Map.Entry<String, Object> entry: objects.entrySet()) {
js.put(entry.getKey(), entry.getValue());
}
} | [
"public",
"void",
"setObjects",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"objects",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
"entry",
":",
"objects",
".",
"entrySet",
"(",
")",
")",
"{",
"js",
".",
"put",
... | Provides objects to the JavaScript engine under various names. | [
"Provides",
"objects",
"to",
"the",
"JavaScript",
"engine",
"under",
"various",
"names",
"."
] | train | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/util/Scriptable.java#L32-L36 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java | ScriptRequestState.writeScriptBlock | public static void writeScriptBlock(ServletRequest req, AbstractRenderAppender results, String script)
{
assert(results != null);
ScriptTag.State state = new ScriptTag.State();
state.suppressComments = false;
ScriptTag br = (ScriptTag) TagRenderingBase.Factory.getRendering(TagRenderingBase.SCRIPT_TAG, req);
results.append("\n");
br.doStartTag(results, state);
results.append(script);
br.doEndTag(results, false);
results.append("\n");
} | java | public static void writeScriptBlock(ServletRequest req, AbstractRenderAppender results, String script)
{
assert(results != null);
ScriptTag.State state = new ScriptTag.State();
state.suppressComments = false;
ScriptTag br = (ScriptTag) TagRenderingBase.Factory.getRendering(TagRenderingBase.SCRIPT_TAG, req);
results.append("\n");
br.doStartTag(results, state);
results.append(script);
br.doEndTag(results, false);
results.append("\n");
} | [
"public",
"static",
"void",
"writeScriptBlock",
"(",
"ServletRequest",
"req",
",",
"AbstractRenderAppender",
"results",
",",
"String",
"script",
")",
"{",
"assert",
"(",
"results",
"!=",
"null",
")",
";",
"ScriptTag",
".",
"State",
"state",
"=",
"new",
"Script... | This is a static method that will write a consistent look/feel to the
tags and comment markup that appears around the JavaScript.
@param results the InternalStringBuilder that will have the <script>
tag written into
@param script the JavaScript block | [
"This",
"is",
"a",
"static",
"method",
"that",
"will",
"write",
"a",
"consistent",
"look",
"/",
"feel",
"to",
"the",
"tags",
"and",
"comment",
"markup",
"that",
"appears",
"around",
"the",
"JavaScript",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java#L248-L260 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/primitives/DoubleUtils.java | DoubleUtils.isCloseToIntegral | public static boolean isCloseToIntegral(final double value, final double tolerance) {
return Math.abs(value - Math.round(value)) <= tolerance;
} | java | public static boolean isCloseToIntegral(final double value, final double tolerance) {
return Math.abs(value - Math.round(value)) <= tolerance;
} | [
"public",
"static",
"boolean",
"isCloseToIntegral",
"(",
"final",
"double",
"value",
",",
"final",
"double",
"tolerance",
")",
"{",
"return",
"Math",
".",
"abs",
"(",
"value",
"-",
"Math",
".",
"round",
"(",
"value",
")",
")",
"<=",
"tolerance",
";",
"}"... | Is {@code value} within {@code tolerance} of being an integer? | [
"Is",
"{"
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/primitives/DoubleUtils.java#L193-L195 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/Compare.java | Compare.movies | public static boolean movies(final MovieInfo moviedb, final String title, final String year, int maxDistance) {
return Compare.movies(moviedb, title, year, maxDistance, true);
} | java | public static boolean movies(final MovieInfo moviedb, final String title, final String year, int maxDistance) {
return Compare.movies(moviedb, title, year, maxDistance, true);
} | [
"public",
"static",
"boolean",
"movies",
"(",
"final",
"MovieInfo",
"moviedb",
",",
"final",
"String",
"title",
",",
"final",
"String",
"year",
",",
"int",
"maxDistance",
")",
"{",
"return",
"Compare",
".",
"movies",
"(",
"moviedb",
",",
"title",
",",
"yea... | Compare the MovieDB object with a title and year, case sensitive
@param moviedb movieinfo
@param title title
@param year year
@param maxDistance maximum distance
@return true if matched | [
"Compare",
"the",
"MovieDB",
"object",
"with",
"a",
"title",
"and",
"year",
"case",
"sensitive"
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/Compare.java#L118-L120 |
alkacon/opencms-core | src/org/opencms/cmis/CmsCmisRepository.java | CmsCmisRepository.getResourceTypeFromProperties | protected String getResourceTypeFromProperties(Map<String, PropertyData<?>> properties, String defaultValue) {
PropertyData<?> typeProp = properties.get(CmsCmisTypeManager.PROPERTY_RESOURCE_TYPE);
String resTypeName = defaultValue;
if (typeProp != null) {
resTypeName = (String)typeProp.getFirstValue();
}
return resTypeName;
} | java | protected String getResourceTypeFromProperties(Map<String, PropertyData<?>> properties, String defaultValue) {
PropertyData<?> typeProp = properties.get(CmsCmisTypeManager.PROPERTY_RESOURCE_TYPE);
String resTypeName = defaultValue;
if (typeProp != null) {
resTypeName = (String)typeProp.getFirstValue();
}
return resTypeName;
} | [
"protected",
"String",
"getResourceTypeFromProperties",
"(",
"Map",
"<",
"String",
",",
"PropertyData",
"<",
"?",
">",
">",
"properties",
",",
"String",
"defaultValue",
")",
"{",
"PropertyData",
"<",
"?",
">",
"typeProp",
"=",
"properties",
".",
"get",
"(",
... | Extracts the resource type from a set of CMIS properties.<p>
@param properties the CMIS properties
@param defaultValue the default value
@return the resource type property, or the default value if the property was not found | [
"Extracts",
"the",
"resource",
"type",
"from",
"a",
"set",
"of",
"CMIS",
"properties",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisRepository.java#L1519-L1527 |
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/FleetsApi.java | FleetsApi.postFleetsFleetIdMembers | public void postFleetsFleetIdMembers(Long fleetId, String datasource, String token, FleetInvitation fleetInvitation)
throws ApiException {
postFleetsFleetIdMembersWithHttpInfo(fleetId, datasource, token, fleetInvitation);
} | java | public void postFleetsFleetIdMembers(Long fleetId, String datasource, String token, FleetInvitation fleetInvitation)
throws ApiException {
postFleetsFleetIdMembersWithHttpInfo(fleetId, datasource, token, fleetInvitation);
} | [
"public",
"void",
"postFleetsFleetIdMembers",
"(",
"Long",
"fleetId",
",",
"String",
"datasource",
",",
"String",
"token",
",",
"FleetInvitation",
"fleetInvitation",
")",
"throws",
"ApiException",
"{",
"postFleetsFleetIdMembersWithHttpInfo",
"(",
"fleetId",
",",
"dataso... | Create fleet invitation Invite a character into the fleet. If a character
has a CSPA charge set it is not possible to invite them to the fleet
using ESI --- SSO Scope: esi-fleets.write_fleet.v1
@param fleetId
ID for a fleet (required)
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param token
Access token to use if unable to set a header (optional)
@param fleetInvitation
(optional)
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body | [
"Create",
"fleet",
"invitation",
"Invite",
"a",
"character",
"into",
"the",
"fleet",
".",
"If",
"a",
"character",
"has",
"a",
"CSPA",
"charge",
"set",
"it",
"is",
"not",
"possible",
"to",
"invite",
"them",
"to",
"the",
"fleet",
"using",
"ESI",
"---",
"SS... | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/FleetsApi.java#L1334-L1337 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java | GBSNode.findIndex | private void findIndex(
int lower,
int upper,
Object new1,
NodeInsertPoint point)
{
int nkeys = numKeys(lower, upper);
if (nkeys < 4)
sequentialFindIndex(lower, upper, new1, point);
else
binaryFindIndex(lower, upper, new1, point);
} | java | private void findIndex(
int lower,
int upper,
Object new1,
NodeInsertPoint point)
{
int nkeys = numKeys(lower, upper);
if (nkeys < 4)
sequentialFindIndex(lower, upper, new1, point);
else
binaryFindIndex(lower, upper, new1, point);
} | [
"private",
"void",
"findIndex",
"(",
"int",
"lower",
",",
"int",
"upper",
",",
"Object",
"new1",
",",
"NodeInsertPoint",
"point",
")",
"{",
"int",
"nkeys",
"=",
"numKeys",
"(",
"lower",
",",
"upper",
")",
";",
"if",
"(",
"nkeys",
"<",
"4",
")",
"sequ... | Find the insert point for a new key.
<p>Find the insert point for a new key. This method finds the point
AFTER which the new key should be inserted. The key does not
need to be bounded by the node value and duplicates are allowed.
If the new key is less than the lowest value already in the node,
-1 is returned as the insert point.</p>
<p>If the node is full, the PRE-insert point returned may be the
right-most slot in the node. In that case, the new key REPLACES
the maximum value in the node.</p>
@param lower Lower bound for search
@param upper Upper bound for search
@param new1 New Object to be inserted
@param point Found insertion point | [
"Find",
"the",
"insert",
"point",
"for",
"a",
"new",
"key",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSNode.java#L681-L692 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/util/WikipediaXMLWriter.java | WikipediaXMLWriter.writeDiff | public void writeDiff(final Task<Diff> diff, final int start)
throws IOException
{
int size = diff.size();
Diff d;
String previousRevision = null, currentRevision = null;
this.writer
.write(WikipediaXMLKeys.KEY_START_PAGE.getKeyword() + "\r\n");
ArticleInformation header = diff.getHeader();
this.writer.write("\t" + WikipediaXMLKeys.KEY_START_TITLE.getKeyword());
this.writer.write(header.getArticleName());
this.writer.write(WikipediaXMLKeys.KEY_END_TITLE.getKeyword() + "\r\n");
this.writer.write("\t" + WikipediaXMLKeys.KEY_START_ID.getKeyword());
this.writer.write(Integer.toString(header.getArticleId()));
this.writer.write(WikipediaXMLKeys.KEY_END_ID.getKeyword() + "\r\n");
this.writer.write("\t<partCounter>");
this.writer.write(Integer.toString(diff.getPartCounter()));
this.writer.write("</partCounter>\r\n");
for (int i = start; i < size; i++) {
d = diff.get(i);
currentRevision = d.buildRevision(previousRevision);
this.writer
.write("\t"
+ WikipediaXMLKeys.KEY_START_REVISION.getKeyword()
+ "\r\n");
this.writer.write("\t\t"
+ WikipediaXMLKeys.KEY_START_ID.getKeyword());
this.writer.write(Integer.toString(d.getRevisionID()));
this.writer
.write(WikipediaXMLKeys.KEY_END_ID.getKeyword() + "\r\n");
this.writer.write("\t\t<revCount>");
this.writer.write(Integer.toString(d.getRevisionCounter()));
this.writer.write("</revCount>\r\n");
this.writer.write("\t\t"
+ WikipediaXMLKeys.KEY_START_TIMESTAMP.getKeyword());
this.writer.write(d.getTimeStamp().toString());
this.writer.write(WikipediaXMLKeys.KEY_END_TIMESTAMP.getKeyword()
+ "\r\n");
this.writer.write("\t\t"
+ WikipediaXMLKeys.KEY_START_TEXT.getKeyword());
if (currentRevision != null) {
this.writer.write(currentRevision);
previousRevision = currentRevision;
}
this.writer.write(WikipediaXMLKeys.KEY_END_TEXT.getKeyword()
+ "\r\n");
this.writer.write("\t"
+ WikipediaXMLKeys.KEY_END_REVISION.getKeyword() + "\r\n");
}
this.writer.write(WikipediaXMLKeys.KEY_END_PAGE.getKeyword() + "\r\n");
this.writer.flush();
} | java | public void writeDiff(final Task<Diff> diff, final int start)
throws IOException
{
int size = diff.size();
Diff d;
String previousRevision = null, currentRevision = null;
this.writer
.write(WikipediaXMLKeys.KEY_START_PAGE.getKeyword() + "\r\n");
ArticleInformation header = diff.getHeader();
this.writer.write("\t" + WikipediaXMLKeys.KEY_START_TITLE.getKeyword());
this.writer.write(header.getArticleName());
this.writer.write(WikipediaXMLKeys.KEY_END_TITLE.getKeyword() + "\r\n");
this.writer.write("\t" + WikipediaXMLKeys.KEY_START_ID.getKeyword());
this.writer.write(Integer.toString(header.getArticleId()));
this.writer.write(WikipediaXMLKeys.KEY_END_ID.getKeyword() + "\r\n");
this.writer.write("\t<partCounter>");
this.writer.write(Integer.toString(diff.getPartCounter()));
this.writer.write("</partCounter>\r\n");
for (int i = start; i < size; i++) {
d = diff.get(i);
currentRevision = d.buildRevision(previousRevision);
this.writer
.write("\t"
+ WikipediaXMLKeys.KEY_START_REVISION.getKeyword()
+ "\r\n");
this.writer.write("\t\t"
+ WikipediaXMLKeys.KEY_START_ID.getKeyword());
this.writer.write(Integer.toString(d.getRevisionID()));
this.writer
.write(WikipediaXMLKeys.KEY_END_ID.getKeyword() + "\r\n");
this.writer.write("\t\t<revCount>");
this.writer.write(Integer.toString(d.getRevisionCounter()));
this.writer.write("</revCount>\r\n");
this.writer.write("\t\t"
+ WikipediaXMLKeys.KEY_START_TIMESTAMP.getKeyword());
this.writer.write(d.getTimeStamp().toString());
this.writer.write(WikipediaXMLKeys.KEY_END_TIMESTAMP.getKeyword()
+ "\r\n");
this.writer.write("\t\t"
+ WikipediaXMLKeys.KEY_START_TEXT.getKeyword());
if (currentRevision != null) {
this.writer.write(currentRevision);
previousRevision = currentRevision;
}
this.writer.write(WikipediaXMLKeys.KEY_END_TEXT.getKeyword()
+ "\r\n");
this.writer.write("\t"
+ WikipediaXMLKeys.KEY_END_REVISION.getKeyword() + "\r\n");
}
this.writer.write(WikipediaXMLKeys.KEY_END_PAGE.getKeyword() + "\r\n");
this.writer.flush();
} | [
"public",
"void",
"writeDiff",
"(",
"final",
"Task",
"<",
"Diff",
">",
"diff",
",",
"final",
"int",
"start",
")",
"throws",
"IOException",
"{",
"int",
"size",
"=",
"diff",
".",
"size",
"(",
")",
";",
"Diff",
"d",
";",
"String",
"previousRevision",
"=",... | Writes a part of the diff task, starting with the given element, to the
output using wikipedia xml notation.
@param diff
Reference to a diff task
@param start
Position of the start element
@throws IOException
if an error occurs while writing the output | [
"Writes",
"a",
"part",
"of",
"the",
"diff",
"task",
"starting",
"with",
"the",
"given",
"element",
"to",
"the",
"output",
"using",
"wikipedia",
"xml",
"notation",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/util/WikipediaXMLWriter.java#L89-L155 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java | LabAccountsInner.createOrUpdate | public LabAccountInner createOrUpdate(String resourceGroupName, String labAccountName, LabAccountInner labAccount) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labAccount).toBlocking().single().body();
} | java | public LabAccountInner createOrUpdate(String resourceGroupName, String labAccountName, LabAccountInner labAccount) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labAccount).toBlocking().single().body();
} | [
"public",
"LabAccountInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"LabAccountInner",
"labAccount",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"labAccountName",
",",
"lab... | Create or replace an existing Lab Account.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labAccount Represents a lab account.
@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 LabAccountInner object if successful. | [
"Create",
"or",
"replace",
"an",
"existing",
"Lab",
"Account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java#L776-L778 |
janus-project/guava.janusproject.io | guava/src/com/google/common/collect/Iterators.java | Iterators.retainAll | public static boolean retainAll(
Iterator<?> removeFrom, Collection<?> elementsToRetain) {
return removeIf(removeFrom, not(in(elementsToRetain)));
} | java | public static boolean retainAll(
Iterator<?> removeFrom, Collection<?> elementsToRetain) {
return removeIf(removeFrom, not(in(elementsToRetain)));
} | [
"public",
"static",
"boolean",
"retainAll",
"(",
"Iterator",
"<",
"?",
">",
"removeFrom",
",",
"Collection",
"<",
"?",
">",
"elementsToRetain",
")",
"{",
"return",
"removeIf",
"(",
"removeFrom",
",",
"not",
"(",
"in",
"(",
"elementsToRetain",
")",
")",
")"... | Traverses an iterator and removes every element that does not belong to the
provided collection. The iterator will be left exhausted: its
{@code hasNext()} method will return {@code false}.
@param removeFrom the iterator to (potentially) remove elements from
@param elementsToRetain the elements to retain
@return {@code true} if any element was removed from {@code iterator} | [
"Traverses",
"an",
"iterator",
"and",
"removes",
"every",
"element",
"that",
"does",
"not",
"belong",
"to",
"the",
"provided",
"collection",
".",
"The",
"iterator",
"will",
"be",
"left",
"exhausted",
":",
"its",
"{",
"@code",
"hasNext",
"()",
"}",
"method",
... | train | https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/collect/Iterators.java#L252-L255 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/operations/NestedMappingHandler.java | NestedMappingHandler.loadNestedMappingInformation | public static NestedMappingInfo loadNestedMappingInformation(XML xml, Class<?> targetClass,String nestedMappingPath, Class<?> sourceClass, Class<?> destinationClass, Field configuredField){
boolean isSourceClass = targetClass == sourceClass;
NestedMappingInfo info = new NestedMappingInfo(isSourceClass);
info.setConfiguredClass(isSourceClass?destinationClass:sourceClass);
info.setConfiguredField(configuredField);
try{
Class<?> nestedClass = targetClass;
String[] nestedFields = nestedFields(nestedMappingPath);
Field field = null;
for(int i = 0; i< nestedFields.length;i++){
String nestedFieldName = nestedFields[i];
boolean elvisOperatorDefined = false;
// the safe navigation operator is not valid for the last field
if(i < nestedFields.length - 1){
String nextNestedFieldName = nestedFields[i+1];
elvisOperatorDefined = safeNavigationOperatorDefined(nextNestedFieldName);
}
// name filtering
nestedFieldName = safeNavigationOperatorFilter(nestedFieldName);
field = retrieveField(nestedClass, nestedFieldName);
if(isNull(field))
Error.inexistentField(nestedFieldName, nestedClass.getSimpleName());
// verifies if is exists a get method for this nested field
// in case of nested mapping relative to source, only get methods will be checked
// in case of nested mapping relative to destination, get and set methods will be checked
MappedField nestedField = isSourceClass ? checkGetAccessor(xml, nestedClass, field)
//TODO Nested Mapping -> in caso di avoidSet qui potremmo avere un problema
: checkAccessors(xml, nestedClass, field);
// storage information relating to the piece of path
info.addNestedField(new NestedMappedField(nestedField, nestedClass, elvisOperatorDefined));
nestedClass = field.getType();
}
}catch(MappingException e){
InvalidNestedMappingException exception = new InvalidNestedMappingException(nestedMappingPath);
exception.getMessages().put(InvalidNestedMappingException.FIELD, e.getMessage());
throw exception;
}
return info;
} | java | public static NestedMappingInfo loadNestedMappingInformation(XML xml, Class<?> targetClass,String nestedMappingPath, Class<?> sourceClass, Class<?> destinationClass, Field configuredField){
boolean isSourceClass = targetClass == sourceClass;
NestedMappingInfo info = new NestedMappingInfo(isSourceClass);
info.setConfiguredClass(isSourceClass?destinationClass:sourceClass);
info.setConfiguredField(configuredField);
try{
Class<?> nestedClass = targetClass;
String[] nestedFields = nestedFields(nestedMappingPath);
Field field = null;
for(int i = 0; i< nestedFields.length;i++){
String nestedFieldName = nestedFields[i];
boolean elvisOperatorDefined = false;
// the safe navigation operator is not valid for the last field
if(i < nestedFields.length - 1){
String nextNestedFieldName = nestedFields[i+1];
elvisOperatorDefined = safeNavigationOperatorDefined(nextNestedFieldName);
}
// name filtering
nestedFieldName = safeNavigationOperatorFilter(nestedFieldName);
field = retrieveField(nestedClass, nestedFieldName);
if(isNull(field))
Error.inexistentField(nestedFieldName, nestedClass.getSimpleName());
// verifies if is exists a get method for this nested field
// in case of nested mapping relative to source, only get methods will be checked
// in case of nested mapping relative to destination, get and set methods will be checked
MappedField nestedField = isSourceClass ? checkGetAccessor(xml, nestedClass, field)
//TODO Nested Mapping -> in caso di avoidSet qui potremmo avere un problema
: checkAccessors(xml, nestedClass, field);
// storage information relating to the piece of path
info.addNestedField(new NestedMappedField(nestedField, nestedClass, elvisOperatorDefined));
nestedClass = field.getType();
}
}catch(MappingException e){
InvalidNestedMappingException exception = new InvalidNestedMappingException(nestedMappingPath);
exception.getMessages().put(InvalidNestedMappingException.FIELD, e.getMessage());
throw exception;
}
return info;
} | [
"public",
"static",
"NestedMappingInfo",
"loadNestedMappingInformation",
"(",
"XML",
"xml",
",",
"Class",
"<",
"?",
">",
"targetClass",
",",
"String",
"nestedMappingPath",
",",
"Class",
"<",
"?",
">",
"sourceClass",
",",
"Class",
"<",
"?",
">",
"destinationClass... | This method returns a bean with nested mapping information.
@param xml xml configuration
@param targetClass class to check
@param nestedMappingPath path that define nested mapping
@param sourceClass sourceClass used to indentify nested mapping
@param destinationClass destinationClass used to indentify nested mapping
@param configuredField used only for the explanation of the errors
@return NestedMappingInfo | [
"This",
"method",
"returns",
"a",
"bean",
"with",
"nested",
"mapping",
"information",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/NestedMappingHandler.java#L128-L183 |
EMCECS/nfs-client-java | src/main/java/com/emc/ecs/nfsclient/portmap/Portmapper.java | Portmapper.queryPortFromPortMap | public static int queryPortFromPortMap(int program, int version, String serverIP) throws IOException {
GetPortResponse response = null;
GetPortRequest request = new GetPortRequest(program, version);
for (int i = 0; i < _maxRetry; ++i) {
try {
Xdr portmapXdr = new Xdr(PORTMAP_MAX_REQUEST_SIZE);
request.marshalling(portmapXdr);
Xdr reply = NetMgr.getInstance().sendAndWait(serverIP, PMAP_PORT, _usePrivilegedPort, portmapXdr,
PORTMAP_RPC_TIMEOUT);
response = new GetPortResponse();
response.unmarshalling(reply);
} catch (RpcException e) {
handleRpcException(e, i, serverIP);
}
}
int port = response.getPort();
if (port == 0) { // A port value of zeros means the program has not been
// registered.
String msg = String.format("No registry entry for program: %s, version: %s, serverIP: %s", program, version,
serverIP);
throw new IOException(msg);
}
return port;
} | java | public static int queryPortFromPortMap(int program, int version, String serverIP) throws IOException {
GetPortResponse response = null;
GetPortRequest request = new GetPortRequest(program, version);
for (int i = 0; i < _maxRetry; ++i) {
try {
Xdr portmapXdr = new Xdr(PORTMAP_MAX_REQUEST_SIZE);
request.marshalling(portmapXdr);
Xdr reply = NetMgr.getInstance().sendAndWait(serverIP, PMAP_PORT, _usePrivilegedPort, portmapXdr,
PORTMAP_RPC_TIMEOUT);
response = new GetPortResponse();
response.unmarshalling(reply);
} catch (RpcException e) {
handleRpcException(e, i, serverIP);
}
}
int port = response.getPort();
if (port == 0) { // A port value of zeros means the program has not been
// registered.
String msg = String.format("No registry entry for program: %s, version: %s, serverIP: %s", program, version,
serverIP);
throw new IOException(msg);
}
return port;
} | [
"public",
"static",
"int",
"queryPortFromPortMap",
"(",
"int",
"program",
",",
"int",
"version",
",",
"String",
"serverIP",
")",
"throws",
"IOException",
"{",
"GetPortResponse",
"response",
"=",
"null",
";",
"GetPortRequest",
"request",
"=",
"new",
"GetPortRequest... | Given program and version of a service, query its tcp port number
@param program
The program number, used to identify it for RPC calls.
@param version
The program version number, used to identify it for RPC calls.
@param serverIP
The server IP address.
@return The port number for the program. | [
"Given",
"program",
"and",
"version",
"of",
"a",
"service",
"query",
"its",
"tcp",
"port",
"number"
] | train | https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/portmap/Portmapper.java#L76-L102 |
weld/core | impl/src/main/java/org/jboss/weld/resolution/CovariantTypes.java | CovariantTypes.isAssignableFrom | private static boolean isAssignableFrom(WildcardType type1, Type type2) {
if (!isAssignableFrom(type1.getUpperBounds()[0], type2)) {
return false;
}
if (type1.getLowerBounds().length > 0 && !isAssignableFrom(type2, type1.getLowerBounds()[0])) {
return false;
}
return true;
} | java | private static boolean isAssignableFrom(WildcardType type1, Type type2) {
if (!isAssignableFrom(type1.getUpperBounds()[0], type2)) {
return false;
}
if (type1.getLowerBounds().length > 0 && !isAssignableFrom(type2, type1.getLowerBounds()[0])) {
return false;
}
return true;
} | [
"private",
"static",
"boolean",
"isAssignableFrom",
"(",
"WildcardType",
"type1",
",",
"Type",
"type2",
")",
"{",
"if",
"(",
"!",
"isAssignableFrom",
"(",
"type1",
".",
"getUpperBounds",
"(",
")",
"[",
"0",
"]",
",",
"type2",
")",
")",
"{",
"return",
"fa... | This logic is shared for all actual types i.e. raw types, parameterized types and generic array types. | [
"This",
"logic",
"is",
"shared",
"for",
"all",
"actual",
"types",
"i",
".",
"e",
".",
"raw",
"types",
"parameterized",
"types",
"and",
"generic",
"array",
"types",
"."
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/resolution/CovariantTypes.java#L295-L303 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/Container.java | Container.rangeOfOnes | public static Container rangeOfOnes(final int start, final int last) {
final int arrayContainerOverRunThreshold = 2;
final int cardinality = last - start;
if (cardinality <= arrayContainerOverRunThreshold) {
return new ArrayContainer(start, last);
}
return new RunContainer(start, last);
} | java | public static Container rangeOfOnes(final int start, final int last) {
final int arrayContainerOverRunThreshold = 2;
final int cardinality = last - start;
if (cardinality <= arrayContainerOverRunThreshold) {
return new ArrayContainer(start, last);
}
return new RunContainer(start, last);
} | [
"public",
"static",
"Container",
"rangeOfOnes",
"(",
"final",
"int",
"start",
",",
"final",
"int",
"last",
")",
"{",
"final",
"int",
"arrayContainerOverRunThreshold",
"=",
"2",
";",
"final",
"int",
"cardinality",
"=",
"last",
"-",
"start",
";",
"if",
"(",
... | Create a container initialized with a range of consecutive values
@param start first index
@param last last index (range is exclusive)
@return a new container initialized with the specified values | [
"Create",
"a",
"container",
"initialized",
"with",
"a",
"range",
"of",
"consecutive",
"values"
] | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/Container.java#L29-L37 |
YahooArchive/samoa | samoa-samza/src/main/java/com/yahoo/labs/samoa/topology/impl/SamzaStream.java | SamzaStream.addDestination | public SamzaSystemStream addDestination(StreamDestination destination) {
PartitioningScheme scheme = destination.getPartitioningScheme();
int parallelism = destination.getParallelism();
SamzaSystemStream resultStream = null;
for (int i=0; i<systemStreams.size(); i++) {
// There is an existing SystemStream that matches the settings.
// Do not create a new one
if (systemStreams.get(i).isSame(scheme, parallelism)) {
resultStream = systemStreams.get(i);
}
}
// No existing SystemStream match the requirement
// Create a new one
if (resultStream == null) {
String topicName = this.getStreamId() + "-" + Integer.toString(systemStreams.size());
resultStream = new SamzaSystemStream(this.systemName,topicName,scheme,parallelism);
systemStreams.add(resultStream);
}
return resultStream;
} | java | public SamzaSystemStream addDestination(StreamDestination destination) {
PartitioningScheme scheme = destination.getPartitioningScheme();
int parallelism = destination.getParallelism();
SamzaSystemStream resultStream = null;
for (int i=0; i<systemStreams.size(); i++) {
// There is an existing SystemStream that matches the settings.
// Do not create a new one
if (systemStreams.get(i).isSame(scheme, parallelism)) {
resultStream = systemStreams.get(i);
}
}
// No existing SystemStream match the requirement
// Create a new one
if (resultStream == null) {
String topicName = this.getStreamId() + "-" + Integer.toString(systemStreams.size());
resultStream = new SamzaSystemStream(this.systemName,topicName,scheme,parallelism);
systemStreams.add(resultStream);
}
return resultStream;
} | [
"public",
"SamzaSystemStream",
"addDestination",
"(",
"StreamDestination",
"destination",
")",
"{",
"PartitioningScheme",
"scheme",
"=",
"destination",
".",
"getPartitioningScheme",
"(",
")",
";",
"int",
"parallelism",
"=",
"destination",
".",
"getParallelism",
"(",
"... | /*
Add the PI to the list of destinations.
Return the name of the corresponding SystemStream. | [
"/",
"*",
"Add",
"the",
"PI",
"to",
"the",
"list",
"of",
"destinations",
".",
"Return",
"the",
"name",
"of",
"the",
"corresponding",
"SystemStream",
"."
] | train | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-samza/src/main/java/com/yahoo/labs/samoa/topology/impl/SamzaStream.java#L87-L109 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java | PosixHelp.setGroup | public static final void setGroup(String name, Path... files) throws IOException
{
if (supports("posix"))
{
for (Path file : files)
{
FileSystem fs = file.getFileSystem();
UserPrincipalLookupService upls = fs.getUserPrincipalLookupService();
GroupPrincipal group = upls.lookupPrincipalByGroupName(name);
PosixFileAttributeView view = Files.getFileAttributeView(file, PosixFileAttributeView.class);
view.setGroup(group);
}
}
else
{
JavaLogging.getLogger(PosixHelp.class).warning("no posix support. setGroup(%s)", name);
}
} | java | public static final void setGroup(String name, Path... files) throws IOException
{
if (supports("posix"))
{
for (Path file : files)
{
FileSystem fs = file.getFileSystem();
UserPrincipalLookupService upls = fs.getUserPrincipalLookupService();
GroupPrincipal group = upls.lookupPrincipalByGroupName(name);
PosixFileAttributeView view = Files.getFileAttributeView(file, PosixFileAttributeView.class);
view.setGroup(group);
}
}
else
{
JavaLogging.getLogger(PosixHelp.class).warning("no posix support. setGroup(%s)", name);
}
} | [
"public",
"static",
"final",
"void",
"setGroup",
"(",
"String",
"name",
",",
"Path",
"...",
"files",
")",
"throws",
"IOException",
"{",
"if",
"(",
"supports",
"(",
"\"posix\"",
")",
")",
"{",
"for",
"(",
"Path",
"file",
":",
"files",
")",
"{",
"FileSys... | Change group of given files. Works only in linux
@param name
@param files
@throws IOException
@see org.vesalainen.util.OSProcess#call(java.lang.String...) | [
"Change",
"group",
"of",
"given",
"files",
".",
"Works",
"only",
"in",
"linux"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L175-L192 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_sf_storagecentervpx_image.java | xen_sf_storagecentervpx_image.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
xen_sf_storagecentervpx_image_responses result = (xen_sf_storagecentervpx_image_responses) service.get_payload_formatter().string_to_resource(xen_sf_storagecentervpx_image_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_sf_storagecentervpx_image_response_array);
}
xen_sf_storagecentervpx_image[] result_xen_sf_storagecentervpx_image = new xen_sf_storagecentervpx_image[result.xen_sf_storagecentervpx_image_response_array.length];
for(int i = 0; i < result.xen_sf_storagecentervpx_image_response_array.length; i++)
{
result_xen_sf_storagecentervpx_image[i] = result.xen_sf_storagecentervpx_image_response_array[i].xen_sf_storagecentervpx_image[0];
}
return result_xen_sf_storagecentervpx_image;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
xen_sf_storagecentervpx_image_responses result = (xen_sf_storagecentervpx_image_responses) service.get_payload_formatter().string_to_resource(xen_sf_storagecentervpx_image_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_sf_storagecentervpx_image_response_array);
}
xen_sf_storagecentervpx_image[] result_xen_sf_storagecentervpx_image = new xen_sf_storagecentervpx_image[result.xen_sf_storagecentervpx_image_response_array.length];
for(int i = 0; i < result.xen_sf_storagecentervpx_image_response_array.length; i++)
{
result_xen_sf_storagecentervpx_image[i] = result.xen_sf_storagecentervpx_image_response_array[i].xen_sf_storagecentervpx_image[0];
}
return result_xen_sf_storagecentervpx_image;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"xen_sf_storagecentervpx_image_responses",
"result",
"=",
"(",
"xen_sf_storagecentervpx_image_responses",
")",
"se... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_sf_storagecentervpx_image.java#L264-L281 |
actframework/actframework | src/main/java/act/conf/Config.java | Config.get | public <T> T get(ConfigKey key, T def) {
Object o = data.get(key);
if (null == o) {
o = key.val(raw);
if (null == o) {
o = null == def ? NULL : def;
}
data.put(key, o);
}
if (isDebugEnabled()) {
debug("config[%s] loaded: %s", key, o);
}
if (o == NULL) {
return null;
} else {
return (T) o;
}
} | java | public <T> T get(ConfigKey key, T def) {
Object o = data.get(key);
if (null == o) {
o = key.val(raw);
if (null == o) {
o = null == def ? NULL : def;
}
data.put(key, o);
}
if (isDebugEnabled()) {
debug("config[%s] loaded: %s", key, o);
}
if (o == NULL) {
return null;
} else {
return (T) o;
}
} | [
"public",
"<",
"T",
">",
"T",
"get",
"(",
"ConfigKey",
"key",
",",
"T",
"def",
")",
"{",
"Object",
"o",
"=",
"data",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"null",
"==",
"o",
")",
"{",
"o",
"=",
"key",
".",
"val",
"(",
"raw",
")",
"... | Return configuration by {@link AppConfigKey configuration key}
@param key
@param <T>
@return the configured item | [
"Return",
"configuration",
"by",
"{",
"@link",
"AppConfigKey",
"configuration",
"key",
"}"
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/conf/Config.java#L72-L89 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.resourcedefinition.jms.2.0/src/com/ibm/ws/jca/processor/jms/service/JMSConnectionFactoryResourceBuilder.java | JMSConnectionFactoryResourceBuilder.getConnectionFactoryID | private static final String getConnectionFactoryID(String application, String module, String component, String jndiName) {
StringBuilder sb = new StringBuilder(jndiName.length() + 80);
if (application != null) {
sb.append(AppDefinedResource.APPLICATION).append('[').append(application).append(']').append('/');
if (module != null) {
sb.append(AppDefinedResource.MODULE).append('[').append(module).append(']').append('/');
if (component != null)
sb.append(AppDefinedResource.COMPONENT).append('[').append(component).append(']').append('/');
}
}
return sb.append(ConnectionFactoryService.CONNECTION_FACTORY).append('[').append(jndiName).append(']').toString();
} | java | private static final String getConnectionFactoryID(String application, String module, String component, String jndiName) {
StringBuilder sb = new StringBuilder(jndiName.length() + 80);
if (application != null) {
sb.append(AppDefinedResource.APPLICATION).append('[').append(application).append(']').append('/');
if (module != null) {
sb.append(AppDefinedResource.MODULE).append('[').append(module).append(']').append('/');
if (component != null)
sb.append(AppDefinedResource.COMPONENT).append('[').append(component).append(']').append('/');
}
}
return sb.append(ConnectionFactoryService.CONNECTION_FACTORY).append('[').append(jndiName).append(']').toString();
} | [
"private",
"static",
"final",
"String",
"getConnectionFactoryID",
"(",
"String",
"application",
",",
"String",
"module",
",",
"String",
"component",
",",
"String",
"jndiName",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"jndiName",
".",
"l... | Utility method that creates a unique identifier for an application defined data source.
For example,
application[MyApp]/module[MyModule]/connectionFactory[java:module/env/jdbc/cf1]
@param application application name if data source is in java:app, java:module, or java:comp. Otherwise null.
@param module module name if data source is in java:module or java:comp. Otherwise null.
@param component component name if data source is in java:comp and isn't in web container. Otherwise null.
@param jndiName configured JNDI name for the data source. For example, java:module/env/jca/cf1
@return the unique identifier | [
"Utility",
"method",
"that",
"creates",
"a",
"unique",
"identifier",
"for",
"an",
"application",
"defined",
"data",
"source",
".",
"For",
"example",
"application",
"[",
"MyApp",
"]",
"/",
"module",
"[",
"MyModule",
"]",
"/",
"connectionFactory",
"[",
"java",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.resourcedefinition.jms.2.0/src/com/ibm/ws/jca/processor/jms/service/JMSConnectionFactoryResourceBuilder.java#L382-L393 |
google/j2objc | translator/src/main/java/com/google/devtools/j2objc/gen/GenerationUnit.java | GenerationUnit.addPackageJavadoc | private void addPackageJavadoc(CompilationUnit unit, String qualifiedMainType) {
Javadoc javadoc = unit.getPackage().getJavadoc();
if (javadoc == null) {
return;
}
SourceBuilder builder = new SourceBuilder(false);
JavadocGenerator.printDocComment(builder, javadoc);
javadocBlocks.put(qualifiedMainType, builder.toString());
} | java | private void addPackageJavadoc(CompilationUnit unit, String qualifiedMainType) {
Javadoc javadoc = unit.getPackage().getJavadoc();
if (javadoc == null) {
return;
}
SourceBuilder builder = new SourceBuilder(false);
JavadocGenerator.printDocComment(builder, javadoc);
javadocBlocks.put(qualifiedMainType, builder.toString());
} | [
"private",
"void",
"addPackageJavadoc",
"(",
"CompilationUnit",
"unit",
",",
"String",
"qualifiedMainType",
")",
"{",
"Javadoc",
"javadoc",
"=",
"unit",
".",
"getPackage",
"(",
")",
".",
"getJavadoc",
"(",
")",
";",
"if",
"(",
"javadoc",
"==",
"null",
")",
... | Collect javadoc from the package declarations to display in the header. | [
"Collect",
"javadoc",
"from",
"the",
"package",
"declarations",
"to",
"display",
"in",
"the",
"header",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/gen/GenerationUnit.java#L186-L194 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/SegmentMeanShiftSearch.java | SegmentMeanShiftSearch.distanceSq | public static float distanceSq( float[] a , float[]b ) {
float ret = 0;
for( int i = 0; i < a.length; i++ ) {
float d = a[i] - b[i];
ret += d*d;
}
return ret;
} | java | public static float distanceSq( float[] a , float[]b ) {
float ret = 0;
for( int i = 0; i < a.length; i++ ) {
float d = a[i] - b[i];
ret += d*d;
}
return ret;
} | [
"public",
"static",
"float",
"distanceSq",
"(",
"float",
"[",
"]",
"a",
",",
"float",
"[",
"]",
"b",
")",
"{",
"float",
"ret",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"a",
".",
"length",
";",
"i",
"++",
")",
"{",
"fl... | Returns the Euclidean distance squared between the two vectors | [
"Returns",
"the",
"Euclidean",
"distance",
"squared",
"between",
"the",
"two",
"vectors"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/SegmentMeanShiftSearch.java#L173-L180 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/MenuUtil.java | MenuUtil.findMenu | public static BaseMenuComponent findMenu(BaseComponent parent, String label, BaseComponent insertBefore) {
for (BaseMenuComponent child : parent.getChildren(BaseMenuComponent.class)) {
if (label.equalsIgnoreCase(child.getLabel())) {
return child;
}
}
BaseMenuComponent cmp = createMenuOrMenuitem(parent);
cmp.setLabel(label);
parent.addChild(cmp, insertBefore);
return cmp;
} | java | public static BaseMenuComponent findMenu(BaseComponent parent, String label, BaseComponent insertBefore) {
for (BaseMenuComponent child : parent.getChildren(BaseMenuComponent.class)) {
if (label.equalsIgnoreCase(child.getLabel())) {
return child;
}
}
BaseMenuComponent cmp = createMenuOrMenuitem(parent);
cmp.setLabel(label);
parent.addChild(cmp, insertBefore);
return cmp;
} | [
"public",
"static",
"BaseMenuComponent",
"findMenu",
"(",
"BaseComponent",
"parent",
",",
"String",
"label",
",",
"BaseComponent",
"insertBefore",
")",
"{",
"for",
"(",
"BaseMenuComponent",
"child",
":",
"parent",
".",
"getChildren",
"(",
"BaseMenuComponent",
".",
... | Returns the menu with the specified label, or creates one if it does not exist.
@param parent The parent component under which to search. May be a Toolbar or a Menupopup
component.
@param label Label of menu to search.
@param insertBefore If not null, the new menu is inserted before this one. If null, the menu
is appended.
@return Menu or menu item with the specified label. | [
"Returns",
"the",
"menu",
"with",
"the",
"specified",
"label",
"or",
"creates",
"one",
"if",
"it",
"does",
"not",
"exist",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/MenuUtil.java#L97-L109 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/searchindex/sourcesearch/CmsSourceSearchDialog.java | CmsSourceSearchDialog.getSolrIndexOptions | private List<CmsSelectWidgetOption> getSolrIndexOptions() {
List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>();
result.add(
new CmsSelectWidgetOption(CmsSearchReplaceSettings.VFS, true, CmsSearchReplaceSettings.VFS.toUpperCase()));
if (OpenCms.getSearchManager().getSolrServerConfiguration().isEnabled()) {
for (CmsSearchIndex index : OpenCms.getSearchManager().getAllSolrIndexes()) {
if (CmsSearchIndex.REBUILD_MODE_OFFLINE.equals(index.getRebuildMode())) {
result.add(new CmsSelectWidgetOption(index.getName(), false, index.getName()));
}
}
}
return result;
} | java | private List<CmsSelectWidgetOption> getSolrIndexOptions() {
List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>();
result.add(
new CmsSelectWidgetOption(CmsSearchReplaceSettings.VFS, true, CmsSearchReplaceSettings.VFS.toUpperCase()));
if (OpenCms.getSearchManager().getSolrServerConfiguration().isEnabled()) {
for (CmsSearchIndex index : OpenCms.getSearchManager().getAllSolrIndexes()) {
if (CmsSearchIndex.REBUILD_MODE_OFFLINE.equals(index.getRebuildMode())) {
result.add(new CmsSelectWidgetOption(index.getName(), false, index.getName()));
}
}
}
return result;
} | [
"private",
"List",
"<",
"CmsSelectWidgetOption",
">",
"getSolrIndexOptions",
"(",
")",
"{",
"List",
"<",
"CmsSelectWidgetOption",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"CmsSelectWidgetOption",
">",
"(",
")",
";",
"result",
".",
"add",
"(",
"new",
"CmsSe... | Returns select options for all configures Solr Offline indexes.<p>
@return select options for all configures Solr Offline indexes | [
"Returns",
"select",
"options",
"for",
"all",
"configures",
"Solr",
"Offline",
"indexes",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/sourcesearch/CmsSourceSearchDialog.java#L288-L301 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/Project.java | Project.createIteration | public Iteration createIteration(String name, DateTime beginDate, DateTime endDate) {
return getInstance().create().iteration(name, getSchedule(), beginDate, endDate);
} | java | public Iteration createIteration(String name, DateTime beginDate, DateTime endDate) {
return getInstance().create().iteration(name, getSchedule(), beginDate, endDate);
} | [
"public",
"Iteration",
"createIteration",
"(",
"String",
"name",
",",
"DateTime",
"beginDate",
",",
"DateTime",
"endDate",
")",
"{",
"return",
"getInstance",
"(",
")",
".",
"create",
"(",
")",
".",
"iteration",
"(",
"name",
",",
"getSchedule",
"(",
")",
",... | Create a new Iteration in the Project where the schedule is defined.
@param name The initial name of the Iteration.
@param beginDate The begin date of the Iteration.
@param endDate The end date of the Iteration.
@return A new Iteration. | [
"Create",
"a",
"new",
"Iteration",
"in",
"the",
"Project",
"where",
"the",
"schedule",
"is",
"defined",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Project.java#L368-L370 |
mikereedell/sunrisesunsetlib-java | src/main/java/com/luckycatlabs/sunrisesunset/calculator/SolarEventCalculator.java | SolarEventCalculator.computeSunsetTime | public String computeSunsetTime(Zenith solarZenith, Calendar date) {
return getLocalTimeAsString(computeSolarEventTime(solarZenith, date, false));
} | java | public String computeSunsetTime(Zenith solarZenith, Calendar date) {
return getLocalTimeAsString(computeSolarEventTime(solarZenith, date, false));
} | [
"public",
"String",
"computeSunsetTime",
"(",
"Zenith",
"solarZenith",
",",
"Calendar",
"date",
")",
"{",
"return",
"getLocalTimeAsString",
"(",
"computeSolarEventTime",
"(",
"solarZenith",
",",
"date",
",",
"false",
")",
")",
";",
"}"
] | Computes the sunset time for the given zenith at the given date.
@param solarZenith
<code>Zenith</code> enum corresponding to the type of sunset to compute.
@param date
<code>Calendar</code> object representing the date to compute the sunset for.
@return the sunset time, in HH:MM format (24-hour clock), 00:00 if the sun does not set on the given
date. | [
"Computes",
"the",
"sunset",
"time",
"for",
"the",
"given",
"zenith",
"at",
"the",
"given",
"date",
"."
] | train | https://github.com/mikereedell/sunrisesunsetlib-java/blob/6e6de23f1d11429eef58de2541582cbde9b85b92/src/main/java/com/luckycatlabs/sunrisesunset/calculator/SolarEventCalculator.java#L99-L101 |
jbundle/jbundle | base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseGridScreen.java | XBaseGridScreen.printStartRecordGridData | public void printStartRecordGridData(PrintWriter out, int iPrintOptions)
{
out.println(Utility.startTag(XMLTags.DETAIL));
out.println(Utility.startTag(XMLTags.FILE));
} | java | public void printStartRecordGridData(PrintWriter out, int iPrintOptions)
{
out.println(Utility.startTag(XMLTags.DETAIL));
out.println(Utility.startTag(XMLTags.FILE));
} | [
"public",
"void",
"printStartRecordGridData",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"out",
".",
"println",
"(",
"Utility",
".",
"startTag",
"(",
"XMLTags",
".",
"DETAIL",
")",
")",
";",
"out",
".",
"println",
"(",
"Utility",
"."... | Display the start grid in input format.
@return true if default params were found for this form.
@param out The http output stream.
@exception DBException File exception. | [
"Display",
"the",
"start",
"grid",
"in",
"input",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseGridScreen.java#L185-L189 |
google/closure-compiler | src/com/google/javascript/jscomp/Promises.java | Promises.wrapInIThenable | static final JSType wrapInIThenable(JSTypeRegistry registry, JSType maybeThenable) {
// Unwrap for simplicity first in the event it is a thenable.
JSType unwrapped = getResolvedType(registry, maybeThenable);
return registry.createTemplatizedType(
registry.getNativeObjectType(JSTypeNative.I_THENABLE_TYPE), unwrapped);
} | java | static final JSType wrapInIThenable(JSTypeRegistry registry, JSType maybeThenable) {
// Unwrap for simplicity first in the event it is a thenable.
JSType unwrapped = getResolvedType(registry, maybeThenable);
return registry.createTemplatizedType(
registry.getNativeObjectType(JSTypeNative.I_THENABLE_TYPE), unwrapped);
} | [
"static",
"final",
"JSType",
"wrapInIThenable",
"(",
"JSTypeRegistry",
"registry",
",",
"JSType",
"maybeThenable",
")",
"{",
"// Unwrap for simplicity first in the event it is a thenable.",
"JSType",
"unwrapped",
"=",
"getResolvedType",
"(",
"registry",
",",
"maybeThenable",
... | Wraps the given type in an IThenable.
<p>If the given type is already IThenable it is first unwrapped. For example:
<p>{@code number} becomes {@code IThenable<number>}
<p>{@code IThenable<number>} becomes {@code IThenable<number>}
<p>{@code Promise<number>} becomes {@code IThenable<number>}
<p>{@code IThenable<number>|string} becomes {@code IThenable<number|string>}
<p>{@code IThenable<number>|IThenable<string>} becomes {@code IThenable<number|string>} | [
"Wraps",
"the",
"given",
"type",
"in",
"an",
"IThenable",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Promises.java#L119-L124 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/DataUtil.java | DataUtil.growArrayToAtLeast | public static Object growArrayToAtLeast(Object arr, int minLen)
{
if (arr == null) {
throw new IllegalArgumentException(NO_TYPE);
}
Object old = arr;
int oldLen = Array.getLength(arr);
int newLen = oldLen + ((oldLen + 1) >> 1);
if (newLen < minLen) {
newLen = minLen;
}
arr = Array.newInstance(arr.getClass().getComponentType(), newLen);
System.arraycopy(old, 0, arr, 0, oldLen);
return arr;
} | java | public static Object growArrayToAtLeast(Object arr, int minLen)
{
if (arr == null) {
throw new IllegalArgumentException(NO_TYPE);
}
Object old = arr;
int oldLen = Array.getLength(arr);
int newLen = oldLen + ((oldLen + 1) >> 1);
if (newLen < minLen) {
newLen = minLen;
}
arr = Array.newInstance(arr.getClass().getComponentType(), newLen);
System.arraycopy(old, 0, arr, 0, oldLen);
return arr;
} | [
"public",
"static",
"Object",
"growArrayToAtLeast",
"(",
"Object",
"arr",
",",
"int",
"minLen",
")",
"{",
"if",
"(",
"arr",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"NO_TYPE",
")",
";",
"}",
"Object",
"old",
"=",
"arr",
";... | Method similar to {@link #growArrayBy50Pct}, but it also ensures that
the new size is at least as big as the specified minimum size. | [
"Method",
"similar",
"to",
"{"
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/DataUtil.java#L118-L132 |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.validateGroupByItem | private void validateGroupByItem(SqlSelect select, SqlNode groupByItem) {
final SqlValidatorScope groupByScope = getGroupScope(select);
groupByScope.validateExpr(groupByItem);
} | java | private void validateGroupByItem(SqlSelect select, SqlNode groupByItem) {
final SqlValidatorScope groupByScope = getGroupScope(select);
groupByScope.validateExpr(groupByItem);
} | [
"private",
"void",
"validateGroupByItem",
"(",
"SqlSelect",
"select",
",",
"SqlNode",
"groupByItem",
")",
"{",
"final",
"SqlValidatorScope",
"groupByScope",
"=",
"getGroupScope",
"(",
"select",
")",
";",
"groupByScope",
".",
"validateExpr",
"(",
"groupByItem",
")",
... | Validates an item in the GROUP BY clause of a SELECT statement.
@param select Select statement
@param groupByItem GROUP BY clause item | [
"Validates",
"an",
"item",
"in",
"the",
"GROUP",
"BY",
"clause",
"of",
"a",
"SELECT",
"statement",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3850-L3853 |
jglobus/JGlobus | ssl-proxies/src/main/java/org/globus/util/GlobusPathMatchingResourcePatternResolver.java | GlobusPathMatchingResourcePatternResolver.getResources | public GlobusResource[] getResources(String locationPattern) {
Vector<GlobusResource> pathsMatchingLocationPattern = new Vector<GlobusResource>();
String mainPath = "";
if (locationPattern.startsWith("classpath:")) {
String pathUntilWildcard = getPathUntilWildcard(locationPattern.replaceFirst("classpath:/", ""), false);
URL resourceURL = getClass().getClassLoader().getResource(pathUntilWildcard);
this.mainClassPath = resourceURL.getPath();
this.locationPattern = Pattern.compile(antToRegexConverter(locationPattern.replaceFirst("classpath:/", "").replaceFirst(pathUntilWildcard, "")));
parseDirectoryStructure(new File(this.mainClassPath), pathsMatchingLocationPattern);
} else if (locationPattern.startsWith("file:")) {
if ((locationPattern.replaceFirst("file:", "").compareTo(getPathUntilWildcard(locationPattern.replaceFirst("file:", ""), true))) == 0) {//Check to see if the pattern is not a pattern
pathsMatchingLocationPattern.add(new GlobusResource(locationPattern.replaceFirst("file:", "")));
}
else {
try {
URL resourceURL = new File(getPathUntilWildcard(locationPattern.replaceFirst("file:", ""), true)).toURL();
mainPath = resourceURL.getPath();
this.locationPattern = Pattern.compile(antToRegexConverter(locationPattern.replaceFirst("file:", "")));
parseDirectoryStructure(new File(mainPath), pathsMatchingLocationPattern);
} catch (MalformedURLException ex) {
}
}
} else {
mainPath = getPathUntilWildcard(locationPattern, true);
this.locationPattern = Pattern.compile(antToRegexConverter(locationPattern));
parseDirectoryStructure(new File(mainPath), pathsMatchingLocationPattern);
}
return pathsMatchingLocationPattern.toArray(new GlobusResource[0]);
} | java | public GlobusResource[] getResources(String locationPattern) {
Vector<GlobusResource> pathsMatchingLocationPattern = new Vector<GlobusResource>();
String mainPath = "";
if (locationPattern.startsWith("classpath:")) {
String pathUntilWildcard = getPathUntilWildcard(locationPattern.replaceFirst("classpath:/", ""), false);
URL resourceURL = getClass().getClassLoader().getResource(pathUntilWildcard);
this.mainClassPath = resourceURL.getPath();
this.locationPattern = Pattern.compile(antToRegexConverter(locationPattern.replaceFirst("classpath:/", "").replaceFirst(pathUntilWildcard, "")));
parseDirectoryStructure(new File(this.mainClassPath), pathsMatchingLocationPattern);
} else if (locationPattern.startsWith("file:")) {
if ((locationPattern.replaceFirst("file:", "").compareTo(getPathUntilWildcard(locationPattern.replaceFirst("file:", ""), true))) == 0) {//Check to see if the pattern is not a pattern
pathsMatchingLocationPattern.add(new GlobusResource(locationPattern.replaceFirst("file:", "")));
}
else {
try {
URL resourceURL = new File(getPathUntilWildcard(locationPattern.replaceFirst("file:", ""), true)).toURL();
mainPath = resourceURL.getPath();
this.locationPattern = Pattern.compile(antToRegexConverter(locationPattern.replaceFirst("file:", "")));
parseDirectoryStructure(new File(mainPath), pathsMatchingLocationPattern);
} catch (MalformedURLException ex) {
}
}
} else {
mainPath = getPathUntilWildcard(locationPattern, true);
this.locationPattern = Pattern.compile(antToRegexConverter(locationPattern));
parseDirectoryStructure(new File(mainPath), pathsMatchingLocationPattern);
}
return pathsMatchingLocationPattern.toArray(new GlobusResource[0]);
} | [
"public",
"GlobusResource",
"[",
"]",
"getResources",
"(",
"String",
"locationPattern",
")",
"{",
"Vector",
"<",
"GlobusResource",
">",
"pathsMatchingLocationPattern",
"=",
"new",
"Vector",
"<",
"GlobusResource",
">",
"(",
")",
";",
"String",
"mainPath",
"=",
"\... | Finds all the resources that match the Ant-Style locationPattern
@param locationPattern Ant-Style location pattern which may be prefixed with
classpath:/, file:/, or describe a relative path.
@return An array of GlobusResource containing all resources whose locaiton match the locationPattern | [
"Finds",
"all",
"the",
"resources",
"that",
"match",
"the",
"Ant",
"-",
"Style",
"locationPattern"
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/util/GlobusPathMatchingResourcePatternResolver.java#L64-L93 |
graphql-java/graphql-java | src/main/java/graphql/execution/nextgen/FetchedValueAnalyzer.java | FetchedValueAnalyzer.analyzeFetchedValue | public FetchedValueAnalysis analyzeFetchedValue(ExecutionContext executionContext, FetchedValue fetchedValue, ExecutionStepInfo executionInfo) throws NonNullableFieldWasNullException {
return analyzeFetchedValueImpl(executionContext, fetchedValue, fetchedValue.getFetchedValue(), executionInfo);
} | java | public FetchedValueAnalysis analyzeFetchedValue(ExecutionContext executionContext, FetchedValue fetchedValue, ExecutionStepInfo executionInfo) throws NonNullableFieldWasNullException {
return analyzeFetchedValueImpl(executionContext, fetchedValue, fetchedValue.getFetchedValue(), executionInfo);
} | [
"public",
"FetchedValueAnalysis",
"analyzeFetchedValue",
"(",
"ExecutionContext",
"executionContext",
",",
"FetchedValue",
"fetchedValue",
",",
"ExecutionStepInfo",
"executionInfo",
")",
"throws",
"NonNullableFieldWasNullException",
"{",
"return",
"analyzeFetchedValueImpl",
"(",
... | /*
scalar: the value, null and/or error
enum: same as scalar
list: list of X: X can be list again, list of scalars or enum or objects | [
"/",
"*",
"scalar",
":",
"the",
"value",
"null",
"and",
"/",
"or",
"error",
"enum",
":",
"same",
"as",
"scalar",
"list",
":",
"list",
"of",
"X",
":",
"X",
"can",
"be",
"list",
"again",
"list",
"of",
"scalars",
"or",
"enum",
"or",
"objects"
] | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/execution/nextgen/FetchedValueAnalyzer.java#L45-L47 |
inkstand-io/scribble | scribble-core/src/main/java/io/inkstand/scribble/rules/ExternalResource.java | ExternalResource.apply | @Override
public Statement apply(final Statement base, final Description description) {
if (description.isSuite()) {
return super.apply(classStatement(base), description);
}
return super.apply(statement(base), description);
} | java | @Override
public Statement apply(final Statement base, final Description description) {
if (description.isSuite()) {
return super.apply(classStatement(base), description);
}
return super.apply(statement(base), description);
} | [
"@",
"Override",
"public",
"Statement",
"apply",
"(",
"final",
"Statement",
"base",
",",
"final",
"Description",
"description",
")",
"{",
"if",
"(",
"description",
".",
"isSuite",
"(",
")",
")",
"{",
"return",
"super",
".",
"apply",
"(",
"classStatement",
... | Verifies if the caller is a Suite and triggers the beforeClass and afterClass behavior. | [
"Verifies",
"if",
"the",
"caller",
"is",
"a",
"Suite",
"and",
"triggers",
"the",
"beforeClass",
"and",
"afterClass",
"behavior",
"."
] | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-core/src/main/java/io/inkstand/scribble/rules/ExternalResource.java#L42-L48 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/xmlhelpers/ContextXmlReader.java | ContextXmlReader.readContext | public JournalEntryContext readContext(XMLEventReader reader)
throws JournalException, XMLStreamException {
JournalEntryContext context = new JournalEntryContext();
XMLEvent event = reader.nextTag();
if (!isStartTagEvent(event, QNAME_TAG_CONTEXT)) {
throw getNotStartTagException(QNAME_TAG_CONTEXT, event);
}
context.setPassword(readContextPassword(reader));
context.setNoOp(readContextNoOp(reader));
context.setNow(readContextNow(reader));
context
.setEnvironmentAttributes(convertStringMap(readMultiMap(reader,
CONTEXT_MAPNAME_ENVIRONMENT)));
context.setSubjectAttributes(readMultiMap(reader,
CONTEXT_MAPNAME_SUBJECT));
context
.setActionAttributes(convertStringMap(readMultiMap(reader,
CONTEXT_MAPNAME_ACTION)));
context.setResourceAttributes(convertStringMap(readMultiMap(reader,
CONTEXT_MAPNAME_RESOURCE)));
context.setRecoveryAttributes(convertStringMap(readMultiMap(reader,
CONTEXT_MAPNAME_RECOVERY)));
event = reader.nextTag();
if (!isEndTagEvent(event, QNAME_TAG_CONTEXT)) {
throw getNotEndTagException(QNAME_TAG_CONTEXT, event);
}
decipherPassword(context);
return context;
} | java | public JournalEntryContext readContext(XMLEventReader reader)
throws JournalException, XMLStreamException {
JournalEntryContext context = new JournalEntryContext();
XMLEvent event = reader.nextTag();
if (!isStartTagEvent(event, QNAME_TAG_CONTEXT)) {
throw getNotStartTagException(QNAME_TAG_CONTEXT, event);
}
context.setPassword(readContextPassword(reader));
context.setNoOp(readContextNoOp(reader));
context.setNow(readContextNow(reader));
context
.setEnvironmentAttributes(convertStringMap(readMultiMap(reader,
CONTEXT_MAPNAME_ENVIRONMENT)));
context.setSubjectAttributes(readMultiMap(reader,
CONTEXT_MAPNAME_SUBJECT));
context
.setActionAttributes(convertStringMap(readMultiMap(reader,
CONTEXT_MAPNAME_ACTION)));
context.setResourceAttributes(convertStringMap(readMultiMap(reader,
CONTEXT_MAPNAME_RESOURCE)));
context.setRecoveryAttributes(convertStringMap(readMultiMap(reader,
CONTEXT_MAPNAME_RECOVERY)));
event = reader.nextTag();
if (!isEndTagEvent(event, QNAME_TAG_CONTEXT)) {
throw getNotEndTagException(QNAME_TAG_CONTEXT, event);
}
decipherPassword(context);
return context;
} | [
"public",
"JournalEntryContext",
"readContext",
"(",
"XMLEventReader",
"reader",
")",
"throws",
"JournalException",
",",
"XMLStreamException",
"{",
"JournalEntryContext",
"context",
"=",
"new",
"JournalEntryContext",
"(",
")",
";",
"XMLEvent",
"event",
"=",
"reader",
... | Read the context tax and populate a JournalEntryContext object. | [
"Read",
"the",
"context",
"tax",
"and",
"populate",
"a",
"JournalEntryContext",
"object",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/xmlhelpers/ContextXmlReader.java#L38-L71 |
ehcache/ehcache3 | transactions/src/main/java/org/ehcache/transactions/xa/txmgr/btm/BitronixXAResourceRegistry.java | BitronixXAResourceRegistry.unregisterXAResource | @Override
public void unregisterXAResource(String uniqueName, XAResource xaResource) {
Ehcache3XAResourceProducer xaResourceProducer = producers.get(uniqueName);
if (xaResourceProducer != null) {
boolean found = xaResourceProducer.removeXAResource(xaResource);
if (!found) {
throw new IllegalStateException("no XAResource " + xaResource + " found in XAResourceProducer with name " + uniqueName);
}
if (xaResourceProducer.isEmpty()) {
xaResourceProducer.close();
producers.remove(uniqueName);
}
} else {
throw new IllegalStateException("no XAResourceProducer registered with name " + uniqueName);
}
} | java | @Override
public void unregisterXAResource(String uniqueName, XAResource xaResource) {
Ehcache3XAResourceProducer xaResourceProducer = producers.get(uniqueName);
if (xaResourceProducer != null) {
boolean found = xaResourceProducer.removeXAResource(xaResource);
if (!found) {
throw new IllegalStateException("no XAResource " + xaResource + " found in XAResourceProducer with name " + uniqueName);
}
if (xaResourceProducer.isEmpty()) {
xaResourceProducer.close();
producers.remove(uniqueName);
}
} else {
throw new IllegalStateException("no XAResourceProducer registered with name " + uniqueName);
}
} | [
"@",
"Override",
"public",
"void",
"unregisterXAResource",
"(",
"String",
"uniqueName",
",",
"XAResource",
"xaResource",
")",
"{",
"Ehcache3XAResourceProducer",
"xaResourceProducer",
"=",
"producers",
".",
"get",
"(",
"uniqueName",
")",
";",
"if",
"(",
"xaResourcePr... | Unregister an XAResource of a cache from BTM.
@param uniqueName the uniqueName of this XAResourceProducer, usually the cache's name
@param xaResource the XAResource to be registered | [
"Unregister",
"an",
"XAResource",
"of",
"a",
"cache",
"from",
"BTM",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/transactions/src/main/java/org/ehcache/transactions/xa/txmgr/btm/BitronixXAResourceRegistry.java#L66-L82 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java | BundlesHandlerFactory.buildCompositeResourcebundle | private JoinableResourceBundle buildCompositeResourcebundle(ResourceBundleDefinition def)
throws BundleDependencyException {
List<JoinableResourceBundle> childBundles = new ArrayList<>();
for (ResourceBundleDefinition child : def.getChildren()) {
JoinableResourceBundle childBundle = null;
if (child.isComposite()) {
childBundle = buildCompositeResourcebundle(child);
} else {
childBundle = buildResourcebundle(child);
}
childBundles.add(childBundle);
}
return buildCompositeResourcebundle(def, childBundles);
} | java | private JoinableResourceBundle buildCompositeResourcebundle(ResourceBundleDefinition def)
throws BundleDependencyException {
List<JoinableResourceBundle> childBundles = new ArrayList<>();
for (ResourceBundleDefinition child : def.getChildren()) {
JoinableResourceBundle childBundle = null;
if (child.isComposite()) {
childBundle = buildCompositeResourcebundle(child);
} else {
childBundle = buildResourcebundle(child);
}
childBundles.add(childBundle);
}
return buildCompositeResourcebundle(def, childBundles);
} | [
"private",
"JoinableResourceBundle",
"buildCompositeResourcebundle",
"(",
"ResourceBundleDefinition",
"def",
")",
"throws",
"BundleDependencyException",
"{",
"List",
"<",
"JoinableResourceBundle",
">",
"childBundles",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
... | Build a Composite resource bundle using a ResourceBundleDefinition
@param def
the bundle definition
@param childBundles
the list of child bundles
@return a Composite resource bundle
@throws BundleDependencyException
if a bundle dependency excption occurs | [
"Build",
"a",
"Composite",
"resource",
"bundle",
"using",
"a",
"ResourceBundleDefinition"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L477-L491 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WRepeaterRenderer.java | WRepeaterRenderer.paintRows | protected void paintRows(final WRepeater repeater, final WebXmlRenderContext renderContext) {
List<?> beanList = repeater.getBeanList();
WComponent row = repeater.getRepeatedComponent();
for (int i = 0; i < beanList.size(); i++) {
Object rowData = beanList.get(i);
// Each row has its own context. This is why we can reuse the same
// WComponent instance for each row.
UIContext rowContext = repeater.getRowContext(rowData, i);
UIContextHolder.pushContext(rowContext);
try {
row.paint(renderContext);
} finally {
UIContextHolder.popContext();
}
}
} | java | protected void paintRows(final WRepeater repeater, final WebXmlRenderContext renderContext) {
List<?> beanList = repeater.getBeanList();
WComponent row = repeater.getRepeatedComponent();
for (int i = 0; i < beanList.size(); i++) {
Object rowData = beanList.get(i);
// Each row has its own context. This is why we can reuse the same
// WComponent instance for each row.
UIContext rowContext = repeater.getRowContext(rowData, i);
UIContextHolder.pushContext(rowContext);
try {
row.paint(renderContext);
} finally {
UIContextHolder.popContext();
}
}
} | [
"protected",
"void",
"paintRows",
"(",
"final",
"WRepeater",
"repeater",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"List",
"<",
"?",
">",
"beanList",
"=",
"repeater",
".",
"getBeanList",
"(",
")",
";",
"WComponent",
"row",
"=",
"repeater"... | Paints the rows.
@param repeater the repeater to paint the rows for.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"rows",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WRepeaterRenderer.java#L49-L67 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/ServerInstanceLogRecordListImpl.java | ServerInstanceLogRecordListImpl.getCache | public RemoteListCache getCache() {
RemoteRepositoryCache logCache = getLogResult()==null ? null : getLogResult().getCache();
RemoteRepositoryCache traceCache = getTraceResult()==null ? null : getTraceResult().getCache();
return switched ? new RemoteListCacheImpl(traceCache, logCache) : new RemoteListCacheImpl(logCache, traceCache);
} | java | public RemoteListCache getCache() {
RemoteRepositoryCache logCache = getLogResult()==null ? null : getLogResult().getCache();
RemoteRepositoryCache traceCache = getTraceResult()==null ? null : getTraceResult().getCache();
return switched ? new RemoteListCacheImpl(traceCache, logCache) : new RemoteListCacheImpl(logCache, traceCache);
} | [
"public",
"RemoteListCache",
"getCache",
"(",
")",
"{",
"RemoteRepositoryCache",
"logCache",
"=",
"getLogResult",
"(",
")",
"==",
"null",
"?",
"null",
":",
"getLogResult",
"(",
")",
".",
"getCache",
"(",
")",
";",
"RemoteRepositoryCache",
"traceCache",
"=",
"g... | returns this result cache usable for remote transport
@return cache instance used in remote log reading | [
"returns",
"this",
"result",
"cache",
"usable",
"for",
"remote",
"transport"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/ServerInstanceLogRecordListImpl.java#L75-L79 |
voldemort/voldemort | src/java/voldemort/utils/pool/QueuedKeyedResourcePool.java | QueuedKeyedResourcePool.checkin | @Override
public void checkin(K key, V resource) {
super.checkin(key, resource);
// NB: Blocking checkout calls for synchronous requests get the resource
// checked in above before processQueueLoop() attempts checkout below.
// There is therefore a risk that asynchronous requests will be starved.
processQueueLoop(key);
} | java | @Override
public void checkin(K key, V resource) {
super.checkin(key, resource);
// NB: Blocking checkout calls for synchronous requests get the resource
// checked in above before processQueueLoop() attempts checkout below.
// There is therefore a risk that asynchronous requests will be starved.
processQueueLoop(key);
} | [
"@",
"Override",
"public",
"void",
"checkin",
"(",
"K",
"key",
",",
"V",
"resource",
")",
"{",
"super",
".",
"checkin",
"(",
"key",
",",
"resource",
")",
";",
"// NB: Blocking checkout calls for synchronous requests get the resource",
"// checked in above before process... | Check the given resource back into the pool
@param key The key for the resource
@param resource The resource | [
"Check",
"the",
"given",
"resource",
"back",
"into",
"the",
"pool"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/pool/QueuedKeyedResourcePool.java#L248-L255 |
VueGWT/vue-gwt | core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java | VueComponentOptions.addJavaPropDefaultValue | @JsOverlay
public final void addJavaPropDefaultValue(Function javaMethod, String propertyName) {
PropOptions propDefinition = getProps().get(propertyName);
propDefinition.defaultValue = javaMethod;
} | java | @JsOverlay
public final void addJavaPropDefaultValue(Function javaMethod, String propertyName) {
PropOptions propDefinition = getProps().get(propertyName);
propDefinition.defaultValue = javaMethod;
} | [
"@",
"JsOverlay",
"public",
"final",
"void",
"addJavaPropDefaultValue",
"(",
"Function",
"javaMethod",
",",
"String",
"propertyName",
")",
"{",
"PropOptions",
"propDefinition",
"=",
"getProps",
"(",
")",
".",
"get",
"(",
"propertyName",
")",
";",
"propDefinition",... | Add a custom prop validator to validate a property
@param javaMethod Function pointer to the method in the {@link IsVueComponent}
@param propertyName The name of the property to validate | [
"Add",
"a",
"custom",
"prop",
"validator",
"to",
"validate",
"a",
"property"
] | train | https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java#L207-L211 |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/DatabaseFactory.java | DatabaseFactory.getConnection | public static DatabaseEngine getConnection(Properties p) throws DatabaseFactoryException {
PdbProperties pdbProperties = new PdbProperties(p, true);
final String engine = pdbProperties.getEngine();
if (StringUtils.isBlank(engine)) {
throw new DatabaseFactoryException("pdb.engine property is mandatory");
}
try {
Class<?> c = Class.forName(engine);
Constructor cons = c.getConstructor(PdbProperties.class);
final AbstractDatabaseEngine de = (AbstractDatabaseEngine) cons.newInstance(pdbProperties);
Class<? extends AbstractTranslator> tc = de.getTranslatorClass();
if (pdbProperties.isTranslatorSet()) {
final Class<?> propertiesTranslator = Class.forName(pdbProperties.getTranslator());
if (!AbstractTranslator.class.isAssignableFrom(propertiesTranslator)) {
throw new DatabaseFactoryException("Provided translator does extend from AbstractTranslator.");
}
tc = (Class<? extends AbstractTranslator>) propertiesTranslator;
}
final Injector injector = Guice.createInjector(
new PdbModule.Builder()
.withTranslator(tc)
.withPdbProperties(pdbProperties)
.build());
injector.injectMembers(de);
return de;
} catch (final DatabaseFactoryException e) {
throw e;
} catch (final Exception e) {
throw new DatabaseFactoryException(e);
}
} | java | public static DatabaseEngine getConnection(Properties p) throws DatabaseFactoryException {
PdbProperties pdbProperties = new PdbProperties(p, true);
final String engine = pdbProperties.getEngine();
if (StringUtils.isBlank(engine)) {
throw new DatabaseFactoryException("pdb.engine property is mandatory");
}
try {
Class<?> c = Class.forName(engine);
Constructor cons = c.getConstructor(PdbProperties.class);
final AbstractDatabaseEngine de = (AbstractDatabaseEngine) cons.newInstance(pdbProperties);
Class<? extends AbstractTranslator> tc = de.getTranslatorClass();
if (pdbProperties.isTranslatorSet()) {
final Class<?> propertiesTranslator = Class.forName(pdbProperties.getTranslator());
if (!AbstractTranslator.class.isAssignableFrom(propertiesTranslator)) {
throw new DatabaseFactoryException("Provided translator does extend from AbstractTranslator.");
}
tc = (Class<? extends AbstractTranslator>) propertiesTranslator;
}
final Injector injector = Guice.createInjector(
new PdbModule.Builder()
.withTranslator(tc)
.withPdbProperties(pdbProperties)
.build());
injector.injectMembers(de);
return de;
} catch (final DatabaseFactoryException e) {
throw e;
} catch (final Exception e) {
throw new DatabaseFactoryException(e);
}
} | [
"public",
"static",
"DatabaseEngine",
"getConnection",
"(",
"Properties",
"p",
")",
"throws",
"DatabaseFactoryException",
"{",
"PdbProperties",
"pdbProperties",
"=",
"new",
"PdbProperties",
"(",
"p",
",",
"true",
")",
";",
"final",
"String",
"engine",
"=",
"pdbPro... | Gets a database connection from the specified properties.
@param p The database properties.
@return A reference of the specified database engine.
@throws DatabaseFactoryException If the class specified does not exist or its not well implemented. | [
"Gets",
"a",
"database",
"connection",
"from",
"the",
"specified",
"properties",
"."
] | train | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/DatabaseFactory.java#L50-L89 |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/util/SAMFileMerger.java | SAMFileMerger.writeTerminatorBlock | private static void writeTerminatorBlock(final OutputStream out, final SAMFormat samOutputFormat) throws IOException {
if (SAMFormat.CRAM == samOutputFormat) {
CramIO.issueEOF(CramVersions.DEFAULT_CRAM_VERSION, out); // terminate with CRAM EOF container
} else if (SAMFormat.BAM == samOutputFormat) {
out.write(BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK); // add the BGZF terminator
}
// no terminator for SAM
} | java | private static void writeTerminatorBlock(final OutputStream out, final SAMFormat samOutputFormat) throws IOException {
if (SAMFormat.CRAM == samOutputFormat) {
CramIO.issueEOF(CramVersions.DEFAULT_CRAM_VERSION, out); // terminate with CRAM EOF container
} else if (SAMFormat.BAM == samOutputFormat) {
out.write(BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK); // add the BGZF terminator
}
// no terminator for SAM
} | [
"private",
"static",
"void",
"writeTerminatorBlock",
"(",
"final",
"OutputStream",
"out",
",",
"final",
"SAMFormat",
"samOutputFormat",
")",
"throws",
"IOException",
"{",
"if",
"(",
"SAMFormat",
".",
"CRAM",
"==",
"samOutputFormat",
")",
"{",
"CramIO",
".",
"iss... | Terminate the aggregated output stream with an appropriate SAMOutputFormat-dependent terminator block | [
"Terminate",
"the",
"aggregated",
"output",
"stream",
"with",
"an",
"appropriate",
"SAMOutputFormat",
"-",
"dependent",
"terminator",
"block"
] | train | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/SAMFileMerger.java#L96-L103 |
wildfly-extras/wildfly-camel | common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java | IllegalStateAssertion.assertNull | public static <T> T assertNull(T value, String message) {
if (value != null)
throw new IllegalStateException(message);
return value;
} | java | public static <T> T assertNull(T value, String message) {
if (value != null)
throw new IllegalStateException(message);
return value;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"assertNull",
"(",
"T",
"value",
",",
"String",
"message",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"message",
")",
";",
"return",
"value",
";",
"}"
] | Throws an IllegalStateException when the given value is not null.
@return the value | [
"Throws",
"an",
"IllegalStateException",
"when",
"the",
"given",
"value",
"is",
"not",
"null",
"."
] | train | https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java#L38-L42 |
grycap/coreutils | coreutils-fiber/src/main/java/es/upv/grycap/coreutils/fiber/http/HttpDataFetcher.java | HttpDataFetcher.fetchToDir | public FecthFuture fetchToDir(final URL baseUrl, final List<String> ids, final File outdir) throws IOException {
return fetchToDir(baseUrl, null, ids, null, null, outdir);
} | java | public FecthFuture fetchToDir(final URL baseUrl, final List<String> ids, final File outdir) throws IOException {
return fetchToDir(baseUrl, null, ids, null, null, outdir);
} | [
"public",
"FecthFuture",
"fetchToDir",
"(",
"final",
"URL",
"baseUrl",
",",
"final",
"List",
"<",
"String",
">",
"ids",
",",
"final",
"File",
"outdir",
")",
"throws",
"IOException",
"{",
"return",
"fetchToDir",
"(",
"baseUrl",
",",
"null",
",",
"ids",
",",... | Specialization of the method {@link HttpDataFetcher#fetchToDir(URL, String, List, String, String, File)} that allows fetching
and saving a bunch of objects to the specified directory from a server that uses a REST or REST-like API where each object
is retrieved from the URL formed appending the object's identifier to the path of the the base URL.
@param baseUrl - base URL from where the objects will be fetched
@param ids - a list with the identifiers of the all requests that will be attempted
@param outdir - directory where the files will be stored
@return A {@link CompletableFuture} that allows cancellation. Once each fetch operation is completed, its status is updated
in the future with one of the possible values provided by the enumeration {@link FetchStatus}.
@throws IOException If an error occurs during the execution of the method that prevents fetching or saving the files. | [
"Specialization",
"of",
"the",
"method",
"{"
] | train | https://github.com/grycap/coreutils/blob/e6db61dc50b49ea7276c0c29c7401204681a10c2/coreutils-fiber/src/main/java/es/upv/grycap/coreutils/fiber/http/HttpDataFetcher.java#L116-L118 |
cdk/cdk | tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java | MolecularFormulaManipulator.getMolecularFormula | public static IMolecularFormula getMolecularFormula(IAtomContainer atomContainer) {
IMolecularFormula formula = atomContainer.getBuilder().newInstance(IMolecularFormula.class);
return getMolecularFormula(atomContainer, formula);
} | java | public static IMolecularFormula getMolecularFormula(IAtomContainer atomContainer) {
IMolecularFormula formula = atomContainer.getBuilder().newInstance(IMolecularFormula.class);
return getMolecularFormula(atomContainer, formula);
} | [
"public",
"static",
"IMolecularFormula",
"getMolecularFormula",
"(",
"IAtomContainer",
"atomContainer",
")",
"{",
"IMolecularFormula",
"formula",
"=",
"atomContainer",
".",
"getBuilder",
"(",
")",
".",
"newInstance",
"(",
"IMolecularFormula",
".",
"class",
")",
";",
... | Method that actually does the work of convert the atomContainer
to IMolecularFormula.
<p> The hydrogens must be implicit.
@param atomContainer IAtomContainer object
@return a molecular formula object
@see #getMolecularFormula(IAtomContainer,IMolecularFormula) | [
"Method",
"that",
"actually",
"does",
"the",
"work",
"of",
"convert",
"the",
"atomContainer",
"to",
"IMolecularFormula",
".",
"<p",
">",
"The",
"hydrogens",
"must",
"be",
"implicit",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java#L1050-L1055 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java | TreeScanner.visitMemberReference | @Override
public R visitMemberReference(MemberReferenceTree node, P p) {
R r = scan(node.getQualifierExpression(), p);
r = scanAndReduce(node.getTypeArguments(), p, r);
return r;
} | java | @Override
public R visitMemberReference(MemberReferenceTree node, P p) {
R r = scan(node.getQualifierExpression(), p);
r = scanAndReduce(node.getTypeArguments(), p, r);
return r;
} | [
"@",
"Override",
"public",
"R",
"visitMemberReference",
"(",
"MemberReferenceTree",
"node",
",",
"P",
"p",
")",
"{",
"R",
"r",
"=",
"scan",
"(",
"node",
".",
"getQualifierExpression",
"(",
")",
",",
"p",
")",
";",
"r",
"=",
"scanAndReduce",
"(",
"node",
... | {@inheritDoc} This implementation scans the children in left to right order.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of scanning | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"scans",
"the",
"children",
"in",
"left",
"to",
"right",
"order",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java#L690-L695 |
xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedDelayQueue.java | DistributedDelayQueue.putMulti | public void putMulti(MultiItem<T> items, long delayUntilEpoch) throws Exception
{
putMulti(items, delayUntilEpoch, 0, null);
} | java | public void putMulti(MultiItem<T> items, long delayUntilEpoch) throws Exception
{
putMulti(items, delayUntilEpoch, 0, null);
} | [
"public",
"void",
"putMulti",
"(",
"MultiItem",
"<",
"T",
">",
"items",
",",
"long",
"delayUntilEpoch",
")",
"throws",
"Exception",
"{",
"putMulti",
"(",
"items",
",",
"delayUntilEpoch",
",",
"0",
",",
"null",
")",
";",
"}"
] | Add a set of items with the same priority into the queue. Adding is done in the background - thus, this method will
return quickly.<br><br>
NOTE: if an upper bound was set via {@link QueueBuilder#maxItems}, this method will
block until there is available space in the queue.
@param items items to add
@param delayUntilEpoch future epoch (milliseconds) when this item will be available to consumers
@throws Exception connection issues | [
"Add",
"a",
"set",
"of",
"items",
"with",
"the",
"same",
"priority",
"into",
"the",
"queue",
".",
"Adding",
"is",
"done",
"in",
"the",
"background",
"-",
"thus",
"this",
"method",
"will",
"return",
"quickly",
".",
"<br",
">",
"<br",
">",
"NOTE",
":",
... | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedDelayQueue.java#L175-L178 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/SlimFixture.java | SlimFixture.createFile | protected String createFile(String dir, String fileName, byte[] content) {
String baseName = FilenameUtils.getBaseName(fileName);
String ext = FilenameUtils.getExtension(fileName);
String downloadedFile = FileUtil.saveToFile(dir + baseName, ext, content);
return linkToFile(downloadedFile);
} | java | protected String createFile(String dir, String fileName, byte[] content) {
String baseName = FilenameUtils.getBaseName(fileName);
String ext = FilenameUtils.getExtension(fileName);
String downloadedFile = FileUtil.saveToFile(dir + baseName, ext, content);
return linkToFile(downloadedFile);
} | [
"protected",
"String",
"createFile",
"(",
"String",
"dir",
",",
"String",
"fileName",
",",
"byte",
"[",
"]",
"content",
")",
"{",
"String",
"baseName",
"=",
"FilenameUtils",
".",
"getBaseName",
"(",
"fileName",
")",
";",
"String",
"ext",
"=",
"FilenameUtils"... | Creates a file using the supplied content.
@param dir directory to create file in.
@param fileName name for file.
@param content content to save.
@return link to created file. | [
"Creates",
"a",
"file",
"using",
"the",
"supplied",
"content",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/SlimFixture.java#L286-L291 |
dita-ot/dita-ot | src/main/java/org/dita/dost/reader/ChunkMapReader.java | ChunkMapReader.getChildElementValueOfTopicmeta | private String getChildElementValueOfTopicmeta(final Element element, final DitaClass classValue) {
if (element.hasChildNodes()) {
final Element topicMeta = getElementNode(element, MAP_TOPICMETA);
if (topicMeta != null) {
final Element elem = getElementNode(topicMeta, classValue);
if (elem != null) {
return getText(elem);
}
}
}
return null;
} | java | private String getChildElementValueOfTopicmeta(final Element element, final DitaClass classValue) {
if (element.hasChildNodes()) {
final Element topicMeta = getElementNode(element, MAP_TOPICMETA);
if (topicMeta != null) {
final Element elem = getElementNode(topicMeta, classValue);
if (elem != null) {
return getText(elem);
}
}
}
return null;
} | [
"private",
"String",
"getChildElementValueOfTopicmeta",
"(",
"final",
"Element",
"element",
",",
"final",
"DitaClass",
"classValue",
")",
"{",
"if",
"(",
"element",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"final",
"Element",
"topicMeta",
"=",
"getElementNode",
... | get topicmeta's child(e.g navtitle, shortdesc) tag's value(text-only).
@param element input element
@return text value | [
"get",
"topicmeta",
"s",
"child",
"(",
"e",
".",
"g",
"navtitle",
"shortdesc",
")",
"tag",
"s",
"value",
"(",
"text",
"-",
"only",
")",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/ChunkMapReader.java#L505-L516 |
baasbox/Android-SDK | library/src/main/java/com/baasbox/android/json/JsonWriter.java | JsonWriter.open | private JsonWriter open(JsonScope empty, String openBracket) throws IOException {
beforeValue(true);
stack.add(empty);
out.write(openBracket);
return this;
} | java | private JsonWriter open(JsonScope empty, String openBracket) throws IOException {
beforeValue(true);
stack.add(empty);
out.write(openBracket);
return this;
} | [
"private",
"JsonWriter",
"open",
"(",
"JsonScope",
"empty",
",",
"String",
"openBracket",
")",
"throws",
"IOException",
"{",
"beforeValue",
"(",
"true",
")",
";",
"stack",
".",
"add",
"(",
"empty",
")",
";",
"out",
".",
"write",
"(",
"openBracket",
")",
... | Enters a new scope by appending any necessary whitespace and the given
bracket. | [
"Enters",
"a",
"new",
"scope",
"by",
"appending",
"any",
"necessary",
"whitespace",
"and",
"the",
"given",
"bracket",
"."
] | train | https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/json/JsonWriter.java#L219-L224 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointObjectPropertiesAxiomImpl_CustomFieldSerializer.java | OWLDisjointObjectPropertiesAxiomImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLDisjointObjectPropertiesAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLDisjointObjectPropertiesAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLDisjointObjectPropertiesAxiomImpl",
"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",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointObjectPropertiesAxiomImpl_CustomFieldSerializer.java#L74-L77 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderAttributeUrl.java | OrderAttributeUrl.updateOrderAttributesUrl | public static MozuUrl updateOrderAttributesUrl(String orderId, Boolean removeMissing)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/attributes?removeMissing={removeMissing}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("removeMissing", removeMissing);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl updateOrderAttributesUrl(String orderId, Boolean removeMissing)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/attributes?removeMissing={removeMissing}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("removeMissing", removeMissing);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"updateOrderAttributesUrl",
"(",
"String",
"orderId",
",",
"Boolean",
"removeMissing",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/orders/{orderId}/attributes?removeMissing={removeMissing}\"",
")",
";... | Get Resource Url for UpdateOrderAttributes
@param orderId Unique identifier of the order.
@param removeMissing If true, the operation removes missing properties so that the updated order attributes will not show properties with a null value.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"UpdateOrderAttributes"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderAttributeUrl.java#L46-L52 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLHasKeyAxiomImpl_CustomFieldSerializer.java | OWLHasKeyAxiomImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLHasKeyAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLHasKeyAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLHasKeyAxiomImpl",
"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",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLHasKeyAxiomImpl_CustomFieldSerializer.java#L76-L79 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.