repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
micronaut-projects/micronaut-core | runtime/src/main/java/io/micronaut/jackson/JacksonConfiguration.java | JacksonConfiguration.constructType | public static <T> JavaType constructType(@Nonnull Argument<T> type, @Nonnull TypeFactory typeFactory) {
ArgumentUtils.requireNonNull("type", type);
ArgumentUtils.requireNonNull("typeFactory", typeFactory);
Map<String, Argument<?>> typeVariables = type.getTypeVariables();
JavaType[] objects = toJavaTypeArray(typeFactory, typeVariables);
final Class<T> rawType = type.getType();
if (ArrayUtils.isNotEmpty(objects)) {
final JavaType javaType = typeFactory.constructType(
rawType
);
if (javaType.isCollectionLikeType()) {
return typeFactory.constructCollectionLikeType(
rawType,
objects[0]
);
} else if (javaType.isMapLikeType()) {
return typeFactory.constructMapLikeType(
rawType,
objects[0],
objects[1]
);
} else if (javaType.isReferenceType()) {
return typeFactory.constructReferenceType(rawType, objects[0]);
}
return typeFactory.constructParametricType(rawType, objects);
} else {
return typeFactory.constructType(
rawType
);
}
} | java | public static <T> JavaType constructType(@Nonnull Argument<T> type, @Nonnull TypeFactory typeFactory) {
ArgumentUtils.requireNonNull("type", type);
ArgumentUtils.requireNonNull("typeFactory", typeFactory);
Map<String, Argument<?>> typeVariables = type.getTypeVariables();
JavaType[] objects = toJavaTypeArray(typeFactory, typeVariables);
final Class<T> rawType = type.getType();
if (ArrayUtils.isNotEmpty(objects)) {
final JavaType javaType = typeFactory.constructType(
rawType
);
if (javaType.isCollectionLikeType()) {
return typeFactory.constructCollectionLikeType(
rawType,
objects[0]
);
} else if (javaType.isMapLikeType()) {
return typeFactory.constructMapLikeType(
rawType,
objects[0],
objects[1]
);
} else if (javaType.isReferenceType()) {
return typeFactory.constructReferenceType(rawType, objects[0]);
}
return typeFactory.constructParametricType(rawType, objects);
} else {
return typeFactory.constructType(
rawType
);
}
} | [
"public",
"static",
"<",
"T",
">",
"JavaType",
"constructType",
"(",
"@",
"Nonnull",
"Argument",
"<",
"T",
">",
"type",
",",
"@",
"Nonnull",
"TypeFactory",
"typeFactory",
")",
"{",
"ArgumentUtils",
".",
"requireNonNull",
"(",
"\"type\"",
",",
"type",
")",
... | Constructors a JavaType for the given argument and type factory.
@param type The type
@param typeFactory The type factory
@param <T> The generic type
@return The JavaType | [
"Constructors",
"a",
"JavaType",
"for",
"the",
"given",
"argument",
"and",
"type",
"factory",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/runtime/src/main/java/io/micronaut/jackson/JacksonConfiguration.java#L317-L347 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/SmartTable.java | SmartTable.addText | public int addText (Object text, int colSpan, String... styles)
{
int row = getRowCount();
setText(row, 0, text, colSpan, styles);
return row;
} | java | public int addText (Object text, int colSpan, String... styles)
{
int row = getRowCount();
setText(row, 0, text, colSpan, styles);
return row;
} | [
"public",
"int",
"addText",
"(",
"Object",
"text",
",",
"int",
"colSpan",
",",
"String",
"...",
"styles",
")",
"{",
"int",
"row",
"=",
"getRowCount",
"(",
")",
";",
"setText",
"(",
"row",
",",
"0",
",",
"text",
",",
"colSpan",
",",
"styles",
")",
"... | Adds text to the bottom row of this table in column zero, with the specified column span and
style.
@param text an object whose string value will be displayed.
@return the row to which the text was added. | [
"Adds",
"text",
"to",
"the",
"bottom",
"row",
"of",
"this",
"table",
"in",
"column",
"zero",
"with",
"the",
"specified",
"column",
"span",
"and",
"style",
"."
] | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/SmartTable.java#L311-L316 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java | Hdf5Archive.getDataSets | public List<String> getDataSets(String... groups) {
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0)
return getObjects(this.file, H5O_TYPE_DATASET);
Group[] groupArray = openGroups(groups);
List<String> ls = getObjects(groupArray[groupArray.length - 1], H5O_TYPE_DATASET);
closeGroups(groupArray);
return ls;
}
} | java | public List<String> getDataSets(String... groups) {
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0)
return getObjects(this.file, H5O_TYPE_DATASET);
Group[] groupArray = openGroups(groups);
List<String> ls = getObjects(groupArray[groupArray.length - 1], H5O_TYPE_DATASET);
closeGroups(groupArray);
return ls;
}
} | [
"public",
"List",
"<",
"String",
">",
"getDataSets",
"(",
"String",
"...",
"groups",
")",
"{",
"synchronized",
"(",
"Hdf5Archive",
".",
"LOCK_OBJECT",
")",
"{",
"if",
"(",
"groups",
".",
"length",
"==",
"0",
")",
"return",
"getObjects",
"(",
"this",
".",... | Get list of data sets from group path.
@param groups Array of zero or more ancestor groups from root to parent.
@return List of HDF5 data set names | [
"Get",
"list",
"of",
"data",
"sets",
"from",
"group",
"path",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java#L194-L203 |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.transformURLAnchor | @SuppressWarnings("static-method")
protected String transformURLAnchor(File file, String anchor, ReferenceContext references) {
String anc = anchor;
if (references != null) {
anc = references.validateAnchor(anc);
}
return anc;
} | java | @SuppressWarnings("static-method")
protected String transformURLAnchor(File file, String anchor, ReferenceContext references) {
String anc = anchor;
if (references != null) {
anc = references.validateAnchor(anc);
}
return anc;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"String",
"transformURLAnchor",
"(",
"File",
"file",
",",
"String",
"anchor",
",",
"ReferenceContext",
"references",
")",
"{",
"String",
"anc",
"=",
"anchor",
";",
"if",
"(",
"references",
"!="... | Transform the anchor of an URL from Markdown format to HTML format.
@param file the linked file.
@param anchor the anchor to transform.
@param references the set of references from the local document, or {@code null}.
@return the result of the transformation.
@since 0.7 | [
"Transform",
"the",
"anchor",
"of",
"an",
"URL",
"from",
"Markdown",
"format",
"to",
"HTML",
"format",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L719-L726 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/CmsDisplayTypeSelectWidget.java | CmsDisplayTypeSelectWidget.replaceItems | private void replaceItems(Map<String, String> items) {
String oldValue = m_selectBox.getFormValueAsString();
//set value and option to the combo box.
m_selectBox.setItems(items);
if (items.containsKey(oldValue)) {
m_selectBox.setFormValueAsString(oldValue);
}
} | java | private void replaceItems(Map<String, String> items) {
String oldValue = m_selectBox.getFormValueAsString();
//set value and option to the combo box.
m_selectBox.setItems(items);
if (items.containsKey(oldValue)) {
m_selectBox.setFormValueAsString(oldValue);
}
} | [
"private",
"void",
"replaceItems",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"items",
")",
"{",
"String",
"oldValue",
"=",
"m_selectBox",
".",
"getFormValueAsString",
"(",
")",
";",
"//set value and option to the combo box.",
"m_selectBox",
".",
"setItems",
"... | Replaces the select items with the given items.<p>
@param items the select items | [
"Replaces",
"the",
"select",
"items",
"with",
"the",
"given",
"items",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/CmsDisplayTypeSelectWidget.java#L307-L315 |
undertow-io/undertow | core/src/main/java/io/undertow/util/ETagUtils.java | ETagUtils.handleIfNoneMatch | public static boolean handleIfNoneMatch(final HttpServerExchange exchange, final ETag etag, boolean allowWeak) {
return handleIfNoneMatch(exchange, Collections.singletonList(etag), allowWeak);
} | java | public static boolean handleIfNoneMatch(final HttpServerExchange exchange, final ETag etag, boolean allowWeak) {
return handleIfNoneMatch(exchange, Collections.singletonList(etag), allowWeak);
} | [
"public",
"static",
"boolean",
"handleIfNoneMatch",
"(",
"final",
"HttpServerExchange",
"exchange",
",",
"final",
"ETag",
"etag",
",",
"boolean",
"allowWeak",
")",
"{",
"return",
"handleIfNoneMatch",
"(",
"exchange",
",",
"Collections",
".",
"singletonList",
"(",
... | Handles the if-none-match header. returns true if the request should proceed, false otherwise
@param exchange the exchange
@param etag The etags
@return | [
"Handles",
"the",
"if",
"-",
"none",
"-",
"match",
"header",
".",
"returns",
"true",
"if",
"the",
"request",
"should",
"proceed",
"false",
"otherwise"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/ETagUtils.java#L111-L113 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/Utils.java | Utils.toHexBytes | public static String toHexBytes(byte[] bytes, int offset, int length) {
StringBuilder builder = new StringBuilder();
for (int index = offset; index < bytes.length && index < (offset + length); index++) {
byte b = bytes[index];
int first = (b >> 4) & 15;
int second = b & 15;
builder.append(hexChars.charAt(first)).append(hexChars.charAt(second));
}
return builder.toString();
} | java | public static String toHexBytes(byte[] bytes, int offset, int length) {
StringBuilder builder = new StringBuilder();
for (int index = offset; index < bytes.length && index < (offset + length); index++) {
byte b = bytes[index];
int first = (b >> 4) & 15;
int second = b & 15;
builder.append(hexChars.charAt(first)).append(hexChars.charAt(second));
}
return builder.toString();
} | [
"public",
"static",
"String",
"toHexBytes",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"index",
"=",
"offset",
";",
"i... | Converts the given bytes into a hexadecimal representation. bytes[offset] through
bytes[offset + length - 1] are converted, although the given array's length is
never exceeded.
@param offset Index of first byte to convert.
@param length Number of bytes to convert.
@param bytes Source bytes.
@return Hexadecimal string. | [
"Converts",
"the",
"given",
"bytes",
"into",
"a",
"hexadecimal",
"representation",
".",
"bytes",
"[",
"offset",
"]",
"through",
"bytes",
"[",
"offset",
"+",
"length",
"-",
"1",
"]",
"are",
"converted",
"although",
"the",
"given",
"array",
"s",
"length",
"i... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/Utils.java#L673-L682 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/FloatField.java | FloatField.doSetData | public int doSetData(Object data, boolean bDisplayOption, int iMoveMode)
{
if ((data != null) && (!(data instanceof Float)))
return DBConstants.ERROR_RETURN;
return super.doSetData(data, bDisplayOption, iMoveMode);
} | java | public int doSetData(Object data, boolean bDisplayOption, int iMoveMode)
{
if ((data != null) && (!(data instanceof Float)))
return DBConstants.ERROR_RETURN;
return super.doSetData(data, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"doSetData",
"(",
"Object",
"data",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"(",
"data",
"!=",
"null",
")",
"&&",
"(",
"!",
"(",
"data",
"instanceof",
"Float",
")",
")",
")",
"return",
"DBConstan... | Move this physical binary data to this field.
@param data The physical data to move to this field (must be Float raw data class).
@param bDisplayOption If true, display after setting the data.
@param iMoveMode The type of move.
@return an error code (0 if success). | [
"Move",
"this",
"physical",
"binary",
"data",
"to",
"this",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/FloatField.java#L263-L268 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java | JarVerifier.mapSignersToCodeSource | private synchronized CodeSource mapSignersToCodeSource(URL url, CodeSigner[] signers) {
Map map;
if (url == lastURL) {
map = lastURLMap;
} else {
map = (Map) urlToCodeSourceMap.get(url);
if (map == null) {
map = new HashMap();
urlToCodeSourceMap.put(url, map);
}
lastURLMap = map;
lastURL = url;
}
CodeSource cs = (CodeSource) map.get(signers);
if (cs == null) {
cs = new VerifierCodeSource(csdomain, url, signers);
signerToCodeSource.put(signers, cs);
}
return cs;
} | java | private synchronized CodeSource mapSignersToCodeSource(URL url, CodeSigner[] signers) {
Map map;
if (url == lastURL) {
map = lastURLMap;
} else {
map = (Map) urlToCodeSourceMap.get(url);
if (map == null) {
map = new HashMap();
urlToCodeSourceMap.put(url, map);
}
lastURLMap = map;
lastURL = url;
}
CodeSource cs = (CodeSource) map.get(signers);
if (cs == null) {
cs = new VerifierCodeSource(csdomain, url, signers);
signerToCodeSource.put(signers, cs);
}
return cs;
} | [
"private",
"synchronized",
"CodeSource",
"mapSignersToCodeSource",
"(",
"URL",
"url",
",",
"CodeSigner",
"[",
"]",
"signers",
")",
"{",
"Map",
"map",
";",
"if",
"(",
"url",
"==",
"lastURL",
")",
"{",
"map",
"=",
"lastURLMap",
";",
"}",
"else",
"{",
"map"... | /*
Create a unique mapping from codeSigner cache entries to CodeSource.
In theory, multiple URLs origins could map to a single locally cached
and shared JAR file although in practice there will be a single URL in use. | [
"/",
"*",
"Create",
"a",
"unique",
"mapping",
"from",
"codeSigner",
"cache",
"entries",
"to",
"CodeSource",
".",
"In",
"theory",
"multiple",
"URLs",
"origins",
"could",
"map",
"to",
"a",
"single",
"locally",
"cached",
"and",
"shared",
"JAR",
"file",
"althoug... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java#L528-L547 |
sebastiangraf/jSCSI | bundles/commons/src/main/java/org/jscsi/utils/Utils.java | Utils.printField | public static final void printField (final StringBuilder sb, final String fieldName, final String fieldValue, final int indent) {
indent(sb, indent);
sb.append(fieldName);
sb.append(": ");
sb.append(fieldValue);
sb.append("\n");
} | java | public static final void printField (final StringBuilder sb, final String fieldName, final String fieldValue, final int indent) {
indent(sb, indent);
sb.append(fieldName);
sb.append(": ");
sb.append(fieldValue);
sb.append("\n");
} | [
"public",
"static",
"final",
"void",
"printField",
"(",
"final",
"StringBuilder",
"sb",
",",
"final",
"String",
"fieldName",
",",
"final",
"String",
"fieldValue",
",",
"final",
"int",
"indent",
")",
"{",
"indent",
"(",
"sb",
",",
"indent",
")",
";",
"sb",
... | This methods creates an easy to use interface to print out a logging message of a specific variable.
@param sb StringBuilder to directly write the logging messages in.
@param fieldName The name of the variable.
@param fieldValue The value of the given variable.
@param indent The level of indention. | [
"This",
"methods",
"creates",
"an",
"easy",
"to",
"use",
"interface",
"to",
"print",
"out",
"a",
"logging",
"message",
"of",
"a",
"specific",
"variable",
"."
] | train | https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/commons/src/main/java/org/jscsi/utils/Utils.java#L111-L118 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsync | public static <R> Func0<Observable<R>> toAsync(final Func0<? extends R> func, final Scheduler scheduler) {
return new Func0<Observable<R>>() {
@Override
public Observable<R> call() {
return startCallable(func, scheduler);
}
};
} | java | public static <R> Func0<Observable<R>> toAsync(final Func0<? extends R> func, final Scheduler scheduler) {
return new Func0<Observable<R>>() {
@Override
public Observable<R> call() {
return startCallable(func, scheduler);
}
};
} | [
"public",
"static",
"<",
"R",
">",
"Func0",
"<",
"Observable",
"<",
"R",
">",
">",
"toAsync",
"(",
"final",
"Func0",
"<",
"?",
"extends",
"R",
">",
"func",
",",
"final",
"Scheduler",
"scheduler",
")",
"{",
"return",
"new",
"Func0",
"<",
"Observable",
... | Convert a synchronous function call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.s.png" alt="">
@param <R> the result type
@param func the function to convert
@param scheduler the Scheduler used to call the {@code func}
@return a function that returns an Observable that executes the {@code func} and emits its returned value
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh211792.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"function",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki"... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L779-L786 |
Appendium/objectlabkit | datecalc-jdk8/src/main/java/net/objectlab/kit/datecalc/jdk8/Jdk8WorkingWeek.java | Jdk8WorkingWeek.withWorkingDayFromDateTimeConstant | public Jdk8WorkingWeek withWorkingDayFromDateTimeConstant(final boolean working, final DayOfWeek givenDayOfWeek) {
final int dayOfWeek = jdk8ToCalendarDayConstant(givenDayOfWeek);
return new Jdk8WorkingWeek(super.withWorkingDayFromCalendar(working, dayOfWeek));
} | java | public Jdk8WorkingWeek withWorkingDayFromDateTimeConstant(final boolean working, final DayOfWeek givenDayOfWeek) {
final int dayOfWeek = jdk8ToCalendarDayConstant(givenDayOfWeek);
return new Jdk8WorkingWeek(super.withWorkingDayFromCalendar(working, dayOfWeek));
} | [
"public",
"Jdk8WorkingWeek",
"withWorkingDayFromDateTimeConstant",
"(",
"final",
"boolean",
"working",
",",
"final",
"DayOfWeek",
"givenDayOfWeek",
")",
"{",
"final",
"int",
"dayOfWeek",
"=",
"jdk8ToCalendarDayConstant",
"(",
"givenDayOfWeek",
")",
";",
"return",
"new",... | Return a new JodaWorkingWeek if the status for the given day has changed.
@param working
true if working day
@param givenDayOfWeek
e.g. DateTimeConstants.MONDAY, DateTimeConstants.TUESDAY, etc | [
"Return",
"a",
"new",
"JodaWorkingWeek",
"if",
"the",
"status",
"for",
"the",
"given",
"day",
"has",
"changed",
"."
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-jdk8/src/main/java/net/objectlab/kit/datecalc/jdk8/Jdk8WorkingWeek.java#L84-L87 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/query/Predicates.java | Predicates.greaterEqual | public static Predicate greaterEqual(String attribute, Comparable value) {
return new GreaterLessPredicate(attribute, value, true, false);
} | java | public static Predicate greaterEqual(String attribute, Comparable value) {
return new GreaterLessPredicate(attribute, value, true, false);
} | [
"public",
"static",
"Predicate",
"greaterEqual",
"(",
"String",
"attribute",
",",
"Comparable",
"value",
")",
"{",
"return",
"new",
"GreaterLessPredicate",
"(",
"attribute",
",",
"value",
",",
"true",
",",
"false",
")",
";",
"}"
] | Creates a <b>greater than or equal to</b> predicate that will pass items if the value stored under the given
item {@code attribute} is greater than or equal to the given {@code value}.
<p>
See also <i>Special Attributes</i>, <i>Attribute Paths</i>, <i>Handling of {@code null}</i> and
<i>Implicit Type Conversion</i> sections of {@link Predicates}.
@param attribute the left-hand side attribute to fetch the value for comparison from.
@param value the right-hand side value to compare the attribute value against.
@return the created <b>greater than or equal to</b> predicate.
@throws IllegalArgumentException if the {@code attribute} does not exist. | [
"Creates",
"a",
"<b",
">",
"greater",
"than",
"or",
"equal",
"to<",
"/",
"b",
">",
"predicate",
"that",
"will",
"pass",
"items",
"if",
"the",
"value",
"stored",
"under",
"the",
"given",
"item",
"{",
"@code",
"attribute",
"}",
"is",
"greater",
"than",
"... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/Predicates.java#L360-L362 |
phax/ph-web | ph-smtp/src/main/java/com/helger/smtp/util/EmailAddressValidator.java | EmailAddressValidator._hasMXRecord | private static boolean _hasMXRecord (@Nonnull final String sHostName)
{
try
{
final Record [] aRecords = new Lookup (sHostName, Type.MX).run ();
return aRecords != null && aRecords.length > 0;
}
catch (final Exception ex)
{
// Do not log this message, as this method is potentially called very
// often!
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Failed to check for MX record on host '" +
sHostName +
"': " +
ex.getClass ().getName () +
" - " +
ex.getMessage ());
return false;
}
} | java | private static boolean _hasMXRecord (@Nonnull final String sHostName)
{
try
{
final Record [] aRecords = new Lookup (sHostName, Type.MX).run ();
return aRecords != null && aRecords.length > 0;
}
catch (final Exception ex)
{
// Do not log this message, as this method is potentially called very
// often!
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Failed to check for MX record on host '" +
sHostName +
"': " +
ex.getClass ().getName () +
" - " +
ex.getMessage ());
return false;
}
} | [
"private",
"static",
"boolean",
"_hasMXRecord",
"(",
"@",
"Nonnull",
"final",
"String",
"sHostName",
")",
"{",
"try",
"{",
"final",
"Record",
"[",
"]",
"aRecords",
"=",
"new",
"Lookup",
"(",
"sHostName",
",",
"Type",
".",
"MX",
")",
".",
"run",
"(",
")... | Check if the passed host name has an MX record.
@param sHostName
The host name to check.
@return <code>true</code> if an MX record was found, <code>false</code> if
not (or if an exception occurred) | [
"Check",
"if",
"the",
"passed",
"host",
"name",
"has",
"an",
"MX",
"record",
"."
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-smtp/src/main/java/com/helger/smtp/util/EmailAddressValidator.java#L81-L101 |
jenkinsci/java-client-api | jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java | JenkinsServer.getJobs | public Map<String, Job> getJobs(FolderJob folder) throws IOException {
return getJobs(folder, null);
} | java | public Map<String, Job> getJobs(FolderJob folder) throws IOException {
return getJobs(folder, null);
} | [
"public",
"Map",
"<",
"String",
",",
"Job",
">",
"getJobs",
"(",
"FolderJob",
"folder",
")",
"throws",
"IOException",
"{",
"return",
"getJobs",
"(",
"folder",
",",
"null",
")",
";",
"}"
] | Get a list of all the defined jobs on the server (in the given folder)
@param folder {@link FolderJob}
@return list of defined jobs (summary level, for details @see Job#details
@throws IOException in case of an error. | [
"Get",
"a",
"list",
"of",
"all",
"the",
"defined",
"jobs",
"on",
"the",
"server",
"(",
"in",
"the",
"given",
"folder",
")"
] | train | https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L140-L142 |
to2mbn/JMCCC | jmccc/src/main/java/org/to2mbn/jmccc/version/parsing/Versions.java | Versions.resolveVersion | public static Version resolveVersion(MinecraftDirectory minecraftDir, String version) throws IOException {
Objects.requireNonNull(minecraftDir);
Objects.requireNonNull(version);
if (doesVersionExist(minecraftDir, version)) {
try {
return getVersionParser().parseVersion(resolveVersionHierarchy(version, minecraftDir), PlatformDescription.current());
} catch (JSONException e) {
throw new IOException("Couldn't parse version json: " + version, e);
}
} else {
return null;
}
} | java | public static Version resolveVersion(MinecraftDirectory minecraftDir, String version) throws IOException {
Objects.requireNonNull(minecraftDir);
Objects.requireNonNull(version);
if (doesVersionExist(minecraftDir, version)) {
try {
return getVersionParser().parseVersion(resolveVersionHierarchy(version, minecraftDir), PlatformDescription.current());
} catch (JSONException e) {
throw new IOException("Couldn't parse version json: " + version, e);
}
} else {
return null;
}
} | [
"public",
"static",
"Version",
"resolveVersion",
"(",
"MinecraftDirectory",
"minecraftDir",
",",
"String",
"version",
")",
"throws",
"IOException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"minecraftDir",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"version"... | Resolves the version.
@param minecraftDir the minecraft directory
@param version the version name
@return the version object, or null if the version does not exist
@throws IOException if an I/O error has occurred during resolving version
@throws NullPointerException if
<code>minecraftDir==null || version==null</code> | [
"Resolves",
"the",
"version",
"."
] | train | https://github.com/to2mbn/JMCCC/blob/17e5b1b56ff18255cfd60976dca1a24598946647/jmccc/src/main/java/org/to2mbn/jmccc/version/parsing/Versions.java#L36-L49 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCDriver.java | JDBCDriver.getPropertyInfo | public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
if (!acceptsURL(url)) {
return new DriverPropertyInfo[0];
}
String[] choices = new String[] {
"true", "false"
};
DriverPropertyInfo[] pinfo = new DriverPropertyInfo[6];
DriverPropertyInfo p;
if (info == null) {
info = new Properties();
}
p = new DriverPropertyInfo("user", null);
p.value = info.getProperty("user");
p.required = true;
pinfo[0] = p;
p = new DriverPropertyInfo("password", null);
p.value = info.getProperty("password");
p.required = true;
pinfo[1] = p;
p = new DriverPropertyInfo("get_column_name", null);
p.value = info.getProperty("get_column_name", "true");
p.required = false;
p.choices = choices;
pinfo[2] = p;
p = new DriverPropertyInfo("ifexists", null);
p.value = info.getProperty("ifexists", "false");
p.required = false;
p.choices = choices;
pinfo[3] = p;
p = new DriverPropertyInfo("default_schema", null);
p.value = info.getProperty("default_schema", "false");
p.required = false;
p.choices = choices;
pinfo[4] = p;
p = new DriverPropertyInfo("shutdown", null);
p.value = info.getProperty("shutdown", "false");
p.required = false;
p.choices = choices;
pinfo[5] = p;
return pinfo;
} | java | public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
if (!acceptsURL(url)) {
return new DriverPropertyInfo[0];
}
String[] choices = new String[] {
"true", "false"
};
DriverPropertyInfo[] pinfo = new DriverPropertyInfo[6];
DriverPropertyInfo p;
if (info == null) {
info = new Properties();
}
p = new DriverPropertyInfo("user", null);
p.value = info.getProperty("user");
p.required = true;
pinfo[0] = p;
p = new DriverPropertyInfo("password", null);
p.value = info.getProperty("password");
p.required = true;
pinfo[1] = p;
p = new DriverPropertyInfo("get_column_name", null);
p.value = info.getProperty("get_column_name", "true");
p.required = false;
p.choices = choices;
pinfo[2] = p;
p = new DriverPropertyInfo("ifexists", null);
p.value = info.getProperty("ifexists", "false");
p.required = false;
p.choices = choices;
pinfo[3] = p;
p = new DriverPropertyInfo("default_schema", null);
p.value = info.getProperty("default_schema", "false");
p.required = false;
p.choices = choices;
pinfo[4] = p;
p = new DriverPropertyInfo("shutdown", null);
p.value = info.getProperty("shutdown", "false");
p.required = false;
p.choices = choices;
pinfo[5] = p;
return pinfo;
} | [
"public",
"DriverPropertyInfo",
"[",
"]",
"getPropertyInfo",
"(",
"String",
"url",
",",
"Properties",
"info",
")",
"{",
"if",
"(",
"!",
"acceptsURL",
"(",
"url",
")",
")",
"{",
"return",
"new",
"DriverPropertyInfo",
"[",
"0",
"]",
";",
"}",
"String",
"["... | Gets information about the possible properties for this driver. <p>
The getPropertyInfo method is intended to allow a generic GUI tool
to discover what properties it should prompt a human for in order to
get enough information to connect to a database. Note that depending
on the values the human has supplied so far, additional values may
become necessary, so it may be necessary to iterate though several
calls to getPropertyInfo.<p>
<!-- start release-specific documentation -->
<div class="ReleaseSpecificDocumentation">
<h3>HSQLDB-Specific Information:</h3> <p>
HSQLDB uses the values submitted in info to set the value for
each DriverPropertyInfo object returned. It does not use the default
value that it would use for the property if the value is null. <p>
</div> <!-- end release-specific documentation -->
@param url the URL of the database to which to connect
@param info a proposed list of tag/value pairs that will be sent on
connect open
@return an array of DriverPropertyInfo objects describing possible
properties. This array may be an empty array if no properties
are required. | [
"Gets",
"information",
"about",
"the",
"possible",
"properties",
"for",
"this",
"driver",
".",
"<p",
">"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCDriver.java#L389-L434 |
alkacon/opencms-core | src/org/opencms/search/CmsSearchUtil.java | CmsSearchUtil.getDateCreatedTimeRangeFilterQuery | public static String getDateCreatedTimeRangeFilterQuery(String searchField, long startTime, long endTime) {
String sStartTime = null;
String sEndTime = null;
// Convert startTime to ISO 8601 format
if ((startTime > Long.MIN_VALUE) && (startTime < Long.MAX_VALUE)) {
sStartTime = CmsSearchUtil.getDateAsIso8601(new Date(startTime));
}
// Convert endTime to ISO 8601 format
if ((endTime > Long.MIN_VALUE) && (endTime < Long.MAX_VALUE)) {
sEndTime = CmsSearchUtil.getDateAsIso8601(new Date(endTime));
}
// Build Solr range string
final String rangeString = CmsSearchUtil.getSolrRangeString(sStartTime, sEndTime);
// Build Solr filter string
return String.format("%s:%s", searchField, rangeString);
} | java | public static String getDateCreatedTimeRangeFilterQuery(String searchField, long startTime, long endTime) {
String sStartTime = null;
String sEndTime = null;
// Convert startTime to ISO 8601 format
if ((startTime > Long.MIN_VALUE) && (startTime < Long.MAX_VALUE)) {
sStartTime = CmsSearchUtil.getDateAsIso8601(new Date(startTime));
}
// Convert endTime to ISO 8601 format
if ((endTime > Long.MIN_VALUE) && (endTime < Long.MAX_VALUE)) {
sEndTime = CmsSearchUtil.getDateAsIso8601(new Date(endTime));
}
// Build Solr range string
final String rangeString = CmsSearchUtil.getSolrRangeString(sStartTime, sEndTime);
// Build Solr filter string
return String.format("%s:%s", searchField, rangeString);
} | [
"public",
"static",
"String",
"getDateCreatedTimeRangeFilterQuery",
"(",
"String",
"searchField",
",",
"long",
"startTime",
",",
"long",
"endTime",
")",
"{",
"String",
"sStartTime",
"=",
"null",
";",
"String",
"sEndTime",
"=",
"null",
";",
"// Convert startTime to I... | Returns a time interval as Solr compatible query string.
@param searchField the field to search for.
@param startTime the lower limit of the interval.
@param endTime the upper limit of the interval.
@return Solr compatible query string. | [
"Returns",
"a",
"time",
"interval",
"as",
"Solr",
"compatible",
"query",
"string",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchUtil.java#L209-L229 |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM1Utils.java | HELM1Utils.convertConnection | private static String convertConnection(String notation, String source, String target, Map<String, String> convertIds) throws HELM1ConverterException {
try {
String test = notation.replace(source, "one");
test = test.replace(target, "two");
test = test.replace("one", convertIds.get(source));
test = test.replace("two", convertIds.get(target));
return test;
} catch (NullPointerException ex) {
ex.printStackTrace();
LOG.error("Connection can't be downgraded to HELM1-Format");
throw new HELM1ConverterException("Connection can't be downgraded to HELM1-Format");
}
} | java | private static String convertConnection(String notation, String source, String target, Map<String, String> convertIds) throws HELM1ConverterException {
try {
String test = notation.replace(source, "one");
test = test.replace(target, "two");
test = test.replace("one", convertIds.get(source));
test = test.replace("two", convertIds.get(target));
return test;
} catch (NullPointerException ex) {
ex.printStackTrace();
LOG.error("Connection can't be downgraded to HELM1-Format");
throw new HELM1ConverterException("Connection can't be downgraded to HELM1-Format");
}
} | [
"private",
"static",
"String",
"convertConnection",
"(",
"String",
"notation",
",",
"String",
"source",
",",
"String",
"target",
",",
"Map",
"<",
"String",
",",
"String",
">",
"convertIds",
")",
"throws",
"HELM1ConverterException",
"{",
"try",
"{",
"String",
"... | method to convert the polymers ids of the connection
@param notation connection description in HELM
@param source polymer id of source
@param target polymer id of target
@param convertIds Map of old polymer ids with the new polymer ids
@return connection description in HELM with the changed polymer ids
according to the map
@throws HELM1ConverterException | [
"method",
"to",
"convert",
"the",
"polymers",
"ids",
"of",
"the",
"connection"
] | train | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM1Utils.java#L333-L345 |
derari/cthul | log-cal10n/src/main/java/org/cthul/log/CLocLogConfiguration.java | CLocLogConfiguration.getClassLogger | public <E extends Enum<?>> CLocLogger<E> getClassLogger(int i) {
if (i < 0) {
throw new IllegalArgumentException("Expected value >= 0, got " + i);
}
return getLogger(slfLogger(i+1));
} | java | public <E extends Enum<?>> CLocLogger<E> getClassLogger(int i) {
if (i < 0) {
throw new IllegalArgumentException("Expected value >= 0, got " + i);
}
return getLogger(slfLogger(i+1));
} | [
"public",
"<",
"E",
"extends",
"Enum",
"<",
"?",
">",
">",
"CLocLogger",
"<",
"E",
">",
"getClassLogger",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"i",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Expected value >= 0, got \"",
"+"... | Chooses a logger based on the class name of the caller of this method.
{@code i == 0} identifies the caller of this method, for {@code i > 0},
the stack is walked upwards.
@param i
@return a logger | [
"Chooses",
"a",
"logger",
"based",
"on",
"the",
"class",
"name",
"of",
"the",
"caller",
"of",
"this",
"method",
".",
"{"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/log-cal10n/src/main/java/org/cthul/log/CLocLogConfiguration.java#L73-L78 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java | AbstractIndexWriter.addClassInfo | protected void addClassInfo(ClassDoc cd, Content contentTree) {
contentTree.addContent(getResource("doclet.in",
utils.getTypeName(configuration, cd, false),
getPackageLink(cd.containingPackage(),
utils.getPackageName(cd.containingPackage()))
));
} | java | protected void addClassInfo(ClassDoc cd, Content contentTree) {
contentTree.addContent(getResource("doclet.in",
utils.getTypeName(configuration, cd, false),
getPackageLink(cd.containingPackage(),
utils.getPackageName(cd.containingPackage()))
));
} | [
"protected",
"void",
"addClassInfo",
"(",
"ClassDoc",
"cd",
",",
"Content",
"contentTree",
")",
"{",
"contentTree",
".",
"addContent",
"(",
"getResource",
"(",
"\"doclet.in\"",
",",
"utils",
".",
"getTypeName",
"(",
"configuration",
",",
"cd",
",",
"false",
")... | Add the classkind (class, interface, exception), error of the class
passed.
@param cd the class being documented
@param contentTree the content tree to which the class info will be added | [
"Add",
"the",
"classkind",
"(",
"class",
"interface",
"exception",
")",
"error",
"of",
"the",
"class",
"passed",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java#L229-L235 |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/util/I18nUtil.java | I18nUtil.getText | public static String getText(String key, ResourceBundle bundle)
{
try
{
return bundle.getString(key);
}
catch (MissingResourceException ex)
{
return key;
}
} | java | public static String getText(String key, ResourceBundle bundle)
{
try
{
return bundle.getString(key);
}
catch (MissingResourceException ex)
{
return key;
}
} | [
"public",
"static",
"String",
"getText",
"(",
"String",
"key",
",",
"ResourceBundle",
"bundle",
")",
"{",
"try",
"{",
"return",
"bundle",
".",
"getString",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"MissingResourceException",
"ex",
")",
"{",
"return",
"key"... | Custom I18n. Based on WebWork i18n.
@param key a {@link java.lang.String} object.
@return the i18nze message. If none found key is returned.
@param bundle a {@link java.util.ResourceBundle} object. | [
"Custom",
"I18n",
".",
"Based",
"on",
"WebWork",
"i18n",
"."
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/util/I18nUtil.java#L28-L38 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/BinaryLogRecordSerializerVersion2Impl.java | BinaryLogRecordSerializerVersion2Impl.readParam | private static Object readParam(DataInput reader) throws IOException {
int type = reader.readUnsignedByte();
switch (type) {
case BYTE_ID:
return Byte.valueOf(reader.readByte());
case SHORT_ID:
return Short.valueOf(reader.readShort());
case INTEGER_ID:
return Integer.valueOf(reader.readInt());
case CHAR_ID:
return Character.valueOf(reader.readChar());
case LONG_ID:
return Long.valueOf(reader.readLong());
case FLOAT_ID:
return Float.valueOf(reader.readFloat());
case DOUBLE_ID:
return Double.valueOf(reader.readDouble());
case DATE_ID:
return new Date(reader.readLong());
case STRING_ID:
return readString(reader);
case NULL_ID:
return null;
}
throw new DeserializerException("Wrong type of a parameter", "one of the B,S,I,C,L,F,D,T,O,N", Character.toString((char)type));
} | java | private static Object readParam(DataInput reader) throws IOException {
int type = reader.readUnsignedByte();
switch (type) {
case BYTE_ID:
return Byte.valueOf(reader.readByte());
case SHORT_ID:
return Short.valueOf(reader.readShort());
case INTEGER_ID:
return Integer.valueOf(reader.readInt());
case CHAR_ID:
return Character.valueOf(reader.readChar());
case LONG_ID:
return Long.valueOf(reader.readLong());
case FLOAT_ID:
return Float.valueOf(reader.readFloat());
case DOUBLE_ID:
return Double.valueOf(reader.readDouble());
case DATE_ID:
return new Date(reader.readLong());
case STRING_ID:
return readString(reader);
case NULL_ID:
return null;
}
throw new DeserializerException("Wrong type of a parameter", "one of the B,S,I,C,L,F,D,T,O,N", Character.toString((char)type));
} | [
"private",
"static",
"Object",
"readParam",
"(",
"DataInput",
"reader",
")",
"throws",
"IOException",
"{",
"int",
"type",
"=",
"reader",
".",
"readUnsignedByte",
"(",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"BYTE_ID",
":",
"return",
"Byte",
".",... | /*
Deserialize parameter Object. Restores {@link Number} and {@link Date} instances
into their original type. | [
"/",
"*",
"Deserialize",
"parameter",
"Object",
".",
"Restores",
"{"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/BinaryLogRecordSerializerVersion2Impl.java#L792-L817 |
Waikato/moa | moa/src/main/java/moa/clusterers/kmeanspm/BICO.java | BICO.bicoUpdate | protected void bicoUpdate(double[] x) {
assert (!this.bufferPhase && this.numDimensions == x.length);
// Starts with the global root node as the current root node
ClusteringTreeNode r = this.root;
int i = 1;
while (true) {
ClusteringTreeNode y = r.nearestChild(x);
// Checks if the point can not be added to the current level
if (r.hasNoChildren()
|| y == null
|| Metric.distanceSquared(x, y.getCenter()) > calcRSquared(i)) {
// Creates a new node for the point and adds it to the current
// root node
r.addChild(new ClusteringTreeNode(x, new ClusteringFeature(x, calcR(i))));
this.rootCount++;
break;
} else {
// Checks if the point can be added to the nearest node without
// exceeding the global threshold
if (y.getClusteringFeature().calcKMeansCosts(y.getCenter(), x) <= this.T) {
// Adds the point to the ClusteringFeature
y.getClusteringFeature().add(1, x, Metric.distanceSquared(x));
break;
} else {
// Navigates one level down in the tree
r = y;
i++;
}
}
}
// Checks if the number of nodes in the tree exceeds the maximum number
if (this.rootCount > this.maxNumClusterFeatures) {
rebuild();
}
} | java | protected void bicoUpdate(double[] x) {
assert (!this.bufferPhase && this.numDimensions == x.length);
// Starts with the global root node as the current root node
ClusteringTreeNode r = this.root;
int i = 1;
while (true) {
ClusteringTreeNode y = r.nearestChild(x);
// Checks if the point can not be added to the current level
if (r.hasNoChildren()
|| y == null
|| Metric.distanceSquared(x, y.getCenter()) > calcRSquared(i)) {
// Creates a new node for the point and adds it to the current
// root node
r.addChild(new ClusteringTreeNode(x, new ClusteringFeature(x, calcR(i))));
this.rootCount++;
break;
} else {
// Checks if the point can be added to the nearest node without
// exceeding the global threshold
if (y.getClusteringFeature().calcKMeansCosts(y.getCenter(), x) <= this.T) {
// Adds the point to the ClusteringFeature
y.getClusteringFeature().add(1, x, Metric.distanceSquared(x));
break;
} else {
// Navigates one level down in the tree
r = y;
i++;
}
}
}
// Checks if the number of nodes in the tree exceeds the maximum number
if (this.rootCount > this.maxNumClusterFeatures) {
rebuild();
}
} | [
"protected",
"void",
"bicoUpdate",
"(",
"double",
"[",
"]",
"x",
")",
"{",
"assert",
"(",
"!",
"this",
".",
"bufferPhase",
"&&",
"this",
".",
"numDimensions",
"==",
"x",
".",
"length",
")",
";",
"// Starts with the global root node as the current root node",
"Cl... | Inserts a new point into the ClusteringFeature tree.
@param x
the point | [
"Inserts",
"a",
"new",
"point",
"into",
"the",
"ClusteringFeature",
"tree",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/BICO.java#L294-L328 |
Sciss/abc4j | abc/src/main/java/abc/xml/Abc2xml.java | Abc2xml.writeAsMusicXML | public void writeAsMusicXML(Document doc, BufferedWriter writer) throws IOException {
/*
* writer.write("<"+node.getNodeName()); NamedNodeMap attr =
* node.getAttributes(); if (attr!=null) for (int i=0;
* i<attr.getLength(); i++) writer.write(" " +
* attr.item(i).getNodeName() + "=" + attr.item(i).getNodeValue());
* writer.write(">"); writer.newLine(); NodeList nlist =
* node.getChildNodes(); for (int i=0; i<nlist.getLength(); i++)
* writeAsMusicXML(writer, nlist.item(i));
* writer.write("</"+node.getNodeName()+">"); writer.newLine();
*/
try {
TransformerFactory transfac = TransformerFactory.newInstance();
Transformer trans = transfac.newTransformer();
// trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
trans.setOutputProperty(OutputKeys.INDENT, "yes");
trans.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, "-//Recordare//DTD MusicXML 2.0 Partwise//EN");
trans.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "http://www.musicxml.org/dtds/partwise.dtd");
// create string from xml tree
// StringWriter sw = new StringWriter();
StreamResult result = new StreamResult(writer);
DOMSource source = new DOMSource(doc);
trans.transform(source, result);
} catch (Exception e) {
e.printStackTrace();
}
// String xmlString = sw.toString();
// }
} | java | public void writeAsMusicXML(Document doc, BufferedWriter writer) throws IOException {
/*
* writer.write("<"+node.getNodeName()); NamedNodeMap attr =
* node.getAttributes(); if (attr!=null) for (int i=0;
* i<attr.getLength(); i++) writer.write(" " +
* attr.item(i).getNodeName() + "=" + attr.item(i).getNodeValue());
* writer.write(">"); writer.newLine(); NodeList nlist =
* node.getChildNodes(); for (int i=0; i<nlist.getLength(); i++)
* writeAsMusicXML(writer, nlist.item(i));
* writer.write("</"+node.getNodeName()+">"); writer.newLine();
*/
try {
TransformerFactory transfac = TransformerFactory.newInstance();
Transformer trans = transfac.newTransformer();
// trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
trans.setOutputProperty(OutputKeys.INDENT, "yes");
trans.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, "-//Recordare//DTD MusicXML 2.0 Partwise//EN");
trans.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "http://www.musicxml.org/dtds/partwise.dtd");
// create string from xml tree
// StringWriter sw = new StringWriter();
StreamResult result = new StreamResult(writer);
DOMSource source = new DOMSource(doc);
trans.transform(source, result);
} catch (Exception e) {
e.printStackTrace();
}
// String xmlString = sw.toString();
// }
} | [
"public",
"void",
"writeAsMusicXML",
"(",
"Document",
"doc",
",",
"BufferedWriter",
"writer",
")",
"throws",
"IOException",
"{",
"/*\r\n\t\t * writer.write(\"<\"+node.getNodeName()); NamedNodeMap attr =\r\n\t\t * node.getAttributes(); if (attr!=null) for (int i=0;\r\n\t\t * i<attr.getLengt... | Writes the specified Node to the given writer.
@param node
A DOM node.
@param writer
A stream writer.
@throws IOException
Thrown if the file cannot be created. | [
"Writes",
"the",
"specified",
"Node",
"to",
"the",
"given",
"writer",
"."
] | train | https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/xml/Abc2xml.java#L194-L224 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java | ServiceDiscoveryManager.accountSupportsFeatures | public boolean accountSupportsFeatures(Collection<? extends CharSequence> features)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
EntityBareJid accountJid = connection().getUser().asEntityBareJid();
return supportsFeatures(accountJid, features);
} | java | public boolean accountSupportsFeatures(Collection<? extends CharSequence> features)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
EntityBareJid accountJid = connection().getUser().asEntityBareJid();
return supportsFeatures(accountJid, features);
} | [
"public",
"boolean",
"accountSupportsFeatures",
"(",
"Collection",
"<",
"?",
"extends",
"CharSequence",
">",
"features",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"EntityBareJid",
"acco... | Check if the given collection of features are supported by the connection account. This means that the discovery
information lookup will be performed on the bare JID of the connection managed by this ServiceDiscoveryManager.
@param features a collection of features
@return <code>true</code> if all features are supported by the connection account, <code>false</code> otherwise
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException
@since 4.2.2 | [
"Check",
"if",
"the",
"given",
"collection",
"of",
"features",
"are",
"supported",
"by",
"the",
"connection",
"account",
".",
"This",
"means",
"that",
"the",
"discovery",
"information",
"lookup",
"will",
"be",
"performed",
"on",
"the",
"bare",
"JID",
"of",
"... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java#L630-L634 |
bullhorn/sdk-rest | src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java | StandardBullhornData.parseResume | protected ParsedResume parseResume(String url, Object requestPayLoad, Map<String, String> uriVariables) {
ParsedResume response = null;
for (int tryNumber = 1; tryNumber <= RESUME_PARSE_RETRY; tryNumber++) {
try {
response = this.performPostResumeRequest(url, requestPayLoad, uriVariables);
break;
} catch (HttpStatusCodeException error) {
response = handleResumeParseError(tryNumber, error);
} catch (Exception e) {
log.error("error", e);
}
}
return response;
} | java | protected ParsedResume parseResume(String url, Object requestPayLoad, Map<String, String> uriVariables) {
ParsedResume response = null;
for (int tryNumber = 1; tryNumber <= RESUME_PARSE_RETRY; tryNumber++) {
try {
response = this.performPostResumeRequest(url, requestPayLoad, uriVariables);
break;
} catch (HttpStatusCodeException error) {
response = handleResumeParseError(tryNumber, error);
} catch (Exception e) {
log.error("error", e);
}
}
return response;
} | [
"protected",
"ParsedResume",
"parseResume",
"(",
"String",
"url",
",",
"Object",
"requestPayLoad",
",",
"Map",
"<",
"String",
",",
"String",
">",
"uriVariables",
")",
"{",
"ParsedResume",
"response",
"=",
"null",
";",
"for",
"(",
"int",
"tryNumber",
"=",
"1"... | Makes the call to the resume parser. If parse fails this method will retry RESUME_PARSE_RETRY number of times.
@param url
@param requestPayLoad
@param uriVariables
@return | [
"Makes",
"the",
"call",
"to",
"the",
"resume",
"parser",
".",
"If",
"parse",
"fails",
"this",
"method",
"will",
"retry",
"RESUME_PARSE_RETRY",
"number",
"of",
"times",
"."
] | train | https://github.com/bullhorn/sdk-rest/blob/0c75a141c768bb31510afc3a412c11bd101eca06/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java#L1360-L1374 |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexRequest.java | CmsFlexRequest.setAttributeMap | public void setAttributeMap(Map<String, Object> map) {
m_attributes = new HashMap<String, Object>(map);
} | java | public void setAttributeMap(Map<String, Object> map) {
m_attributes = new HashMap<String, Object>(map);
} | [
"public",
"void",
"setAttributeMap",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"m_attributes",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
"map",
")",
";",
"}"
] | Sets the specified Map as attribute map of the request.<p>
The map should be immutable.
This will completely replace the attribute map.
Use this in combination with {@link #getAttributeMap()} and
{@link #addAttributeMap(Map)} in case you want to set the old status
of the attribute map after you have modified it for
a specific operation.<p>
@param map the map to set | [
"Sets",
"the",
"specified",
"Map",
"as",
"attribute",
"map",
"of",
"the",
"request",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexRequest.java#L728-L731 |
jsurfer/JsonSurfer | jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java | JsonSurfer.createResumableParser | @Deprecated
public ResumableParser createResumableParser(Reader json, SurfingConfiguration configuration) {
ensureSetting(configuration);
return jsonParserAdapter.createResumableParser(json, new SurfingContext(configuration));
} | java | @Deprecated
public ResumableParser createResumableParser(Reader json, SurfingConfiguration configuration) {
ensureSetting(configuration);
return jsonParserAdapter.createResumableParser(json, new SurfingContext(configuration));
} | [
"@",
"Deprecated",
"public",
"ResumableParser",
"createResumableParser",
"(",
"Reader",
"json",
",",
"SurfingConfiguration",
"configuration",
")",
"{",
"ensureSetting",
"(",
"configuration",
")",
";",
"return",
"jsonParserAdapter",
".",
"createResumableParser",
"(",
"js... | Create resumable parser
@param json Json source
@param configuration SurfingConfiguration
@return Resumable parser
@deprecated use {@link #createResumableParser(InputStream, SurfingConfiguration)} instead | [
"Create",
"resumable",
"parser"
] | train | https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L225-L229 |
alkacon/opencms-core | src/org/opencms/importexport/CmsImport.java | CmsImport.importData | public void importData(CmsImportParameters parameters) throws CmsImportExportException, CmsXmlException {
boolean run = false;
try {
// now find the correct import implementation
Iterator<I_CmsImport> i = m_importImplementations.iterator();
while (i.hasNext()) {
I_CmsImport importVersion = i.next();
if (importVersion.matches(parameters)) {
m_report.println(
Messages.get().container(
Messages.RPT_IMPORT_VERSION_1,
String.valueOf(importVersion.getVersion())),
I_CmsReport.FORMAT_NOTE);
// this is the correct import version, so call it for the import process
importVersion.importData(m_cms, m_report, parameters);
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY, null));
run = true;
break;
}
}
if (!run) {
m_report.println(
Messages.get().container(Messages.RPT_IMPORT_DB_NO_CLASS_1, parameters.getPath()),
I_CmsReport.FORMAT_WARNING);
}
} finally {
OpenCms.fireCmsEvent(
new CmsEvent(I_CmsEventListener.EVENT_CLEAR_OFFLINE_CACHES, Collections.<String, Object> emptyMap()));
}
} | java | public void importData(CmsImportParameters parameters) throws CmsImportExportException, CmsXmlException {
boolean run = false;
try {
// now find the correct import implementation
Iterator<I_CmsImport> i = m_importImplementations.iterator();
while (i.hasNext()) {
I_CmsImport importVersion = i.next();
if (importVersion.matches(parameters)) {
m_report.println(
Messages.get().container(
Messages.RPT_IMPORT_VERSION_1,
String.valueOf(importVersion.getVersion())),
I_CmsReport.FORMAT_NOTE);
// this is the correct import version, so call it for the import process
importVersion.importData(m_cms, m_report, parameters);
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY, null));
run = true;
break;
}
}
if (!run) {
m_report.println(
Messages.get().container(Messages.RPT_IMPORT_DB_NO_CLASS_1, parameters.getPath()),
I_CmsReport.FORMAT_WARNING);
}
} finally {
OpenCms.fireCmsEvent(
new CmsEvent(I_CmsEventListener.EVENT_CLEAR_OFFLINE_CACHES, Collections.<String, Object> emptyMap()));
}
} | [
"public",
"void",
"importData",
"(",
"CmsImportParameters",
"parameters",
")",
"throws",
"CmsImportExportException",
",",
"CmsXmlException",
"{",
"boolean",
"run",
"=",
"false",
";",
"try",
"{",
"// now find the correct import implementation",
"Iterator",
"<",
"I_CmsImpor... | Imports the resources and writes them to the cms VFS, even if there
already exist files with the same name.<p>
@param parameters the import parameters
@throws CmsImportExportException if something goes wrong
@throws CmsXmlException if the manifest of the import file could not be unmarshalled | [
"Imports",
"the",
"resources",
"and",
"writes",
"them",
"to",
"the",
"cms",
"VFS",
"even",
"if",
"there",
"already",
"exist",
"files",
"with",
"the",
"same",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImport.java#L99-L130 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java | PatternBox.controlsStateChangeButIsParticipant | public static Pattern controlsStateChangeButIsParticipant()
{
Pattern p = new Pattern(SequenceEntityReference.class, "controller ER");
p.add(linkedER(true), "controller ER", "controller generic ER");
p.add(erToPE(), "controller generic ER", "controller simple PE");
p.add(linkToComplex(), "controller simple PE", "controller PE");
p.add(participatesInConv(), "controller PE", "Conversion");
p.add(left(), "Conversion", "controller PE");
p.add(right(), "Conversion", "controller PE");
// The controller ER is not associated with the Conversion in another way.
p.add(new NOT(new InterToPartER(1)), "Conversion", "controller PE", "controller ER");
stateChange(p, null);
p.add(equal(false), "controller ER", "changed ER");
p.add(equal(false), "controller PE", "input PE");
p.add(equal(false), "controller PE", "output PE");
return p;
} | java | public static Pattern controlsStateChangeButIsParticipant()
{
Pattern p = new Pattern(SequenceEntityReference.class, "controller ER");
p.add(linkedER(true), "controller ER", "controller generic ER");
p.add(erToPE(), "controller generic ER", "controller simple PE");
p.add(linkToComplex(), "controller simple PE", "controller PE");
p.add(participatesInConv(), "controller PE", "Conversion");
p.add(left(), "Conversion", "controller PE");
p.add(right(), "Conversion", "controller PE");
// The controller ER is not associated with the Conversion in another way.
p.add(new NOT(new InterToPartER(1)), "Conversion", "controller PE", "controller ER");
stateChange(p, null);
p.add(equal(false), "controller ER", "changed ER");
p.add(equal(false), "controller PE", "input PE");
p.add(equal(false), "controller PE", "output PE");
return p;
} | [
"public",
"static",
"Pattern",
"controlsStateChangeButIsParticipant",
"(",
")",
"{",
"Pattern",
"p",
"=",
"new",
"Pattern",
"(",
"SequenceEntityReference",
".",
"class",
",",
"\"controller ER\"",
")",
";",
"p",
".",
"add",
"(",
"linkedER",
"(",
"true",
")",
",... | Pattern for a EntityReference has a member PhysicalEntity that is controlling a state change
reaction of another EntityReference. This pattern is different from the original
controls-state-change. The controller in this case is not modeled as a controller, but as a
participant of the conversion, and it is at both sides.
@return the pattern | [
"Pattern",
"for",
"a",
"EntityReference",
"has",
"a",
"member",
"PhysicalEntity",
"that",
"is",
"controlling",
"a",
"state",
"change",
"reaction",
"of",
"another",
"EntityReference",
".",
"This",
"pattern",
"is",
"different",
"from",
"the",
"original",
"controls",... | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L151-L170 |
networknt/light-4j | metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java | InstrumentedExecutors.newFixedThreadPool | public static InstrumentedExecutorService newFixedThreadPool(
int nThreads, ThreadFactory threadFactory, MetricRegistry registry, String name) {
return new InstrumentedExecutorService(Executors.newFixedThreadPool(nThreads, threadFactory), registry, name);
} | java | public static InstrumentedExecutorService newFixedThreadPool(
int nThreads, ThreadFactory threadFactory, MetricRegistry registry, String name) {
return new InstrumentedExecutorService(Executors.newFixedThreadPool(nThreads, threadFactory), registry, name);
} | [
"public",
"static",
"InstrumentedExecutorService",
"newFixedThreadPool",
"(",
"int",
"nThreads",
",",
"ThreadFactory",
"threadFactory",
",",
"MetricRegistry",
"registry",
",",
"String",
"name",
")",
"{",
"return",
"new",
"InstrumentedExecutorService",
"(",
"Executors",
... | Creates an instrumented thread pool that reuses a fixed number of threads
operating off a shared unbounded queue, using the provided
ThreadFactory to create new threads when needed. At any point,
at most {@code nThreads} threads will be active processing
tasks. If additional tasks are submitted when all threads are
active, they will wait in the queue until a thread is
available. If any thread terminates due to a failure during
execution prior to shutdown, a new one will take its place if
needed to execute subsequent tasks. The threads in the pool will
exist until it is explicitly {@link ExecutorService#shutdown shutdown}.
@param nThreads the number of threads in the pool
@param threadFactory the factory to use when creating new threads
@param registry the {@link MetricRegistry} that will contain the metrics.
@param name the (metrics) name for this executor service, see {@link MetricRegistry#name(String, String...)}.
@return the newly created thread pool
@throws NullPointerException if threadFactory is null
@throws IllegalArgumentException if {@code nThreads <= 0}
@see Executors#newFixedThreadPool(int, ThreadFactory) | [
"Creates",
"an",
"instrumented",
"thread",
"pool",
"that",
"reuses",
"a",
"fixed",
"number",
"of",
"threads",
"operating",
"off",
"a",
"shared",
"unbounded",
"queue",
"using",
"the",
"provided",
"ThreadFactory",
"to",
"create",
"new",
"threads",
"when",
"needed"... | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java#L107-L110 |
alkacon/opencms-core | src/org/opencms/ui/sitemap/CmsLocaleComparePanel.java | CmsLocaleComparePanel.showHeader | private void showHeader() throws CmsException {
CmsSitemapUI ui = (CmsSitemapUI)A_CmsUI.get();
String title = null;
String description = null;
String path = null;
String locale = m_rootLocale.toString();
CmsObject cms = A_CmsUI.getCmsObject();
CmsResource targetRes = getRoot();
if (targetRes.isFolder()) {
targetRes = cms.readDefaultFile(targetRes, CmsResourceFilter.IGNORE_EXPIRATION);
if (targetRes == null) {
targetRes = getRoot();
}
}
CmsResourceUtil resUtil = new CmsResourceUtil(cms, getRoot());
title = resUtil.getTitle();
description = resUtil.getGalleryDescription(A_CmsUI.get().getLocale());
path = OpenCms.getLinkManager().getServerLink(
cms,
cms.getRequestContext().removeSiteRoot(targetRes.getRootPath()));
String iconClasses = CmsIconUtil.getIconClasses(
CmsIconUtil.getDisplayType(cms, getRoot()),
getRoot().getName(),
false);
ui.getSitemapExtension().showInfoHeader(title, description, path, locale, iconClasses);
} | java | private void showHeader() throws CmsException {
CmsSitemapUI ui = (CmsSitemapUI)A_CmsUI.get();
String title = null;
String description = null;
String path = null;
String locale = m_rootLocale.toString();
CmsObject cms = A_CmsUI.getCmsObject();
CmsResource targetRes = getRoot();
if (targetRes.isFolder()) {
targetRes = cms.readDefaultFile(targetRes, CmsResourceFilter.IGNORE_EXPIRATION);
if (targetRes == null) {
targetRes = getRoot();
}
}
CmsResourceUtil resUtil = new CmsResourceUtil(cms, getRoot());
title = resUtil.getTitle();
description = resUtil.getGalleryDescription(A_CmsUI.get().getLocale());
path = OpenCms.getLinkManager().getServerLink(
cms,
cms.getRequestContext().removeSiteRoot(targetRes.getRootPath()));
String iconClasses = CmsIconUtil.getIconClasses(
CmsIconUtil.getDisplayType(cms, getRoot()),
getRoot().getName(),
false);
ui.getSitemapExtension().showInfoHeader(title, description, path, locale, iconClasses);
} | [
"private",
"void",
"showHeader",
"(",
")",
"throws",
"CmsException",
"{",
"CmsSitemapUI",
"ui",
"=",
"(",
"CmsSitemapUI",
")",
"A_CmsUI",
".",
"get",
"(",
")",
";",
"String",
"title",
"=",
"null",
";",
"String",
"description",
"=",
"null",
";",
"String",
... | Shows the header for the currently selected sitemap root.<p>
@throws CmsException if something goes wrong | [
"Shows",
"the",
"header",
"for",
"the",
"currently",
"selected",
"sitemap",
"root",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/sitemap/CmsLocaleComparePanel.java#L438-L464 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java | WebConfigParamUtils.getLongInitParameter | public static long getLongInitParameter(ExternalContext context, String[] names, long defaultValue)
{
if (names == null)
{
throw new NullPointerException();
}
String param = null;
for (String name : names)
{
if (name == null)
{
throw new NullPointerException();
}
param = getStringInitParameter(context, name);
if (param != null)
{
break;
}
}
if (param == null)
{
return defaultValue;
}
else
{
return Long.parseLong(param.toLowerCase());
}
} | java | public static long getLongInitParameter(ExternalContext context, String[] names, long defaultValue)
{
if (names == null)
{
throw new NullPointerException();
}
String param = null;
for (String name : names)
{
if (name == null)
{
throw new NullPointerException();
}
param = getStringInitParameter(context, name);
if (param != null)
{
break;
}
}
if (param == null)
{
return defaultValue;
}
else
{
return Long.parseLong(param.toLowerCase());
}
} | [
"public",
"static",
"long",
"getLongInitParameter",
"(",
"ExternalContext",
"context",
",",
"String",
"[",
"]",
"names",
",",
"long",
"defaultValue",
")",
"{",
"if",
"(",
"names",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",... | Gets the long init parameter value from the specified context. If the parameter was not specified, the default
value is used instead.
@param context
the application's external context
@param names
the init parameter's names
@param defaultValue
the default value to return in case the parameter was not set
@return the init parameter value as a long
@throws NullPointerException
if context or name is <code>null</code> | [
"Gets",
"the",
"long",
"init",
"parameter",
"value",
"from",
"the",
"specified",
"context",
".",
"If",
"the",
"parameter",
"was",
"not",
"specified",
"the",
"default",
"value",
"is",
"used",
"instead",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java#L638-L667 |
ManfredTremmel/gwt-bean-validators | gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/data/domain/Sort.java | Sort.withDirection | private Sort withDirection(final Direction direction) {
return Sort.by(orders.stream().map(it -> new Order(direction, it.getProperty()))
.collect(Collectors.toList()));
} | java | private Sort withDirection(final Direction direction) {
return Sort.by(orders.stream().map(it -> new Order(direction, it.getProperty()))
.collect(Collectors.toList()));
} | [
"private",
"Sort",
"withDirection",
"(",
"final",
"Direction",
"direction",
")",
"{",
"return",
"Sort",
".",
"by",
"(",
"orders",
".",
"stream",
"(",
")",
".",
"map",
"(",
"it",
"->",
"new",
"Order",
"(",
"direction",
",",
"it",
".",
"getProperty",
"("... | Creates a new {@link Sort} with the current setup but the given order direction.
@param direction
@return | [
"Creates",
"a",
"new",
"{",
"@link",
"Sort",
"}",
"with",
"the",
"current",
"setup",
"but",
"the",
"given",
"order",
"direction",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/data/domain/Sort.java#L328-L332 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuStringUtil.java | GosuStringUtil.getNestedString | public static String getNestedString(String str, String open, String close) {
return substringBetween(str, open, close);
} | java | public static String getNestedString(String str, String open, String close) {
return substringBetween(str, open, close);
} | [
"public",
"static",
"String",
"getNestedString",
"(",
"String",
"str",
",",
"String",
"open",
",",
"String",
"close",
")",
"{",
"return",
"substringBetween",
"(",
"str",
",",
"open",
",",
"close",
")",
";",
"}"
] | <p>Gets the String that is nested in between two Strings.
Only the first match is returned.</p>
<p>A <code>null</code> input String returns <code>null</code>.
A <code>null</code> open/close returns <code>null</code> (no match).
An empty ("") open/close returns an empty string.</p>
<pre>
GosuStringUtil.getNestedString(null, *, *) = null
GosuStringUtil.getNestedString("", "", "") = ""
GosuStringUtil.getNestedString("", "", "tag") = null
GosuStringUtil.getNestedString("", "tag", "tag") = null
GosuStringUtil.getNestedString("yabcz", null, null) = null
GosuStringUtil.getNestedString("yabcz", "", "") = ""
GosuStringUtil.getNestedString("yabcz", "y", "z") = "abc"
GosuStringUtil.getNestedString("yabczyabcz", "y", "z") = "abc"
</pre>
@param str the String containing nested-string, may be null
@param open the String before nested-string, may be null
@param close the String after nested-string, may be null
@return the nested String, <code>null</code> if no match
@deprecated Use the better named {@link #substringBetween(String, String, String)}.
Method will be removed in Commons Lang 3.0. | [
"<p",
">",
"Gets",
"the",
"String",
"that",
"is",
"nested",
"in",
"between",
"two",
"Strings",
".",
"Only",
"the",
"first",
"match",
"is",
"returned",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L2051-L2053 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.listWorkerPoolSkusWithServiceResponseAsync | public Observable<ServiceResponse<Page<SkuInfoInner>>> listWorkerPoolSkusWithServiceResponseAsync(final String resourceGroupName, final String name, final String workerPoolName) {
return listWorkerPoolSkusSinglePageAsync(resourceGroupName, name, workerPoolName)
.concatMap(new Func1<ServiceResponse<Page<SkuInfoInner>>, Observable<ServiceResponse<Page<SkuInfoInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SkuInfoInner>>> call(ServiceResponse<Page<SkuInfoInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listWorkerPoolSkusNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<SkuInfoInner>>> listWorkerPoolSkusWithServiceResponseAsync(final String resourceGroupName, final String name, final String workerPoolName) {
return listWorkerPoolSkusSinglePageAsync(resourceGroupName, name, workerPoolName)
.concatMap(new Func1<ServiceResponse<Page<SkuInfoInner>>, Observable<ServiceResponse<Page<SkuInfoInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SkuInfoInner>>> call(ServiceResponse<Page<SkuInfoInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listWorkerPoolSkusNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"SkuInfoInner",
">",
">",
">",
"listWorkerPoolSkusWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
"String",
"workerPoolName",
")",
... | Get available SKUs for scaling a worker pool.
Get available SKUs for scaling a worker pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param workerPoolName Name of the worker pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SkuInfoInner> object | [
"Get",
"available",
"SKUs",
"for",
"scaling",
"a",
"worker",
"pool",
".",
"Get",
"available",
"SKUs",
"for",
"scaling",
"a",
"worker",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L6408-L6420 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Date.java | Date.valueOf | public static Date valueOf(String s) {
final int YEAR_LENGTH = 4;
final int MONTH_LENGTH = 2;
final int DAY_LENGTH = 2;
final int MAX_MONTH = 12;
final int MAX_DAY = 31;
int firstDash;
int secondDash;
Date d = null;
if (s == null) {
throw new java.lang.IllegalArgumentException();
}
firstDash = s.indexOf('-');
secondDash = s.indexOf('-', firstDash + 1);
if ((firstDash > 0) && (secondDash > 0) && (secondDash < s.length() - 1)) {
String yyyy = s.substring(0, firstDash);
String mm = s.substring(firstDash + 1, secondDash);
String dd = s.substring(secondDash + 1);
if (yyyy.length() == YEAR_LENGTH &&
(mm.length() >= 1 && mm.length() <= MONTH_LENGTH) &&
(dd.length() >= 1 && dd.length() <= DAY_LENGTH)) {
int year = Integer.parseInt(yyyy);
int month = Integer.parseInt(mm);
int day = Integer.parseInt(dd);
if ((month >= 1 && month <= MAX_MONTH) && (day >= 1 && day <= MAX_DAY)) {
d = new Date(year - 1900, month - 1, day);
}
}
}
if (d == null) {
throw new java.lang.IllegalArgumentException();
}
return d;
} | java | public static Date valueOf(String s) {
final int YEAR_LENGTH = 4;
final int MONTH_LENGTH = 2;
final int DAY_LENGTH = 2;
final int MAX_MONTH = 12;
final int MAX_DAY = 31;
int firstDash;
int secondDash;
Date d = null;
if (s == null) {
throw new java.lang.IllegalArgumentException();
}
firstDash = s.indexOf('-');
secondDash = s.indexOf('-', firstDash + 1);
if ((firstDash > 0) && (secondDash > 0) && (secondDash < s.length() - 1)) {
String yyyy = s.substring(0, firstDash);
String mm = s.substring(firstDash + 1, secondDash);
String dd = s.substring(secondDash + 1);
if (yyyy.length() == YEAR_LENGTH &&
(mm.length() >= 1 && mm.length() <= MONTH_LENGTH) &&
(dd.length() >= 1 && dd.length() <= DAY_LENGTH)) {
int year = Integer.parseInt(yyyy);
int month = Integer.parseInt(mm);
int day = Integer.parseInt(dd);
if ((month >= 1 && month <= MAX_MONTH) && (day >= 1 && day <= MAX_DAY)) {
d = new Date(year - 1900, month - 1, day);
}
}
}
if (d == null) {
throw new java.lang.IllegalArgumentException();
}
return d;
} | [
"public",
"static",
"Date",
"valueOf",
"(",
"String",
"s",
")",
"{",
"final",
"int",
"YEAR_LENGTH",
"=",
"4",
";",
"final",
"int",
"MONTH_LENGTH",
"=",
"2",
";",
"final",
"int",
"DAY_LENGTH",
"=",
"2",
";",
"final",
"int",
"MAX_MONTH",
"=",
"12",
";",
... | Converts a string in JDBC date escape format to
a <code>Date</code> value.
@param s a <code>String</code> object representing a date in
in the format "yyyy-[m]m-[d]d". The leading zero for <code>mm</code>
and <code>dd</code> may also be omitted.
@return a <code>java.sql.Date</code> object representing the
given date
@throws IllegalArgumentException if the date given is not in the
JDBC date escape format (yyyy-[m]m-[d]d) | [
"Converts",
"a",
"string",
"in",
"JDBC",
"date",
"escape",
"format",
"to",
"a",
"<code",
">",
"Date<",
"/",
"code",
">",
"value",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Date.java#L108-L147 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/dns/dns_stats.java | dns_stats.get_nitro_response | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
dns_stats[] resources = new dns_stats[1];
dns_response result = (dns_response) service.get_payload_formatter().string_to_resource(dns_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
resources[0] = result.dns;
return resources;
} | java | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
dns_stats[] resources = new dns_stats[1];
dns_response result = (dns_response) service.get_payload_formatter().string_to_resource(dns_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
resources[0] = result.dns;
return resources;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"dns_stats",
"[",
"]",
"resources",
"=",
"new",
"dns_stats",
"[",
"1",
"]",
";",
"dns_response",
"result",
... | <pre>
converts nitro response into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"converts",
"nitro",
"response",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/dns/dns_stats.java#L1177-L1196 |
javagl/ND | nd-distance/src/main/java/de/javagl/nd/distance/tuples/i/IntTupleDistanceFunctions.java | IntTupleDistanceFunctions.computeEuclidean | static double computeEuclidean(IntTuple t0, IntTuple t1)
{
return Math.sqrt(computeEuclideanSquared(t0, t1));
} | java | static double computeEuclidean(IntTuple t0, IntTuple t1)
{
return Math.sqrt(computeEuclideanSquared(t0, t1));
} | [
"static",
"double",
"computeEuclidean",
"(",
"IntTuple",
"t0",
",",
"IntTuple",
"t1",
")",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"computeEuclideanSquared",
"(",
"t0",
",",
"t1",
")",
")",
";",
"}"
] | Computes the Euclidean distance between the given arrays
@param t0 The first array
@param t1 The second array
@return The distance
@throws IllegalArgumentException If the given array do not
have the same length | [
"Computes",
"the",
"Euclidean",
"distance",
"between",
"the",
"given",
"arrays"
] | train | https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-distance/src/main/java/de/javagl/nd/distance/tuples/i/IntTupleDistanceFunctions.java#L183-L186 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/dynamic/support/ClassTypeInformation.java | ClassTypeInformation.getTypeVariableMap | private static Map<TypeVariable<?>, Type> getTypeVariableMap(Class<?> type) {
return getTypeVariableMap(type, new HashSet<Type>());
} | java | private static Map<TypeVariable<?>, Type> getTypeVariableMap(Class<?> type) {
return getTypeVariableMap(type, new HashSet<Type>());
} | [
"private",
"static",
"Map",
"<",
"TypeVariable",
"<",
"?",
">",
",",
"Type",
">",
"getTypeVariableMap",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"getTypeVariableMap",
"(",
"type",
",",
"new",
"HashSet",
"<",
"Type",
">",
"(",
")",
")",
... | Little helper to allow us to create a generified map, actually just to satisfy the compiler.
@param type must not be {@literal null}.
@return | [
"Little",
"helper",
"to",
"allow",
"us",
"to",
"create",
"a",
"generified",
"map",
"actually",
"just",
"to",
"satisfy",
"the",
"compiler",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/support/ClassTypeInformation.java#L132-L134 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java | SqlExecutor.query | public static <T> T query(Connection conn, String sql, RsHandler<T> rsh, Object... params) throws SQLException {
PreparedStatement ps = null;
try {
ps = StatementUtil.prepareStatement(conn, sql, params);
return executeQuery(ps, rsh);
} finally {
DbUtil.close(ps);
}
} | java | public static <T> T query(Connection conn, String sql, RsHandler<T> rsh, Object... params) throws SQLException {
PreparedStatement ps = null;
try {
ps = StatementUtil.prepareStatement(conn, sql, params);
return executeQuery(ps, rsh);
} finally {
DbUtil.close(ps);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"query",
"(",
"Connection",
"conn",
",",
"String",
"sql",
",",
"RsHandler",
"<",
"T",
">",
"rsh",
",",
"Object",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"PreparedStatement",
"ps",
"=",
"null",
";",
"... | 执行查询语句<br>
此方法不会关闭Connection
@param <T> 处理结果类型
@param conn 数据库连接对象
@param sql 查询语句
@param rsh 结果集处理对象
@param params 参数
@return 结果对象
@throws SQLException SQL执行异常 | [
"执行查询语句<br",
">",
"此方法不会关闭Connection"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L258-L266 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.rebootWorkerAsync | public Observable<Void> rebootWorkerAsync(String resourceGroupName, String name, String workerName) {
return rebootWorkerWithServiceResponseAsync(resourceGroupName, name, workerName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> rebootWorkerAsync(String resourceGroupName, String name, String workerName) {
return rebootWorkerWithServiceResponseAsync(resourceGroupName, name, workerName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"rebootWorkerAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"workerName",
")",
"{",
"return",
"rebootWorkerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"workerName",... | Reboot a worker machine in an App Service plan.
Reboot a worker machine in an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@param workerName Name of worker machine, which typically starts with RD.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Reboot",
"a",
"worker",
"machine",
"in",
"an",
"App",
"Service",
"plan",
".",
"Reboot",
"a",
"worker",
"machine",
"in",
"an",
"App",
"Service",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L3951-L3958 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/ws/webcontainer31/util/UpgradeInputByteBufferUtil.java | UpgradeInputByteBufferUtil.validate | private void validate() throws IOException {
if (null != _error) {
throw _error;
}
if(!_isReadLine && !_isReady){
//If there is no data available then isReady will have returned false and this throw an IllegalStateException
if (TraceComponent.isAnyTracingEnabled() && tc.isErrorEnabled())
Tr.error(tc, "read.failed.isReady.false");
throw new IllegalStateException(Tr.formatMessage(tc, "read.failed.isReady.false"));
}
} | java | private void validate() throws IOException {
if (null != _error) {
throw _error;
}
if(!_isReadLine && !_isReady){
//If there is no data available then isReady will have returned false and this throw an IllegalStateException
if (TraceComponent.isAnyTracingEnabled() && tc.isErrorEnabled())
Tr.error(tc, "read.failed.isReady.false");
throw new IllegalStateException(Tr.formatMessage(tc, "read.failed.isReady.false"));
}
} | [
"private",
"void",
"validate",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"null",
"!=",
"_error",
")",
"{",
"throw",
"_error",
";",
"}",
"if",
"(",
"!",
"_isReadLine",
"&&",
"!",
"_isReady",
")",
"{",
"//If there is no data available then isReady will ... | This checks if we have already had an exception thrown. If so it just rethrows that exception
This check is done before any reads are done
@throws IOException | [
"This",
"checks",
"if",
"we",
"have",
"already",
"had",
"an",
"exception",
"thrown",
".",
"If",
"so",
"it",
"just",
"rethrows",
"that",
"exception",
"This",
"check",
"is",
"done",
"before",
"any",
"reads",
"are",
"done"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/ws/webcontainer31/util/UpgradeInputByteBufferUtil.java#L309-L320 |
stripe/stripe-android | stripe/src/main/java/com/stripe/android/Stripe.java | Stripe.createAccountTokenSynchronous | @Nullable
public Token createAccountTokenSynchronous(@NonNull final AccountParams accountParams)
throws AuthenticationException,
InvalidRequestException,
APIConnectionException,
APIException {
return createAccountTokenSynchronous(accountParams, mDefaultPublishableKey);
} | java | @Nullable
public Token createAccountTokenSynchronous(@NonNull final AccountParams accountParams)
throws AuthenticationException,
InvalidRequestException,
APIConnectionException,
APIException {
return createAccountTokenSynchronous(accountParams, mDefaultPublishableKey);
} | [
"@",
"Nullable",
"public",
"Token",
"createAccountTokenSynchronous",
"(",
"@",
"NonNull",
"final",
"AccountParams",
"accountParams",
")",
"throws",
"AuthenticationException",
",",
"InvalidRequestException",
",",
"APIConnectionException",
",",
"APIException",
"{",
"return",
... | Blocking method to create a {@link Token} for a Connect Account. Do not call this on the UI
thread or your app will crash. The method uses the currently set
{@link #mDefaultPublishableKey}.
@param accountParams params to use for this token.
@return a {@link Token} that can be used for this account.
@throws AuthenticationException failure to properly authenticate yourself (check your key)
@throws InvalidRequestException your request has invalid parameters
@throws APIConnectionException failure to connect to Stripe's API
@throws APIException any other type of problem (for instance, a temporary issue with
Stripe's servers) | [
"Blocking",
"method",
"to",
"create",
"a",
"{",
"@link",
"Token",
"}",
"for",
"a",
"Connect",
"Account",
".",
"Do",
"not",
"call",
"this",
"on",
"the",
"UI",
"thread",
"or",
"your",
"app",
"will",
"crash",
".",
"The",
"method",
"uses",
"the",
"currentl... | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/Stripe.java#L689-L696 |
apache/flink | flink-core/src/main/java/org/apache/flink/util/Preconditions.java | Preconditions.checkState | public static void checkState(boolean condition,
@Nullable String errorMessageTemplate,
@Nullable Object... errorMessageArgs) {
if (!condition) {
throw new IllegalStateException(format(errorMessageTemplate, errorMessageArgs));
}
} | java | public static void checkState(boolean condition,
@Nullable String errorMessageTemplate,
@Nullable Object... errorMessageArgs) {
if (!condition) {
throw new IllegalStateException(format(errorMessageTemplate, errorMessageArgs));
}
} | [
"public",
"static",
"void",
"checkState",
"(",
"boolean",
"condition",
",",
"@",
"Nullable",
"String",
"errorMessageTemplate",
",",
"@",
"Nullable",
"Object",
"...",
"errorMessageArgs",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"IllegalS... | Checks the given boolean condition, and throws an {@code IllegalStateException} if
the condition is not met (evaluates to {@code false}).
@param condition The condition to check
@param errorMessageTemplate The message template for the {@code IllegalStateException}
that is thrown if the check fails. The template substitutes its
{@code %s} placeholders with the error message arguments.
@param errorMessageArgs The arguments for the error message, to be inserted into the
message template for the {@code %s} placeholders.
@throws IllegalStateException Thrown, if the condition is violated. | [
"Checks",
"the",
"given",
"boolean",
"condition",
"and",
"throws",
"an",
"{",
"@code",
"IllegalStateException",
"}",
"if",
"the",
"condition",
"is",
"not",
"met",
"(",
"evaluates",
"to",
"{",
"@code",
"false",
"}",
")",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/Preconditions.java#L212-L219 |
lessthanoptimal/BoofCV | main/boofcv-simulation/src/main/java/boofcv/simulation/SimulatePlanarWorld.java | SimulatePlanarWorld.computePixel | public void computePixel(int which, double x, double y, Point2D_F64 output) {
SurfaceRect r = scene.get(which);
Point3D_F64 p3 = new Point3D_F64(-x,-y,0);
SePointOps_F64.transform(r.rectToCamera, p3, p3);
// unit sphere
p3.scale(1.0/p3.norm());
sphereToPixel.compute(p3.x,p3.y,p3.z,output);
} | java | public void computePixel(int which, double x, double y, Point2D_F64 output) {
SurfaceRect r = scene.get(which);
Point3D_F64 p3 = new Point3D_F64(-x,-y,0);
SePointOps_F64.transform(r.rectToCamera, p3, p3);
// unit sphere
p3.scale(1.0/p3.norm());
sphereToPixel.compute(p3.x,p3.y,p3.z,output);
} | [
"public",
"void",
"computePixel",
"(",
"int",
"which",
",",
"double",
"x",
",",
"double",
"y",
",",
"Point2D_F64",
"output",
")",
"{",
"SurfaceRect",
"r",
"=",
"scene",
".",
"get",
"(",
"which",
")",
";",
"Point3D_F64",
"p3",
"=",
"new",
"Point3D_F64",
... | Project a point which lies on the 2D planar polygon's surface onto the rendered image | [
"Project",
"a",
"point",
"which",
"lies",
"on",
"the",
"2D",
"planar",
"polygon",
"s",
"surface",
"onto",
"the",
"rendered",
"image"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-simulation/src/main/java/boofcv/simulation/SimulatePlanarWorld.java#L307-L317 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.rebootInstance | public void rebootInstance(String instanceId, boolean forceStop) {
this.rebootInstance(new RebootInstanceRequest().withInstanceId(instanceId).withForceStop(forceStop));
} | java | public void rebootInstance(String instanceId, boolean forceStop) {
this.rebootInstance(new RebootInstanceRequest().withInstanceId(instanceId).withForceStop(forceStop));
} | [
"public",
"void",
"rebootInstance",
"(",
"String",
"instanceId",
",",
"boolean",
"forceStop",
")",
"{",
"this",
".",
"rebootInstance",
"(",
"new",
"RebootInstanceRequest",
"(",
")",
".",
"withInstanceId",
"(",
"instanceId",
")",
".",
"withForceStop",
"(",
"force... | Rebooting the instance owned by the user.
You can reboot the instance only when the instance is Running,
otherwise,it's will get <code>409</code> errorCode.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getInstance(GetInstanceRequest)}
@param instanceId The id of the instance.
@param forceStop The option param to stop the instance forcibly.If <code>true</code>,
it will stop the instance just like power off immediately
and it may result int losing important data which have not written to disk. | [
"Rebooting",
"the",
"instance",
"owned",
"by",
"the",
"user",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L480-L482 |
alkacon/opencms-core | src/org/opencms/xml/CmsXmlContentDefinition.java | CmsXmlContentDefinition.getCachedContentDefinition | private static CmsXmlContentDefinition getCachedContentDefinition(String schemaLocation, EntityResolver resolver) {
if (resolver instanceof CmsXmlEntityResolver) {
// check for a cached version of this content definition
CmsXmlEntityResolver cmsResolver = (CmsXmlEntityResolver)resolver;
return cmsResolver.getCachedContentDefinition(schemaLocation);
}
return null;
} | java | private static CmsXmlContentDefinition getCachedContentDefinition(String schemaLocation, EntityResolver resolver) {
if (resolver instanceof CmsXmlEntityResolver) {
// check for a cached version of this content definition
CmsXmlEntityResolver cmsResolver = (CmsXmlEntityResolver)resolver;
return cmsResolver.getCachedContentDefinition(schemaLocation);
}
return null;
} | [
"private",
"static",
"CmsXmlContentDefinition",
"getCachedContentDefinition",
"(",
"String",
"schemaLocation",
",",
"EntityResolver",
"resolver",
")",
"{",
"if",
"(",
"resolver",
"instanceof",
"CmsXmlEntityResolver",
")",
"{",
"// check for a cached version of this content defi... | Looks up the given XML content definition system id in the internal content definition cache.<p>
@param schemaLocation the system id of the XML content definition to look up
@param resolver the XML entity resolver to use (contains the cache)
@return the XML content definition found, or null if no definition is cached for the given system id | [
"Looks",
"up",
"the",
"given",
"XML",
"content",
"definition",
"system",
"id",
"in",
"the",
"internal",
"content",
"definition",
"cache",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlContentDefinition.java#L861-L869 |
keyboardsurfer/Crouton | library/src/main/java/de/keyboardsurfer/android/widget/crouton/Manager.java | Manager.removeCrouton | protected void removeCrouton(Crouton crouton) {
// If the crouton hasn't been displayed yet a `Crouton.hide()` will fail to hide
// it since the DISPLAY message might still be in the queue. Remove all messages
// for this crouton.
removeAllMessagesForCrouton(crouton);
View croutonView = crouton.getView();
ViewGroup croutonParentView = (ViewGroup) croutonView.getParent();
if (null != croutonParentView) {
croutonView.startAnimation(crouton.getOutAnimation());
// Remove the Crouton from the queue.
Crouton removed = croutonQueue.poll();
// Remove the crouton from the view's parent.
croutonParentView.removeView(croutonView);
if (null != removed) {
removed.detachActivity();
removed.detachViewGroup();
if (null != removed.getLifecycleCallback()) {
removed.getLifecycleCallback().onRemoved();
}
removed.detachLifecycleCallback();
}
// Send a message to display the next crouton but delay it by the out
// animation duration to make sure it finishes
sendMessageDelayed(crouton, Messages.DISPLAY_CROUTON, crouton.getOutAnimation().getDuration());
}
} | java | protected void removeCrouton(Crouton crouton) {
// If the crouton hasn't been displayed yet a `Crouton.hide()` will fail to hide
// it since the DISPLAY message might still be in the queue. Remove all messages
// for this crouton.
removeAllMessagesForCrouton(crouton);
View croutonView = crouton.getView();
ViewGroup croutonParentView = (ViewGroup) croutonView.getParent();
if (null != croutonParentView) {
croutonView.startAnimation(crouton.getOutAnimation());
// Remove the Crouton from the queue.
Crouton removed = croutonQueue.poll();
// Remove the crouton from the view's parent.
croutonParentView.removeView(croutonView);
if (null != removed) {
removed.detachActivity();
removed.detachViewGroup();
if (null != removed.getLifecycleCallback()) {
removed.getLifecycleCallback().onRemoved();
}
removed.detachLifecycleCallback();
}
// Send a message to display the next crouton but delay it by the out
// animation duration to make sure it finishes
sendMessageDelayed(crouton, Messages.DISPLAY_CROUTON, crouton.getOutAnimation().getDuration());
}
} | [
"protected",
"void",
"removeCrouton",
"(",
"Crouton",
"crouton",
")",
"{",
"// If the crouton hasn't been displayed yet a `Crouton.hide()` will fail to hide",
"// it since the DISPLAY message might still be in the queue. Remove all messages",
"// for this crouton.",
"removeAllMessagesForCrouto... | Removes the {@link Crouton}'s view after it's display
durationInMilliseconds.
@param crouton
The {@link Crouton} added to a {@link ViewGroup} and should be
removed. | [
"Removes",
"the",
"{",
"@link",
"Crouton",
"}",
"s",
"view",
"after",
"it",
"s",
"display",
"durationInMilliseconds",
"."
] | train | https://github.com/keyboardsurfer/Crouton/blob/7806b15e4d52793e1f5aeaa4a55b1e220289e619/library/src/main/java/de/keyboardsurfer/android/widget/crouton/Manager.java#L295-L325 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/miner/ControlsStateChangeDetailedMiner.java | ControlsStateChangeDetailedMiner.getValue | @Override
public String getValue(Match m, int col)
{
switch(col)
{
case 0:
{
return getGeneSymbol(m, "controller ER");
}
case 1:
{
return concat(getModifications(m, "controller simple PE", "controller PE"), " ");
}
case 2:
{
return getGeneSymbol(m, "changed ER");
}
case 3:
{
return concat(getDeltaModifications(m,
"input simple PE", "input PE", "output simple PE", "output PE")[0], " ");
}
case 4:
{
return concat(getDeltaModifications(m,
"input simple PE", "input PE", "output simple PE", "output PE")[1], " ");
}
default: throw new RuntimeException("Invalid col number: " + col);
}
} | java | @Override
public String getValue(Match m, int col)
{
switch(col)
{
case 0:
{
return getGeneSymbol(m, "controller ER");
}
case 1:
{
return concat(getModifications(m, "controller simple PE", "controller PE"), " ");
}
case 2:
{
return getGeneSymbol(m, "changed ER");
}
case 3:
{
return concat(getDeltaModifications(m,
"input simple PE", "input PE", "output simple PE", "output PE")[0], " ");
}
case 4:
{
return concat(getDeltaModifications(m,
"input simple PE", "input PE", "output simple PE", "output PE")[1], " ");
}
default: throw new RuntimeException("Invalid col number: " + col);
}
} | [
"@",
"Override",
"public",
"String",
"getValue",
"(",
"Match",
"m",
",",
"int",
"col",
")",
"{",
"switch",
"(",
"col",
")",
"{",
"case",
"0",
":",
"{",
"return",
"getGeneSymbol",
"(",
"m",
",",
"\"controller ER\"",
")",
";",
"}",
"case",
"1",
":",
... | Creates values for the result file columns.
@param m current match
@param col current column
@return value of the given match at the given column | [
"Creates",
"values",
"for",
"the",
"result",
"file",
"columns",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/ControlsStateChangeDetailedMiner.java#L71-L100 |
indeedeng/proctor | proctor-common/src/main/java/com/indeed/proctor/common/ProctorUtils.java | ProctorUtils.generateSpecification | public static TestSpecification generateSpecification(@Nonnull final TestDefinition testDefinition) {
final TestSpecification testSpecification = new TestSpecification();
// Sort buckets by value ascending
final Map<String,Integer> buckets = Maps.newLinkedHashMap();
final List<TestBucket> testDefinitionBuckets = Ordering.from(new Comparator<TestBucket>() {
@Override
public int compare(final TestBucket lhs, final TestBucket rhs) {
return Ints.compare(lhs.getValue(), rhs.getValue());
}
}).immutableSortedCopy(testDefinition.getBuckets());
int fallbackValue = -1;
if(testDefinitionBuckets.size() > 0) {
final TestBucket firstBucket = testDefinitionBuckets.get(0);
fallbackValue = firstBucket.getValue(); // buckets are sorted, choose smallest value as the fallback value
final PayloadSpecification payloadSpecification = new PayloadSpecification();
if(firstBucket.getPayload() != null && !firstBucket.getPayload().equals(Payload.EMPTY_PAYLOAD)) {
final PayloadType payloadType = PayloadType.payloadTypeForName(firstBucket.getPayload().fetchType());
payloadSpecification.setType(payloadType.payloadTypeName);
if (payloadType == PayloadType.MAP) {
final Map<String, String> payloadSpecificationSchema = new HashMap<String, String>();
for (Map.Entry<String, Object> entry : firstBucket.getPayload().getMap().entrySet()) {
payloadSpecificationSchema.put(entry.getKey(), PayloadType.payloadTypeForValue(entry.getValue()).payloadTypeName);
}
payloadSpecification.setSchema(payloadSpecificationSchema);
}
testSpecification.setPayload(payloadSpecification);
}
for (int i = 0; i < testDefinitionBuckets.size(); i++) {
final TestBucket bucket = testDefinitionBuckets.get(i);
buckets.put(bucket.getName(), bucket.getValue());
}
}
testSpecification.setBuckets(buckets);
testSpecification.setDescription(testDefinition.getDescription());
testSpecification.setFallbackValue(fallbackValue);
return testSpecification;
} | java | public static TestSpecification generateSpecification(@Nonnull final TestDefinition testDefinition) {
final TestSpecification testSpecification = new TestSpecification();
// Sort buckets by value ascending
final Map<String,Integer> buckets = Maps.newLinkedHashMap();
final List<TestBucket> testDefinitionBuckets = Ordering.from(new Comparator<TestBucket>() {
@Override
public int compare(final TestBucket lhs, final TestBucket rhs) {
return Ints.compare(lhs.getValue(), rhs.getValue());
}
}).immutableSortedCopy(testDefinition.getBuckets());
int fallbackValue = -1;
if(testDefinitionBuckets.size() > 0) {
final TestBucket firstBucket = testDefinitionBuckets.get(0);
fallbackValue = firstBucket.getValue(); // buckets are sorted, choose smallest value as the fallback value
final PayloadSpecification payloadSpecification = new PayloadSpecification();
if(firstBucket.getPayload() != null && !firstBucket.getPayload().equals(Payload.EMPTY_PAYLOAD)) {
final PayloadType payloadType = PayloadType.payloadTypeForName(firstBucket.getPayload().fetchType());
payloadSpecification.setType(payloadType.payloadTypeName);
if (payloadType == PayloadType.MAP) {
final Map<String, String> payloadSpecificationSchema = new HashMap<String, String>();
for (Map.Entry<String, Object> entry : firstBucket.getPayload().getMap().entrySet()) {
payloadSpecificationSchema.put(entry.getKey(), PayloadType.payloadTypeForValue(entry.getValue()).payloadTypeName);
}
payloadSpecification.setSchema(payloadSpecificationSchema);
}
testSpecification.setPayload(payloadSpecification);
}
for (int i = 0; i < testDefinitionBuckets.size(); i++) {
final TestBucket bucket = testDefinitionBuckets.get(i);
buckets.put(bucket.getName(), bucket.getValue());
}
}
testSpecification.setBuckets(buckets);
testSpecification.setDescription(testDefinition.getDescription());
testSpecification.setFallbackValue(fallbackValue);
return testSpecification;
} | [
"public",
"static",
"TestSpecification",
"generateSpecification",
"(",
"@",
"Nonnull",
"final",
"TestDefinition",
"testDefinition",
")",
"{",
"final",
"TestSpecification",
"testSpecification",
"=",
"new",
"TestSpecification",
"(",
")",
";",
"// Sort buckets by value ascendi... | Generates a usable test specification for a given test definition
Uses the first bucket as the fallback value
@param testDefinition a {@link TestDefinition}
@return a {@link TestSpecification} which corresponding to given test definition. | [
"Generates",
"a",
"usable",
"test",
"specification",
"for",
"a",
"given",
"test",
"definition",
"Uses",
"the",
"first",
"bucket",
"as",
"the",
"fallback",
"value"
] | train | https://github.com/indeedeng/proctor/blob/b7795acfc26a30d013655d0e0fa1d3f8d0576571/proctor-common/src/main/java/com/indeed/proctor/common/ProctorUtils.java#L924-L962 |
googleads/googleads-java-lib | modules/ads_lib_appengine/src/main/java/com/google/api/ads/common/lib/soap/jaxws/JaxWsHandler.java | JaxWsHandler.getHeader | @Override
public Object getHeader(BindingProvider soapClient, String headerName) {
for (SOAPElement addedHeader : getContextHandlerFromClient(soapClient).getAddedHeaders()) {
if (addedHeader.getNodeName().equals(headerName)) {
return addedHeader;
}
}
return null;
} | java | @Override
public Object getHeader(BindingProvider soapClient, String headerName) {
for (SOAPElement addedHeader : getContextHandlerFromClient(soapClient).getAddedHeaders()) {
if (addedHeader.getNodeName().equals(headerName)) {
return addedHeader;
}
}
return null;
} | [
"@",
"Override",
"public",
"Object",
"getHeader",
"(",
"BindingProvider",
"soapClient",
",",
"String",
"headerName",
")",
"{",
"for",
"(",
"SOAPElement",
"addedHeader",
":",
"getContextHandlerFromClient",
"(",
"soapClient",
")",
".",
"getAddedHeaders",
"(",
")",
"... | Returns a SOAP header from the given SOAP client, if it exists.
@param soapClient the SOAP client to check for the given header
@param headerName the name of the header being looked for
@return the header element, if it exists | [
"Returns",
"a",
"SOAP",
"header",
"from",
"the",
"given",
"SOAP",
"client",
"if",
"it",
"exists",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib_appengine/src/main/java/com/google/api/ads/common/lib/soap/jaxws/JaxWsHandler.java#L85-L93 |
tempodb/tempodb-java | src/main/java/com/tempodb/Client.java | Client.readMultiRollupDataPoints | public Cursor<MultiDataPoint> readMultiRollupDataPoints(Series series, Interval interval, DateTimeZone timezone, MultiRollup rollup, Interpolation interpolation) {
checkNotNull(series);
checkNotNull(interval);
checkNotNull(timezone);
checkNotNull(rollup);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/data/rollups/segment/", API_VERSION, urlencode(series.getKey())));
addInterpolationToURI(builder, interpolation);
addIntervalToURI(builder, interval);
addMultiRollupToURI(builder, rollup);
addTimeZoneToURI(builder, timezone);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s, rollup: %s, timezone: %s", series.getKey(), interval, rollup, timezone);
throw new IllegalArgumentException(message, e);
}
Cursor<MultiDataPoint> cursor = new MultiRollupDataPointCursor(uri, this);
return cursor;
} | java | public Cursor<MultiDataPoint> readMultiRollupDataPoints(Series series, Interval interval, DateTimeZone timezone, MultiRollup rollup, Interpolation interpolation) {
checkNotNull(series);
checkNotNull(interval);
checkNotNull(timezone);
checkNotNull(rollup);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/data/rollups/segment/", API_VERSION, urlencode(series.getKey())));
addInterpolationToURI(builder, interpolation);
addIntervalToURI(builder, interval);
addMultiRollupToURI(builder, rollup);
addTimeZoneToURI(builder, timezone);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s, rollup: %s, timezone: %s", series.getKey(), interval, rollup, timezone);
throw new IllegalArgumentException(message, e);
}
Cursor<MultiDataPoint> cursor = new MultiRollupDataPointCursor(uri, this);
return cursor;
} | [
"public",
"Cursor",
"<",
"MultiDataPoint",
">",
"readMultiRollupDataPoints",
"(",
"Series",
"series",
",",
"Interval",
"interval",
",",
"DateTimeZone",
"timezone",
",",
"MultiRollup",
"rollup",
",",
"Interpolation",
"interpolation",
")",
"{",
"checkNotNull",
"(",
"s... | Returns a cursor of datapoints specified by series with multiple rollups.
@param series The series
@param interval An interval of time for the query (start/end datetimes)
@param timezone The time zone for the returned datapoints.
@param rollup The MultiRollup for the read query.
@param interpolation The interpolation for the read query. This can be null.
@return A Cursor of DataPoints. The cursor.iterator().next() may throw a {@link TempoDBException} if an error occurs while making a request.
@see Cursor
@see MultiRollup
@since 1.0.0 | [
"Returns",
"a",
"cursor",
"of",
"datapoints",
"specified",
"by",
"series",
"with",
"multiple",
"rollups",
"."
] | train | https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L725-L746 |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java | DeploymentResourceSupport.getOrCreateSubDeployment | static Resource getOrCreateSubDeployment(final String deploymentName, final DeploymentUnit parent) {
final Resource root = parent.getAttachment(DEPLOYMENT_RESOURCE);
return getOrCreate(root, PathElement.pathElement(SUBDEPLOYMENT, deploymentName));
} | java | static Resource getOrCreateSubDeployment(final String deploymentName, final DeploymentUnit parent) {
final Resource root = parent.getAttachment(DEPLOYMENT_RESOURCE);
return getOrCreate(root, PathElement.pathElement(SUBDEPLOYMENT, deploymentName));
} | [
"static",
"Resource",
"getOrCreateSubDeployment",
"(",
"final",
"String",
"deploymentName",
",",
"final",
"DeploymentUnit",
"parent",
")",
"{",
"final",
"Resource",
"root",
"=",
"parent",
".",
"getAttachment",
"(",
"DEPLOYMENT_RESOURCE",
")",
";",
"return",
"getOrCr... | Gets or creates the a resource for the sub-deployment on the parent deployments resource.
@param deploymentName the name of the deployment
@param parent the parent deployment used to find the parent resource
@return the already registered resource or a newly created resource | [
"Gets",
"or",
"creates",
"the",
"a",
"resource",
"for",
"the",
"sub",
"-",
"deployment",
"on",
"the",
"parent",
"deployments",
"resource",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java#L231-L234 |
Talend/tesb-rt-se | sam/sam-agent/src/main/java/org/talend/esb/sam/agent/feature/EventFeatureImpl.java | EventFeatureImpl.detectWSAddressingFeature | private boolean detectWSAddressingFeature(InterceptorProvider provider, Bus bus) {
//detect on the bus level
if (bus.getFeatures() != null) {
Iterator<Feature> busFeatures = bus.getFeatures().iterator();
while (busFeatures.hasNext()) {
Feature busFeature = busFeatures.next();
if (busFeature instanceof WSAddressingFeature) {
return true;
}
}
}
//detect on the endpoint/client level
Iterator<Interceptor<? extends Message>> interceptors = provider.getInInterceptors().iterator();
while (interceptors.hasNext()) {
Interceptor<? extends Message> ic = interceptors.next();
if (ic instanceof MAPAggregator) {
return true;
}
}
return false;
} | java | private boolean detectWSAddressingFeature(InterceptorProvider provider, Bus bus) {
//detect on the bus level
if (bus.getFeatures() != null) {
Iterator<Feature> busFeatures = bus.getFeatures().iterator();
while (busFeatures.hasNext()) {
Feature busFeature = busFeatures.next();
if (busFeature instanceof WSAddressingFeature) {
return true;
}
}
}
//detect on the endpoint/client level
Iterator<Interceptor<? extends Message>> interceptors = provider.getInInterceptors().iterator();
while (interceptors.hasNext()) {
Interceptor<? extends Message> ic = interceptors.next();
if (ic instanceof MAPAggregator) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"detectWSAddressingFeature",
"(",
"InterceptorProvider",
"provider",
",",
"Bus",
"bus",
")",
"{",
"//detect on the bus level",
"if",
"(",
"bus",
".",
"getFeatures",
"(",
")",
"!=",
"null",
")",
"{",
"Iterator",
"<",
"Feature",
">",
"busFeat... | detect if WS Addressing feature already enabled.
@param provider the interceptor provider
@param bus the bus
@return true, if successful | [
"detect",
"if",
"WS",
"Addressing",
"feature",
"already",
"enabled",
"."
] | train | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/sam/sam-agent/src/main/java/org/talend/esb/sam/agent/feature/EventFeatureImpl.java#L181-L203 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/GridBy.java | GridBy.getXPathForHeaderRowByHeaders | public static String getXPathForHeaderRowByHeaders(String columnName, String... extraColumnNames) {
String allHeadersPresent;
if (extraColumnNames != null && extraColumnNames.length > 0) {
int extraCount = extraColumnNames.length;
String[] columnNames = new String[extraCount + 1];
columnNames[0] = columnName;
System.arraycopy(extraColumnNames, 0, columnNames, 1, extraCount);
allHeadersPresent = Stream.of(columnNames)
.map(GridBy::getXPathForHeaderCellWithText)
.collect(Collectors.joining(" and "));
} else {
allHeadersPresent = getXPathForHeaderCellWithText(columnName);
}
return String.format("/tr[%1$s]", allHeadersPresent);
} | java | public static String getXPathForHeaderRowByHeaders(String columnName, String... extraColumnNames) {
String allHeadersPresent;
if (extraColumnNames != null && extraColumnNames.length > 0) {
int extraCount = extraColumnNames.length;
String[] columnNames = new String[extraCount + 1];
columnNames[0] = columnName;
System.arraycopy(extraColumnNames, 0, columnNames, 1, extraCount);
allHeadersPresent = Stream.of(columnNames)
.map(GridBy::getXPathForHeaderCellWithText)
.collect(Collectors.joining(" and "));
} else {
allHeadersPresent = getXPathForHeaderCellWithText(columnName);
}
return String.format("/tr[%1$s]", allHeadersPresent);
} | [
"public",
"static",
"String",
"getXPathForHeaderRowByHeaders",
"(",
"String",
"columnName",
",",
"String",
"...",
"extraColumnNames",
")",
"{",
"String",
"allHeadersPresent",
";",
"if",
"(",
"extraColumnNames",
"!=",
"null",
"&&",
"extraColumnNames",
".",
"length",
... | Creates an XPath expression that will find a header row, selecting the row based on the
header texts present.
@param columnName first header text which must be present.
@param extraColumnNames name of other header texts that must be present in table's header row.
@return XPath expression selecting a tr in the row | [
"Creates",
"an",
"XPath",
"expression",
"that",
"will",
"find",
"a",
"header",
"row",
"selecting",
"the",
"row",
"based",
"on",
"the",
"header",
"texts",
"present",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/GridBy.java#L89-L104 |
pravega/pravega | client/src/main/java/io/pravega/client/stream/ScalingPolicy.java | ScalingPolicy.byDataRate | public static ScalingPolicy byDataRate(int targetKBps, int scaleFactor, int minNumSegments) {
Preconditions.checkArgument(targetKBps > 0, "KBps should be > 0.");
Preconditions.checkArgument(scaleFactor > 0, "Scale factor should be > 0. Otherwise use fixed scaling policy.");
Preconditions.checkArgument(minNumSegments > 0, "Minimum number of segments should be > 0.");
return new ScalingPolicy(ScaleType.BY_RATE_IN_KBYTES_PER_SEC, targetKBps, scaleFactor, minNumSegments);
} | java | public static ScalingPolicy byDataRate(int targetKBps, int scaleFactor, int minNumSegments) {
Preconditions.checkArgument(targetKBps > 0, "KBps should be > 0.");
Preconditions.checkArgument(scaleFactor > 0, "Scale factor should be > 0. Otherwise use fixed scaling policy.");
Preconditions.checkArgument(minNumSegments > 0, "Minimum number of segments should be > 0.");
return new ScalingPolicy(ScaleType.BY_RATE_IN_KBYTES_PER_SEC, targetKBps, scaleFactor, minNumSegments);
} | [
"public",
"static",
"ScalingPolicy",
"byDataRate",
"(",
"int",
"targetKBps",
",",
"int",
"scaleFactor",
",",
"int",
"minNumSegments",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"targetKBps",
">",
"0",
",",
"\"KBps should be > 0.\"",
")",
";",
"Precondit... | Create a scaling policy to configure a stream to scale up and down according
to byte rate. Pravega scales a stream segment up in the case that one of these
conditions holds:
- The two-minute rate is greater than 5x the target rate
- The five-minute rate is greater than 2x the target rate
- The ten-minute rate is greater than the target rate
It scales a segment down (merges with a neighbor segment) in the case that
both these conditions hold:
- The two-, five-, ten-minute rate is smaller than the target rate
- The twenty-minute rate is smaller than half of the target rate
We additionally consider a cool-down period during which the segment is not
considered for scaling. This period is determined by the configuration
parameter autoScale.cooldownInSeconds; the default value is 10 minutes.
The scale factor bounds the number of new segments that can be created upon
a scaling event. In the case the controller computes the number of splits
to be greater than the scale factor for a given scale-up event, the number
of splits for the event is going to be equal to the scale factor.
The policy is configured with a minimum number of segments for a stream,
independent of the number of scale down events.
@param targetKBps Target rate in kilo bytes per second to enable scaling events
per segment.
@param scaleFactor Maximum number of splits of a segment for a scale-up event.
@param minNumSegments Minimum number of segments that a stream can have
independent of the number of scale down events.
@return Scaling policy object. | [
"Create",
"a",
"scaling",
"policy",
"to",
"configure",
"a",
"stream",
"to",
"scale",
"up",
"and",
"down",
"according",
"to",
"byte",
"rate",
".",
"Pravega",
"scales",
"a",
"stream",
"segment",
"up",
"in",
"the",
"case",
"that",
"one",
"of",
"these",
"con... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/ScalingPolicy.java#L139-L144 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/PropertySetProxy.java | PropertySetProxy.getProxy | public static <T extends Annotation> T getProxy(Class<T> propertySet, PropertyMap propertyMap)
{
assert propertySet != null && propertyMap != null;
if (!propertySet.isAnnotation())
throw new IllegalArgumentException(propertySet + " is not an annotation type");
return (T)Proxy.newProxyInstance(propertySet.getClassLoader(),
new Class [] {propertySet },
new PropertySetProxy(propertySet, propertyMap));
} | java | public static <T extends Annotation> T getProxy(Class<T> propertySet, PropertyMap propertyMap)
{
assert propertySet != null && propertyMap != null;
if (!propertySet.isAnnotation())
throw new IllegalArgumentException(propertySet + " is not an annotation type");
return (T)Proxy.newProxyInstance(propertySet.getClassLoader(),
new Class [] {propertySet },
new PropertySetProxy(propertySet, propertyMap));
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"getProxy",
"(",
"Class",
"<",
"T",
">",
"propertySet",
",",
"PropertyMap",
"propertyMap",
")",
"{",
"assert",
"propertySet",
"!=",
"null",
"&&",
"propertyMap",
"!=",
"null",
";",
"if",
"(",
... | Creates a new proxy instance implementing the PropertySet interface and backed
by the data from the property map.
@param propertySet an annotation type that has the PropertySet meta-annotation
@param propertyMap the PropertyMap containing property values backing the proxy
@return proxy that implements the PropertySet interface | [
"Creates",
"a",
"new",
"proxy",
"instance",
"implementing",
"the",
"PropertySet",
"interface",
"and",
"backed",
"by",
"the",
"data",
"from",
"the",
"property",
"map",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/PropertySetProxy.java#L52-L62 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java | JAXBAnnotationsHelper.applyAttribute | private static void applyAttribute(Annotated member, Schema property) {
final XmlAttribute attribute = member.getAnnotation(XmlAttribute.class);
if (attribute != null) {
final XML xml = getXml(property);
xml.setAttribute(true);
setName(attribute.namespace(), attribute.name(), property);
}
} | java | private static void applyAttribute(Annotated member, Schema property) {
final XmlAttribute attribute = member.getAnnotation(XmlAttribute.class);
if (attribute != null) {
final XML xml = getXml(property);
xml.setAttribute(true);
setName(attribute.namespace(), attribute.name(), property);
}
} | [
"private",
"static",
"void",
"applyAttribute",
"(",
"Annotated",
"member",
",",
"Schema",
"property",
")",
"{",
"final",
"XmlAttribute",
"attribute",
"=",
"member",
".",
"getAnnotation",
"(",
"XmlAttribute",
".",
"class",
")",
";",
"if",
"(",
"attribute",
"!="... | Puts definitions for XML attribute.
@param member annotations provider
@param property property instance to be updated | [
"Puts",
"definitions",
"for",
"XML",
"attribute",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java#L78-L85 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/converter/json/JsonStringToJsonIntermediateConverter.java | JsonStringToJsonIntermediateConverter.convertSchema | @Override
public JsonArray convertSchema(String inputSchema, WorkUnitState workUnit)
throws SchemaConversionException {
this.unpackComplexSchemas =
workUnit.getPropAsBoolean(UNPACK_COMPLEX_SCHEMAS_KEY, DEFAULT_UNPACK_COMPLEX_SCHEMAS_KEY);
JsonParser jsonParser = new JsonParser();
log.info("Schema: " + inputSchema);
JsonElement jsonSchema = jsonParser.parse(inputSchema);
return jsonSchema.getAsJsonArray();
} | java | @Override
public JsonArray convertSchema(String inputSchema, WorkUnitState workUnit)
throws SchemaConversionException {
this.unpackComplexSchemas =
workUnit.getPropAsBoolean(UNPACK_COMPLEX_SCHEMAS_KEY, DEFAULT_UNPACK_COMPLEX_SCHEMAS_KEY);
JsonParser jsonParser = new JsonParser();
log.info("Schema: " + inputSchema);
JsonElement jsonSchema = jsonParser.parse(inputSchema);
return jsonSchema.getAsJsonArray();
} | [
"@",
"Override",
"public",
"JsonArray",
"convertSchema",
"(",
"String",
"inputSchema",
",",
"WorkUnitState",
"workUnit",
")",
"throws",
"SchemaConversionException",
"{",
"this",
".",
"unpackComplexSchemas",
"=",
"workUnit",
".",
"getPropAsBoolean",
"(",
"UNPACK_COMPLEX_... | Take in an input schema of type string, the schema must be in JSON format
@return a JsonArray representation of the schema | [
"Take",
"in",
"an",
"input",
"schema",
"of",
"type",
"string",
"the",
"schema",
"must",
"be",
"in",
"JSON",
"format"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/converter/json/JsonStringToJsonIntermediateConverter.java#L62-L72 |
Ellzord/JALSE | src/main/java/jalse/actions/Actions.java | Actions.copy | public static <T> void copy(final ActionContext<T> source, final SchedulableActionContext<T> target) {
target.setActor(source.getActor());
target.putAll(source.toMap());
target.setInitialDelay(target.getInitialDelay(TimeUnit.NANOSECONDS), TimeUnit.NANOSECONDS);
target.setPeriod(source.getPeriod(TimeUnit.NANOSECONDS), TimeUnit.NANOSECONDS);
} | java | public static <T> void copy(final ActionContext<T> source, final SchedulableActionContext<T> target) {
target.setActor(source.getActor());
target.putAll(source.toMap());
target.setInitialDelay(target.getInitialDelay(TimeUnit.NANOSECONDS), TimeUnit.NANOSECONDS);
target.setPeriod(source.getPeriod(TimeUnit.NANOSECONDS), TimeUnit.NANOSECONDS);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"copy",
"(",
"final",
"ActionContext",
"<",
"T",
">",
"source",
",",
"final",
"SchedulableActionContext",
"<",
"T",
">",
"target",
")",
"{",
"target",
".",
"setActor",
"(",
"source",
".",
"getActor",
"(",
")",
... | Copies context information to a target context (actor, bindings, initial delay and period).
@param source
Source context.
@param target
Target context. | [
"Copies",
"context",
"information",
"to",
"a",
"target",
"context",
"(",
"actor",
"bindings",
"initial",
"delay",
"and",
"period",
")",
"."
] | train | https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/actions/Actions.java#L39-L44 |
allcolor/YaHP-Converter | YaHPConverter/src/org/allcolor/yahp/converter/CClassLoader.java | CClassLoader.addClass | public final void addClass(final String className, final URL urlToClass) {
if ((className == null) || (urlToClass == null)) {
return;
}
if (!this.classesMap.containsKey(className)) {
this.classesMap.put(className, urlToClass);
}
} | java | public final void addClass(final String className, final URL urlToClass) {
if ((className == null) || (urlToClass == null)) {
return;
}
if (!this.classesMap.containsKey(className)) {
this.classesMap.put(className, urlToClass);
}
} | [
"public",
"final",
"void",
"addClass",
"(",
"final",
"String",
"className",
",",
"final",
"URL",
"urlToClass",
")",
"{",
"if",
"(",
"(",
"className",
"==",
"null",
")",
"||",
"(",
"urlToClass",
"==",
"null",
")",
")",
"{",
"return",
";",
"}",
"if",
"... | add a class to known class
@param className
class name
@param urlToClass
url to class file | [
"add",
"a",
"class",
"to",
"known",
"class"
] | train | https://github.com/allcolor/YaHP-Converter/blob/d72745281766a784a6b319f3787aa1d8de7cd0fe/YaHPConverter/src/org/allcolor/yahp/converter/CClassLoader.java#L1292-L1300 |
akberc/ceylon-maven-plugin | src/main/java/com/dgwave/car/maven/CeylonInstall.java | CeylonInstall.installAdditional | void installAdditional(final File installedFile, final String fileExt, final String payload, final boolean chop)
throws MojoExecutionException {
File additionalFile = null;
if (chop) {
String path = installedFile.getAbsolutePath();
additionalFile = new File(path.substring(0, path.lastIndexOf('.')) + fileExt);
} else {
if (fileExt.indexOf('.') > 0) {
additionalFile = new File(installedFile.getParentFile(), fileExt);
} else {
additionalFile = new File(installedFile.getAbsolutePath() + fileExt);
}
}
getLog().debug("Installing additional file to " + additionalFile);
try {
additionalFile.getParentFile().mkdirs();
FileUtils.fileWrite(additionalFile.getAbsolutePath(), "UTF-8", payload);
} catch (IOException e) {
throw new MojoExecutionException("Failed to install additional file to " + additionalFile, e);
}
} | java | void installAdditional(final File installedFile, final String fileExt, final String payload, final boolean chop)
throws MojoExecutionException {
File additionalFile = null;
if (chop) {
String path = installedFile.getAbsolutePath();
additionalFile = new File(path.substring(0, path.lastIndexOf('.')) + fileExt);
} else {
if (fileExt.indexOf('.') > 0) {
additionalFile = new File(installedFile.getParentFile(), fileExt);
} else {
additionalFile = new File(installedFile.getAbsolutePath() + fileExt);
}
}
getLog().debug("Installing additional file to " + additionalFile);
try {
additionalFile.getParentFile().mkdirs();
FileUtils.fileWrite(additionalFile.getAbsolutePath(), "UTF-8", payload);
} catch (IOException e) {
throw new MojoExecutionException("Failed to install additional file to " + additionalFile, e);
}
} | [
"void",
"installAdditional",
"(",
"final",
"File",
"installedFile",
",",
"final",
"String",
"fileExt",
",",
"final",
"String",
"payload",
",",
"final",
"boolean",
"chop",
")",
"throws",
"MojoExecutionException",
"{",
"File",
"additionalFile",
"=",
"null",
";",
"... | Installs additional files into the same repo directory as the artifact.
@param installedFile The artifact to which this additional file is related
@param fileExt The full file name or extension (begins with .) of the additional file
@param payload The String to write to the additional file
@param chop True of it replaces the artifact extension, false to attach the extension
@throws MojoExecutionException In case of installation error | [
"Installs",
"additional",
"files",
"into",
"the",
"same",
"repo",
"directory",
"as",
"the",
"artifact",
"."
] | train | https://github.com/akberc/ceylon-maven-plugin/blob/b7f6c4a2b24f2fa237350c9e715f4193e83415ef/src/main/java/com/dgwave/car/maven/CeylonInstall.java#L289-L309 |
UrielCh/ovh-java-sdk | ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java | ApiOvhPrice.domain_zone_option_optionName_GET | public OvhPrice domain_zone_option_optionName_GET(net.minidev.ovh.api.price.domain.zone.OvhOptionEnum optionName) throws IOException {
String qPath = "/price/domain/zone/option/{optionName}";
StringBuilder sb = path(qPath, optionName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | java | public OvhPrice domain_zone_option_optionName_GET(net.minidev.ovh.api.price.domain.zone.OvhOptionEnum optionName) throws IOException {
String qPath = "/price/domain/zone/option/{optionName}";
StringBuilder sb = path(qPath, optionName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | [
"public",
"OvhPrice",
"domain_zone_option_optionName_GET",
"(",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"price",
".",
"domain",
".",
"zone",
".",
"OvhOptionEnum",
"optionName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/price/doma... | Get price of zone options
REST: GET /price/domain/zone/option/{optionName}
@param optionName [required] Option | [
"Get",
"price",
"of",
"zone",
"options"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L284-L289 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.publishProject | public CmsUUID publishProject(CmsObject cms, CmsPublishList publishList, I_CmsReport report) throws CmsException {
CmsRequestContext context = cms.getRequestContext();
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
// check if the current user has the required publish permissions
checkPublishPermissions(dbc, publishList);
m_driverManager.publishProject(cms, dbc, publishList, report);
} finally {
dbc.clear();
}
return publishList.getPublishHistoryId();
} | java | public CmsUUID publishProject(CmsObject cms, CmsPublishList publishList, I_CmsReport report) throws CmsException {
CmsRequestContext context = cms.getRequestContext();
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
// check if the current user has the required publish permissions
checkPublishPermissions(dbc, publishList);
m_driverManager.publishProject(cms, dbc, publishList, report);
} finally {
dbc.clear();
}
return publishList.getPublishHistoryId();
} | [
"public",
"CmsUUID",
"publishProject",
"(",
"CmsObject",
"cms",
",",
"CmsPublishList",
"publishList",
",",
"I_CmsReport",
"report",
")",
"throws",
"CmsException",
"{",
"CmsRequestContext",
"context",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
";",
"CmsDbContext... | Publishes the resources of a specified publish list.<p>
@param cms the current request context
@param publishList a publish list
@param report an instance of <code>{@link I_CmsReport}</code> to print messages
@return the publish history id of the published project
@throws CmsException if something goes wrong
@see #fillPublishList(CmsRequestContext, CmsPublishList) | [
"Publishes",
"the",
"resources",
"of",
"a",
"specified",
"publish",
"list",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L3854-L3866 |
fuinorg/utils4j | src/main/java/org/fuin/utils4j/Utils4J.java | Utils4J.addToClasspath | public static void addToClasspath(final String url, final ClassLoader classLoader) {
checkNotNull("url", url);
try {
addToClasspath(new URL(url), classLoader);
} catch (final MalformedURLException e) {
throw new RuntimeException(e);
}
} | java | public static void addToClasspath(final String url, final ClassLoader classLoader) {
checkNotNull("url", url);
try {
addToClasspath(new URL(url), classLoader);
} catch (final MalformedURLException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"void",
"addToClasspath",
"(",
"final",
"String",
"url",
",",
"final",
"ClassLoader",
"classLoader",
")",
"{",
"checkNotNull",
"(",
"\"url\"",
",",
"url",
")",
";",
"try",
"{",
"addToClasspath",
"(",
"new",
"URL",
"(",
"url",
")",
",",
... | Adds an URL to the classpath.
@param url
URL to add - Cannot be <code>null</code>.
@param classLoader
Class loader to use - Cannot be <code>null</code>. | [
"Adds",
"an",
"URL",
"to",
"the",
"classpath",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L254-L261 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java | JobScheduleOperations.updateJobSchedule | public void updateJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification, List<MetadataItem> metadata, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleUpdateOptions options = new JobScheduleUpdateOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
JobScheduleUpdateParameter param = new JobScheduleUpdateParameter()
.withJobSpecification(jobSpecification)
.withMetadata(metadata)
.withSchedule(schedule);
this.parentBatchClient.protocolLayer().jobSchedules().update(jobScheduleId, param, options);
} | java | public void updateJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification, List<MetadataItem> metadata, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleUpdateOptions options = new JobScheduleUpdateOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
JobScheduleUpdateParameter param = new JobScheduleUpdateParameter()
.withJobSpecification(jobSpecification)
.withMetadata(metadata)
.withSchedule(schedule);
this.parentBatchClient.protocolLayer().jobSchedules().update(jobScheduleId, param, options);
} | [
"public",
"void",
"updateJobSchedule",
"(",
"String",
"jobScheduleId",
",",
"Schedule",
"schedule",
",",
"JobSpecification",
"jobSpecification",
",",
"List",
"<",
"MetadataItem",
">",
"metadata",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
... | Updates the specified job schedule.
This method performs a full replace of all the updatable properties of the job schedule. For example, if the schedule parameter is null, then the Batch service removes the job schedule’s existing schedule and replaces it with the default schedule.
@param jobScheduleId The ID of the job schedule.
@param schedule The schedule according to which jobs will be created. If null, it is equivalent to passing the default schedule: that is, a single job scheduled to run immediately.
@param jobSpecification The details of the jobs to be created on this schedule. Updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification.
@param metadata A list of name-value pairs associated with the job schedule as metadata. If null, it takes the default value of an empty list; in effect, any existing metadata is deleted.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Updates",
"the",
"specified",
"job",
"schedule",
".",
"This",
"method",
"performs",
"a",
"full",
"replace",
"of",
"all",
"the",
"updatable",
"properties",
"of",
"the",
"job",
"schedule",
".",
"For",
"example",
"if",
"the",
"schedule",
"parameter",
"is",
"nu... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java#L262-L272 |
mozilla/rhino | src/org/mozilla/javascript/ScriptableObject.java | ScriptableObject.has | @Override
public boolean has(String name, Scriptable start)
{
return null != slotMap.query(name, 0);
} | java | @Override
public boolean has(String name, Scriptable start)
{
return null != slotMap.query(name, 0);
} | [
"@",
"Override",
"public",
"boolean",
"has",
"(",
"String",
"name",
",",
"Scriptable",
"start",
")",
"{",
"return",
"null",
"!=",
"slotMap",
".",
"query",
"(",
"name",
",",
"0",
")",
";",
"}"
] | Returns true if the named property is defined.
@param name the name of the property
@param start the object in which the lookup began
@return true if and only if the property was found in the object | [
"Returns",
"true",
"if",
"the",
"named",
"property",
"is",
"defined",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L415-L419 |
pdef/pdef-java | pdef/src/main/java/io/pdef/descriptors/Descriptors.java | Descriptors.findInterfaceDescriptor | @Nullable
public static <T> InterfaceDescriptor<T> findInterfaceDescriptor(final Class<T> cls) {
if (!cls.isInterface()) {
throw new IllegalArgumentException("Interface required, got " + cls);
}
Field field;
try {
field = cls.getField("DESCRIPTOR");
} catch (NoSuchFieldException e) {
throw new IllegalArgumentException("No DESCRIPTOR field in " + cls);
}
if (!InterfaceDescriptor.class.isAssignableFrom(field.getType())) {
throw new IllegalArgumentException("Not an InterfaceDescriptor field, " + field);
}
try {
// Get the static TYPE field.
@SuppressWarnings("unchecked")
InterfaceDescriptor<T> descriptor = (InterfaceDescriptor<T>) field.get(null);
return descriptor;
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | java | @Nullable
public static <T> InterfaceDescriptor<T> findInterfaceDescriptor(final Class<T> cls) {
if (!cls.isInterface()) {
throw new IllegalArgumentException("Interface required, got " + cls);
}
Field field;
try {
field = cls.getField("DESCRIPTOR");
} catch (NoSuchFieldException e) {
throw new IllegalArgumentException("No DESCRIPTOR field in " + cls);
}
if (!InterfaceDescriptor.class.isAssignableFrom(field.getType())) {
throw new IllegalArgumentException("Not an InterfaceDescriptor field, " + field);
}
try {
// Get the static TYPE field.
@SuppressWarnings("unchecked")
InterfaceDescriptor<T> descriptor = (InterfaceDescriptor<T>) field.get(null);
return descriptor;
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | [
"@",
"Nullable",
"public",
"static",
"<",
"T",
">",
"InterfaceDescriptor",
"<",
"T",
">",
"findInterfaceDescriptor",
"(",
"final",
"Class",
"<",
"T",
">",
"cls",
")",
"{",
"if",
"(",
"!",
"cls",
".",
"isInterface",
"(",
")",
")",
"{",
"throw",
"new",
... | Returns an interface descriptor or throws an IllegalArgumentException. | [
"Returns",
"an",
"interface",
"descriptor",
"or",
"throws",
"an",
"IllegalArgumentException",
"."
] | train | https://github.com/pdef/pdef-java/blob/7776c44d1aab0f3dbf7267b0c32b8f9282fe6167/pdef/src/main/java/io/pdef/descriptors/Descriptors.java#L58-L83 |
alibaba/canal | client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/bind/PropertySourcesPropertyResolver.java | PropertySourcesPropertyResolver.logKeyFound | protected void logKeyFound(String key, PropertySource<?> propertySource, Object value) {
if (logger.isDebugEnabled()) {
logger.debug("Found key '" + key + "' in PropertySource '" + propertySource.getName()
+ "' with value of type " + value.getClass().getSimpleName());
}
} | java | protected void logKeyFound(String key, PropertySource<?> propertySource, Object value) {
if (logger.isDebugEnabled()) {
logger.debug("Found key '" + key + "' in PropertySource '" + propertySource.getName()
+ "' with value of type " + value.getClass().getSimpleName());
}
} | [
"protected",
"void",
"logKeyFound",
"(",
"String",
"key",
",",
"PropertySource",
"<",
"?",
">",
"propertySource",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Found key '\... | Log the given key as found in the given {@link PropertySource}, resulting in
the given value.
<p>
The default implementation writes a debug log message with key and source. As
of 4.3.3, this does not log the value anymore in order to avoid accidental
logging of sensitive settings. Subclasses may override this method to change
the log level and/or log message, including the property's value if desired.
@param key the key found
@param propertySource the {@code PropertySource} that the key has been found
in
@param value the corresponding value
@since 4.3.1 | [
"Log",
"the",
"given",
"key",
"as",
"found",
"in",
"the",
"given",
"{",
"@link",
"PropertySource",
"}",
"resulting",
"in",
"the",
"given",
"value",
".",
"<p",
">",
"The",
"default",
"implementation",
"writes",
"a",
"debug",
"log",
"message",
"with",
"key",... | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/bind/PropertySourcesPropertyResolver.java#L140-L145 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java | HttpContext.POST | public <T> Optional<T> POST(String partialUrl, Object payload, GenericType<T> returnType)
{
URI uri = buildUri(partialUrl);
return executePostRequest(uri, payload, returnType);
} | java | public <T> Optional<T> POST(String partialUrl, Object payload, GenericType<T> returnType)
{
URI uri = buildUri(partialUrl);
return executePostRequest(uri, payload, returnType);
} | [
"public",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"POST",
"(",
"String",
"partialUrl",
",",
"Object",
"payload",
",",
"GenericType",
"<",
"T",
">",
"returnType",
")",
"{",
"URI",
"uri",
"=",
"buildUri",
"(",
"partialUrl",
")",
";",
"return",
"execute... | Execute a POST call against the partial URL.
@param <T> The type parameter used for the return object
@param partialUrl The partial URL to build
@param payload The object to use for the POST
@param returnType The expected return type
@return The return type | [
"Execute",
"a",
"POST",
"call",
"against",
"the",
"partial",
"URL",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L220-L224 |
spotbugs/spotbugs | spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/BugTreeModel.java | BugTreeModel.enumsThatExist | private @Nonnull List<SortableValue> enumsThatExist(BugAspects a) {
List<Sortables> orderBeforeDivider = st.getOrderBeforeDivider();
if (orderBeforeDivider.size() == 0) {
List<SortableValue> result = Collections.emptyList();
assert false;
return result;
}
Sortables key;
if (a.size() == 0) {
key = orderBeforeDivider.get(0);
} else {
Sortables lastKey = a.last().key;
int index = orderBeforeDivider.indexOf(lastKey);
if (index + 1 < orderBeforeDivider.size()) {
key = orderBeforeDivider.get(index + 1);
} else {
key = lastKey;
}
}
String[] all = key.getAll(bugSet.query(a));
ArrayList<SortableValue> result = new ArrayList<>(all.length);
for (String i : all) {
result.add(new SortableValue(key, i));
}
return result;
} | java | private @Nonnull List<SortableValue> enumsThatExist(BugAspects a) {
List<Sortables> orderBeforeDivider = st.getOrderBeforeDivider();
if (orderBeforeDivider.size() == 0) {
List<SortableValue> result = Collections.emptyList();
assert false;
return result;
}
Sortables key;
if (a.size() == 0) {
key = orderBeforeDivider.get(0);
} else {
Sortables lastKey = a.last().key;
int index = orderBeforeDivider.indexOf(lastKey);
if (index + 1 < orderBeforeDivider.size()) {
key = orderBeforeDivider.get(index + 1);
} else {
key = lastKey;
}
}
String[] all = key.getAll(bugSet.query(a));
ArrayList<SortableValue> result = new ArrayList<>(all.length);
for (String i : all) {
result.add(new SortableValue(key, i));
}
return result;
} | [
"private",
"@",
"Nonnull",
"List",
"<",
"SortableValue",
">",
"enumsThatExist",
"(",
"BugAspects",
"a",
")",
"{",
"List",
"<",
"Sortables",
">",
"orderBeforeDivider",
"=",
"st",
".",
"getOrderBeforeDivider",
"(",
")",
";",
"if",
"(",
"orderBeforeDivider",
".",... | /*
This contract has been changed to return a HashList of Stringpair, our
own data structure in which finding the index of an object in the list is
very fast | [
"/",
"*",
"This",
"contract",
"has",
"been",
"changed",
"to",
"return",
"a",
"HashList",
"of",
"Stringpair",
"our",
"own",
"data",
"structure",
"in",
"which",
"finding",
"the",
"index",
"of",
"an",
"object",
"in",
"the",
"list",
"is",
"very",
"fast"
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/BugTreeModel.java#L248-L276 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java | AbstractIndexWriter.addComment | protected void addComment(ProgramElementDoc element, Content contentTree) {
Tag[] tags;
Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.block);
if (Util.isDeprecated(element)) {
div.addContent(span);
if ((tags = element.tags("deprecated")).length > 0)
addInlineDeprecatedComment(element, tags[0], div);
contentTree.addContent(div);
} else {
ClassDoc cont = element.containingClass();
while (cont != null) {
if (Util.isDeprecated(cont)) {
div.addContent(span);
contentTree.addContent(div);
break;
}
cont = cont.containingClass();
}
addSummaryComment(element, contentTree);
}
} | java | protected void addComment(ProgramElementDoc element, Content contentTree) {
Tag[] tags;
Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.block);
if (Util.isDeprecated(element)) {
div.addContent(span);
if ((tags = element.tags("deprecated")).length > 0)
addInlineDeprecatedComment(element, tags[0], div);
contentTree.addContent(div);
} else {
ClassDoc cont = element.containingClass();
while (cont != null) {
if (Util.isDeprecated(cont)) {
div.addContent(span);
contentTree.addContent(div);
break;
}
cont = cont.containingClass();
}
addSummaryComment(element, contentTree);
}
} | [
"protected",
"void",
"addComment",
"(",
"ProgramElementDoc",
"element",
",",
"Content",
"contentTree",
")",
"{",
"Tag",
"[",
"]",
"tags",
";",
"Content",
"span",
"=",
"HtmlTree",
".",
"SPAN",
"(",
"HtmlStyle",
".",
"deprecatedLabel",
",",
"deprecatedPhrase",
"... | Add comment for each element in the index. If the element is deprecated
and it has a @deprecated tag, use that comment. Else if the containing
class for this element is deprecated, then add the word "Deprecated." at
the start and then print the normal comment.
@param element Index element
@param contentTree the content tree to which the comment will be added | [
"Add",
"comment",
"for",
"each",
"element",
"in",
"the",
"index",
".",
"If",
"the",
"element",
"is",
"deprecated",
"and",
"it",
"has",
"a",
"@deprecated",
"tag",
"use",
"that",
"comment",
".",
"Else",
"if",
"the",
"containing",
"class",
"for",
"this",
"e... | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java#L199-L221 |
icode/ameba | src/main/java/ameba/db/ebean/support/ModelResourceStructure.java | ModelResourceStructure.deleteMultipleModel | protected boolean deleteMultipleModel(Set<MODEL_ID> idCollection, boolean permanent) throws Exception {
if (permanent) {
server.deleteAllPermanent(modelType, idCollection);
} else {
server.deleteAll(modelType, idCollection);
}
return permanent;
} | java | protected boolean deleteMultipleModel(Set<MODEL_ID> idCollection, boolean permanent) throws Exception {
if (permanent) {
server.deleteAllPermanent(modelType, idCollection);
} else {
server.deleteAll(modelType, idCollection);
}
return permanent;
} | [
"protected",
"boolean",
"deleteMultipleModel",
"(",
"Set",
"<",
"MODEL_ID",
">",
"idCollection",
",",
"boolean",
"permanent",
")",
"throws",
"Exception",
"{",
"if",
"(",
"permanent",
")",
"{",
"server",
".",
"deleteAllPermanent",
"(",
"modelType",
",",
"idCollec... | delete multiple Model
@param idCollection model id collection
@param permanent a boolean.
@return if true delete from physical device, if logical delete return false, response status 202
@throws java.lang.Exception if any. | [
"delete",
"multiple",
"Model"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/support/ModelResourceStructure.java#L482-L489 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/ClassHelper.java | ClassHelper.newInstance | public static Object newInstance(Class target, Class type, Object arg) throws InstantiationException,
IllegalAccessException,
IllegalArgumentException,
InvocationTargetException,
NoSuchMethodException,
SecurityException
{
return newInstance(target, new Class[]{ type }, new Object[]{ arg });
} | java | public static Object newInstance(Class target, Class type, Object arg) throws InstantiationException,
IllegalAccessException,
IllegalArgumentException,
InvocationTargetException,
NoSuchMethodException,
SecurityException
{
return newInstance(target, new Class[]{ type }, new Object[]{ arg });
} | [
"public",
"static",
"Object",
"newInstance",
"(",
"Class",
"target",
",",
"Class",
"type",
",",
"Object",
"arg",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
",",
"IllegalArgumentException",
",",
"InvocationTargetException",
",",
"NoSuchMethod... | Returns a new instance of the given class using the constructor with the specified parameter.
@param target The class to instantiate
@param type The types of the single parameter of the constructor
@param arg The argument
@return The instance | [
"Returns",
"a",
"new",
"instance",
"of",
"the",
"given",
"class",
"using",
"the",
"constructor",
"with",
"the",
"specified",
"parameter",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/ClassHelper.java#L320-L328 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java | LocalQPConsumerKey.notifyReceiveAllowed | public void notifyReceiveAllowed(boolean isAllowed, DestinationHandler destinationBeingModified)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "notifyReceiveAllowed", Boolean.valueOf(isAllowed));
if (consumerPoint.destinationMatches(destinationBeingModified, consumerDispatcher))
{
consumerPoint.notifyReceiveAllowed(isAllowed);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "notifyReceiveAllowed");
} | java | public void notifyReceiveAllowed(boolean isAllowed, DestinationHandler destinationBeingModified)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "notifyReceiveAllowed", Boolean.valueOf(isAllowed));
if (consumerPoint.destinationMatches(destinationBeingModified, consumerDispatcher))
{
consumerPoint.notifyReceiveAllowed(isAllowed);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "notifyReceiveAllowed");
} | [
"public",
"void",
"notifyReceiveAllowed",
"(",
"boolean",
"isAllowed",
",",
"DestinationHandler",
"destinationBeingModified",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".... | Method notifyReceiveAllowed
<p>Notify the consumerKeys consumerPoint about change of Receive Allowed state
@param isAllowed - New state of Receive Allowed for localization | [
"Method",
"notifyReceiveAllowed",
"<p",
">",
"Notify",
"the",
"consumerKeys",
"consumerPoint",
"about",
"change",
"of",
"Receive",
"Allowed",
"state"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKey.java#L638-L647 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/ClientFactoryBuilder.java | ClientFactoryBuilder.socketOption | @Deprecated
public <T> ClientFactoryBuilder socketOption(ChannelOption<T> option, T value) {
return channelOption(option, value);
} | java | @Deprecated
public <T> ClientFactoryBuilder socketOption(ChannelOption<T> option, T value) {
return channelOption(option, value);
} | [
"@",
"Deprecated",
"public",
"<",
"T",
">",
"ClientFactoryBuilder",
"socketOption",
"(",
"ChannelOption",
"<",
"T",
">",
"option",
",",
"T",
"value",
")",
"{",
"return",
"channelOption",
"(",
"option",
",",
"value",
")",
";",
"}"
] | Sets the options of sockets created by the {@link ClientFactory}.
@deprecated Use {@link #channelOption(ChannelOption, Object)}. | [
"Sets",
"the",
"options",
"of",
"sockets",
"created",
"by",
"the",
"{",
"@link",
"ClientFactory",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/ClientFactoryBuilder.java#L161-L164 |
GCRC/nunaliit | nunaliit2-dbSec/src/main/java/ca/carleton/gcrc/dbSec/FieldSelectorScoreSubString.java | FieldSelectorScoreSubString.getQueryString | public String getQueryString(TableSchema tableSchema, Phase phase) throws Exception {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
boolean first = true;
for(String fieldName : fieldNames) {
if( first ) {
pw.print("least(coalesce(nullif(position(lower(?) IN lower(");
first = false;
} else {
pw.print(")),0),9999),coalesce(nullif(position(lower(?) IN lower(");
}
pw.print(fieldName);
}
pw.print(")),0),9999))");
if( Phase.SELECT == phase ) {
pw.print(" AS score");
}
pw.flush();
return sw.toString();
} | java | public String getQueryString(TableSchema tableSchema, Phase phase) throws Exception {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
boolean first = true;
for(String fieldName : fieldNames) {
if( first ) {
pw.print("least(coalesce(nullif(position(lower(?) IN lower(");
first = false;
} else {
pw.print(")),0),9999),coalesce(nullif(position(lower(?) IN lower(");
}
pw.print(fieldName);
}
pw.print(")),0),9999))");
if( Phase.SELECT == phase ) {
pw.print(" AS score");
}
pw.flush();
return sw.toString();
} | [
"public",
"String",
"getQueryString",
"(",
"TableSchema",
"tableSchema",
",",
"Phase",
"phase",
")",
"throws",
"Exception",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"pw",
"=",
"new",
"PrintWriter",
"(",
"sw",
")",
... | /*
least(
coalesce(
nullif(
position(lower(?) IN lower(title))
,0
)
,9999
)
,coalesce(
nullif(
position(lower(?) IN lower(notes))
,0
)
,9999
)
) AS score
coalesce - The COALESCE function returns the first of its arguments that
is not null. Null is returned only if all arguments are null.
nullif - The NULLIF function returns a null value if value1 and value2
are equal; otherwise it returns value1. | [
"/",
"*",
"least",
"(",
"coalesce",
"(",
"nullif",
"(",
"position",
"(",
"lower",
"(",
"?",
")",
"IN",
"lower",
"(",
"title",
"))",
"0",
")",
"9999",
")",
"coalesce",
"(",
"nullif",
"(",
"position",
"(",
"lower",
"(",
"?",
")",
"IN",
"lower",
"("... | train | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-dbSec/src/main/java/ca/carleton/gcrc/dbSec/FieldSelectorScoreSubString.java#L109-L128 |
otto-de/edison-microservice | edison-jobs/src/main/java/de/otto/edison/jobs/definition/DefaultJobDefinition.java | DefaultJobDefinition.fixedDelayJobDefinition | public static DefaultJobDefinition fixedDelayJobDefinition(final String jobType,
final String jobName,
final String description,
final Duration fixedDelay,
final int restarts,
final Optional<Duration> maxAge) {
return new DefaultJobDefinition(jobType, jobName, description, maxAge, Optional.of(fixedDelay), Optional.empty(), restarts, 0, Optional.empty());
} | java | public static DefaultJobDefinition fixedDelayJobDefinition(final String jobType,
final String jobName,
final String description,
final Duration fixedDelay,
final int restarts,
final Optional<Duration> maxAge) {
return new DefaultJobDefinition(jobType, jobName, description, maxAge, Optional.of(fixedDelay), Optional.empty(), restarts, 0, Optional.empty());
} | [
"public",
"static",
"DefaultJobDefinition",
"fixedDelayJobDefinition",
"(",
"final",
"String",
"jobType",
",",
"final",
"String",
"jobName",
",",
"final",
"String",
"description",
",",
"final",
"Duration",
"fixedDelay",
",",
"final",
"int",
"restarts",
",",
"final",... | Create a JobDefinition that is using fixed delays specify, when and how often the job should be triggered.
@param jobType The type of the Job
@param jobName A human readable name of the Job
@param description A human readable description of the Job.
@param fixedDelay The delay duration between to executions of the Job
@param restarts The number of restarts if the job failed because of errors or exceptions
@param maxAge Optional maximum age of a job. When the job is not run for longer than this duration,
a warning is displayed on the status page
@return JobDefinition | [
"Create",
"a",
"JobDefinition",
"that",
"is",
"using",
"fixed",
"delays",
"specify",
"when",
"and",
"how",
"often",
"the",
"job",
"should",
"be",
"triggered",
"."
] | train | https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-jobs/src/main/java/de/otto/edison/jobs/definition/DefaultJobDefinition.java#L106-L113 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/VRPResourceManager.java | VRPResourceManager.undeployVM | public void undeployVM(String vrpId, VirtualMachine vm, ClusterComputeResource cluster) throws InvalidState, NotFound, RuntimeFault, RemoteException {
getVimService().undeployVM(getMOR(), vrpId, vm.getMOR(), cluster.getMOR());
} | java | public void undeployVM(String vrpId, VirtualMachine vm, ClusterComputeResource cluster) throws InvalidState, NotFound, RuntimeFault, RemoteException {
getVimService().undeployVM(getMOR(), vrpId, vm.getMOR(), cluster.getMOR());
} | [
"public",
"void",
"undeployVM",
"(",
"String",
"vrpId",
",",
"VirtualMachine",
"vm",
",",
"ClusterComputeResource",
"cluster",
")",
"throws",
"InvalidState",
",",
"NotFound",
",",
"RuntimeFault",
",",
"RemoteException",
"{",
"getVimService",
"(",
")",
".",
"undepl... | Undeploy a VM in given VRP, hub pair.
@param vrpId The unique Id of the VRP.
@param vm VirtualMachine
@param cluster Cluster Object
@throws InvalidState
@throws NotFound
@throws RuntimeFault
@throws RemoteException | [
"Undeploy",
"a",
"VM",
"in",
"given",
"VRP",
"hub",
"pair",
"."
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/VRPResourceManager.java#L195-L197 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java | WaveformPreviewComponent.updateWaveform | private void updateWaveform(WaveformPreview preview) {
this.preview.set(preview);
if (preview == null) {
waveformImage.set(null);
} else {
BufferedImage image = new BufferedImage(preview.segmentCount, preview.maxHeight, BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
g.setColor(Color.BLACK);
g.fillRect(0, 0, preview.segmentCount, preview.maxHeight);
for (int segment = 0; segment < preview.segmentCount; segment++) {
g.setColor(preview.segmentColor(segment, false));
g.drawLine(segment, preview.maxHeight, segment, preview.maxHeight - preview.segmentHeight(segment, false));
if (preview.isColor) { // We have a front color segment to draw on top.
g.setColor(preview.segmentColor(segment, true));
g.drawLine(segment, preview.maxHeight, segment, preview.maxHeight - preview.segmentHeight(segment, true));
}
}
waveformImage.set(image);
}
} | java | private void updateWaveform(WaveformPreview preview) {
this.preview.set(preview);
if (preview == null) {
waveformImage.set(null);
} else {
BufferedImage image = new BufferedImage(preview.segmentCount, preview.maxHeight, BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
g.setColor(Color.BLACK);
g.fillRect(0, 0, preview.segmentCount, preview.maxHeight);
for (int segment = 0; segment < preview.segmentCount; segment++) {
g.setColor(preview.segmentColor(segment, false));
g.drawLine(segment, preview.maxHeight, segment, preview.maxHeight - preview.segmentHeight(segment, false));
if (preview.isColor) { // We have a front color segment to draw on top.
g.setColor(preview.segmentColor(segment, true));
g.drawLine(segment, preview.maxHeight, segment, preview.maxHeight - preview.segmentHeight(segment, true));
}
}
waveformImage.set(image);
}
} | [
"private",
"void",
"updateWaveform",
"(",
"WaveformPreview",
"preview",
")",
"{",
"this",
".",
"preview",
".",
"set",
"(",
"preview",
")",
";",
"if",
"(",
"preview",
"==",
"null",
")",
"{",
"waveformImage",
".",
"set",
"(",
"null",
")",
";",
"}",
"else... | Create an image of the proper size to hold a new waveform preview image and draw it. | [
"Create",
"an",
"image",
"of",
"the",
"proper",
"size",
"to",
"hold",
"a",
"new",
"waveform",
"preview",
"image",
"and",
"draw",
"it",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java#L420-L439 |
virgo47/javasimon | core/src/main/java/org/javasimon/proxy/DelegatingProxyFactory.java | DelegatingProxyFactory.newProxy | public Object newProxy(ClassLoader classLoader, Class<?>... interfaces) {
return Proxy.newProxyInstance(classLoader, interfaces, this);
} | java | public Object newProxy(ClassLoader classLoader, Class<?>... interfaces) {
return Proxy.newProxyInstance(classLoader, interfaces, this);
} | [
"public",
"Object",
"newProxy",
"(",
"ClassLoader",
"classLoader",
",",
"Class",
"<",
"?",
">",
"...",
"interfaces",
")",
"{",
"return",
"Proxy",
".",
"newProxyInstance",
"(",
"classLoader",
",",
"interfaces",
",",
"this",
")",
";",
"}"
] | Create a proxy using given classloader and interfaces
@param classLoader Class loader
@param interfaces Interfaces to implement
@return Proxy | [
"Create",
"a",
"proxy",
"using",
"given",
"classloader",
"and",
"interfaces"
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/proxy/DelegatingProxyFactory.java#L56-L58 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/JFapUtils.java | JFapUtils.debugTraceWsByteBuffer | public static void debugTraceWsByteBuffer(Object _this, TraceComponent _tc, WsByteBuffer buffer, int amount, String comment)
{
byte[] data = null;
int start;
int count = amount;
if (count > buffer.remaining()) count = buffer.remaining();
if (buffer.hasArray())
{
data = buffer.array();
start = buffer.arrayOffset() + buffer.position();;
}
else
{
data = new byte[count];
int pos = buffer.position();
buffer.get(data);
buffer.position(pos);
start = 0;
}
StringBuffer sb = new StringBuffer(comment);
sb.append("\nbuffer hashcode: ");
sb.append(buffer.hashCode());
sb.append("\nbuffer position: ");
sb.append(buffer.position());
sb.append("\nbuffer remaining: ");
sb.append(buffer.remaining());
sb.append("\n");
SibTr.debug(_this, _tc, sb.toString());
if (count > 0)
SibTr.bytes(_this, _tc, data, start, count, "First "+count+" bytes of buffer data:");
} | java | public static void debugTraceWsByteBuffer(Object _this, TraceComponent _tc, WsByteBuffer buffer, int amount, String comment)
{
byte[] data = null;
int start;
int count = amount;
if (count > buffer.remaining()) count = buffer.remaining();
if (buffer.hasArray())
{
data = buffer.array();
start = buffer.arrayOffset() + buffer.position();;
}
else
{
data = new byte[count];
int pos = buffer.position();
buffer.get(data);
buffer.position(pos);
start = 0;
}
StringBuffer sb = new StringBuffer(comment);
sb.append("\nbuffer hashcode: ");
sb.append(buffer.hashCode());
sb.append("\nbuffer position: ");
sb.append(buffer.position());
sb.append("\nbuffer remaining: ");
sb.append(buffer.remaining());
sb.append("\n");
SibTr.debug(_this, _tc, sb.toString());
if (count > 0)
SibTr.bytes(_this, _tc, data, start, count, "First "+count+" bytes of buffer data:");
} | [
"public",
"static",
"void",
"debugTraceWsByteBuffer",
"(",
"Object",
"_this",
",",
"TraceComponent",
"_tc",
",",
"WsByteBuffer",
"buffer",
",",
"int",
"amount",
",",
"String",
"comment",
")",
"{",
"byte",
"[",
"]",
"data",
"=",
"null",
";",
"int",
"start",
... | Produces a debug trace entry for a WsByteBuffer. This should be used
as follows:
<code>
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugTraceWsByteBuffer(...);
</code>
@param _this Reference to the object invoking this method.
@param _tc Reference to TraceComponent to use for outputing trace entry.
@param buffer Buffer to trace.
@param amount Maximum amount of data from the buffer to trace.
@param comment A comment to associate with the trace entry. | [
"Produces",
"a",
"debug",
"trace",
"entry",
"for",
"a",
"WsByteBuffer",
".",
"This",
"should",
"be",
"used",
"as",
"follows",
":",
"<code",
">",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"()",
"&&",
"tc",
".",
"isDebugEnabled",
"()",
")",
"d... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/JFapUtils.java#L50-L82 |
josueeduardo/snappy | plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/MainClassFinder.java | MainClassFinder.findMainClass | public static String findMainClass(JarFile jarFile, String classesLocation)
throws IOException {
return doWithMainClasses(jarFile, classesLocation,
new ClassNameCallback<String>() {
@Override
public String doWith(String className) {
return className;
}
});
} | java | public static String findMainClass(JarFile jarFile, String classesLocation)
throws IOException {
return doWithMainClasses(jarFile, classesLocation,
new ClassNameCallback<String>() {
@Override
public String doWith(String className) {
return className;
}
});
} | [
"public",
"static",
"String",
"findMainClass",
"(",
"JarFile",
"jarFile",
",",
"String",
"classesLocation",
")",
"throws",
"IOException",
"{",
"return",
"doWithMainClasses",
"(",
"jarFile",
",",
"classesLocation",
",",
"new",
"ClassNameCallback",
"<",
"String",
">",... | Find the main class in a given jar file.
@param jarFile the jar file to search
@param classesLocation the location within the jar containing classes
@return the main class or {@code null}
@throws IOException if the jar file cannot be read | [
"Find",
"the",
"main",
"class",
"in",
"a",
"given",
"jar",
"file",
"."
] | train | https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/MainClassFinder.java#L171-L180 |
CODAIT/stocator | src/main/java/com/ibm/stocator/fs/common/StocatorPath.java | StocatorPath.modifyPathToFinalDestination | public Path modifyPathToFinalDestination(Path path) throws IOException {
String res;
if (tempFileOriginator.equals(DEFAULT_FOUTPUTCOMMITTER_V1)) {
res = parseHadoopOutputCommitter(path, true, hostNameScheme);
} else {
res = extractNameFromTempPath(path, true, hostNameScheme);
}
return new Path(hostNameScheme, res);
} | java | public Path modifyPathToFinalDestination(Path path) throws IOException {
String res;
if (tempFileOriginator.equals(DEFAULT_FOUTPUTCOMMITTER_V1)) {
res = parseHadoopOutputCommitter(path, true, hostNameScheme);
} else {
res = extractNameFromTempPath(path, true, hostNameScheme);
}
return new Path(hostNameScheme, res);
} | [
"public",
"Path",
"modifyPathToFinalDestination",
"(",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"String",
"res",
";",
"if",
"(",
"tempFileOriginator",
".",
"equals",
"(",
"DEFAULT_FOUTPUTCOMMITTER_V1",
")",
")",
"{",
"res",
"=",
"parseHadoopOutputCommitter... | Accept temporary path and return a final destination path
@param path path name to modify
@return modified path name
@throws IOException if error | [
"Accept",
"temporary",
"path",
"and",
"return",
"a",
"final",
"destination",
"path"
] | train | https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/common/StocatorPath.java#L188-L197 |
kotcrab/vis-ui | ui/src/main/java/com/kotcrab/vis/ui/util/dialog/Dialogs.java | Dialogs.showOptionDialog | public static OptionDialog showOptionDialog (Stage stage, String title, String text, OptionDialogType type, OptionDialogListener listener) {
OptionDialog dialog = new OptionDialog(title, text, type, listener);
stage.addActor(dialog.fadeIn());
return dialog;
} | java | public static OptionDialog showOptionDialog (Stage stage, String title, String text, OptionDialogType type, OptionDialogListener listener) {
OptionDialog dialog = new OptionDialog(title, text, type, listener);
stage.addActor(dialog.fadeIn());
return dialog;
} | [
"public",
"static",
"OptionDialog",
"showOptionDialog",
"(",
"Stage",
"stage",
",",
"String",
"title",
",",
"String",
"text",
",",
"OptionDialogType",
"type",
",",
"OptionDialogListener",
"listener",
")",
"{",
"OptionDialog",
"dialog",
"=",
"new",
"OptionDialog",
... | Dialog with text and buttons like Yes, No, Cancel.
@param title dialog title
@param type specifies what types of buttons will this dialog have
@param listener dialog buttons listener.
@return dialog for the purpose of changing buttons text.
@see OptionDialog
@since 0.6.0 | [
"Dialog",
"with",
"text",
"and",
"buttons",
"like",
"Yes",
"No",
"Cancel",
"."
] | train | https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/dialog/Dialogs.java#L83-L87 |
strator-dev/greenpepper-open | extensions-external/php/src/main/java/com/greenpepper/phpsud/fixtures/PHPFixture.java | PHPFixture.findMethod | public static PHPMethodDescriptor findMethod(PHPClassDescriptor desc, String methodName) {
PHPMethodDescriptor meth;
meth = desc.getMethod(Helper.formatProcedureName(methodName));
if (meth != null) {
return meth;
}
meth = desc.getMethod("get" + Helper.formatProcedureName(methodName));
if (meth != null) {
return meth;
}
return null;
} | java | public static PHPMethodDescriptor findMethod(PHPClassDescriptor desc, String methodName) {
PHPMethodDescriptor meth;
meth = desc.getMethod(Helper.formatProcedureName(methodName));
if (meth != null) {
return meth;
}
meth = desc.getMethod("get" + Helper.formatProcedureName(methodName));
if (meth != null) {
return meth;
}
return null;
} | [
"public",
"static",
"PHPMethodDescriptor",
"findMethod",
"(",
"PHPClassDescriptor",
"desc",
",",
"String",
"methodName",
")",
"{",
"PHPMethodDescriptor",
"meth",
";",
"meth",
"=",
"desc",
".",
"getMethod",
"(",
"Helper",
".",
"formatProcedureName",
"(",
"methodName"... | <p>findMethod.</p>
@param desc a {@link com.greenpepper.phpsud.container.PHPClassDescriptor} object.
@param methodName a {@link java.lang.String} object.
@return a {@link com.greenpepper.phpsud.container.PHPMethodDescriptor} object. | [
"<p",
">",
"findMethod",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper-open/blob/71fd244b4989e9cd2d07ae62dd954a1f2a269a92/extensions-external/php/src/main/java/com/greenpepper/phpsud/fixtures/PHPFixture.java#L88-L99 |
groupe-sii/ogham | ogham-sms-cloudhopper/src/main/java/fr/sii/ogham/sms/sender/impl/cloudhopper/MapCloudhopperCharsetHandler.java | MapCloudhopperCharsetHandler.addCharset | public void addCharset(String nioCharsetName, Charset cloudhopperCharset) {
LOG.debug("Added charset mapping nio {} -> {}", nioCharsetName, cloudhopperCharset);
mapCloudhopperCharsetByNioCharsetName.put(nioCharsetName, cloudhopperCharset);
} | java | public void addCharset(String nioCharsetName, Charset cloudhopperCharset) {
LOG.debug("Added charset mapping nio {} -> {}", nioCharsetName, cloudhopperCharset);
mapCloudhopperCharsetByNioCharsetName.put(nioCharsetName, cloudhopperCharset);
} | [
"public",
"void",
"addCharset",
"(",
"String",
"nioCharsetName",
",",
"Charset",
"cloudhopperCharset",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Added charset mapping nio {} -> {}\"",
",",
"nioCharsetName",
",",
"cloudhopperCharset",
")",
";",
"mapCloudhopperCharsetByNioChar... | Add a charset mapping.
@param nioCharsetName
Java NIO charset name
@param cloudhopperCharset
Cloudhopper charset | [
"Add",
"a",
"charset",
"mapping",
"."
] | train | https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-sms-cloudhopper/src/main/java/fr/sii/ogham/sms/sender/impl/cloudhopper/MapCloudhopperCharsetHandler.java#L87-L90 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java | AbstractHibernateCriteriaBuilder.sqlGroupProjection | protected void sqlGroupProjection(String sql, String groupBy, List<String> columnAliases, List<Type> types) {
projectionList.add(Projections.sqlGroupProjection(sql, groupBy, columnAliases.toArray(new String[columnAliases.size()]), types.toArray(new Type[types.size()])));
} | java | protected void sqlGroupProjection(String sql, String groupBy, List<String> columnAliases, List<Type> types) {
projectionList.add(Projections.sqlGroupProjection(sql, groupBy, columnAliases.toArray(new String[columnAliases.size()]), types.toArray(new Type[types.size()])));
} | [
"protected",
"void",
"sqlGroupProjection",
"(",
"String",
"sql",
",",
"String",
"groupBy",
",",
"List",
"<",
"String",
">",
"columnAliases",
",",
"List",
"<",
"Type",
">",
"types",
")",
"{",
"projectionList",
".",
"add",
"(",
"Projections",
".",
"sqlGroupPro... | Adds a sql projection to the criteria
@param sql SQL projecting
@param groupBy group by clause
@param columnAliases List of column aliases for the projected values
@param types List of types for the projected values | [
"Adds",
"a",
"sql",
"projection",
"to",
"the",
"criteria"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java#L186-L188 |
m-m-m/util | cli/src/main/java/net/sf/mmm/util/cli/base/CliValueContainerMap.java | CliValueContainerMap.setValueEntry | @Override
protected void setValueEntry(String entry, GenericType<?> propertyType) {
int splitIndex = entry.indexOf('=');
if (splitIndex < 0) {
throw new NlsParseException(entry, "key=value", "MapEntry");
}
// key
String keyString = entry.substring(0, splitIndex);
GenericType<?> keyType = propertyType.getKeyType();
GenericValueConverter<Object> converter = getDependencies().getConverter();
Object key = converter.convertValue(keyString, getParameterContainer(), keyType.getAssignmentClass(), keyType);
// value
String valueString = entry.substring(splitIndex + 1);
GenericType<?> valueType = propertyType.getComponentType();
Object value = converter.convertValue(valueString, getParameterContainer(), valueType.getAssignmentClass(),
valueType);
Object old = this.map.put(key, value);
if (old != null) {
CliStyleHandling handling = getCliState().getCliStyle().valueDuplicateMapKey();
if (handling != CliStyleHandling.OK) {
DuplicateObjectException exception = new DuplicateObjectException(valueString, keyString);
handling.handle(getLogger(), exception);
}
}
} | java | @Override
protected void setValueEntry(String entry, GenericType<?> propertyType) {
int splitIndex = entry.indexOf('=');
if (splitIndex < 0) {
throw new NlsParseException(entry, "key=value", "MapEntry");
}
// key
String keyString = entry.substring(0, splitIndex);
GenericType<?> keyType = propertyType.getKeyType();
GenericValueConverter<Object> converter = getDependencies().getConverter();
Object key = converter.convertValue(keyString, getParameterContainer(), keyType.getAssignmentClass(), keyType);
// value
String valueString = entry.substring(splitIndex + 1);
GenericType<?> valueType = propertyType.getComponentType();
Object value = converter.convertValue(valueString, getParameterContainer(), valueType.getAssignmentClass(),
valueType);
Object old = this.map.put(key, value);
if (old != null) {
CliStyleHandling handling = getCliState().getCliStyle().valueDuplicateMapKey();
if (handling != CliStyleHandling.OK) {
DuplicateObjectException exception = new DuplicateObjectException(valueString, keyString);
handling.handle(getLogger(), exception);
}
}
} | [
"@",
"Override",
"protected",
"void",
"setValueEntry",
"(",
"String",
"entry",
",",
"GenericType",
"<",
"?",
">",
"propertyType",
")",
"{",
"int",
"splitIndex",
"=",
"entry",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"splitIndex",
"<",
"0",
"... | {@inheritDoc}
@param entry is a single map-entry in the form "key=value". | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/cli/src/main/java/net/sf/mmm/util/cli/base/CliValueContainerMap.java#L60-L85 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java | VirtualHubsInner.beginDelete | public void beginDelete(String resourceGroupName, String virtualHubName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, virtualHubName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String virtualHubName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, virtualHubName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualHubName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualHubName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
... | Deletes a VirtualHub.
@param resourceGroupName The resource group name of the VirtualHub.
@param virtualHubName The name of the VirtualHub.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"a",
"VirtualHub",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java#L758-L760 |
keyboardsurfer/Crouton | library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java | Crouton.show | public static void show(Activity activity, View customView, int viewGroupResId) {
make(activity, customView, viewGroupResId).show();
} | java | public static void show(Activity activity, View customView, int viewGroupResId) {
make(activity, customView, viewGroupResId).show();
} | [
"public",
"static",
"void",
"show",
"(",
"Activity",
"activity",
",",
"View",
"customView",
",",
"int",
"viewGroupResId",
")",
"{",
"make",
"(",
"activity",
",",
"customView",
",",
"viewGroupResId",
")",
".",
"show",
"(",
")",
";",
"}"
] | Creates a {@link Crouton} with provided text and style for a given activity
and displays it directly.
@param activity
The {@link Activity} that represents the context in which the Crouton should exist.
@param customView
The custom {@link View} to display
@param viewGroupResId
The resource id of the {@link ViewGroup} that this {@link Crouton} should be added to. | [
"Creates",
"a",
"{",
"@link",
"Crouton",
"}",
"with",
"provided",
"text",
"and",
"style",
"for",
"a",
"given",
"activity",
"and",
"displays",
"it",
"directly",
"."
] | train | https://github.com/keyboardsurfer/Crouton/blob/7806b15e4d52793e1f5aeaa4a55b1e220289e619/library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java#L477-L479 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/AzureFirewallsInner.java | AzureFirewallsInner.createOrUpdate | public AzureFirewallInner createOrUpdate(String resourceGroupName, String azureFirewallName, AzureFirewallInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, azureFirewallName, parameters).toBlocking().last().body();
} | java | public AzureFirewallInner createOrUpdate(String resourceGroupName, String azureFirewallName, AzureFirewallInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, azureFirewallName, parameters).toBlocking().last().body();
} | [
"public",
"AzureFirewallInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"azureFirewallName",
",",
"AzureFirewallInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"azureFirewallName",
... | Creates or updates the specified Azure Firewall.
@param resourceGroupName The name of the resource group.
@param azureFirewallName The name of the Azure Firewall.
@param parameters Parameters supplied to the create or update Azure Firewall 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 AzureFirewallInner object if successful. | [
"Creates",
"or",
"updates",
"the",
"specified",
"Azure",
"Firewall",
"."
] | 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/AzureFirewallsInner.java#L351-L353 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/web/ws/WSController.java | WSController.receiveCommandMessage | @Override
public void receiveCommandMessage(Session client, String json) {
MessageFromClient message = MessageFromClient.createFromJson(json);
logger.debug("Receive call message in websocket '{}' for session '{}'", message.getId(), client.getId());
callServiceManager.sendMessageToClient(message, client);
} | java | @Override
public void receiveCommandMessage(Session client, String json) {
MessageFromClient message = MessageFromClient.createFromJson(json);
logger.debug("Receive call message in websocket '{}' for session '{}'", message.getId(), client.getId());
callServiceManager.sendMessageToClient(message, client);
} | [
"@",
"Override",
"public",
"void",
"receiveCommandMessage",
"(",
"Session",
"client",
",",
"String",
"json",
")",
"{",
"MessageFromClient",
"message",
"=",
"MessageFromClient",
".",
"createFromJson",
"(",
"json",
")",
";",
"logger",
".",
"debug",
"(",
"\"Receive... | A message is a call service request or subscribe/unsubscribe topic
@param client
@param json | [
"A",
"message",
"is",
"a",
"call",
"service",
"request",
"or",
"subscribe",
"/",
"unsubscribe",
"topic"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/web/ws/WSController.java#L89-L94 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java | ServiceEndpointPoliciesInner.beginCreateOrUpdate | public ServiceEndpointPolicyInner beginCreateOrUpdate(String resourceGroupName, String serviceEndpointPolicyName, ServiceEndpointPolicyInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, parameters).toBlocking().single().body();
} | java | public ServiceEndpointPolicyInner beginCreateOrUpdate(String resourceGroupName, String serviceEndpointPolicyName, ServiceEndpointPolicyInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, parameters).toBlocking().single().body();
} | [
"public",
"ServiceEndpointPolicyInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serviceEndpointPolicyName",
",",
"ServiceEndpointPolicyInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName... | Creates or updates a service Endpoint Policies.
@param resourceGroupName The name of the resource group.
@param serviceEndpointPolicyName The name of the service endpoint policy.
@param parameters Parameters supplied to the create or update service endpoint policy 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 ServiceEndpointPolicyInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"service",
"Endpoint",
"Policies",
"."
] | 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/ServiceEndpointPoliciesInner.java#L519-L521 |
j256/simplejmx | src/main/java/com/j256/simplejmx/common/ObjectNameUtil.java | ObjectNameUtil.makeObjectName | public static ObjectName makeObjectName(String domainName, String beanName, String[] folderNameStrings) {
return makeObjectName(domainName, beanName, null, folderNameStrings);
} | java | public static ObjectName makeObjectName(String domainName, String beanName, String[] folderNameStrings) {
return makeObjectName(domainName, beanName, null, folderNameStrings);
} | [
"public",
"static",
"ObjectName",
"makeObjectName",
"(",
"String",
"domainName",
",",
"String",
"beanName",
",",
"String",
"[",
"]",
"folderNameStrings",
")",
"{",
"return",
"makeObjectName",
"(",
"domainName",
",",
"beanName",
",",
"null",
",",
"folderNameStrings... | Constructs an object-name from a domain-name, object-name, and folder-name strings.
@param domainName
This is the top level folder name for the beans.
@param beanName
This is the bean name in the lowest folder level.
@param folderNameStrings
These can be used to setup folders inside of the top folder. Each of the entries in the array can
either be in "value" or "name=value" format.
@throws IllegalArgumentException
If we had problems building the name | [
"Constructs",
"an",
"object",
"-",
"name",
"from",
"a",
"domain",
"-",
"name",
"object",
"-",
"name",
"and",
"folder",
"-",
"name",
"strings",
"."
] | train | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/common/ObjectNameUtil.java#L102-L104 |
cdk/cdk | misc/extra/src/main/java/org/openscience/cdk/geometry/AtomTools.java | AtomTools.rescaleBondLength | public static Point3d rescaleBondLength(IAtom atom1, IAtom atom2, Point3d point2) {
Point3d point1 = atom1.getPoint3d();
double d1 = atom1.getCovalentRadius();
double d2 = atom2.getCovalentRadius();
// in case we have no covalent radii, set to 1.0
double distance = (d1 < 0.1 || d2 < 0.1) ? 1.0 : atom1.getCovalentRadius() + atom2.getCovalentRadius();
Vector3d vect = new Vector3d(point2);
vect.sub(point1);
vect.normalize();
vect.scale(distance);
Point3d newPoint = new Point3d(point1);
newPoint.add(vect);
return newPoint;
} | java | public static Point3d rescaleBondLength(IAtom atom1, IAtom atom2, Point3d point2) {
Point3d point1 = atom1.getPoint3d();
double d1 = atom1.getCovalentRadius();
double d2 = atom2.getCovalentRadius();
// in case we have no covalent radii, set to 1.0
double distance = (d1 < 0.1 || d2 < 0.1) ? 1.0 : atom1.getCovalentRadius() + atom2.getCovalentRadius();
Vector3d vect = new Vector3d(point2);
vect.sub(point1);
vect.normalize();
vect.scale(distance);
Point3d newPoint = new Point3d(point1);
newPoint.add(vect);
return newPoint;
} | [
"public",
"static",
"Point3d",
"rescaleBondLength",
"(",
"IAtom",
"atom1",
",",
"IAtom",
"atom2",
",",
"Point3d",
"point2",
")",
"{",
"Point3d",
"point1",
"=",
"atom1",
".",
"getPoint3d",
"(",
")",
";",
"double",
"d1",
"=",
"atom1",
".",
"getCovalentRadius",... | Rescales Point2 so that length 1-2 is sum of covalent radii.
if covalent radii cannot be found, use bond length of 1.0
@param atom1 stationary atom
@param atom2 movable atom
@param point2 coordinates for atom 2
@return new coords for atom 2 | [
"Rescales",
"Point2",
"so",
"that",
"length",
"1",
"-",
"2",
"is",
"sum",
"of",
"covalent",
"radii",
".",
"if",
"covalent",
"radii",
"cannot",
"be",
"found",
"use",
"bond",
"length",
"of",
"1",
".",
"0"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/misc/extra/src/main/java/org/openscience/cdk/geometry/AtomTools.java#L115-L128 |
code4everything/util | src/main/java/com/zhazhapan/util/FileExecutor.java | FileExecutor.saveFile | public static void saveFile(File file, String content) throws IOException {
saveFile(file, content, false);
} | java | public static void saveFile(File file, String content) throws IOException {
saveFile(file, content, false);
} | [
"public",
"static",
"void",
"saveFile",
"(",
"File",
"file",
",",
"String",
"content",
")",
"throws",
"IOException",
"{",
"saveFile",
"(",
"file",
",",
"content",
",",
"false",
")",
";",
"}"
] | 保存文件,覆盖原内容
@param file 文件
@param content 内容
@throws IOException 异常 | [
"保存文件,覆盖原内容"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L895-L897 |
bazaarvoice/emodb | web/src/main/java/com/bazaarvoice/emodb/web/auth/OwnerDatabusAuthorizer.java | OwnerDatabusAuthorizer.ownerCanReadTable | private boolean ownerCanReadTable(String ownerId, String table) {
return _internalAuthorizer.hasPermissionById(ownerId, getReadPermission(table));
} | java | private boolean ownerCanReadTable(String ownerId, String table) {
return _internalAuthorizer.hasPermissionById(ownerId, getReadPermission(table));
} | [
"private",
"boolean",
"ownerCanReadTable",
"(",
"String",
"ownerId",
",",
"String",
"table",
")",
"{",
"return",
"_internalAuthorizer",
".",
"hasPermissionById",
"(",
"ownerId",
",",
"getReadPermission",
"(",
"table",
")",
")",
";",
"}"
] | Determines if an owner has read permission on a table. This always calls back to the authorizer and will not
return a cached value. | [
"Determines",
"if",
"an",
"owner",
"has",
"read",
"permission",
"on",
"a",
"table",
".",
"This",
"always",
"calls",
"back",
"to",
"the",
"authorizer",
"and",
"will",
"not",
"return",
"a",
"cached",
"value",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/auth/OwnerDatabusAuthorizer.java#L187-L189 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.