repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/storage/translation/AtomDODeserializer.java | AtomDODeserializer.getDSVersionable | private boolean getDSVersionable(DigitalObject obj, Entry entry) {
if (getDatastreamId(obj, entry).equals("AUDIT")) {
return false;
}
List<Category> versionable = entry.getCategories(MODEL.VERSIONABLE.uri);
if (versionable.isEmpty() || versionable.size() > 1) {
return true;
} else {
return Boolean.valueOf(versionable.get(0).getTerm());
}
} | java | private boolean getDSVersionable(DigitalObject obj, Entry entry) {
if (getDatastreamId(obj, entry).equals("AUDIT")) {
return false;
}
List<Category> versionable = entry.getCategories(MODEL.VERSIONABLE.uri);
if (versionable.isEmpty() || versionable.size() > 1) {
return true;
} else {
return Boolean.valueOf(versionable.get(0).getTerm());
}
} | [
"private",
"boolean",
"getDSVersionable",
"(",
"DigitalObject",
"obj",
",",
"Entry",
"entry",
")",
"{",
"if",
"(",
"getDatastreamId",
"(",
"obj",
",",
"entry",
")",
".",
"equals",
"(",
"\"AUDIT\"",
")",
")",
"{",
"return",
"false",
";",
"}",
"List",
"<",... | Note: AUDIT datastreams always return false, otherwise defaults to true.
@param entry
@return | [
"Note",
":",
"AUDIT",
"datastreams",
"always",
"return",
"false",
"otherwise",
"defaults",
"to",
"true",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/translation/AtomDODeserializer.java#L465-L475 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Spies.java | Spies.spyRes | public static <R, T> Function<T, R> spyRes(Function<T, R> function, Box<R> result) {
return spy(function, result, Box.<T>empty());
} | java | public static <R, T> Function<T, R> spyRes(Function<T, R> function, Box<R> result) {
return spy(function, result, Box.<T>empty());
} | [
"public",
"static",
"<",
"R",
",",
"T",
">",
"Function",
"<",
"T",
",",
"R",
">",
"spyRes",
"(",
"Function",
"<",
"T",
",",
"R",
">",
"function",
",",
"Box",
"<",
"R",
">",
"result",
")",
"{",
"return",
"spy",
"(",
"function",
",",
"result",
",... | Proxies a function spying for result.
@param <R> the function result type
@param <T> the function parameter type
@param function the function that will be spied
@param result a box that will be containing spied result
@return the proxied function | [
"Proxies",
"a",
"function",
"spying",
"for",
"result",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L294-L296 |
FXMisc/UndoFX | undofx/src/main/java/org/fxmisc/undo/impl/UndoManagerImpl.java | UndoManagerImpl.applyChange | private boolean applyChange(boolean isChangeAvailable, Supplier<C> changeToApply) {
if (isChangeAvailable) {
canMerge = false;
// perform change
C change = changeToApply.get();
this.expectedChange = change;
performingAction.suspendWhile(() -> apply.accept(change));
if(this.expectedChange != null) {
throw new IllegalStateException("Expected change not received:\n"
+ this.expectedChange);
}
invalidateProperties();
return true;
} else {
return false;
}
} | java | private boolean applyChange(boolean isChangeAvailable, Supplier<C> changeToApply) {
if (isChangeAvailable) {
canMerge = false;
// perform change
C change = changeToApply.get();
this.expectedChange = change;
performingAction.suspendWhile(() -> apply.accept(change));
if(this.expectedChange != null) {
throw new IllegalStateException("Expected change not received:\n"
+ this.expectedChange);
}
invalidateProperties();
return true;
} else {
return false;
}
} | [
"private",
"boolean",
"applyChange",
"(",
"boolean",
"isChangeAvailable",
",",
"Supplier",
"<",
"C",
">",
"changeToApply",
")",
"{",
"if",
"(",
"isChangeAvailable",
")",
"{",
"canMerge",
"=",
"false",
";",
"// perform change",
"C",
"change",
"=",
"changeToApply"... | Helper method for reducing code duplication
@param isChangeAvailable same as `isUndoAvailable()` [Undo] or `isRedoAvailable()` [Redo]
@param changeToApply same as `invert.apply(queue.prev())` [Undo] or `queue.next()` [Redo] | [
"Helper",
"method",
"for",
"reducing",
"code",
"duplication"
] | train | https://github.com/FXMisc/UndoFX/blob/5f9404a657e1dcfcd60bebee0aadef2f072dc2ab/undofx/src/main/java/org/fxmisc/undo/impl/UndoManagerImpl.java#L206-L224 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/github/lgooddatepicker/zinternaltools/DemoPanel.java | DemoPanel.addLabel | public void addLabel(JPanel panel, int x, int pickerRow, String labelText) {
((GridBagLayout) panel.getLayout()).rowHeights[(pickerRow - 3)] = 6;
JLabel label = new JLabel();
label.setText(labelText);
panel.add(label, new GridBagConstraints(x, (pickerRow - 2), 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.VERTICAL,
new Insets(0, 0, 0, 0), 0, 0));
((GridBagLayout) panel.getLayout()).rowHeights[(pickerRow - 1)] = 3;
} | java | public void addLabel(JPanel panel, int x, int pickerRow, String labelText) {
((GridBagLayout) panel.getLayout()).rowHeights[(pickerRow - 3)] = 6;
JLabel label = new JLabel();
label.setText(labelText);
panel.add(label, new GridBagConstraints(x, (pickerRow - 2), 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.VERTICAL,
new Insets(0, 0, 0, 0), 0, 0));
((GridBagLayout) panel.getLayout()).rowHeights[(pickerRow - 1)] = 3;
} | [
"public",
"void",
"addLabel",
"(",
"JPanel",
"panel",
",",
"int",
"x",
",",
"int",
"pickerRow",
",",
"String",
"labelText",
")",
"{",
"(",
"(",
"GridBagLayout",
")",
"panel",
".",
"getLayout",
"(",
")",
")",
".",
"rowHeights",
"[",
"(",
"pickerRow",
"-... | JFormDesigner - End of variables declaration //GEN-END:variables | [
"JFormDesigner",
"-",
"End",
"of",
"variables",
"declaration",
"//",
"GEN",
"-",
"END",
":",
"variables"
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/DemoPanel.java#L203-L212 |
palatable/lambda | src/main/java/com/jnape/palatable/lambda/adt/Maybe.java | Maybe.toEither | public final <L> Either<L, A> toEither(Supplier<L> lSupplier) {
return fmap(Either::<L, A>right).orElseGet(() -> left(lSupplier.get()));
} | java | public final <L> Either<L, A> toEither(Supplier<L> lSupplier) {
return fmap(Either::<L, A>right).orElseGet(() -> left(lSupplier.get()));
} | [
"public",
"final",
"<",
"L",
">",
"Either",
"<",
"L",
",",
"A",
">",
"toEither",
"(",
"Supplier",
"<",
"L",
">",
"lSupplier",
")",
"{",
"return",
"fmap",
"(",
"Either",
"::",
"<",
"L",
",",
"A",
">",
"right",
")",
".",
"orElseGet",
"(",
"(",
")... | If this value is absent, return the value supplied by <code>lSupplier</code> wrapped in <code>Either.left</code>.
Otherwise, wrap the value in <code>Either.right</code> and return it.
@param lSupplier the supplier for the left value
@param <L> the left parameter type
@return this value wrapped in an Either.right, or an Either.left around the result of lSupplier | [
"If",
"this",
"value",
"is",
"absent",
"return",
"the",
"value",
"supplied",
"by",
"<code",
">",
"lSupplier<",
"/",
"code",
">",
"wrapped",
"in",
"<code",
">",
"Either",
".",
"left<",
"/",
"code",
">",
".",
"Otherwise",
"wrap",
"the",
"value",
"in",
"<... | train | https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/adt/Maybe.java#L97-L99 |
JoeKerouac/utils | src/main/java/com/joe/utils/common/DateUtil.java | DateUtil.beforeNow | public static boolean beforeNow(String date, String format, DateUnit dateUnit) {
logger.debug("指定日期为:{}", date);
return calc(new Date(), parse(date, format), dateUnit) > 0;
} | java | public static boolean beforeNow(String date, String format, DateUnit dateUnit) {
logger.debug("指定日期为:{}", date);
return calc(new Date(), parse(date, format), dateUnit) > 0;
} | [
"public",
"static",
"boolean",
"beforeNow",
"(",
"String",
"date",
",",
"String",
"format",
",",
"DateUnit",
"dateUnit",
")",
"{",
"logger",
".",
"debug",
"(",
"\"指定日期为:{}\", date);",
"",
"",
"",
"",
"return",
"calc",
"(",
"new",
"Date",
"(",
")",
",",
... | 判断指定日期是否在当前时间之前,精确到指定单位
@param date 指定日期
@param format 指定日期的格式
@param dateUnit 精确单位(例如传入年就是精确到年)
@return 如果指定日期在当前时间之前返回<code>true</code> | [
"判断指定日期是否在当前时间之前,精确到指定单位"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/DateUtil.java#L218-L221 |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/ExtendedListeningPoint.java | ExtendedListeningPoint.createContactHeader | public ContactHeader createContactHeader(String displayName, String userName, boolean usePublicAddress) {
return createContactHeader(displayName, userName, usePublicAddress, null);
} | java | public ContactHeader createContactHeader(String displayName, String userName, boolean usePublicAddress) {
return createContactHeader(displayName, userName, usePublicAddress, null);
} | [
"public",
"ContactHeader",
"createContactHeader",
"(",
"String",
"displayName",
",",
"String",
"userName",
",",
"boolean",
"usePublicAddress",
")",
"{",
"return",
"createContactHeader",
"(",
"displayName",
",",
"userName",
",",
"usePublicAddress",
",",
"null",
")",
... | Create a Contact Header based on the host, port and transport of this listening point
@param usePublicAddress if true, the host will be the global ip address found by STUN otherwise
it will be the local network interface ipaddress
@param displayName the display name to use
@return the Contact header | [
"Create",
"a",
"Contact",
"Header",
"based",
"on",
"the",
"host",
"port",
"and",
"transport",
"of",
"this",
"listening",
"point"
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/ExtendedListeningPoint.java#L131-L133 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.divideToIntegralValue | public BigDecimal divideToIntegralValue(BigDecimal divisor, MathContext mc) {
if (mc.precision == 0 || // exact result
(this.compareMagnitude(divisor) < 0)) // zero result
return divideToIntegralValue(divisor);
// Calculate preferred scale
int preferredScale = saturateLong((long)this.scale - divisor.scale);
/*
* Perform a normal divide to mc.precision digits. If the
* remainder has absolute value less than the divisor, the
* integer portion of the quotient fits into mc.precision
* digits. Next, remove any fractional digits from the
* quotient and adjust the scale to the preferred value.
*/
BigDecimal result = this.divide(divisor, new MathContext(mc.precision, RoundingMode.DOWN));
if (result.scale() < 0) {
/*
* Result is an integer. See if quotient represents the
* full integer portion of the exact quotient; if it does,
* the computed remainder will be less than the divisor.
*/
BigDecimal product = result.multiply(divisor);
// If the quotient is the full integer value,
// |dividend-product| < |divisor|.
if (this.subtract(product).compareMagnitude(divisor) >= 0) {
throw new ArithmeticException("Division impossible");
}
} else if (result.scale() > 0) {
/*
* Integer portion of quotient will fit into precision
* digits; recompute quotient to scale 0 to avoid double
* rounding and then try to adjust, if necessary.
*/
result = result.setScale(0, RoundingMode.DOWN);
}
// else result.scale() == 0;
int precisionDiff;
if ((preferredScale > result.scale()) &&
(precisionDiff = mc.precision - result.precision()) > 0) {
return result.setScale(result.scale() +
Math.min(precisionDiff, preferredScale - result.scale) );
} else {
return stripZerosToMatchScale(result.intVal,result.intCompact,result.scale,preferredScale);
}
} | java | public BigDecimal divideToIntegralValue(BigDecimal divisor, MathContext mc) {
if (mc.precision == 0 || // exact result
(this.compareMagnitude(divisor) < 0)) // zero result
return divideToIntegralValue(divisor);
// Calculate preferred scale
int preferredScale = saturateLong((long)this.scale - divisor.scale);
/*
* Perform a normal divide to mc.precision digits. If the
* remainder has absolute value less than the divisor, the
* integer portion of the quotient fits into mc.precision
* digits. Next, remove any fractional digits from the
* quotient and adjust the scale to the preferred value.
*/
BigDecimal result = this.divide(divisor, new MathContext(mc.precision, RoundingMode.DOWN));
if (result.scale() < 0) {
/*
* Result is an integer. See if quotient represents the
* full integer portion of the exact quotient; if it does,
* the computed remainder will be less than the divisor.
*/
BigDecimal product = result.multiply(divisor);
// If the quotient is the full integer value,
// |dividend-product| < |divisor|.
if (this.subtract(product).compareMagnitude(divisor) >= 0) {
throw new ArithmeticException("Division impossible");
}
} else if (result.scale() > 0) {
/*
* Integer portion of quotient will fit into precision
* digits; recompute quotient to scale 0 to avoid double
* rounding and then try to adjust, if necessary.
*/
result = result.setScale(0, RoundingMode.DOWN);
}
// else result.scale() == 0;
int precisionDiff;
if ((preferredScale > result.scale()) &&
(precisionDiff = mc.precision - result.precision()) > 0) {
return result.setScale(result.scale() +
Math.min(precisionDiff, preferredScale - result.scale) );
} else {
return stripZerosToMatchScale(result.intVal,result.intCompact,result.scale,preferredScale);
}
} | [
"public",
"BigDecimal",
"divideToIntegralValue",
"(",
"BigDecimal",
"divisor",
",",
"MathContext",
"mc",
")",
"{",
"if",
"(",
"mc",
".",
"precision",
"==",
"0",
"||",
"// exact result",
"(",
"this",
".",
"compareMagnitude",
"(",
"divisor",
")",
"<",
"0",
")"... | Returns a {@code BigDecimal} whose value is the integer part
of {@code (this / divisor)}. Since the integer part of the
exact quotient does not depend on the rounding mode, the
rounding mode does not affect the values returned by this
method. The preferred scale of the result is
{@code (this.scale() - divisor.scale())}. An
{@code ArithmeticException} is thrown if the integer part of
the exact quotient needs more than {@code mc.precision}
digits.
@param divisor value by which this {@code BigDecimal} is to be divided.
@param mc the context to use.
@return The integer part of {@code this / divisor}.
@throws ArithmeticException if {@code divisor==0}
@throws ArithmeticException if {@code mc.precision} {@literal >} 0 and the result
requires a precision of more than {@code mc.precision} digits.
@since 1.5
@author Joseph D. Darcy | [
"Returns",
"a",
"{",
"@code",
"BigDecimal",
"}",
"whose",
"value",
"is",
"the",
"integer",
"part",
"of",
"{",
"@code",
"(",
"this",
"/",
"divisor",
")",
"}",
".",
"Since",
"the",
"integer",
"part",
"of",
"the",
"exact",
"quotient",
"does",
"not",
"depe... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L1829-L1876 |
esigate/esigate | esigate-servlet/src/main/java/org/esigate/servlet/impl/RequestUrl.java | RequestUrl.getRelativeUrl | public static String getRelativeUrl(HttpServletRequest request, boolean servlet) {
// Raw request url
String requestURI = request.getRequestURI();
// Application (war) context path
String contextPath = request.getContextPath();
// Servlet mapping
String servletPath = request.getServletPath();
String relativeUrl = requestURI;
// Remove application context path
if (contextPath != null && relativeUrl.startsWith(contextPath)) {
relativeUrl = relativeUrl.substring(contextPath.length());
}
// Remove servlet mapping path
if (servlet && servletPath != null && relativeUrl.startsWith(servletPath)) {
relativeUrl = relativeUrl.substring(servletPath.length());
}
if (LOG.isDebugEnabled()) {
LOG.debug("requestURI: {}, contextPath: {}, servletPath: {}, relativeUrl: {}, ", requestURI, contextPath,
servletPath, relativeUrl);
}
return relativeUrl;
} | java | public static String getRelativeUrl(HttpServletRequest request, boolean servlet) {
// Raw request url
String requestURI = request.getRequestURI();
// Application (war) context path
String contextPath = request.getContextPath();
// Servlet mapping
String servletPath = request.getServletPath();
String relativeUrl = requestURI;
// Remove application context path
if (contextPath != null && relativeUrl.startsWith(contextPath)) {
relativeUrl = relativeUrl.substring(contextPath.length());
}
// Remove servlet mapping path
if (servlet && servletPath != null && relativeUrl.startsWith(servletPath)) {
relativeUrl = relativeUrl.substring(servletPath.length());
}
if (LOG.isDebugEnabled()) {
LOG.debug("requestURI: {}, contextPath: {}, servletPath: {}, relativeUrl: {}, ", requestURI, contextPath,
servletPath, relativeUrl);
}
return relativeUrl;
} | [
"public",
"static",
"String",
"getRelativeUrl",
"(",
"HttpServletRequest",
"request",
",",
"boolean",
"servlet",
")",
"{",
"// Raw request url",
"String",
"requestURI",
"=",
"request",
".",
"getRequestURI",
"(",
")",
";",
"// Application (war) context path",
"String",
... | Get the relative url to the current servlet.
<p>
Uses the request URI and removes : the context path, the servlet path if used.
@param request
The current HTTP request
@param servlet
true to remove the servlet path
@return the url, relative to the servlet mapping. | [
"Get",
"the",
"relative",
"url",
"to",
"the",
"current",
"servlet",
".",
"<p",
">",
"Uses",
"the",
"request",
"URI",
"and",
"removes",
":",
"the",
"context",
"path",
"the",
"servlet",
"path",
"if",
"used",
"."
] | train | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-servlet/src/main/java/org/esigate/servlet/impl/RequestUrl.java#L46-L72 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java | Gen.hasFinally | boolean hasFinally(JCTree target, Env<GenContext> env) {
while (env.tree != target) {
if (env.tree.hasTag(TRY) && env.info.finalize.hasFinalizer())
return true;
env = env.next;
}
return false;
} | java | boolean hasFinally(JCTree target, Env<GenContext> env) {
while (env.tree != target) {
if (env.tree.hasTag(TRY) && env.info.finalize.hasFinalizer())
return true;
env = env.next;
}
return false;
} | [
"boolean",
"hasFinally",
"(",
"JCTree",
"target",
",",
"Env",
"<",
"GenContext",
">",
"env",
")",
"{",
"while",
"(",
"env",
".",
"tree",
"!=",
"target",
")",
"{",
"if",
"(",
"env",
".",
"tree",
".",
"hasTag",
"(",
"TRY",
")",
"&&",
"env",
".",
"i... | Do any of the structures aborted by a non-local exit have
finalizers that require an empty stack?
@param target The tree representing the structure that's aborted
@param env The environment current at the non-local exit. | [
"Do",
"any",
"of",
"the",
"structures",
"aborted",
"by",
"a",
"non",
"-",
"local",
"exit",
"have",
"finalizers",
"that",
"require",
"an",
"empty",
"stack?"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L386-L393 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java | ByteOp.copyStream | public static void copyStream(InputStream is, OutputStream os)
throws IOException {
copyStream(is,os,BUFFER_SIZE);
} | java | public static void copyStream(InputStream is, OutputStream os)
throws IOException {
copyStream(is,os,BUFFER_SIZE);
} | [
"public",
"static",
"void",
"copyStream",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"copyStream",
"(",
"is",
",",
"os",
",",
"BUFFER_SIZE",
")",
";",
"}"
] | Write all bytes from is to os. Does not close either stream.
@param is to copy bytes from
@param os to copy bytes to
@throws IOException for usual reasons | [
"Write",
"all",
"bytes",
"from",
"is",
"to",
"os",
".",
"Does",
"not",
"close",
"either",
"stream",
"."
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java#L129-L132 |
fabiomaffioletti/jsondoc | jsondoc-springmvc/src/main/java/org/jsondoc/springmvc/scanner/builder/SpringQueryParamBuilder.java | SpringQueryParamBuilder.mergeApiQueryParamDoc | private static void mergeApiQueryParamDoc(ApiQueryParam apiQueryParam, ApiParamDoc apiParamDoc) {
if (apiQueryParam != null) {
if (apiParamDoc.getName().trim().isEmpty()) {
apiParamDoc.setName(apiQueryParam.name());
}
apiParamDoc.setDescription(apiQueryParam.description());
apiParamDoc.setAllowedvalues(apiQueryParam.allowedvalues());
apiParamDoc.setFormat(apiQueryParam.format());
}
} | java | private static void mergeApiQueryParamDoc(ApiQueryParam apiQueryParam, ApiParamDoc apiParamDoc) {
if (apiQueryParam != null) {
if (apiParamDoc.getName().trim().isEmpty()) {
apiParamDoc.setName(apiQueryParam.name());
}
apiParamDoc.setDescription(apiQueryParam.description());
apiParamDoc.setAllowedvalues(apiQueryParam.allowedvalues());
apiParamDoc.setFormat(apiQueryParam.format());
}
} | [
"private",
"static",
"void",
"mergeApiQueryParamDoc",
"(",
"ApiQueryParam",
"apiQueryParam",
",",
"ApiParamDoc",
"apiParamDoc",
")",
"{",
"if",
"(",
"apiQueryParam",
"!=",
"null",
")",
"{",
"if",
"(",
"apiParamDoc",
".",
"getName",
"(",
")",
".",
"trim",
"(",
... | Available properties that can be overridden: name, description, required,
allowedvalues, format, defaultvalue. Name is overridden only if it's empty
in the apiParamDoc argument. Description, format and allowedvalues are
copied in any case Default value and required are not overridden: in any
case they are coming from the default values of @RequestParam
@param apiQueryParam
@param apiParamDoc | [
"Available",
"properties",
"that",
"can",
"be",
"overridden",
":",
"name",
"description",
"required",
"allowedvalues",
"format",
"defaultvalue",
".",
"Name",
"is",
"overridden",
"only",
"if",
"it",
"s",
"empty",
"in",
"the",
"apiParamDoc",
"argument",
".",
"Desc... | train | https://github.com/fabiomaffioletti/jsondoc/blob/26bf413c236e7c3b66f534c2451b157783c1f45e/jsondoc-springmvc/src/main/java/org/jsondoc/springmvc/scanner/builder/SpringQueryParamBuilder.java#L109-L118 |
jenkinsci/jenkins | core/src/main/java/hudson/util/ReflectionUtils.java | ReflectionUtils.getPublicMethodNamed | public static Method getPublicMethodNamed(Class c, String methodName) {
for( Method m : c.getMethods() )
if(m.getName().equals(methodName))
return m;
return null;
} | java | public static Method getPublicMethodNamed(Class c, String methodName) {
for( Method m : c.getMethods() )
if(m.getName().equals(methodName))
return m;
return null;
} | [
"public",
"static",
"Method",
"getPublicMethodNamed",
"(",
"Class",
"c",
",",
"String",
"methodName",
")",
"{",
"for",
"(",
"Method",
"m",
":",
"c",
".",
"getMethods",
"(",
")",
")",
"if",
"(",
"m",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"meth... | Finds a public method of the given name, regardless of its parameter definitions, | [
"Finds",
"a",
"public",
"method",
"of",
"the",
"given",
"name",
"regardless",
"of",
"its",
"parameter",
"definitions"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/ReflectionUtils.java#L52-L57 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/MapsInner.java | MapsInner.listContentCallbackUrl | public WorkflowTriggerCallbackUrlInner listContentCallbackUrl(String resourceGroupName, String integrationAccountName, String mapName, GetCallbackUrlParameters listContentCallbackUrl) {
return listContentCallbackUrlWithServiceResponseAsync(resourceGroupName, integrationAccountName, mapName, listContentCallbackUrl).toBlocking().single().body();
} | java | public WorkflowTriggerCallbackUrlInner listContentCallbackUrl(String resourceGroupName, String integrationAccountName, String mapName, GetCallbackUrlParameters listContentCallbackUrl) {
return listContentCallbackUrlWithServiceResponseAsync(resourceGroupName, integrationAccountName, mapName, listContentCallbackUrl).toBlocking().single().body();
} | [
"public",
"WorkflowTriggerCallbackUrlInner",
"listContentCallbackUrl",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"String",
"mapName",
",",
"GetCallbackUrlParameters",
"listContentCallbackUrl",
")",
"{",
"return",
"listContentCallbackUrlWith... | Get the content callback url.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param mapName The integration account map name.
@param listContentCallbackUrl the GetCallbackUrlParameters value
@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 WorkflowTriggerCallbackUrlInner object if successful. | [
"Get",
"the",
"content",
"callback",
"url",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/MapsInner.java#L643-L645 |
appium/java-client | src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingResult.java | FeaturesMatchingResult.getPoints1 | public List<Point> getPoints1() {
verifyPropertyPresence(POINTS1);
//noinspection unchecked
return ((List<Map<String, Object>>) getCommandResult().get(POINTS1)).stream()
.map(ComparisonResult::mapToPoint)
.collect(Collectors.toList());
} | java | public List<Point> getPoints1() {
verifyPropertyPresence(POINTS1);
//noinspection unchecked
return ((List<Map<String, Object>>) getCommandResult().get(POINTS1)).stream()
.map(ComparisonResult::mapToPoint)
.collect(Collectors.toList());
} | [
"public",
"List",
"<",
"Point",
">",
"getPoints1",
"(",
")",
"{",
"verifyPropertyPresence",
"(",
"POINTS1",
")",
";",
"//noinspection unchecked",
"return",
"(",
"(",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
")",
"getCommandResult",
"(",
... | Returns a list of matching points on the first image.
@return The list of matching points on the first image. | [
"Returns",
"a",
"list",
"of",
"matching",
"points",
"on",
"the",
"first",
"image",
"."
] | train | https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingResult.java#L67-L73 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/ElevationUtil.java | ElevationUtil.createElevationShadow | public static Bitmap createElevationShadow(@NonNull final Context context, final int elevation,
@NonNull final Orientation orientation) {
return createElevationShadow(context, elevation, orientation, false);
} | java | public static Bitmap createElevationShadow(@NonNull final Context context, final int elevation,
@NonNull final Orientation orientation) {
return createElevationShadow(context, elevation, orientation, false);
} | [
"public",
"static",
"Bitmap",
"createElevationShadow",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"final",
"int",
"elevation",
",",
"@",
"NonNull",
"final",
"Orientation",
"orientation",
")",
"{",
"return",
"createElevationShadow",
"(",
"context",
",... | Creates and returns a bitmap, which can be used to emulate a shadow of an elevated view on
pre-Lollipop devices. By default a non-parallel illumination of the view is emulated, which
causes the shadow at its bottom to appear a bit more intense than the shadows to its left and
right and a lot more intense than the shadow at its top.
@param context
The context, which should be used, as an instance of the class {@link Context}. The
context may not be null
@param elevation
The elevation, which should be emulated, in dp as an {@link Integer} value. The
elevation must be at least 0 and at maximum the value of the constant
<code>MAX_ELEVATION</code>
@param orientation
The orientation of the shadow in relation to the elevated view as a value of the enum
{@link Orientation}. The orientation may either be <code>LEFT</code>,
<code>RIGHT</code>, <code>TOP</code>, <code>BOTTOM</code>, <code>TOP_LEFT</code>,
<code>TOP_RIGHT</code>, <code>BOTTOM_LEFT</code> or <code>BOTTOM_RIGHT</code>
@return The bitmap, which has been created, as an instance of the class {@link Bitmap} or
null, if the given elevation is 0 | [
"Creates",
"and",
"returns",
"a",
"bitmap",
"which",
"can",
"be",
"used",
"to",
"emulate",
"a",
"shadow",
"of",
"an",
"elevated",
"view",
"on",
"pre",
"-",
"Lollipop",
"devices",
".",
"By",
"default",
"a",
"non",
"-",
"parallel",
"illumination",
"of",
"t... | train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/ElevationUtil.java#L792-L795 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Elvis.java | Elvis.operate | public static boolean operate(PageContext pc, double scope, String[] varNames) {
return _operate(pc, scope, KeyImpl.toKeyArray(varNames), 0);
} | java | public static boolean operate(PageContext pc, double scope, String[] varNames) {
return _operate(pc, scope, KeyImpl.toKeyArray(varNames), 0);
} | [
"public",
"static",
"boolean",
"operate",
"(",
"PageContext",
"pc",
",",
"double",
"scope",
",",
"String",
"[",
"]",
"varNames",
")",
"{",
"return",
"_operate",
"(",
"pc",
",",
"scope",
",",
"KeyImpl",
".",
"toKeyArray",
"(",
"varNames",
")",
",",
"0",
... | called by the Elvis operator from generated bytecode
@param pc
@param scope
@param varNames
@return | [
"called",
"by",
"the",
"Elvis",
"operator",
"from",
"generated",
"bytecode"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Elvis.java#L51-L53 |
brianwhu/xillium | base/src/main/java/org/xillium/base/beans/Beans.java | Beans.valueOf | @Deprecated
@SuppressWarnings("unchecked")
public static <T> T valueOf(Class<T> type, String value, typeinfo annotation) {
if (type.equals(String.class)) {
return type.cast(value);
} else {
try {
Class<?> boxed = boxPrimitive(type);
try {
return (T)boxed.getMethod("valueOf", String.class).invoke(null, value);
} catch (NoSuchMethodException x) {
try {
return (T)boxed.getMethod("valueOf", Class.class, String.class).invoke(null, annotation != null ? annotation.value()[0] : type, value);
} catch (NoSuchMethodException y) {
return (T)boxed.getConstructor(String.class).newInstance(value);
}
}
} catch (Exception x) {
throw new IllegalArgumentException(x.getMessage(), x);
}
}
} | java | @Deprecated
@SuppressWarnings("unchecked")
public static <T> T valueOf(Class<T> type, String value, typeinfo annotation) {
if (type.equals(String.class)) {
return type.cast(value);
} else {
try {
Class<?> boxed = boxPrimitive(type);
try {
return (T)boxed.getMethod("valueOf", String.class).invoke(null, value);
} catch (NoSuchMethodException x) {
try {
return (T)boxed.getMethod("valueOf", Class.class, String.class).invoke(null, annotation != null ? annotation.value()[0] : type, value);
} catch (NoSuchMethodException y) {
return (T)boxed.getConstructor(String.class).newInstance(value);
}
}
} catch (Exception x) {
throw new IllegalArgumentException(x.getMessage(), x);
}
}
} | [
"@",
"Deprecated",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"valueOf",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"value",
",",
"typeinfo",
"annotation",
")",
"{",
"if",
"(",
"type",
".",
"equ... | Converts a String representation into a value of a given type. Conversion attempts are made in the following order:
<ol>
<li>Try to invoke {@code public static SomeClass valueOf(String text)}.</li>
<li>Try to invoke {@code public static SomeClass valueOf(Class<SomeClass> type, String text)},
or {@code public static SomeClass<T, V, ...> valueOf(Class<T> type1, Class<V> type2, ..., String text)} if a @typeinfo annotation exists to
give argument types {@code T}, {@code V}, ...</li>
<li>Try to invoke {@code <init>(String text)}.</li>
</ol>
@param <T> the target class
@param type the target class
@param value the string to convert
@param annotation an optional typeinfo annotation containing type arguments to {@code type}, which should be a generic type in this case
@return the converted value
@throws IllegalArgumentException if all conversion attempts fail | [
"Converts",
"a",
"String",
"representation",
"into",
"a",
"value",
"of",
"a",
"given",
"type",
".",
"Conversion",
"attempts",
"are",
"made",
"in",
"the",
"following",
"order",
":",
"<ol",
">",
"<li",
">",
"Try",
"to",
"invoke",
"{",
"@code",
"public",
"s... | train | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/beans/Beans.java#L481-L502 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.changeVnetWithServiceResponseAsync | public Observable<ServiceResponse<Page<SiteInner>>> changeVnetWithServiceResponseAsync(final String resourceGroupName, final String name, final VirtualNetworkProfile vnetInfo) {
return changeVnetSinglePageAsync(resourceGroupName, name, vnetInfo)
.concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(changeVnetNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<SiteInner>>> changeVnetWithServiceResponseAsync(final String resourceGroupName, final String name, final VirtualNetworkProfile vnetInfo) {
return changeVnetSinglePageAsync(resourceGroupName, name, vnetInfo)
.concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(changeVnetNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"SiteInner",
">",
">",
">",
"changeVnetWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
"VirtualNetworkProfile",
"vnetInfo",
")",
"... | Move an App Service Environment to a different VNET.
Move an App Service Environment to a different VNET.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param vnetInfo Details for the new virtual network.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SiteInner> object | [
"Move",
"an",
"App",
"Service",
"Environment",
"to",
"a",
"different",
"VNET",
".",
"Move",
"an",
"App",
"Service",
"Environment",
"to",
"a",
"different",
"VNET",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceEnvironmentsInner.java#L1602-L1614 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.getGroupsOfUser | public List<CmsGroup> getGroupsOfUser(String username, boolean directGroupsOnly, boolean includeOtherOus)
throws CmsException {
return getGroupsOfUser(username, directGroupsOnly, includeOtherOus, m_context.getRemoteAddress());
} | java | public List<CmsGroup> getGroupsOfUser(String username, boolean directGroupsOnly, boolean includeOtherOus)
throws CmsException {
return getGroupsOfUser(username, directGroupsOnly, includeOtherOus, m_context.getRemoteAddress());
} | [
"public",
"List",
"<",
"CmsGroup",
">",
"getGroupsOfUser",
"(",
"String",
"username",
",",
"boolean",
"directGroupsOnly",
",",
"boolean",
"includeOtherOus",
")",
"throws",
"CmsException",
"{",
"return",
"getGroupsOfUser",
"(",
"username",
",",
"directGroupsOnly",
",... | Returns all the groups the given user belongs to.<p>
@param username the name of the user
@param directGroupsOnly if set only the direct assigned groups will be returned, if not also indirect roles
@param includeOtherOus if to include groups of other organizational units
@return a list of <code>{@link CmsGroup}</code> objects
@throws CmsException if operation was not successful | [
"Returns",
"all",
"the",
"groups",
"the",
"given",
"user",
"belongs",
"to",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1471-L1475 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java | TimeZone.getDisplayName | public final String getDisplayName(Locale locale) {
return _getDisplayName(LONG_GENERIC, false, ULocale.forLocale(locale));
} | java | public final String getDisplayName(Locale locale) {
return _getDisplayName(LONG_GENERIC, false, ULocale.forLocale(locale));
} | [
"public",
"final",
"String",
"getDisplayName",
"(",
"Locale",
"locale",
")",
"{",
"return",
"_getDisplayName",
"(",
"LONG_GENERIC",
",",
"false",
",",
"ULocale",
".",
"forLocale",
"(",
"locale",
")",
")",
";",
"}"
] | Returns a name of this time zone suitable for presentation to the user
in the specified locale.
This method returns the long generic name.
If the display name is not available for the locale,
a fallback based on the country, city, or time zone id will be used.
@param locale the locale in which to supply the display name.
@return the human-readable name of this time zone in the given locale
or in the default locale if the given locale is not recognized. | [
"Returns",
"a",
"name",
"of",
"this",
"time",
"zone",
"suitable",
"for",
"presentation",
"to",
"the",
"user",
"in",
"the",
"specified",
"locale",
".",
"This",
"method",
"returns",
"the",
"long",
"generic",
"name",
".",
"If",
"the",
"display",
"name",
"is",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java#L388-L390 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraSchemaMgr.java | CassandraSchemaMgr.dropKeyspace | public void dropKeyspace(DBConn dbConn, String keyspace) {
m_logger.info("Deleting Keyspace '{}'", keyspace);
try {
dbConn.getClientSession().system_drop_keyspace(keyspace);
waitForSchemaPropagation(dbConn);
} catch (Exception ex) {
String errMsg = "Failed to delete Keyspace '" + keyspace + "'";
m_logger.error(errMsg, ex);
throw new RuntimeException(errMsg, ex);
}
} | java | public void dropKeyspace(DBConn dbConn, String keyspace) {
m_logger.info("Deleting Keyspace '{}'", keyspace);
try {
dbConn.getClientSession().system_drop_keyspace(keyspace);
waitForSchemaPropagation(dbConn);
} catch (Exception ex) {
String errMsg = "Failed to delete Keyspace '" + keyspace + "'";
m_logger.error(errMsg, ex);
throw new RuntimeException(errMsg, ex);
}
} | [
"public",
"void",
"dropKeyspace",
"(",
"DBConn",
"dbConn",
",",
"String",
"keyspace",
")",
"{",
"m_logger",
".",
"info",
"(",
"\"Deleting Keyspace '{}'\"",
",",
"keyspace",
")",
";",
"try",
"{",
"dbConn",
".",
"getClientSession",
"(",
")",
".",
"system_drop_ke... | Delete the keyspace with the given name. This method can use any DB connection.
@param dbConn Database connection to use.
@param keyspace Name of keyspace to drop. | [
"Delete",
"the",
"keyspace",
"with",
"the",
"given",
"name",
".",
"This",
"method",
"can",
"use",
"any",
"DB",
"connection",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraSchemaMgr.java#L118-L128 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuGraphicsSubResourceGetMappedArray | public static int cuGraphicsSubResourceGetMappedArray(CUarray pArray, CUgraphicsResource resource, int arrayIndex, int mipLevel)
{
return checkResult(cuGraphicsSubResourceGetMappedArrayNative(pArray, resource, arrayIndex, mipLevel));
} | java | public static int cuGraphicsSubResourceGetMappedArray(CUarray pArray, CUgraphicsResource resource, int arrayIndex, int mipLevel)
{
return checkResult(cuGraphicsSubResourceGetMappedArrayNative(pArray, resource, arrayIndex, mipLevel));
} | [
"public",
"static",
"int",
"cuGraphicsSubResourceGetMappedArray",
"(",
"CUarray",
"pArray",
",",
"CUgraphicsResource",
"resource",
",",
"int",
"arrayIndex",
",",
"int",
"mipLevel",
")",
"{",
"return",
"checkResult",
"(",
"cuGraphicsSubResourceGetMappedArrayNative",
"(",
... | Get an array through which to access a subresource of a mapped graphics resource.
<pre>
CUresult cuGraphicsSubResourceGetMappedArray (
CUarray* pArray,
CUgraphicsResource resource,
unsigned int arrayIndex,
unsigned int mipLevel )
</pre>
<div>
<p>Get an array through which to access a
subresource of a mapped graphics resource. Returns in <tt>*pArray</tt>
an array through which the subresource of the mapped graphics resource
<tt>resource</tt> which corresponds to array index <tt>arrayIndex</tt>
and mipmap level <tt>mipLevel</tt> may be accessed. The value set in
<tt>*pArray</tt> may change every time that <tt>resource</tt> is
mapped.
</p>
<p>If <tt>resource</tt> is not a texture
then it cannot be accessed via an array and CUDA_ERROR_NOT_MAPPED_AS_ARRAY
is returned. If <tt>arrayIndex</tt> is not a valid array index for
<tt>resource</tt> then CUDA_ERROR_INVALID_VALUE is returned. If <tt>mipLevel</tt> is not a valid mipmap level for <tt>resource</tt> then
CUDA_ERROR_INVALID_VALUE is returned. If <tt>resource</tt> is not
mapped then CUDA_ERROR_NOT_MAPPED is returned.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param pArray Returned array through which a subresource of resource may be accessed
@param resource Mapped resource to access
@param arrayIndex Array index for array textures or cubemap face index as defined by CUarray_cubemap_face for cubemap textures for the subresource to access
@param mipLevel Mipmap level for the subresource to access
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE,
CUDA_ERROR_INVALID_HANDLE,
CUDA_ERROR_NOT_MAPPEDCUDA_ERROR_NOT_MAPPED_AS_ARRAY
@see JCudaDriver#cuGraphicsResourceGetMappedPointer | [
"Get",
"an",
"array",
"through",
"which",
"to",
"access",
"a",
"subresource",
"of",
"a",
"mapped",
"graphics",
"resource",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L15864-L15867 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.booleanTemplate | public static BooleanTemplate booleanTemplate(String template, List<?> args) {
return booleanTemplate(createTemplate(template), args);
} | java | public static BooleanTemplate booleanTemplate(String template, List<?> args) {
return booleanTemplate(createTemplate(template), args);
} | [
"public",
"static",
"BooleanTemplate",
"booleanTemplate",
"(",
"String",
"template",
",",
"List",
"<",
"?",
">",
"args",
")",
"{",
"return",
"booleanTemplate",
"(",
"createTemplate",
"(",
"template",
")",
",",
"args",
")",
";",
"}"
] | Create a new Template expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L985-L987 |
nostra13/Android-Universal-Image-Loader | library/src/main/java/com/nostra13/universalimageloader/core/DefaultConfigurationFactory.java | DefaultConfigurationFactory.createReserveDiskCacheDir | private static File createReserveDiskCacheDir(Context context) {
File cacheDir = StorageUtils.getCacheDirectory(context, false);
File individualDir = new File(cacheDir, "uil-images");
if (individualDir.exists() || individualDir.mkdir()) {
cacheDir = individualDir;
}
return cacheDir;
} | java | private static File createReserveDiskCacheDir(Context context) {
File cacheDir = StorageUtils.getCacheDirectory(context, false);
File individualDir = new File(cacheDir, "uil-images");
if (individualDir.exists() || individualDir.mkdir()) {
cacheDir = individualDir;
}
return cacheDir;
} | [
"private",
"static",
"File",
"createReserveDiskCacheDir",
"(",
"Context",
"context",
")",
"{",
"File",
"cacheDir",
"=",
"StorageUtils",
".",
"getCacheDirectory",
"(",
"context",
",",
"false",
")",
";",
"File",
"individualDir",
"=",
"new",
"File",
"(",
"cacheDir"... | Creates reserve disk cache folder which will be used if primary disk cache folder becomes unavailable | [
"Creates",
"reserve",
"disk",
"cache",
"folder",
"which",
"will",
"be",
"used",
"if",
"primary",
"disk",
"cache",
"folder",
"becomes",
"unavailable"
] | train | https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/DefaultConfigurationFactory.java#L101-L108 |
threerings/narya | core/src/main/java/com/threerings/presents/client/ClientDObjectMgr.java | ClientDObjectMgr.doUnsubscribe | protected void doUnsubscribe (int oid, Subscriber<?> target)
{
DObject dobj = _ocache.get(oid);
if (dobj != null) {
dobj.removeSubscriber(target);
} else if (_client.isFailureLoggable(Client.FailureType.UNSUBSCRIBE_NOT_PROXIED)) {
log.info("Requested to remove subscriber from non-proxied object", "oid", oid,
"sub", target);
}
} | java | protected void doUnsubscribe (int oid, Subscriber<?> target)
{
DObject dobj = _ocache.get(oid);
if (dobj != null) {
dobj.removeSubscriber(target);
} else if (_client.isFailureLoggable(Client.FailureType.UNSUBSCRIBE_NOT_PROXIED)) {
log.info("Requested to remove subscriber from non-proxied object", "oid", oid,
"sub", target);
}
} | [
"protected",
"void",
"doUnsubscribe",
"(",
"int",
"oid",
",",
"Subscriber",
"<",
"?",
">",
"target",
")",
"{",
"DObject",
"dobj",
"=",
"_ocache",
".",
"get",
"(",
"oid",
")",
";",
"if",
"(",
"dobj",
"!=",
"null",
")",
"{",
"dobj",
".",
"removeSubscri... | This is guaranteed to be invoked via the invoker and can safely do main thread type things
like call back to the subscriber. | [
"This",
"is",
"guaranteed",
"to",
"be",
"invoked",
"via",
"the",
"invoker",
"and",
"can",
"safely",
"do",
"main",
"thread",
"type",
"things",
"like",
"call",
"back",
"to",
"the",
"subscriber",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/ClientDObjectMgr.java#L439-L449 |
segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/Cartographer.java | Cartographer.toJson | public void toJson(Map<?, ?> map, Writer writer) throws IOException {
if (map == null) {
throw new IllegalArgumentException("map == null");
}
if (writer == null) {
throw new IllegalArgumentException("writer == null");
}
JsonWriter jsonWriter = new JsonWriter(writer);
jsonWriter.setLenient(isLenient);
if (prettyPrint) {
jsonWriter.setIndent(" ");
}
try {
mapToWriter(map, jsonWriter);
} finally {
jsonWriter.close();
}
} | java | public void toJson(Map<?, ?> map, Writer writer) throws IOException {
if (map == null) {
throw new IllegalArgumentException("map == null");
}
if (writer == null) {
throw new IllegalArgumentException("writer == null");
}
JsonWriter jsonWriter = new JsonWriter(writer);
jsonWriter.setLenient(isLenient);
if (prettyPrint) {
jsonWriter.setIndent(" ");
}
try {
mapToWriter(map, jsonWriter);
} finally {
jsonWriter.close();
}
} | [
"public",
"void",
"toJson",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"map == null\"",
")",
";",
... | Serializes the map into it's json representation into the provided {@link Writer}. If you want
to retrieve the json as a string, use {@link #toJson(Map)} instead. | [
"Serializes",
"the",
"map",
"into",
"it",
"s",
"json",
"representation",
"into",
"the",
"provided",
"{"
] | train | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Cartographer.java#L105-L123 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.subscription_subscriptionType_GET | public OvhSubscription subscription_subscriptionType_GET(String subscriptionType) throws IOException {
String qPath = "/me/subscription/{subscriptionType}";
StringBuilder sb = path(qPath, subscriptionType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhSubscription.class);
} | java | public OvhSubscription subscription_subscriptionType_GET(String subscriptionType) throws IOException {
String qPath = "/me/subscription/{subscriptionType}";
StringBuilder sb = path(qPath, subscriptionType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhSubscription.class);
} | [
"public",
"OvhSubscription",
"subscription_subscriptionType_GET",
"(",
"String",
"subscriptionType",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/subscription/{subscriptionType}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"subscrip... | Get this object properties
REST: GET /me/subscription/{subscriptionType}
@param subscriptionType [required] The type of subscription | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2612-L2617 |
tvesalainen/util | util/src/main/java/org/vesalainen/navi/ElasticChain.java | ElasticChain.horizontalForce | public double horizontalForce(Double T, double d)
{
return AE*Math.sqrt(Math.pow(T/AE+1, 2)-2*w*d/AE)-AE;
} | java | public double horizontalForce(Double T, double d)
{
return AE*Math.sqrt(Math.pow(T/AE+1, 2)-2*w*d/AE)-AE;
} | [
"public",
"double",
"horizontalForce",
"(",
"Double",
"T",
",",
"double",
"d",
")",
"{",
"return",
"AE",
"*",
"Math",
".",
"sqrt",
"(",
"Math",
".",
"pow",
"(",
"T",
"/",
"AE",
"+",
"1",
",",
"2",
")",
"-",
"2",
"*",
"w",
"*",
"d",
"/",
"AE",... | Horizontal force for a given fairlead tension T
@param T Fairlead tension
@param d depth
@return | [
"Horizontal",
"force",
"for",
"a",
"given",
"fairlead",
"tension",
"T"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/navi/ElasticChain.java#L50-L53 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.L93_L1 | @Pure
public static Point2d L93_L1(double x, double y) {
final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
LAMBERT_93_N,
LAMBERT_93_C,
LAMBERT_93_XS,
LAMBERT_93_YS);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_1_N,
LAMBERT_1_C,
LAMBERT_1_XS,
LAMBERT_1_YS);
} | java | @Pure
public static Point2d L93_L1(double x, double y) {
final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
LAMBERT_93_N,
LAMBERT_93_C,
LAMBERT_93_XS,
LAMBERT_93_YS);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_1_N,
LAMBERT_1_C,
LAMBERT_1_XS,
LAMBERT_1_YS);
} | [
"@",
"Pure",
"public",
"static",
"Point2d",
"L93_L1",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"NTFLambert_NTFLambdaPhi",
"(",
"x",
",",
"y",
",",
"LAMBERT_93_N",
",",
"LAMBERT_93_C",
",",
"LAMBERT_93_XS",
",... | This function convert France Lambert 93 coordinate to
France Lambert I coordinate.
@param x is the coordinate in France Lambert 93
@param y is the coordinate in France Lambert 93
@return the France Lambert I coordinate. | [
"This",
"function",
"convert",
"France",
"Lambert",
"93",
"coordinate",
"to",
"France",
"Lambert",
"I",
"coordinate",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L846-L859 |
jbundle/jbundle | base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java | TableSession.createDatabaseSession | public DatabaseSession createDatabaseSession(BaseDatabase database, Map<String, Object> properties) throws RemoteException
{
DatabaseSession remoteDatabase = null;
Map<String,Object> propOld = this.getProperties();
this.setProperties(properties);
DatabaseOwner databaseOwner = database.getDatabaseOwner();
if (databaseOwner == null)
databaseOwner = this.getDatabaseOwner(); // Never
this.setProperties(propOld);
if (databaseOwner instanceof Application)
remoteDatabase = new DatabaseSession((Application)databaseOwner); // Typical
else
remoteDatabase = new DatabaseSession((BaseSession)databaseOwner, null); // If AUTO_COMMIT if off, I need my own database
database.setMasterSlave(RecordOwner.SLAVE); // Don't create client behaviors
remoteDatabase.setDatabase(database);
return remoteDatabase;
} | java | public DatabaseSession createDatabaseSession(BaseDatabase database, Map<String, Object> properties) throws RemoteException
{
DatabaseSession remoteDatabase = null;
Map<String,Object> propOld = this.getProperties();
this.setProperties(properties);
DatabaseOwner databaseOwner = database.getDatabaseOwner();
if (databaseOwner == null)
databaseOwner = this.getDatabaseOwner(); // Never
this.setProperties(propOld);
if (databaseOwner instanceof Application)
remoteDatabase = new DatabaseSession((Application)databaseOwner); // Typical
else
remoteDatabase = new DatabaseSession((BaseSession)databaseOwner, null); // If AUTO_COMMIT if off, I need my own database
database.setMasterSlave(RecordOwner.SLAVE); // Don't create client behaviors
remoteDatabase.setDatabase(database);
return remoteDatabase;
} | [
"public",
"DatabaseSession",
"createDatabaseSession",
"(",
"BaseDatabase",
"database",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"throws",
"RemoteException",
"{",
"DatabaseSession",
"remoteDatabase",
"=",
"null",
";",
"Map",
"<",
"String",
... | Create a session for this database (and place it in the right spot in the session hierarchy)
@param database
@param properties
@return
@throws RemoteException | [
"Create",
"a",
"session",
"for",
"this",
"database",
"(",
"and",
"place",
"it",
"in",
"the",
"right",
"spot",
"in",
"the",
"session",
"hierarchy",
")"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java#L990-L1006 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/Settings.java | Settings.getBundle | private static String getBundle(String friendlyName, String className, int truncate)
{
try {
cl.loadClass(className);
int start = className.length();
for (int i = 0; i < truncate; ++i)
start = className.lastIndexOf('.', start - 1);
final String bundle = className.substring(0, start);
return "+ " + friendlyName + align(friendlyName) + "- " + bundle;
}
catch (final ClassNotFoundException e) {}
catch (final NoClassDefFoundError e) {}
return "- " + friendlyName + align(friendlyName) + "- not available";
} | java | private static String getBundle(String friendlyName, String className, int truncate)
{
try {
cl.loadClass(className);
int start = className.length();
for (int i = 0; i < truncate; ++i)
start = className.lastIndexOf('.', start - 1);
final String bundle = className.substring(0, start);
return "+ " + friendlyName + align(friendlyName) + "- " + bundle;
}
catch (final ClassNotFoundException e) {}
catch (final NoClassDefFoundError e) {}
return "- " + friendlyName + align(friendlyName) + "- not available";
} | [
"private",
"static",
"String",
"getBundle",
"(",
"String",
"friendlyName",
",",
"String",
"className",
",",
"int",
"truncate",
")",
"{",
"try",
"{",
"cl",
".",
"loadClass",
"(",
"className",
")",
";",
"int",
"start",
"=",
"className",
".",
"length",
"(",
... | to check availability, then class name is truncated to bundle id | [
"to",
"check",
"availability",
"then",
"class",
"name",
"is",
"truncated",
"to",
"bundle",
"id"
] | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/Settings.java#L188-L201 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.putBinds | private void putBinds() throws BindException
{
createStageIfNeeded();
String putStatement = getPutStmt(bindDir.toString(), stagePath);
for (int i = 0; i < PUT_RETRY_COUNT; i++)
{
try
{
SFStatement statement = new SFStatement(session);
SFBaseResultSet putResult = statement.execute(putStatement, null, null);
putResult.next();
// metadata is 0-based, result set is 1-based
int column = putResult.getMetaData().getColumnIndex(
SnowflakeFileTransferAgent.UploadColumns.status.name()) + 1;
String status = putResult.getString(column);
if (SnowflakeFileTransferAgent.ResultStatus.UPLOADED.name().equals(status))
{
return; // success!
}
logger.debug("PUT statement failed. The response had status %s.", status);
}
catch (SFException | SQLException ex)
{
logger.debug("Exception encountered during PUT operation. ", ex);
}
}
// if we haven't returned (on success), throw exception
throw new BindException("Failed to PUT files to stage.", BindException.Type.UPLOAD);
} | java | private void putBinds() throws BindException
{
createStageIfNeeded();
String putStatement = getPutStmt(bindDir.toString(), stagePath);
for (int i = 0; i < PUT_RETRY_COUNT; i++)
{
try
{
SFStatement statement = new SFStatement(session);
SFBaseResultSet putResult = statement.execute(putStatement, null, null);
putResult.next();
// metadata is 0-based, result set is 1-based
int column = putResult.getMetaData().getColumnIndex(
SnowflakeFileTransferAgent.UploadColumns.status.name()) + 1;
String status = putResult.getString(column);
if (SnowflakeFileTransferAgent.ResultStatus.UPLOADED.name().equals(status))
{
return; // success!
}
logger.debug("PUT statement failed. The response had status %s.", status);
}
catch (SFException | SQLException ex)
{
logger.debug("Exception encountered during PUT operation. ", ex);
}
}
// if we haven't returned (on success), throw exception
throw new BindException("Failed to PUT files to stage.", BindException.Type.UPLOAD);
} | [
"private",
"void",
"putBinds",
"(",
")",
"throws",
"BindException",
"{",
"createStageIfNeeded",
"(",
")",
";",
"String",
"putStatement",
"=",
"getPutStmt",
"(",
"bindDir",
".",
"toString",
"(",
")",
",",
"stagePath",
")",
";",
"for",
"(",
"int",
"i",
"=",
... | Upload binds from local file to stage
@throws BindException if uploading the binds fails | [
"Upload",
"binds",
"from",
"local",
"file",
"to",
"stage"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L424-L457 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonObject.java | JsonObject.put | public JsonObject put(String name, List<?> value) {
return put(name, JsonArray.from(value));
} | java | public JsonObject put(String name, List<?> value) {
return put(name, JsonArray.from(value));
} | [
"public",
"JsonObject",
"put",
"(",
"String",
"name",
",",
"List",
"<",
"?",
">",
"value",
")",
"{",
"return",
"put",
"(",
"name",
",",
"JsonArray",
".",
"from",
"(",
"value",
")",
")",
";",
"}"
] | Stores a {@link JsonArray} value identified by the field name.
@param name the name of the JSON field.
@param value the value of the JSON field.
@return the {@link JsonObject}. | [
"Stores",
"a",
"{",
"@link",
"JsonArray",
"}",
"value",
"identified",
"by",
"the",
"field",
"name",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L842-L844 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bos/BosClient.java | BosClient.getObject | public ObjectMetadata getObject(String bucketName, String key, File destinationFile) {
return this.getObject(new GetObjectRequest(bucketName, key), destinationFile);
} | java | public ObjectMetadata getObject(String bucketName, String key, File destinationFile) {
return this.getObject(new GetObjectRequest(bucketName, key), destinationFile);
} | [
"public",
"ObjectMetadata",
"getObject",
"(",
"String",
"bucketName",
",",
"String",
"key",
",",
"File",
"destinationFile",
")",
"{",
"return",
"this",
".",
"getObject",
"(",
"new",
"GetObjectRequest",
"(",
"bucketName",
",",
"key",
")",
",",
"destinationFile",
... | Gets the object metadata for the object stored in Bos under the specified bucket and key,
and saves the object contents to the specified file.
Returns <code>null</code> if the specified constraints weren't met.
@param bucketName The name of the bucket containing the desired object.
@param key The key under which the desired object is stored.
@param destinationFile Indicates the file (which might already exist)
where to save the object content being downloading from Bos.
@return All Bos object metadata for the specified object.
Returns <code>null</code> if constraints were specified but not met. | [
"Gets",
"the",
"object",
"metadata",
"for",
"the",
"object",
"stored",
"in",
"Bos",
"under",
"the",
"specified",
"bucket",
"and",
"key",
"and",
"saves",
"the",
"object",
"contents",
"to",
"the",
"specified",
"file",
".",
"Returns",
"<code",
">",
"null<",
"... | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L659-L661 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java | WSRdbManagedConnectionImpl.setShardingKeys | public final void setShardingKeys(Object shardingKey, Object superShardingKey) throws SQLException {
if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_3))
throw new SQLFeatureNotSupportedException();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Set sharding key/super sharding key to " + shardingKey + "/" + superShardingKey);
mcf.jdbcRuntime.doSetShardingKeys(sqlConn, shardingKey, superShardingKey);
currentShardingKey = shardingKey;
if (superShardingKey != JDBCRuntimeVersion.SUPER_SHARDING_KEY_UNCHANGED)
currentSuperShardingKey = superShardingKey;
connectionPropertyChanged = true;
} | java | public final void setShardingKeys(Object shardingKey, Object superShardingKey) throws SQLException {
if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_3))
throw new SQLFeatureNotSupportedException();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Set sharding key/super sharding key to " + shardingKey + "/" + superShardingKey);
mcf.jdbcRuntime.doSetShardingKeys(sqlConn, shardingKey, superShardingKey);
currentShardingKey = shardingKey;
if (superShardingKey != JDBCRuntimeVersion.SUPER_SHARDING_KEY_UNCHANGED)
currentSuperShardingKey = superShardingKey;
connectionPropertyChanged = true;
} | [
"public",
"final",
"void",
"setShardingKeys",
"(",
"Object",
"shardingKey",
",",
"Object",
"superShardingKey",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"mcf",
".",
"beforeJDBCVersion",
"(",
"JDBCRuntimeVersion",
".",
"VERSION_4_3",
")",
")",
"throw",
"new",
... | Updates the value of the sharding keys.
@param shardingKey the new sharding key.
@param superShardingKey the new super sharding key. The 'unchanged' constant can be used to avoid changing it. | [
"Updates",
"the",
"value",
"of",
"the",
"sharding",
"keys",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4097-L4109 |
EsotericSoftware/kryo | src/com/esotericsoftware/kryo/io/Input.java | Input.readBytes | public void readBytes (byte[] bytes, int offset, int count) throws KryoException {
if (bytes == null) throw new IllegalArgumentException("bytes cannot be null.");
int copyCount = Math.min(limit - position, count);
while (true) {
System.arraycopy(buffer, position, bytes, offset, copyCount);
position += copyCount;
count -= copyCount;
if (count == 0) break;
offset += copyCount;
copyCount = Math.min(count, capacity);
require(copyCount);
}
} | java | public void readBytes (byte[] bytes, int offset, int count) throws KryoException {
if (bytes == null) throw new IllegalArgumentException("bytes cannot be null.");
int copyCount = Math.min(limit - position, count);
while (true) {
System.arraycopy(buffer, position, bytes, offset, copyCount);
position += copyCount;
count -= copyCount;
if (count == 0) break;
offset += copyCount;
copyCount = Math.min(count, capacity);
require(copyCount);
}
} | [
"public",
"void",
"readBytes",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"int",
"count",
")",
"throws",
"KryoException",
"{",
"if",
"(",
"bytes",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"bytes cannot be null.\"",
... | Reads count bytes and writes them to the specified byte[], starting at offset. | [
"Reads",
"count",
"bytes",
"and",
"writes",
"them",
"to",
"the",
"specified",
"byte",
"[]",
"starting",
"at",
"offset",
"."
] | train | https://github.com/EsotericSoftware/kryo/blob/a8be1ab26f347f299a3c3f7171d6447dd5390845/src/com/esotericsoftware/kryo/io/Input.java#L360-L372 |
oaqa/uima-ecd | src/main/java/edu/cmu/lti/oaqa/ecd/driver/SimplePipelineRev803.java | SimplePipelineRev803.runPipeline | public static void runPipeline(final JCas jcas, final AnalysisEngine... engines)
throws UIMAException, IOException {
if (engines.length == 0) {
return;
}
JCasIterator jcasIter = engines[0].processAndOutputNewCASes(jcas);
AnalysisEngine[] enginesRemains = Arrays.copyOfRange(engines, 1, engines.length);
while (jcasIter.hasNext()) {
JCas nextJcas = jcasIter.next();
runPipeline(nextJcas, enginesRemains);
nextJcas.release();
}
} | java | public static void runPipeline(final JCas jcas, final AnalysisEngine... engines)
throws UIMAException, IOException {
if (engines.length == 0) {
return;
}
JCasIterator jcasIter = engines[0].processAndOutputNewCASes(jcas);
AnalysisEngine[] enginesRemains = Arrays.copyOfRange(engines, 1, engines.length);
while (jcasIter.hasNext()) {
JCas nextJcas = jcasIter.next();
runPipeline(nextJcas, enginesRemains);
nextJcas.release();
}
} | [
"public",
"static",
"void",
"runPipeline",
"(",
"final",
"JCas",
"jcas",
",",
"final",
"AnalysisEngine",
"...",
"engines",
")",
"throws",
"UIMAException",
",",
"IOException",
"{",
"if",
"(",
"engines",
".",
"length",
"==",
"0",
")",
"{",
"return",
";",
"}"... | Run a sequence of {@link AnalysisEngine analysis engines} over a {@link JCas}. This method
does not {@link AnalysisEngine#destroy() destroy} the engines or send them other events like
{@link AnalysisEngine#collectionProcessComplete()}. This is left to the caller.
@param jcas
the jCas to process
@param engines
a sequence of analysis engines to run on the jCas
@throws UIMAException
@throws IOException | [
"Run",
"a",
"sequence",
"of",
"{",
"@link",
"AnalysisEngine",
"analysis",
"engines",
"}",
"over",
"a",
"{",
"@link",
"JCas",
"}",
".",
"This",
"method",
"does",
"not",
"{",
"@link",
"AnalysisEngine#destroy",
"()",
"destroy",
"}",
"the",
"engines",
"or",
"s... | train | https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/ecd/driver/SimplePipelineRev803.java#L225-L237 |
forge/core | javaee/impl/src/main/java/org/jboss/forge/addon/javaee/cdi/CDIOperations.java | CDIOperations.getProjectInjectableBeans | public List<JavaResource> getProjectInjectableBeans(Project project)
{
final List<JavaResource> beans = new ArrayList<>();
if (project != null)
{
project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaResourceVisitor()
{
@Override
public void visit(VisitContext context, JavaResource resource)
{
try
{
JavaSource<?> javaSource = resource.getJavaType();
if (!javaSource.isAnnotation() && !javaSource.isEnum()
// CDI
&& !javaSource.hasAnnotation(Decorator.class)
&& !javaSource.hasAnnotation(Interceptor.class)
// EJB
&& !javaSource.hasAnnotation(MessageDriven.class)
// JPA
&& !javaSource.hasAnnotation(Entity.class)
&& !javaSource.hasAnnotation(Embeddable.class)
&& !javaSource.hasAnnotation(MappedSuperclass.class)
// JSF
&& !javaSource.hasAnnotation(FacesConverter.class)
&& !javaSource.hasAnnotation(FacesValidator.class)
// REST
&& !javaSource.hasAnnotation(Path.class)
// Servlet
&& !javaSource.hasAnnotation(WebServlet.class)
&& !javaSource.hasAnnotation(WebFilter.class)
&& !javaSource.hasAnnotation(WebListener.class)
// Bean Validation
&& !javaSource.hasImport(ConstraintValidator.class)
&& !javaSource.hasImport(Payload.class)
)
{
beans.add(resource);
}
}
catch (ResourceException | FileNotFoundException e)
{
// ignore
}
}
});
}
return beans;
} | java | public List<JavaResource> getProjectInjectableBeans(Project project)
{
final List<JavaResource> beans = new ArrayList<>();
if (project != null)
{
project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaResourceVisitor()
{
@Override
public void visit(VisitContext context, JavaResource resource)
{
try
{
JavaSource<?> javaSource = resource.getJavaType();
if (!javaSource.isAnnotation() && !javaSource.isEnum()
// CDI
&& !javaSource.hasAnnotation(Decorator.class)
&& !javaSource.hasAnnotation(Interceptor.class)
// EJB
&& !javaSource.hasAnnotation(MessageDriven.class)
// JPA
&& !javaSource.hasAnnotation(Entity.class)
&& !javaSource.hasAnnotation(Embeddable.class)
&& !javaSource.hasAnnotation(MappedSuperclass.class)
// JSF
&& !javaSource.hasAnnotation(FacesConverter.class)
&& !javaSource.hasAnnotation(FacesValidator.class)
// REST
&& !javaSource.hasAnnotation(Path.class)
// Servlet
&& !javaSource.hasAnnotation(WebServlet.class)
&& !javaSource.hasAnnotation(WebFilter.class)
&& !javaSource.hasAnnotation(WebListener.class)
// Bean Validation
&& !javaSource.hasImport(ConstraintValidator.class)
&& !javaSource.hasImport(Payload.class)
)
{
beans.add(resource);
}
}
catch (ResourceException | FileNotFoundException e)
{
// ignore
}
}
});
}
return beans;
} | [
"public",
"List",
"<",
"JavaResource",
">",
"getProjectInjectableBeans",
"(",
"Project",
"project",
")",
"{",
"final",
"List",
"<",
"JavaResource",
">",
"beans",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"project",
"!=",
"null",
")",
"{",
... | Returns all the injectable objects from the given {@link Project}. Most of the Java EE components can be injected,
except JPA entities, message driven beans.... | [
"Returns",
"all",
"the",
"injectable",
"objects",
"from",
"the",
"given",
"{"
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/javaee/impl/src/main/java/org/jboss/forge/addon/javaee/cdi/CDIOperations.java#L55-L103 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/api/AbstractRecordReader.java | AbstractRecordReader.subscribeToEvent | @Override
public void subscribeToEvent(EventListener eventListener, Class<? extends AbstractTaskEvent> eventType) {
this.eventHandler.subscribeToEvent(eventListener, eventType);
} | java | @Override
public void subscribeToEvent(EventListener eventListener, Class<? extends AbstractTaskEvent> eventType) {
this.eventHandler.subscribeToEvent(eventListener, eventType);
} | [
"@",
"Override",
"public",
"void",
"subscribeToEvent",
"(",
"EventListener",
"eventListener",
",",
"Class",
"<",
"?",
"extends",
"AbstractTaskEvent",
">",
"eventType",
")",
"{",
"this",
".",
"eventHandler",
".",
"subscribeToEvent",
"(",
"eventListener",
",",
"even... | Subscribes the listener object to receive events of the given type.
@param eventListener
the listener object to register
@param eventType
the type of event to register the listener for | [
"Subscribes",
"the",
"listener",
"object",
"to",
"receive",
"events",
"of",
"the",
"given",
"type",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/api/AbstractRecordReader.java#L43-L46 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java | XpathUtils.asString | public static String asString(String expression, Node node)
throws XPathExpressionException {
return evaluateAsString(expression, node, xpath());
} | java | public static String asString(String expression, Node node)
throws XPathExpressionException {
return evaluateAsString(expression, node, xpath());
} | [
"public",
"static",
"String",
"asString",
"(",
"String",
"expression",
",",
"Node",
"node",
")",
"throws",
"XPathExpressionException",
"{",
"return",
"evaluateAsString",
"(",
"expression",
",",
"node",
",",
"xpath",
"(",
")",
")",
";",
"}"
] | Evaluates the specified XPath expression and returns the result as a
string.
<p>
This method can be expensive as a new xpath is instantiated per
invocation. Consider passing in the xpath explicitly via {
{@link #asDouble(String, Node, XPath)} instead. Note {@link XPath} is
not thread-safe and not reentrant.
@param expression
The XPath expression to evaluate.
@param node
The node to run the expression on.
@return The string result.
@throws XPathExpressionException
If there was a problem processing the specified XPath
expression. | [
"Evaluates",
"the",
"specified",
"XPath",
"expression",
"and",
"returns",
"the",
"result",
"as",
"a",
"string",
".",
"<p",
">",
"This",
"method",
"can",
"be",
"expensive",
"as",
"a",
"new",
"xpath",
"is",
"instantiated",
"per",
"invocation",
".",
"Consider",... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java#L243-L246 |
spotify/helios | helios-services/src/main/java/com/spotify/helios/master/resources/HistoryResource.java | HistoryResource.jobHistory | @GET
@Produces(APPLICATION_JSON)
@Path("jobs/{id}")
@Timed
@ExceptionMetered
public TaskStatusEvents jobHistory(@PathParam("id") @Valid final JobId jobId)
throws HeliosException {
if (!jobId.isFullyQualified()) {
throw badRequest("Invalid id");
}
try {
final List<TaskStatusEvent> events = model.getJobHistory(jobId);
metrics.jobsHistoryEventSize(events.size());
final TaskStatusEvents result = new TaskStatusEvents(events, OK);
return result;
} catch (JobDoesNotExistException e) {
return new TaskStatusEvents(ImmutableList.<TaskStatusEvent>of(), JOB_ID_NOT_FOUND);
}
} | java | @GET
@Produces(APPLICATION_JSON)
@Path("jobs/{id}")
@Timed
@ExceptionMetered
public TaskStatusEvents jobHistory(@PathParam("id") @Valid final JobId jobId)
throws HeliosException {
if (!jobId.isFullyQualified()) {
throw badRequest("Invalid id");
}
try {
final List<TaskStatusEvent> events = model.getJobHistory(jobId);
metrics.jobsHistoryEventSize(events.size());
final TaskStatusEvents result = new TaskStatusEvents(events, OK);
return result;
} catch (JobDoesNotExistException e) {
return new TaskStatusEvents(ImmutableList.<TaskStatusEvent>of(), JOB_ID_NOT_FOUND);
}
} | [
"@",
"GET",
"@",
"Produces",
"(",
"APPLICATION_JSON",
")",
"@",
"Path",
"(",
"\"jobs/{id}\"",
")",
"@",
"Timed",
"@",
"ExceptionMetered",
"public",
"TaskStatusEvents",
"jobHistory",
"(",
"@",
"PathParam",
"(",
"\"id\"",
")",
"@",
"Valid",
"final",
"JobId",
"... | Returns the {@link TaskStatusEvents} for the specified job.
@param jobId The ID of the job.
@return The history of the jobs.
@throws HeliosException If an unexpected error occurs. | [
"Returns",
"the",
"{",
"@link",
"TaskStatusEvents",
"}",
"for",
"the",
"specified",
"job",
"."
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/resources/HistoryResource.java#L64-L82 |
sporniket/core | sporniket-core-lang/src/main/java/com/sporniket/libre/lang/functor/FunctorFactory.java | FunctorFactory.instanciateFunctorWithParameterAsAMethodWrapper | public static FunctorWithParameter instanciateFunctorWithParameterAsAMethodWrapper(final Object instance, final Method method)
throws Exception
{
if (null == method)
{
throw new NullPointerException("Method is null");
}
if (method.getParameterTypes().length != 1 || !Map.class.equals(method.getParameterTypes()[0]))
{
throw new InvalidParameterException("Method must accept a Map");
}
return new FunctorWithParameter()
{
public Object process(Map<String, Object> parameters) throws Exception
{
Object[] _paramList =
{
parameters
};
return method.invoke(instance, _paramList);
}
};
} | java | public static FunctorWithParameter instanciateFunctorWithParameterAsAMethodWrapper(final Object instance, final Method method)
throws Exception
{
if (null == method)
{
throw new NullPointerException("Method is null");
}
if (method.getParameterTypes().length != 1 || !Map.class.equals(method.getParameterTypes()[0]))
{
throw new InvalidParameterException("Method must accept a Map");
}
return new FunctorWithParameter()
{
public Object process(Map<String, Object> parameters) throws Exception
{
Object[] _paramList =
{
parameters
};
return method.invoke(instance, _paramList);
}
};
} | [
"public",
"static",
"FunctorWithParameter",
"instanciateFunctorWithParameterAsAMethodWrapper",
"(",
"final",
"Object",
"instance",
",",
"final",
"Method",
"method",
")",
"throws",
"Exception",
"{",
"if",
"(",
"null",
"==",
"method",
")",
"{",
"throw",
"new",
"NullPo... | Create a functor with parameter, wrapping a call to another method.
@param instance
null is allowed, for wrapping static method calls
@param method
the method to call.
@return a Functor with parameter that call the specified method on the specified instance.
@throws Exception if there is a problem to deal with. | [
"Create",
"a",
"functor",
"with",
"parameter",
"wrapping",
"a",
"call",
"to",
"another",
"method",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-lang/src/main/java/com/sporniket/libre/lang/functor/FunctorFactory.java#L140-L163 |
prestodb/presto | presto-thrift-connector/src/main/java/com/facebook/presto/connector/thrift/ThriftMetadata.java | ThriftMetadata.getTableMetadataInternal | private Optional<ThriftTableMetadata> getTableMetadataInternal(SchemaTableName schemaTableName)
{
requireNonNull(schemaTableName, "schemaTableName is null");
PrestoThriftNullableTableMetadata thriftTableMetadata = getTableMetadata(schemaTableName);
if (thriftTableMetadata.getTableMetadata() == null) {
return Optional.empty();
}
ThriftTableMetadata tableMetadata = new ThriftTableMetadata(thriftTableMetadata.getTableMetadata(), typeManager);
if (!Objects.equals(schemaTableName, tableMetadata.getSchemaTableName())) {
throw new PrestoException(THRIFT_SERVICE_INVALID_RESPONSE, "Requested and actual table names are different");
}
return Optional.of(tableMetadata);
} | java | private Optional<ThriftTableMetadata> getTableMetadataInternal(SchemaTableName schemaTableName)
{
requireNonNull(schemaTableName, "schemaTableName is null");
PrestoThriftNullableTableMetadata thriftTableMetadata = getTableMetadata(schemaTableName);
if (thriftTableMetadata.getTableMetadata() == null) {
return Optional.empty();
}
ThriftTableMetadata tableMetadata = new ThriftTableMetadata(thriftTableMetadata.getTableMetadata(), typeManager);
if (!Objects.equals(schemaTableName, tableMetadata.getSchemaTableName())) {
throw new PrestoException(THRIFT_SERVICE_INVALID_RESPONSE, "Requested and actual table names are different");
}
return Optional.of(tableMetadata);
} | [
"private",
"Optional",
"<",
"ThriftTableMetadata",
">",
"getTableMetadataInternal",
"(",
"SchemaTableName",
"schemaTableName",
")",
"{",
"requireNonNull",
"(",
"schemaTableName",
",",
"\"schemaTableName is null\"",
")",
";",
"PrestoThriftNullableTableMetadata",
"thriftTableMeta... | this method makes actual thrift request and should be called only by cache load method | [
"this",
"method",
"makes",
"actual",
"thrift",
"request",
"and",
"should",
"be",
"called",
"only",
"by",
"cache",
"load",
"method"
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-thrift-connector/src/main/java/com/facebook/presto/connector/thrift/ThriftMetadata.java#L198-L210 |
GoogleCloudPlatform/appengine-mapreduce | java/src/main/java/com/google/appengine/tools/mapreduce/impl/BigQueryFieldUtil.java | BigQueryFieldUtil.validateNestedRepeatedType | public static void validateNestedRepeatedType(Class<?> parameterType, Field field) {
if (isCollectionOrArray(parameterType)) {
throw new IllegalArgumentException(
" Cannot marshal a nested collection or array field " + field.getName());
}
} | java | public static void validateNestedRepeatedType(Class<?> parameterType, Field field) {
if (isCollectionOrArray(parameterType)) {
throw new IllegalArgumentException(
" Cannot marshal a nested collection or array field " + field.getName());
}
} | [
"public",
"static",
"void",
"validateNestedRepeatedType",
"(",
"Class",
"<",
"?",
">",
"parameterType",
",",
"Field",
"field",
")",
"{",
"if",
"(",
"isCollectionOrArray",
"(",
"parameterType",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\" C... | A field of type Collection<Collection> cannot be marshalled into bigquery data format as
parameterized types nested more than one level cannot be determined at runtime. So cannot be
marshalled. | [
"A",
"field",
"of",
"type",
"Collection<Collection",
">",
"cannot",
"be",
"marshalled",
"into",
"bigquery",
"data",
"format",
"as",
"parameterized",
"types",
"nested",
"more",
"than",
"one",
"level",
"cannot",
"be",
"determined",
"at",
"runtime",
".",
"So",
"c... | train | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/impl/BigQueryFieldUtil.java#L195-L200 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/content/DocumentListUrl.java | DocumentListUrl.updateDocumentListUrl | public static MozuUrl updateDocumentListUrl(String documentListName, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}?responseFields={responseFields}");
formatter.formatUrl("documentListName", documentListName);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl updateDocumentListUrl(String documentListName, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}?responseFields={responseFields}");
formatter.formatUrl("documentListName", documentListName);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"updateDocumentListUrl",
"(",
"String",
"documentListName",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/content/documentlists/{documentListName}?responseFields={responseFields}\"",... | Get Resource Url for UpdateDocumentList
@param documentListName Name of content documentListName to delete
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"UpdateDocumentList"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/content/DocumentListUrl.java#L64-L70 |
alkacon/opencms-core | src/org/opencms/ade/detailpage/CmsDetailPageUtil.java | CmsDetailPageUtil.getBestUrlName | public static String getBestUrlName(CmsObject cms, CmsUUID id) throws CmsException {
// this is currently only used for static export
Locale locale = cms.getRequestContext().getLocale();
List<Locale> defaultLocales = OpenCms.getLocaleManager().getDefaultLocales();
String urlName = cms.readBestUrlName(id, locale, defaultLocales);
if (urlName != null) {
return urlName;
}
return id.toString();
} | java | public static String getBestUrlName(CmsObject cms, CmsUUID id) throws CmsException {
// this is currently only used for static export
Locale locale = cms.getRequestContext().getLocale();
List<Locale> defaultLocales = OpenCms.getLocaleManager().getDefaultLocales();
String urlName = cms.readBestUrlName(id, locale, defaultLocales);
if (urlName != null) {
return urlName;
}
return id.toString();
} | [
"public",
"static",
"String",
"getBestUrlName",
"(",
"CmsObject",
"cms",
",",
"CmsUUID",
"id",
")",
"throws",
"CmsException",
"{",
"// this is currently only used for static export",
"Locale",
"locale",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getLocale",... | Returns either the newest URL name for a structure id, or the structure id as a string if there is no URL name.<p>
@param cms the current CMS context
@param id the structure id of a resource
@return the best URL name for the structure id
@throws CmsException if something goes wrong | [
"Returns",
"either",
"the",
"newest",
"URL",
"name",
"for",
"a",
"structure",
"id",
"or",
"the",
"structure",
"id",
"as",
"a",
"string",
"if",
"there",
"is",
"no",
"URL",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/detailpage/CmsDetailPageUtil.java#L101-L111 |
JadiraOrg/jadira | cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java | UnsafeOperations.deepCopyArrayAtOffset | public final void deepCopyArrayAtOffset(Object source, Object copy, Class<?> fieldClass, long offset) {
deepCopyArrayAtOffset(source, copy, fieldClass, offset, new IdentityHashMap<Object, Object>(100));
} | java | public final void deepCopyArrayAtOffset(Object source, Object copy, Class<?> fieldClass, long offset) {
deepCopyArrayAtOffset(source, copy, fieldClass, offset, new IdentityHashMap<Object, Object>(100));
} | [
"public",
"final",
"void",
"deepCopyArrayAtOffset",
"(",
"Object",
"source",
",",
"Object",
"copy",
",",
"Class",
"<",
"?",
">",
"fieldClass",
",",
"long",
"offset",
")",
"{",
"deepCopyArrayAtOffset",
"(",
"source",
",",
"copy",
",",
"fieldClass",
",",
"offs... | Copies the array of the specified type from the given field offset in the source object
to the same location in the copy, visiting the array during the copy so that its contents are also copied
@param source The object to copy from
@param copy The target object
@param fieldClass The declared type of array at the given offset
@param offset The offset to copy from | [
"Copies",
"the",
"array",
"of",
"the",
"specified",
"type",
"from",
"the",
"given",
"field",
"offset",
"in",
"the",
"source",
"object",
"to",
"the",
"same",
"location",
"in",
"the",
"copy",
"visiting",
"the",
"array",
"during",
"the",
"copy",
"so",
"that",... | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java#L454-L456 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/LocalPDBDirectory.java | LocalPDBDirectory.getLastModifiedTime | private Date getLastModifiedTime(URL url) {
// see http://stackoverflow.com/questions/2416872/how-do-you-obtain-modified-date-from-a-remote-file-java
Date date = null;
try {
String lastModified = url.openConnection().getHeaderField("Last-Modified");
logger.debug("Last modified date of server file ({}) is {}",url.toString(),lastModified);
if (lastModified!=null) {
try {
date = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss Z", Locale.ENGLISH).parse(lastModified);
} catch (ParseException e) {
logger.warn("Could not parse last modified time from string '{}', no last modified time available for file {}",
lastModified, url.toString());
// this will return null
}
}
} catch (IOException e) {
logger.warn("Problems while retrieving last modified time for file {}", url.toString());
}
return date;
} | java | private Date getLastModifiedTime(URL url) {
// see http://stackoverflow.com/questions/2416872/how-do-you-obtain-modified-date-from-a-remote-file-java
Date date = null;
try {
String lastModified = url.openConnection().getHeaderField("Last-Modified");
logger.debug("Last modified date of server file ({}) is {}",url.toString(),lastModified);
if (lastModified!=null) {
try {
date = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss Z", Locale.ENGLISH).parse(lastModified);
} catch (ParseException e) {
logger.warn("Could not parse last modified time from string '{}', no last modified time available for file {}",
lastModified, url.toString());
// this will return null
}
}
} catch (IOException e) {
logger.warn("Problems while retrieving last modified time for file {}", url.toString());
}
return date;
} | [
"private",
"Date",
"getLastModifiedTime",
"(",
"URL",
"url",
")",
"{",
"// see http://stackoverflow.com/questions/2416872/how-do-you-obtain-modified-date-from-a-remote-file-java",
"Date",
"date",
"=",
"null",
";",
"try",
"{",
"String",
"lastModified",
"=",
"url",
".",
"open... | Get the last modified time of the file in given url by retrieveing the "Last-Modified" header.
Note that this only works for http URLs
@param url
@return the last modified date or null if it couldn't be retrieved (in that case a warning will be logged) | [
"Get",
"the",
"last",
"modified",
"time",
"of",
"the",
"file",
"in",
"given",
"url",
"by",
"retrieveing",
"the",
"Last",
"-",
"Modified",
"header",
".",
"Note",
"that",
"this",
"only",
"works",
"for",
"http",
"URLs"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/LocalPDBDirectory.java#L576-L601 |
google/closure-templates | java/src/com/google/template/soy/SoyFileSet.java | SoyFileSet.compileForServerRendering | private ServerCompilationPrimitives compileForServerRendering() {
ParseResult result = parse();
throwIfErrorsPresent();
SoyFileSetNode soyTree = result.fileSet();
TemplateRegistry registry = result.registry();
// Clear the SoyDoc strings because they use unnecessary memory, unless we have a cache, in
// which case it is pointless.
if (cache == null) {
new ClearSoyDocStringsVisitor().exec(soyTree);
}
throwIfErrorsPresent();
return new ServerCompilationPrimitives(registry, soyTree);
} | java | private ServerCompilationPrimitives compileForServerRendering() {
ParseResult result = parse();
throwIfErrorsPresent();
SoyFileSetNode soyTree = result.fileSet();
TemplateRegistry registry = result.registry();
// Clear the SoyDoc strings because they use unnecessary memory, unless we have a cache, in
// which case it is pointless.
if (cache == null) {
new ClearSoyDocStringsVisitor().exec(soyTree);
}
throwIfErrorsPresent();
return new ServerCompilationPrimitives(registry, soyTree);
} | [
"private",
"ServerCompilationPrimitives",
"compileForServerRendering",
"(",
")",
"{",
"ParseResult",
"result",
"=",
"parse",
"(",
")",
";",
"throwIfErrorsPresent",
"(",
")",
";",
"SoyFileSetNode",
"soyTree",
"=",
"result",
".",
"fileSet",
"(",
")",
";",
"TemplateR... | Runs common compiler logic shared by tofu and jbcsrc backends. | [
"Runs",
"common",
"compiler",
"logic",
"shared",
"by",
"tofu",
"and",
"jbcsrc",
"backends",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/SoyFileSet.java#L857-L871 |
apache/incubator-atlas | repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java | AtlasEntityStoreV1.validateEntityAssociations | private void validateEntityAssociations(String guid, List<AtlasClassification> classifications) throws AtlasBaseException {
List<String> entityClassifications = getClassificationNames(guid);
for (AtlasClassification classification : classifications) {
String newClassification = classification.getTypeName();
if (CollectionUtils.isNotEmpty(entityClassifications) && entityClassifications.contains(newClassification)) {
throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "entity: " + guid +
", already associated with classification: " + newClassification);
}
}
} | java | private void validateEntityAssociations(String guid, List<AtlasClassification> classifications) throws AtlasBaseException {
List<String> entityClassifications = getClassificationNames(guid);
for (AtlasClassification classification : classifications) {
String newClassification = classification.getTypeName();
if (CollectionUtils.isNotEmpty(entityClassifications) && entityClassifications.contains(newClassification)) {
throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "entity: " + guid +
", already associated with classification: " + newClassification);
}
}
} | [
"private",
"void",
"validateEntityAssociations",
"(",
"String",
"guid",
",",
"List",
"<",
"AtlasClassification",
">",
"classifications",
")",
"throws",
"AtlasBaseException",
"{",
"List",
"<",
"String",
">",
"entityClassifications",
"=",
"getClassificationNames",
"(",
... | Validate if classification is not already associated with the entities
@param guid unique entity id
@param classifications list of classifications to be associated | [
"Validate",
"if",
"classification",
"is",
"not",
"already",
"associated",
"with",
"the",
"entities"
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java#L726-L737 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_schol.java | Scs_schol.cs_schol | public static Scss cs_schol(int order, Scs A) {
int n, c[], post[], P[];
Scs C;
Scss S;
if (!Scs_util.CS_CSC(A))
return (null); /* check inputs */
n = A.n;
S = new Scss(); /* allocate result S */
P = Scs_amd.cs_amd(order, A); /* P = amd(A+A'), or natural */
S.pinv = Scs_pinv.cs_pinv(P, n); /* find inverse permutation */
if (order != 0 && S.pinv == null)
return null;
C = Scs_symperm.cs_symperm(A, S.pinv, false); /* C = spones(triu(A(P,P))) */
S.parent = Scs_etree.cs_etree(C, false); /* find etree of C */
post = Scs_post.cs_post(S.parent, n); /* postorder the etree */
c = Scs_counts.cs_counts(C, S.parent, post, false); /* find column counts of chol(C) */
S.cp = new int[n + 1]; /* allocate result S.cp */
S.unz = S.lnz = Scs_cumsum.cs_cumsum(S.cp, c, n); /* find column pointers for L */
return ((S.lnz >= 0) ? S : null);
} | java | public static Scss cs_schol(int order, Scs A) {
int n, c[], post[], P[];
Scs C;
Scss S;
if (!Scs_util.CS_CSC(A))
return (null); /* check inputs */
n = A.n;
S = new Scss(); /* allocate result S */
P = Scs_amd.cs_amd(order, A); /* P = amd(A+A'), or natural */
S.pinv = Scs_pinv.cs_pinv(P, n); /* find inverse permutation */
if (order != 0 && S.pinv == null)
return null;
C = Scs_symperm.cs_symperm(A, S.pinv, false); /* C = spones(triu(A(P,P))) */
S.parent = Scs_etree.cs_etree(C, false); /* find etree of C */
post = Scs_post.cs_post(S.parent, n); /* postorder the etree */
c = Scs_counts.cs_counts(C, S.parent, post, false); /* find column counts of chol(C) */
S.cp = new int[n + 1]; /* allocate result S.cp */
S.unz = S.lnz = Scs_cumsum.cs_cumsum(S.cp, c, n); /* find column pointers for L */
return ((S.lnz >= 0) ? S : null);
} | [
"public",
"static",
"Scss",
"cs_schol",
"(",
"int",
"order",
",",
"Scs",
"A",
")",
"{",
"int",
"n",
",",
"c",
"[",
"]",
",",
"post",
"[",
"]",
",",
"P",
"[",
"]",
";",
"Scs",
"C",
";",
"Scss",
"S",
";",
"if",
"(",
"!",
"Scs_util",
".",
"CS_... | Ordering and symbolic analysis for a Cholesky factorization.
@param order
ordering option (0 or 1)
@param A
column-compressed matrix
@return symbolic analysis for Cholesky, null on error | [
"Ordering",
"and",
"symbolic",
"analysis",
"for",
"a",
"Cholesky",
"factorization",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_schol.java#L46-L65 |
groupon/odo | client/src/main/java/com/groupon/odo/client/Client.java | Client.getServerGroups | public List<ServerGroup> getServerGroups() {
ArrayList<ServerGroup> groups = new ArrayList<ServerGroup>();
try {
JSONObject response = new JSONObject(doGet(BASE_SERVERGROUP, null));
JSONArray serverArray = response.getJSONArray("servergroups");
for (int i = 0; i < serverArray.length(); i++) {
JSONObject jsonServerGroup = serverArray.getJSONObject(i);
ServerGroup group = getServerGroupFromJSON(jsonServerGroup);
groups.add(group);
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return groups;
} | java | public List<ServerGroup> getServerGroups() {
ArrayList<ServerGroup> groups = new ArrayList<ServerGroup>();
try {
JSONObject response = new JSONObject(doGet(BASE_SERVERGROUP, null));
JSONArray serverArray = response.getJSONArray("servergroups");
for (int i = 0; i < serverArray.length(); i++) {
JSONObject jsonServerGroup = serverArray.getJSONObject(i);
ServerGroup group = getServerGroupFromJSON(jsonServerGroup);
groups.add(group);
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return groups;
} | [
"public",
"List",
"<",
"ServerGroup",
">",
"getServerGroups",
"(",
")",
"{",
"ArrayList",
"<",
"ServerGroup",
">",
"groups",
"=",
"new",
"ArrayList",
"<",
"ServerGroup",
">",
"(",
")",
";",
"try",
"{",
"JSONObject",
"response",
"=",
"new",
"JSONObject",
"(... | Get the collection of the server groups
@return Collection of active server groups | [
"Get",
"the",
"collection",
"of",
"the",
"server",
"groups"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L1249-L1265 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/replacer/AbstractPbeReplacer.java | AbstractPbeReplacer.transform | private byte[] transform(int cryptMode, byte[] value, byte[] salt, int iterations) throws Exception {
checkPositive(iterations, "Count of iterations has to be positive number.");
SecretKeyFactory factory = SecretKeyFactory.getInstance(secretKeyFactoryAlgorithm);
char[] password = getPassword();
checkTrue(password != null && password.length > 0, "Empty password is not supported");
PBEKeySpec pbeKeySpec = new PBEKeySpec(password, salt, iterations, keyLengthBits);
byte[] tmpKey = factory.generateSecret(pbeKeySpec).getEncoded();
SecretKeySpec secretKeySpec = new SecretKeySpec(tmpKey, secretKeyAlgorithm);
Cipher cipher = securityProvider == null ? Cipher.getInstance(cipherAlgorithm)
: Cipher.getInstance(cipherAlgorithm, securityProvider);
cipher.init(cryptMode, secretKeySpec);
return cipher.doFinal(value);
} | java | private byte[] transform(int cryptMode, byte[] value, byte[] salt, int iterations) throws Exception {
checkPositive(iterations, "Count of iterations has to be positive number.");
SecretKeyFactory factory = SecretKeyFactory.getInstance(secretKeyFactoryAlgorithm);
char[] password = getPassword();
checkTrue(password != null && password.length > 0, "Empty password is not supported");
PBEKeySpec pbeKeySpec = new PBEKeySpec(password, salt, iterations, keyLengthBits);
byte[] tmpKey = factory.generateSecret(pbeKeySpec).getEncoded();
SecretKeySpec secretKeySpec = new SecretKeySpec(tmpKey, secretKeyAlgorithm);
Cipher cipher = securityProvider == null ? Cipher.getInstance(cipherAlgorithm)
: Cipher.getInstance(cipherAlgorithm, securityProvider);
cipher.init(cryptMode, secretKeySpec);
return cipher.doFinal(value);
} | [
"private",
"byte",
"[",
"]",
"transform",
"(",
"int",
"cryptMode",
",",
"byte",
"[",
"]",
"value",
",",
"byte",
"[",
"]",
"salt",
",",
"int",
"iterations",
")",
"throws",
"Exception",
"{",
"checkPositive",
"(",
"iterations",
",",
"\"Count of iterations has t... | Encrypt/decrypt given value by using the configured cipher algorithm with provided salt and iterations count.
@param cryptMode mode (one of {@link Cipher#DECRYPT_MODE}, {@link Cipher#ENCRYPT_MODE})
@param value value to encrypt/decrypt
@param salt salt to be used
@param iterations count of iterations
@return encrypted or decrypted byte array (depending on cryptMode) | [
"Encrypt",
"/",
"decrypt",
"given",
"value",
"by",
"using",
"the",
"configured",
"cipher",
"algorithm",
"with",
"provided",
"salt",
"and",
"iterations",
"count",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/replacer/AbstractPbeReplacer.java#L158-L170 |
messagebird/java-rest-api | api/src/main/java/com/messagebird/RequestSigner.java | RequestSigner.computeSignature | private byte[] computeSignature(Request request) {
String timestampAndQuery = request.getTimestamp() + '\n' +
request.getSortedQueryParameters() + '\n';
byte[] timestampAndQueryBytes = timestampAndQuery.getBytes(CHARSET_UTF8);
byte[] bodyHashBytes = getSha256Hash(request.getData());
return getHmacSha256Signature(appendArrays(timestampAndQueryBytes, bodyHashBytes));
} | java | private byte[] computeSignature(Request request) {
String timestampAndQuery = request.getTimestamp() + '\n' +
request.getSortedQueryParameters() + '\n';
byte[] timestampAndQueryBytes = timestampAndQuery.getBytes(CHARSET_UTF8);
byte[] bodyHashBytes = getSha256Hash(request.getData());
return getHmacSha256Signature(appendArrays(timestampAndQueryBytes, bodyHashBytes));
} | [
"private",
"byte",
"[",
"]",
"computeSignature",
"(",
"Request",
"request",
")",
"{",
"String",
"timestampAndQuery",
"=",
"request",
".",
"getTimestamp",
"(",
")",
"+",
"'",
"'",
"+",
"request",
".",
"getSortedQueryParameters",
"(",
")",
"+",
"'",
"'",
";"... | Computes the signature for a request instance.
@param request Request to compute signature for.
@return HMAC-SHA2556 signature for the provided request. | [
"Computes",
"the",
"signature",
"for",
"a",
"request",
"instance",
"."
] | train | https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/RequestSigner.java#L75-L83 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/cluster/RedisClusterURIUtil.java | RedisClusterURIUtil.applyUriConnectionSettings | static void applyUriConnectionSettings(RedisURI from, RedisURI to) {
if (from.getPassword() != null && from.getPassword().length != 0) {
to.setPassword(new String(from.getPassword()));
}
to.setTimeout(from.getTimeout());
to.setSsl(from.isSsl());
to.setStartTls(from.isStartTls());
to.setVerifyPeer(from.isVerifyPeer());
} | java | static void applyUriConnectionSettings(RedisURI from, RedisURI to) {
if (from.getPassword() != null && from.getPassword().length != 0) {
to.setPassword(new String(from.getPassword()));
}
to.setTimeout(from.getTimeout());
to.setSsl(from.isSsl());
to.setStartTls(from.isStartTls());
to.setVerifyPeer(from.isVerifyPeer());
} | [
"static",
"void",
"applyUriConnectionSettings",
"(",
"RedisURI",
"from",
",",
"RedisURI",
"to",
")",
"{",
"if",
"(",
"from",
".",
"getPassword",
"(",
")",
"!=",
"null",
"&&",
"from",
".",
"getPassword",
"(",
")",
".",
"length",
"!=",
"0",
")",
"{",
"to... | Apply {@link RedisURI} settings such as SSL/Timeout/password.
@param from from {@link RedisURI}.
@param to from {@link RedisURI}. | [
"Apply",
"{",
"@link",
"RedisURI",
"}",
"settings",
"such",
"as",
"SSL",
"/",
"Timeout",
"/",
"password",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/cluster/RedisClusterURIUtil.java#L72-L82 |
Azure/azure-sdk-for-java | containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java | ContainerGroupsInner.createOrUpdate | public ContainerGroupInner createOrUpdate(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).toBlocking().last().body();
} | java | public ContainerGroupInner createOrUpdate(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).toBlocking().last().body();
} | [
"public",
"ContainerGroupInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerGroupName",
",",
"ContainerGroupInner",
"containerGroup",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"containerGroup... | Create or update container groups.
Create or update container groups with specified configurations.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@param containerGroup The properties of the container group to be created or updated.
@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 ContainerGroupInner object if successful. | [
"Create",
"or",
"update",
"container",
"groups",
".",
"Create",
"or",
"update",
"container",
"groups",
"with",
"specified",
"configurations",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java#L441-L443 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java | RouteTablesInner.updateTagsAsync | public Observable<RouteTableInner> updateTagsAsync(String resourceGroupName, String routeTableName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, routeTableName).map(new Func1<ServiceResponse<RouteTableInner>, RouteTableInner>() {
@Override
public RouteTableInner call(ServiceResponse<RouteTableInner> response) {
return response.body();
}
});
} | java | public Observable<RouteTableInner> updateTagsAsync(String resourceGroupName, String routeTableName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, routeTableName).map(new Func1<ServiceResponse<RouteTableInner>, RouteTableInner>() {
@Override
public RouteTableInner call(ServiceResponse<RouteTableInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RouteTableInner",
">",
"updateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"routeTableName",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"routeTableName",
")",
".",
"map",
"(",
... | Updates a route table tags.
@param resourceGroupName The name of the resource group.
@param routeTableName The name of the route table.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"a",
"route",
"table",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java#L636-L643 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java | NumberInRange.isInRange | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static boolean isInRange(@Nonnull final Number number, @Nonnull final BigDecimal min, @Nonnull final BigDecimal max) {
Check.notNull(number, "number");
Check.notNull(min, "min");
Check.notNull(max, "max");
BigDecimal bigDecimal = null;
if (number instanceof Byte || number instanceof Short || number instanceof Integer || number instanceof Long) {
bigDecimal = new BigDecimal(number.longValue());
} else if (number instanceof Float || number instanceof Double) {
bigDecimal = new BigDecimal(number.doubleValue());
} else if (number instanceof BigInteger) {
bigDecimal = new BigDecimal((BigInteger) number);
} else if (number instanceof BigDecimal) {
bigDecimal = (BigDecimal) number;
} else {
throw new IllegalNumberArgumentException("Return value is no known subclass of 'java.lang.Number': "
+ number.getClass().getName());
}
return max.compareTo(bigDecimal) >= 0 && min.compareTo(bigDecimal) <= 0;
} | java | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static boolean isInRange(@Nonnull final Number number, @Nonnull final BigDecimal min, @Nonnull final BigDecimal max) {
Check.notNull(number, "number");
Check.notNull(min, "min");
Check.notNull(max, "max");
BigDecimal bigDecimal = null;
if (number instanceof Byte || number instanceof Short || number instanceof Integer || number instanceof Long) {
bigDecimal = new BigDecimal(number.longValue());
} else if (number instanceof Float || number instanceof Double) {
bigDecimal = new BigDecimal(number.doubleValue());
} else if (number instanceof BigInteger) {
bigDecimal = new BigDecimal((BigInteger) number);
} else if (number instanceof BigDecimal) {
bigDecimal = (BigDecimal) number;
} else {
throw new IllegalNumberArgumentException("Return value is no known subclass of 'java.lang.Number': "
+ number.getClass().getName());
}
return max.compareTo(bigDecimal) >= 0 && min.compareTo(bigDecimal) <= 0;
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"IllegalNullArgumentException",
".",
"class",
")",
"public",
"static",
"boolean",
"isInRange",
"(",
"@",
"Nonnull",
"final",
"Number",
"number",
",",
"@",
"Nonnull",
"final",
"BigDecimal",
"min",
",",
"@",
"Nonnull",
... | Test if a number is in an arbitrary range.
@param number
a number
@param min
lower boundary of the range
@param max
upper boundary of the range
@return true if the given number is within the range | [
"Test",
"if",
"a",
"number",
"is",
"in",
"an",
"arbitrary",
"range",
"."
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java#L250-L271 |
xwiki/xwiki-rendering | xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/parser/reference/GenericLinkReferenceParser.java | GenericLinkReferenceParser.shouldEscape | private boolean shouldEscape(StringBuilder content, int charPosition)
{
int counter = 0;
int pos = charPosition - 1;
while (pos > -1 && content.charAt(pos) == ESCAPE_CHAR) {
counter++;
pos--;
}
return counter % 2 != 0;
} | java | private boolean shouldEscape(StringBuilder content, int charPosition)
{
int counter = 0;
int pos = charPosition - 1;
while (pos > -1 && content.charAt(pos) == ESCAPE_CHAR) {
counter++;
pos--;
}
return counter % 2 != 0;
} | [
"private",
"boolean",
"shouldEscape",
"(",
"StringBuilder",
"content",
",",
"int",
"charPosition",
")",
"{",
"int",
"counter",
"=",
"0",
";",
"int",
"pos",
"=",
"charPosition",
"-",
"1",
";",
"while",
"(",
"pos",
">",
"-",
"1",
"&&",
"content",
".",
"c... | Count the number of escape chars before a given character and if that number is odd then that character should be
escaped.
@param content the content in which to check for escapes
@param charPosition the position of the char for which to decide if it should be escaped or not
@return true if the character should be escaped | [
"Count",
"the",
"number",
"of",
"escape",
"chars",
"before",
"a",
"given",
"character",
"and",
"if",
"that",
"number",
"is",
"odd",
"then",
"that",
"character",
"should",
"be",
"escaped",
"."
] | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/parser/reference/GenericLinkReferenceParser.java#L292-L301 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/CommonFilter.java | CommonFilter.makeConditionWithMatchType | private ICondition makeConditionWithMatchType(String key, String operand, String valueString,
boolean ipAddress) throws FilterException {
if (operand.equalsIgnoreCase(AuthFilterConfig.MATCH_TYPE_EQUALS)) {
return new EqualCondition(key, makeValue(valueString, ipAddress), operand);
} else if (operand.equalsIgnoreCase(AuthFilterConfig.MATCH_TYPE_NOT_CONTAIN)) {
NotContainsCondition cond = new NotContainsCondition(key, operand);
processOrValues(valueString, ipAddress, cond);
return cond;
} else if (operand.equalsIgnoreCase(AuthFilterConfig.MATCH_TYPE_CONTAINS)) {
OrCondition cond = new OrCondition(key, operand);
processOrValues(valueString, ipAddress, cond);
return cond;
} else if (operand.equalsIgnoreCase(AuthFilterConfig.MATCH_TYPE_LESS_THAN)) {
return new LessCondition(key, makeValue(valueString, ipAddress), operand);
} else if (operand.equalsIgnoreCase(AuthFilterConfig.MATCH_TYPE_GREATER_THAN)) {
return new GreaterCondition(key, makeValue(valueString, ipAddress), operand);
} else {
Tr.error(tc, "AUTH_FILTER_MALFORMED_WORD_MATCH_TYPE", new Object[] { operand });
throw new FilterException(TraceNLS.getFormattedMessage(this.getClass(),
TraceConstants.MESSAGE_BUNDLE,
"AUTH_FILTER_MALFORMED_WORD_MATCH_TYPE",
null,
"CWWKS4353E: The filter match type should be one of: equals, notContain, contains, greaterThan or lessThan. The match type used was {0}."));
}
} | java | private ICondition makeConditionWithMatchType(String key, String operand, String valueString,
boolean ipAddress) throws FilterException {
if (operand.equalsIgnoreCase(AuthFilterConfig.MATCH_TYPE_EQUALS)) {
return new EqualCondition(key, makeValue(valueString, ipAddress), operand);
} else if (operand.equalsIgnoreCase(AuthFilterConfig.MATCH_TYPE_NOT_CONTAIN)) {
NotContainsCondition cond = new NotContainsCondition(key, operand);
processOrValues(valueString, ipAddress, cond);
return cond;
} else if (operand.equalsIgnoreCase(AuthFilterConfig.MATCH_TYPE_CONTAINS)) {
OrCondition cond = new OrCondition(key, operand);
processOrValues(valueString, ipAddress, cond);
return cond;
} else if (operand.equalsIgnoreCase(AuthFilterConfig.MATCH_TYPE_LESS_THAN)) {
return new LessCondition(key, makeValue(valueString, ipAddress), operand);
} else if (operand.equalsIgnoreCase(AuthFilterConfig.MATCH_TYPE_GREATER_THAN)) {
return new GreaterCondition(key, makeValue(valueString, ipAddress), operand);
} else {
Tr.error(tc, "AUTH_FILTER_MALFORMED_WORD_MATCH_TYPE", new Object[] { operand });
throw new FilterException(TraceNLS.getFormattedMessage(this.getClass(),
TraceConstants.MESSAGE_BUNDLE,
"AUTH_FILTER_MALFORMED_WORD_MATCH_TYPE",
null,
"CWWKS4353E: The filter match type should be one of: equals, notContain, contains, greaterThan or lessThan. The match type used was {0}."));
}
} | [
"private",
"ICondition",
"makeConditionWithMatchType",
"(",
"String",
"key",
",",
"String",
"operand",
",",
"String",
"valueString",
",",
"boolean",
"ipAddress",
")",
"throws",
"FilterException",
"{",
"if",
"(",
"operand",
".",
"equalsIgnoreCase",
"(",
"AuthFilterCo... | Given the three parts (key, operand, value) make a proper condition object. Notice that I need to know
if the value should be interpreted as an IP address. There some service that use symbol and others use word
for operand/matchType.
Basically just look at the operator string and create the correct condition. Only the OR involved any
complicated processing since there are multiple values for OR.
Note: the new configuration use words such as equals, notContain, contains, greaterThan or lessThan | [
"Given",
"the",
"three",
"parts",
"(",
"key",
"operand",
"value",
")",
"make",
"a",
"proper",
"condition",
"object",
".",
"Notice",
"that",
"I",
"need",
"to",
"know",
"if",
"the",
"value",
"should",
"be",
"interpreted",
"as",
"an",
"IP",
"address",
".",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/CommonFilter.java#L245-L269 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/GroupIterator.java | GroupIterator.getNextGroup | private Group getNextGroup(int tmp_model,int tmp_chain,int tmp_group)
throws NoSuchElementException
{
if ( tmp_model >= structure.nrModels()){
throw new NoSuchElementException("arrived at end of structure!");
}
List<Chain> model = structure.getModel(tmp_model);
if ( tmp_chain >= model.size() ){
if(fixed_model)
throw new NoSuchElementException("arrived at end of model!");
return getNextGroup(tmp_model+1,0,0);
}
Chain chain = model.get(tmp_chain);
if (tmp_group >= chain.getAtomLength()){
// start search at beginning of next chain.
return getNextGroup(tmp_model,tmp_chain+1,0);
} else {
current_model_pos = tmp_model;
current_chain_pos = tmp_chain;
current_group_pos = tmp_group;
return chain.getAtomGroup(current_group_pos);
}
} | java | private Group getNextGroup(int tmp_model,int tmp_chain,int tmp_group)
throws NoSuchElementException
{
if ( tmp_model >= structure.nrModels()){
throw new NoSuchElementException("arrived at end of structure!");
}
List<Chain> model = structure.getModel(tmp_model);
if ( tmp_chain >= model.size() ){
if(fixed_model)
throw new NoSuchElementException("arrived at end of model!");
return getNextGroup(tmp_model+1,0,0);
}
Chain chain = model.get(tmp_chain);
if (tmp_group >= chain.getAtomLength()){
// start search at beginning of next chain.
return getNextGroup(tmp_model,tmp_chain+1,0);
} else {
current_model_pos = tmp_model;
current_chain_pos = tmp_chain;
current_group_pos = tmp_group;
return chain.getAtomGroup(current_group_pos);
}
} | [
"private",
"Group",
"getNextGroup",
"(",
"int",
"tmp_model",
",",
"int",
"tmp_chain",
",",
"int",
"tmp_group",
")",
"throws",
"NoSuchElementException",
"{",
"if",
"(",
"tmp_model",
">=",
"structure",
".",
"nrModels",
"(",
")",
")",
"{",
"throw",
"new",
"NoSu... | recursive method to retrieve the next group. Helper
method for gext().
@see #next | [
"recursive",
"method",
"to",
"retrieve",
"the",
"next",
"group",
".",
"Helper",
"method",
"for",
"gext",
"()",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/GroupIterator.java#L172-L200 |
alkacon/opencms-core | src/org/opencms/db/CmsUserSettings.java | CmsUserSettings.setAdditionalPreference | public void setAdditionalPreference(String name, String value) {
if (value == null) {
m_additionalPreferences.remove(name);
} else {
m_additionalPreferences.put(name, value);
}
} | java | public void setAdditionalPreference(String name, String value) {
if (value == null) {
m_additionalPreferences.remove(name);
} else {
m_additionalPreferences.put(name, value);
}
} | [
"public",
"void",
"setAdditionalPreference",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"m_additionalPreferences",
".",
"remove",
"(",
"name",
")",
";",
"}",
"else",
"{",
"m_additionalPreferences",
".... | Sets an additional preference value.<p>
@param name the additional preference name
@param value the preference value | [
"Sets",
"an",
"additional",
"preference",
"value",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsUserSettings.java#L1740-L1747 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java | StyleUtils.createMarkerOptions | public static MarkerOptions createMarkerOptions(GeoPackage geoPackage, FeatureRow featureRow, float density) {
return createMarkerOptions(geoPackage, featureRow, density, null);
} | java | public static MarkerOptions createMarkerOptions(GeoPackage geoPackage, FeatureRow featureRow, float density) {
return createMarkerOptions(geoPackage, featureRow, density, null);
} | [
"public",
"static",
"MarkerOptions",
"createMarkerOptions",
"(",
"GeoPackage",
"geoPackage",
",",
"FeatureRow",
"featureRow",
",",
"float",
"density",
")",
"{",
"return",
"createMarkerOptions",
"(",
"geoPackage",
",",
"featureRow",
",",
"density",
",",
"null",
")",
... | Create new marker options populated with the feature row style (icon or style)
@param geoPackage GeoPackage
@param featureRow feature row
@param density display density: {@link android.util.DisplayMetrics#density}
@return marker options populated with the feature style | [
"Create",
"new",
"marker",
"options",
"populated",
"with",
"the",
"feature",
"row",
"style",
"(",
"icon",
"or",
"style",
")"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L35-L37 |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRActivity.java | LRActivity.addVerb | public boolean addVerb(String action, Date dateStart, Date dateEnd, String[] description, String comment)
{
Map<String, Object> container = new HashMap<String, Object>();
if (action != null)
{
container.put("action", action);
}
else
{
return false;
}
if (dateStart != null && dateEnd != null)
{
container.put("date", df.format(dateStart) + "/" + df.format(dateEnd));
}
else if (dateStart != null)
{
container.put("date", df.format(dateStart));
}
if (description != null && description.length > 0)
{
container.put("description", description);
}
if (comment != null)
{
container.put("comment", comment);
}
return addChild("verb", container, null);
} | java | public boolean addVerb(String action, Date dateStart, Date dateEnd, String[] description, String comment)
{
Map<String, Object> container = new HashMap<String, Object>();
if (action != null)
{
container.put("action", action);
}
else
{
return false;
}
if (dateStart != null && dateEnd != null)
{
container.put("date", df.format(dateStart) + "/" + df.format(dateEnd));
}
else if (dateStart != null)
{
container.put("date", df.format(dateStart));
}
if (description != null && description.length > 0)
{
container.put("description", description);
}
if (comment != null)
{
container.put("comment", comment);
}
return addChild("verb", container, null);
} | [
"public",
"boolean",
"addVerb",
"(",
"String",
"action",
",",
"Date",
"dateStart",
",",
"Date",
"dateEnd",
",",
"String",
"[",
"]",
"description",
",",
"String",
"comment",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"container",
"=",
"new",
"Has... | Add a verb object to this activity
@param action The action type of the verb (required)
@param dateStart The start date of the action described
@param dateEnd The end date of the action described
@param description An array of descriptions of this action
@param comment A comment on this verb
@return True if added, false if not (due to missing required fields) | [
"Add",
"a",
"verb",
"object",
"to",
"this",
"activity"
] | train | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L298-L328 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/gen/BeanData.java | BeanData.getTypeGenericExtends | public String getTypeGenericExtends(int typeParamIndex, String[] typeParamNames) {
String genericClause = typeGenericExtends[typeParamIndex];
genericClause = genericClause.replace("<" + typeGenericName[typeParamIndex] + ">", "<" + typeParamNames[typeParamIndex] + ">");
for (int i = 0; i < typeGenericName.length; i++) {
genericClause = genericClause.replace("<" + typeGenericName[i] + ">", "<" + typeParamNames[i] + ">");
genericClause = genericClause.replace(" extends " + typeGenericName[i] + ">", " extends " + typeParamNames[i] + ">");
genericClause = genericClause.replace(" super " + typeGenericName[i] + ">", " super " + typeParamNames[i] + ">");
}
return genericClause;
} | java | public String getTypeGenericExtends(int typeParamIndex, String[] typeParamNames) {
String genericClause = typeGenericExtends[typeParamIndex];
genericClause = genericClause.replace("<" + typeGenericName[typeParamIndex] + ">", "<" + typeParamNames[typeParamIndex] + ">");
for (int i = 0; i < typeGenericName.length; i++) {
genericClause = genericClause.replace("<" + typeGenericName[i] + ">", "<" + typeParamNames[i] + ">");
genericClause = genericClause.replace(" extends " + typeGenericName[i] + ">", " extends " + typeParamNames[i] + ">");
genericClause = genericClause.replace(" super " + typeGenericName[i] + ">", " super " + typeParamNames[i] + ">");
}
return genericClause;
} | [
"public",
"String",
"getTypeGenericExtends",
"(",
"int",
"typeParamIndex",
",",
"String",
"[",
"]",
"typeParamNames",
")",
"{",
"String",
"genericClause",
"=",
"typeGenericExtends",
"[",
"typeParamIndex",
"]",
";",
"genericClause",
"=",
"genericClause",
".",
"replac... | Gets the extends clause of the parameterisation of the bean, such as '{@code extends Foo}'.
@param typeParamIndex the zero-based index of the type parameter
@param typeParamNames the type parameter names
@return the generic type extends clause, or a blank string if not generic or no extends, not null | [
"Gets",
"the",
"extends",
"clause",
"of",
"the",
"parameterisation",
"of",
"the",
"bean",
"such",
"as",
"{"
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/gen/BeanData.java#L913-L922 |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Repository.java | Repository.removeRequirement | public void removeRequirement(Requirement requirement) throws GreenPepperServerException
{
if(!requirements.contains(requirement) )
throw new GreenPepperServerException( GreenPepperServerErrorKey.REQUIREMENT_NOT_FOUND, "Requirement not found");
requirements.remove(requirement);
requirement.setRepository(null);
} | java | public void removeRequirement(Requirement requirement) throws GreenPepperServerException
{
if(!requirements.contains(requirement) )
throw new GreenPepperServerException( GreenPepperServerErrorKey.REQUIREMENT_NOT_FOUND, "Requirement not found");
requirements.remove(requirement);
requirement.setRepository(null);
} | [
"public",
"void",
"removeRequirement",
"(",
"Requirement",
"requirement",
")",
"throws",
"GreenPepperServerException",
"{",
"if",
"(",
"!",
"requirements",
".",
"contains",
"(",
"requirement",
")",
")",
"throw",
"new",
"GreenPepperServerException",
"(",
"GreenPepperSe... | <p>removeRequirement.</p>
@param requirement a {@link com.greenpepper.server.domain.Requirement} object.
@throws com.greenpepper.server.GreenPepperServerException if any. | [
"<p",
">",
"removeRequirement",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Repository.java#L363-L370 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.createEvent | public void createEvent(Map<String, Object> eventParams) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
URIBuilder url = new URIBuilder(settings.getURL(Constants.CREATE_EVENT_URL));
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
String body = JSONUtils.buildJSON(eventParams);
bearerRequest.setBody(body);
OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class);
if (oAuthResponse.getResponseCode() != 200 || !oAuthResponse.getType().equals("success")) {
error = oAuthResponse.getError();
errorDescription = oAuthResponse.getErrorDescription();
errorAttribute = oAuthResponse.getErrorAttribute();
}
} | java | public void createEvent(Map<String, Object> eventParams) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
URIBuilder url = new URIBuilder(settings.getURL(Constants.CREATE_EVENT_URL));
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
String body = JSONUtils.buildJSON(eventParams);
bearerRequest.setBody(body);
OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class);
if (oAuthResponse.getResponseCode() != 200 || !oAuthResponse.getType().equals("success")) {
error = oAuthResponse.getError();
errorDescription = oAuthResponse.getErrorDescription();
errorAttribute = oAuthResponse.getErrorAttribute();
}
} | [
"public",
"void",
"createEvent",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"eventParams",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"cleanError",
"(",
")",
";",
"prepareToken",
"(",
")",
";",
"Onelo... | Create an event in the OneLogin event log.
@param eventParams
Event Data (event_type_id, account_id, actor_system, actor_user_id, actor_user_name, app_id,
assuming_acting_user_id, custom_message, directory_sync_run_id, group_id, group_name, ipaddr,
otp_device_id, otp_device_name, policy_id, policy_name, role_id, role_name, user_id, user_name)
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor
@see com.onelogin.sdk.model.Event
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/events/create-event">Create Event documentation</a> | [
"Create",
"an",
"event",
"in",
"the",
"OneLogin",
"event",
"log",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L2163-L2186 |
timehop/sticky-headers-recyclerview | library/src/main/java/com/timehop/stickyheadersrecyclerview/calculation/DimensionCalculator.java | DimensionCalculator.initMargins | public void initMargins(Rect margins, View view) {
LayoutParams layoutParams = view.getLayoutParams();
if (layoutParams instanceof MarginLayoutParams) {
MarginLayoutParams marginLayoutParams = (MarginLayoutParams) layoutParams;
initMarginRect(margins, marginLayoutParams);
} else {
margins.set(0, 0, 0, 0);
}
} | java | public void initMargins(Rect margins, View view) {
LayoutParams layoutParams = view.getLayoutParams();
if (layoutParams instanceof MarginLayoutParams) {
MarginLayoutParams marginLayoutParams = (MarginLayoutParams) layoutParams;
initMarginRect(margins, marginLayoutParams);
} else {
margins.set(0, 0, 0, 0);
}
} | [
"public",
"void",
"initMargins",
"(",
"Rect",
"margins",
",",
"View",
"view",
")",
"{",
"LayoutParams",
"layoutParams",
"=",
"view",
".",
"getLayoutParams",
"(",
")",
";",
"if",
"(",
"layoutParams",
"instanceof",
"MarginLayoutParams",
")",
"{",
"MarginLayoutPara... | Populates {@link Rect} with margins for any view.
@param margins rect to populate
@param view for which to get margins | [
"Populates",
"{",
"@link",
"Rect",
"}",
"with",
"margins",
"for",
"any",
"view",
"."
] | train | https://github.com/timehop/sticky-headers-recyclerview/blob/f5a9e9b8f5d96734e20439b0a41381865fa52fb7/library/src/main/java/com/timehop/stickyheadersrecyclerview/calculation/DimensionCalculator.java#L21-L30 |
OpenLiberty/open-liberty | dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java | LifecycleCallbackHelper.getMethodNameFromDD | public String getMethodNameFromDD(List<LifecycleCallback> callbacks, String classname) {
String methodName = null;
for (LifecycleCallback callback : callbacks) {
// lifecycle-callback-class default to the enclosing component class Client
String callbackClassName;
callbackClassName = callback.getClassName();
if (callbackClassName == null) {
callbackClassName = mainClassName;
}
if (callbackClassName.equals(classname)) {
if (methodName == null) {
methodName = callback.getMethodName();
} else {
Tr.warning(tc, "DUPLICATE_CALLBACK_METHOD_CWWKC2454W", new Object[] { methodName, classname });
}
}
}
return methodName;
} | java | public String getMethodNameFromDD(List<LifecycleCallback> callbacks, String classname) {
String methodName = null;
for (LifecycleCallback callback : callbacks) {
// lifecycle-callback-class default to the enclosing component class Client
String callbackClassName;
callbackClassName = callback.getClassName();
if (callbackClassName == null) {
callbackClassName = mainClassName;
}
if (callbackClassName.equals(classname)) {
if (methodName == null) {
methodName = callback.getMethodName();
} else {
Tr.warning(tc, "DUPLICATE_CALLBACK_METHOD_CWWKC2454W", new Object[] { methodName, classname });
}
}
}
return methodName;
} | [
"public",
"String",
"getMethodNameFromDD",
"(",
"List",
"<",
"LifecycleCallback",
">",
"callbacks",
",",
"String",
"classname",
")",
"{",
"String",
"methodName",
"=",
"null",
";",
"for",
"(",
"LifecycleCallback",
"callback",
":",
"callbacks",
")",
"{",
"// lifec... | Gets the lifecycle callback method name from the application client module deployment descriptor
@param callbacks a list of lifecycle-callback in the application client module deployment descriptor
@param classname the Class name
@return the Mehtod name | [
"Gets",
"the",
"lifecycle",
"callback",
"method",
"name",
"from",
"the",
"application",
"client",
"module",
"deployment",
"descriptor"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java#L220-L238 |
hageldave/ImagingKit | ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java | Pixel.setARGB_fromDouble | public Pixel setARGB_fromDouble(double a, double r, double g, double b){
return setValue(Pixel.argb_fromNormalized(a, r, g, b));
} | java | public Pixel setARGB_fromDouble(double a, double r, double g, double b){
return setValue(Pixel.argb_fromNormalized(a, r, g, b));
} | [
"public",
"Pixel",
"setARGB_fromDouble",
"(",
"double",
"a",
",",
"double",
"r",
",",
"double",
"g",
",",
"double",
"b",
")",
"{",
"return",
"setValue",
"(",
"Pixel",
".",
"argb_fromNormalized",
"(",
"a",
",",
"r",
",",
"g",
",",
"b",
")",
")",
";",
... | Sets an ARGB value at the position currently referenced by this Pixel. <br>
Each channel value is assumed to be within [0.0 .. 1.0]. Channel values
outside these bounds will be clamped to them.
@param a normalized alpha
@param r normalized red
@param g normalized green
@param b normalized blue
@throws ArrayIndexOutOfBoundsException if this Pixel's index is not in
range of the Img's data array.
@see #setRGB_fromDouble(double, double, double)
@see #setRGB_fromDouble_preserveAlpha(double, double, double)
@see #setARGB(int, int, int, int)
@see #a_asDouble()
@see #r_asDouble()
@see #g_asDouble()
@see #b_asDouble()
@since 1.2 | [
"Sets",
"an",
"ARGB",
"value",
"at",
"the",
"position",
"currently",
"referenced",
"by",
"this",
"Pixel",
".",
"<br",
">",
"Each",
"channel",
"value",
"is",
"assumed",
"to",
"be",
"within",
"[",
"0",
".",
"0",
"..",
"1",
".",
"0",
"]",
".",
"Channel"... | train | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java#L406-L408 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.createCertificate | public CertificateOperation createCertificate(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags) {
return createCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificatePolicy, certificateAttributes, tags).toBlocking().single().body();
} | java | public CertificateOperation createCertificate(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags) {
return createCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificatePolicy, certificateAttributes, tags).toBlocking().single().body();
} | [
"public",
"CertificateOperation",
"createCertificate",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"CertificatePolicy",
"certificatePolicy",
",",
"CertificateAttributes",
"certificateAttributes",
",",
"Map",
"<",
"String",
",",
"String",
">",
"ta... | Creates a new certificate.
If this is the first version, the certificate resource is created. This operation requires the certificates/create permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate.
@param certificatePolicy The management policy for the certificate.
@param certificateAttributes The attributes of the certificate (optional).
@param tags Application specific metadata in the form of key-value pairs.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CertificateOperation object if successful. | [
"Creates",
"a",
"new",
"certificate",
".",
"If",
"this",
"is",
"the",
"first",
"version",
"the",
"certificate",
"resource",
"is",
"created",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"create",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6579-L6581 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/form/CmsBasicFormField.java | CmsBasicFormField.createField | public static CmsBasicFormField createField(CmsXmlContentProperty propertyConfig) {
return createField(propertyConfig, Collections.<String, String> emptyMap());
} | java | public static CmsBasicFormField createField(CmsXmlContentProperty propertyConfig) {
return createField(propertyConfig, Collections.<String, String> emptyMap());
} | [
"public",
"static",
"CmsBasicFormField",
"createField",
"(",
"CmsXmlContentProperty",
"propertyConfig",
")",
"{",
"return",
"createField",
"(",
"propertyConfig",
",",
"Collections",
".",
"<",
"String",
",",
"String",
">",
"emptyMap",
"(",
")",
")",
";",
"}"
] | Utility method for creating a single basic form field from an id and a property configuration.
@param propertyConfig the configuration of the property
@return the newly created form field | [
"Utility",
"method",
"for",
"creating",
"a",
"single",
"basic",
"form",
"field",
"from",
"an",
"id",
"and",
"a",
"property",
"configuration",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/form/CmsBasicFormField.java#L112-L115 |
albfernandez/itext2 | src/main/java/com/lowagie/text/html/HtmlParser.java | HtmlParser.go | public void go(DocListener document, String file) {
try {
parser.parse(file, new SAXmyHtmlHandler(document));
}
catch(SAXException se) {
throw new ExceptionConverter(se);
}
catch(IOException ioe) {
throw new ExceptionConverter(ioe);
}
} | java | public void go(DocListener document, String file) {
try {
parser.parse(file, new SAXmyHtmlHandler(document));
}
catch(SAXException se) {
throw new ExceptionConverter(se);
}
catch(IOException ioe) {
throw new ExceptionConverter(ioe);
}
} | [
"public",
"void",
"go",
"(",
"DocListener",
"document",
",",
"String",
"file",
")",
"{",
"try",
"{",
"parser",
".",
"parse",
"(",
"file",
",",
"new",
"SAXmyHtmlHandler",
"(",
"document",
")",
")",
";",
"}",
"catch",
"(",
"SAXException",
"se",
")",
"{",... | Parses a given file.
@param document the document the parser will write to
@param file the file with the content | [
"Parses",
"a",
"given",
"file",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/html/HtmlParser.java#L112-L122 |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexRequestDispatcher.java | CmsFlexRequestDispatcher.includeExternal | private void includeExternal(ServletRequest req, ServletResponse res) throws ServletException, IOException {
// This is an external include, probably to a JSP page, dispatch with system dispatcher
if (LOG.isInfoEnabled()) {
LOG.info(
Messages.get().getBundle().key(
Messages.LOG_FLEXREQUESTDISPATCHER_INCLUDING_EXTERNAL_TARGET_1,
m_extTarget));
}
m_rd.include(req, res);
} | java | private void includeExternal(ServletRequest req, ServletResponse res) throws ServletException, IOException {
// This is an external include, probably to a JSP page, dispatch with system dispatcher
if (LOG.isInfoEnabled()) {
LOG.info(
Messages.get().getBundle().key(
Messages.LOG_FLEXREQUESTDISPATCHER_INCLUDING_EXTERNAL_TARGET_1,
m_extTarget));
}
m_rd.include(req, res);
} | [
"private",
"void",
"includeExternal",
"(",
"ServletRequest",
"req",
",",
"ServletResponse",
"res",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"// This is an external include, probably to a JSP page, dispatch with system dispatcher",
"if",
"(",
"LOG",
".",
"is... | Include an external (non-OpenCms) file using the standard dispatcher.<p>
@param req the servlet request
@param res the servlet response
@throws ServletException in case something goes wrong
@throws IOException in case something goes wrong | [
"Include",
"an",
"external",
"(",
"non",
"-",
"OpenCms",
")",
"file",
"using",
"the",
"standard",
"dispatcher",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexRequestDispatcher.java#L182-L192 |
facebookarchive/hive-dwrf | hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java | Slice.setShort | public void setShort(int index, int value)
{
checkIndexLength(index, SizeOf.SIZE_OF_SHORT);
unsafe.putShort(base, address + index, (short) (value & 0xFFFF));
} | java | public void setShort(int index, int value)
{
checkIndexLength(index, SizeOf.SIZE_OF_SHORT);
unsafe.putShort(base, address + index, (short) (value & 0xFFFF));
} | [
"public",
"void",
"setShort",
"(",
"int",
"index",
",",
"int",
"value",
")",
"{",
"checkIndexLength",
"(",
"index",
",",
"SizeOf",
".",
"SIZE_OF_SHORT",
")",
";",
"unsafe",
".",
"putShort",
"(",
"base",
",",
"address",
"+",
"index",
",",
"(",
"short",
... | Sets the specified 16-bit short integer at the specified absolute
{@code index} in this buffer. The 16 high-order bits of the specified
value are ignored.
@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or
{@code index + 2} is greater than {@code this.length()} | [
"Sets",
"the",
"specified",
"16",
"-",
"bit",
"short",
"integer",
"at",
"the",
"specified",
"absolute",
"{",
"@code",
"index",
"}",
"in",
"this",
"buffer",
".",
"The",
"16",
"high",
"-",
"order",
"bits",
"of",
"the",
"specified",
"value",
"are",
"ignored... | train | https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java#L420-L424 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.spanWithPrefixBlocks | public IPv6AddressSection[] spanWithPrefixBlocks(IPv6AddressSection other) throws AddressPositionException {
if(other.addressSegmentIndex != addressSegmentIndex) {
throw new AddressPositionException(other, other.addressSegmentIndex, addressSegmentIndex);
}
return getSpanningPrefixBlocks(
this,
other,
IPv6AddressSection::getLower,
IPv6AddressSection::getUpper,
Address.ADDRESS_LOW_VALUE_COMPARATOR::compare,
IPv6AddressSection::assignPrefixForSingleBlock,
IPv6AddressSection::withoutPrefixLength,
getAddressCreator()::createSectionArray);
} | java | public IPv6AddressSection[] spanWithPrefixBlocks(IPv6AddressSection other) throws AddressPositionException {
if(other.addressSegmentIndex != addressSegmentIndex) {
throw new AddressPositionException(other, other.addressSegmentIndex, addressSegmentIndex);
}
return getSpanningPrefixBlocks(
this,
other,
IPv6AddressSection::getLower,
IPv6AddressSection::getUpper,
Address.ADDRESS_LOW_VALUE_COMPARATOR::compare,
IPv6AddressSection::assignPrefixForSingleBlock,
IPv6AddressSection::withoutPrefixLength,
getAddressCreator()::createSectionArray);
} | [
"public",
"IPv6AddressSection",
"[",
"]",
"spanWithPrefixBlocks",
"(",
"IPv6AddressSection",
"other",
")",
"throws",
"AddressPositionException",
"{",
"if",
"(",
"other",
".",
"addressSegmentIndex",
"!=",
"addressSegmentIndex",
")",
"{",
"throw",
"new",
"AddressPositionE... | Produces the list of prefix block subnets that span from this series to the given series.
@param other
@return | [
"Produces",
"the",
"list",
"of",
"prefix",
"block",
"subnets",
"that",
"span",
"from",
"this",
"series",
"to",
"the",
"given",
"series",
"."
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L1986-L1999 |
centic9/commons-dost | src/main/java/org/dstadler/commons/http/HttpClientWrapper.java | HttpClientWrapper.simpleGet | public void simpleGet(String url, Consumer<InputStream> consumer) throws IOException {
simpleGetInternal(url, consumer, null);
} | java | public void simpleGet(String url, Consumer<InputStream> consumer) throws IOException {
simpleGetInternal(url, consumer, null);
} | [
"public",
"void",
"simpleGet",
"(",
"String",
"url",
",",
"Consumer",
"<",
"InputStream",
">",
"consumer",
")",
"throws",
"IOException",
"{",
"simpleGetInternal",
"(",
"url",
",",
"consumer",
",",
"null",
")",
";",
"}"
] | Perform a simple get-operation and passes the resulting InputStream to the given Consumer
@param url The URL to query
@param consumer A Consumer which receives the InputStream and can process the data
on-the-fly in streaming fashion without retrieving all of the data into memory
at once.
@throws IOException if the HTTP status code is not 200. | [
"Perform",
"a",
"simple",
"get",
"-",
"operation",
"and",
"passes",
"the",
"resulting",
"InputStream",
"to",
"the",
"given",
"Consumer"
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/http/HttpClientWrapper.java#L209-L211 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/destination/JSPtoPRealization.java | JSPtoPRealization.attachLocalPtoPLocalisation | @Override
public void attachLocalPtoPLocalisation(LocalizationPoint ptoPMessageItemStream)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"attachLocalPtoPLocalisation",
new Object[] {
ptoPMessageItemStream,
this });
/*
* Always maintain a reference to the home localisation of a
* destination, if one exists.
*/
_pToPLocalMsgsItemStream = (PtoPLocalMsgsItemStream) ptoPMessageItemStream;
_localisationManager.setLocal();
ConsumerDispatcherState state = new ConsumerDispatcherState();
/*
* Now create the consumer dispatcher,
* passing it the itemstream that has been created
*/
final ConsumerDispatcher consumerDispatcher =
new ConsumerDispatcher(_baseDestinationHandler, (PtoPMessageItemStream) ptoPMessageItemStream, state);
ptoPMessageItemStream.setOutputHandler(consumerDispatcher);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "attachLocalPtoPLocalisation");
} | java | @Override
public void attachLocalPtoPLocalisation(LocalizationPoint ptoPMessageItemStream)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"attachLocalPtoPLocalisation",
new Object[] {
ptoPMessageItemStream,
this });
/*
* Always maintain a reference to the home localisation of a
* destination, if one exists.
*/
_pToPLocalMsgsItemStream = (PtoPLocalMsgsItemStream) ptoPMessageItemStream;
_localisationManager.setLocal();
ConsumerDispatcherState state = new ConsumerDispatcherState();
/*
* Now create the consumer dispatcher,
* passing it the itemstream that has been created
*/
final ConsumerDispatcher consumerDispatcher =
new ConsumerDispatcher(_baseDestinationHandler, (PtoPMessageItemStream) ptoPMessageItemStream, state);
ptoPMessageItemStream.setOutputHandler(consumerDispatcher);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "attachLocalPtoPLocalisation");
} | [
"@",
"Override",
"public",
"void",
"attachLocalPtoPLocalisation",
"(",
"LocalizationPoint",
"ptoPMessageItemStream",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry... | Method attachLocalPtoPLocalisation
<p> Attach a local Localisation to this Destination's Localisations.
@param ptoPMessageItemStream is the PtoPMessageItemStream to add.
@param localisationIsRemote should be true if the PtoPMessageItemStream is remote.
@param transaction is the Transaction to add it under. | [
"Method",
"attachLocalPtoPLocalisation"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/destination/JSPtoPRealization.java#L1324-L1356 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/db/SystemKeyspace.java | SystemKeyspace.checkHealth | public static void checkHealth() throws ConfigurationException
{
Keyspace keyspace;
try
{
keyspace = Keyspace.open(Keyspace.SYSTEM_KS);
}
catch (AssertionError err)
{
// this happens when a user switches from OPP to RP.
ConfigurationException ex = new ConfigurationException("Could not read system keyspace!");
ex.initCause(err);
throw ex;
}
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(LOCAL_CF);
String req = "SELECT cluster_name FROM system.%s WHERE key='%s'";
UntypedResultSet result = executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY));
if (result.isEmpty() || !result.one().has("cluster_name"))
{
// this is a brand new node
if (!cfs.getSSTables().isEmpty())
throw new ConfigurationException("Found system keyspace files, but they couldn't be loaded!");
// no system files. this is a new node.
req = "INSERT INTO system.%s (key, cluster_name) VALUES ('%s', ?)";
executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY), DatabaseDescriptor.getClusterName());
return;
}
String savedClusterName = result.one().getString("cluster_name");
if (!DatabaseDescriptor.getClusterName().equals(savedClusterName))
throw new ConfigurationException("Saved cluster name " + savedClusterName + " != configured name " + DatabaseDescriptor.getClusterName());
} | java | public static void checkHealth() throws ConfigurationException
{
Keyspace keyspace;
try
{
keyspace = Keyspace.open(Keyspace.SYSTEM_KS);
}
catch (AssertionError err)
{
// this happens when a user switches from OPP to RP.
ConfigurationException ex = new ConfigurationException("Could not read system keyspace!");
ex.initCause(err);
throw ex;
}
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(LOCAL_CF);
String req = "SELECT cluster_name FROM system.%s WHERE key='%s'";
UntypedResultSet result = executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY));
if (result.isEmpty() || !result.one().has("cluster_name"))
{
// this is a brand new node
if (!cfs.getSSTables().isEmpty())
throw new ConfigurationException("Found system keyspace files, but they couldn't be loaded!");
// no system files. this is a new node.
req = "INSERT INTO system.%s (key, cluster_name) VALUES ('%s', ?)";
executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY), DatabaseDescriptor.getClusterName());
return;
}
String savedClusterName = result.one().getString("cluster_name");
if (!DatabaseDescriptor.getClusterName().equals(savedClusterName))
throw new ConfigurationException("Saved cluster name " + savedClusterName + " != configured name " + DatabaseDescriptor.getClusterName());
} | [
"public",
"static",
"void",
"checkHealth",
"(",
")",
"throws",
"ConfigurationException",
"{",
"Keyspace",
"keyspace",
";",
"try",
"{",
"keyspace",
"=",
"Keyspace",
".",
"open",
"(",
"Keyspace",
".",
"SYSTEM_KS",
")",
";",
"}",
"catch",
"(",
"AssertionError",
... | One of three things will happen if you try to read the system keyspace:
1. files are present and you can read them: great
2. no files are there: great (new node is assumed)
3. files are present but you can't read them: bad
@throws ConfigurationException | [
"One",
"of",
"three",
"things",
"will",
"happen",
"if",
"you",
"try",
"to",
"read",
"the",
"system",
"keyspace",
":",
"1",
".",
"files",
"are",
"present",
"and",
"you",
"can",
"read",
"them",
":",
"great",
"2",
".",
"no",
"files",
"are",
"there",
":"... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L555-L589 |
cdk/cdk | tool/hash/src/main/java/org/openscience/cdk/hash/stereo/GeometricTetrahedralEncoderFactory.java | GeometricTetrahedralEncoderFactory.makeElevationMap | private static void makeElevationMap(IAtom atom, List<IBond> bonds, Map<IAtom, Integer> map) {
map.clear();
for (IBond bond : bonds) {
int elevation = 0;
switch (bond.getStereo()) {
case UP:
case DOWN_INVERTED:
elevation = +1;
break;
case DOWN:
case UP_INVERTED:
elevation = -1;
break;
}
// change elevation depending on which end of the wedge/hatch
// the atom is on
if (bond.getBegin().equals(atom)) {
map.put(bond.getEnd(), elevation);
} else {
map.put(bond.getBegin(), -1 * elevation);
}
}
} | java | private static void makeElevationMap(IAtom atom, List<IBond> bonds, Map<IAtom, Integer> map) {
map.clear();
for (IBond bond : bonds) {
int elevation = 0;
switch (bond.getStereo()) {
case UP:
case DOWN_INVERTED:
elevation = +1;
break;
case DOWN:
case UP_INVERTED:
elevation = -1;
break;
}
// change elevation depending on which end of the wedge/hatch
// the atom is on
if (bond.getBegin().equals(atom)) {
map.put(bond.getEnd(), elevation);
} else {
map.put(bond.getBegin(), -1 * elevation);
}
}
} | [
"private",
"static",
"void",
"makeElevationMap",
"(",
"IAtom",
"atom",
",",
"List",
"<",
"IBond",
">",
"bonds",
",",
"Map",
"<",
"IAtom",
",",
"Integer",
">",
"map",
")",
"{",
"map",
".",
"clear",
"(",
")",
";",
"for",
"(",
"IBond",
"bond",
":",
"b... | Maps the input bonds to a map of Atom->Elevation where the elevation is
whether the bond is off the plane with respect to the central atom.
@param atom central atom
@param bonds bonds connected to the central atom
@param map map to load with elevation values (can be reused) | [
"Maps",
"the",
"input",
"bonds",
"to",
"a",
"map",
"of",
"Atom",
"-",
">",
"Elevation",
"where",
"the",
"elevation",
"is",
"whether",
"the",
"bond",
"is",
"off",
"the",
"plane",
"with",
"respect",
"to",
"the",
"central",
"atom",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/hash/src/main/java/org/openscience/cdk/hash/stereo/GeometricTetrahedralEncoderFactory.java#L258-L282 |
classgraph/classgraph | src/main/java/io/github/classgraph/ClassInfo.java | ClassInfo.addFieldInfo | void addFieldInfo(final FieldInfoList fieldInfoList, final Map<String, ClassInfo> classNameToClassInfo) {
for (final FieldInfo fi : fieldInfoList) {
// Index field annotations
addFieldOrMethodAnnotationInfo(fi.annotationInfo, /* isField = */ true, classNameToClassInfo);
}
if (this.fieldInfo == null) {
this.fieldInfo = fieldInfoList;
} else {
this.fieldInfo.addAll(fieldInfoList);
}
} | java | void addFieldInfo(final FieldInfoList fieldInfoList, final Map<String, ClassInfo> classNameToClassInfo) {
for (final FieldInfo fi : fieldInfoList) {
// Index field annotations
addFieldOrMethodAnnotationInfo(fi.annotationInfo, /* isField = */ true, classNameToClassInfo);
}
if (this.fieldInfo == null) {
this.fieldInfo = fieldInfoList;
} else {
this.fieldInfo.addAll(fieldInfoList);
}
} | [
"void",
"addFieldInfo",
"(",
"final",
"FieldInfoList",
"fieldInfoList",
",",
"final",
"Map",
"<",
"String",
",",
"ClassInfo",
">",
"classNameToClassInfo",
")",
"{",
"for",
"(",
"final",
"FieldInfo",
"fi",
":",
"fieldInfoList",
")",
"{",
"// Index field annotations... | Add field info.
@param fieldInfoList
the field info list
@param classNameToClassInfo
the map from class name to class info | [
"Add",
"field",
"info",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ClassInfo.java#L484-L494 |
line/centraldogma | client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/ArmeriaCentralDogma.java | ArmeriaCentralDogma.toJson | private static JsonNode toJson(AggregatedHttpMessage res, @Nullable JsonNodeType expectedNodeType) {
final String content = toString(res);
final JsonNode node;
try {
node = Jackson.readTree(content);
} catch (JsonParseException e) {
throw new CentralDogmaException("failed to parse the response JSON", e);
}
if (expectedNodeType != null && node.getNodeType() != expectedNodeType) {
throw new CentralDogmaException(
"invalid server response; expected: " + expectedNodeType +
", actual: " + node.getNodeType() + ", content: " + content);
}
return node;
} | java | private static JsonNode toJson(AggregatedHttpMessage res, @Nullable JsonNodeType expectedNodeType) {
final String content = toString(res);
final JsonNode node;
try {
node = Jackson.readTree(content);
} catch (JsonParseException e) {
throw new CentralDogmaException("failed to parse the response JSON", e);
}
if (expectedNodeType != null && node.getNodeType() != expectedNodeType) {
throw new CentralDogmaException(
"invalid server response; expected: " + expectedNodeType +
", actual: " + node.getNodeType() + ", content: " + content);
}
return node;
} | [
"private",
"static",
"JsonNode",
"toJson",
"(",
"AggregatedHttpMessage",
"res",
",",
"@",
"Nullable",
"JsonNodeType",
"expectedNodeType",
")",
"{",
"final",
"String",
"content",
"=",
"toString",
"(",
"res",
")",
";",
"final",
"JsonNode",
"node",
";",
"try",
"{... | Parses the content of the specified {@link AggregatedHttpMessage} into a {@link JsonNode}. | [
"Parses",
"the",
"content",
"of",
"the",
"specified",
"{"
] | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/ArmeriaCentralDogma.java#L962-L977 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/pipeline/LabeledChunkIdentifier.java | LabeledChunkIdentifier.isStartOfChunk | public static boolean isStartOfChunk(LabelTagType prev, LabelTagType cur)
{
if (prev == null) {
return isStartOfChunk("O", "O", cur.tag, cur.type);
} else {
return isStartOfChunk(prev.tag, prev.type, cur.tag, cur.type);
}
} | java | public static boolean isStartOfChunk(LabelTagType prev, LabelTagType cur)
{
if (prev == null) {
return isStartOfChunk("O", "O", cur.tag, cur.type);
} else {
return isStartOfChunk(prev.tag, prev.type, cur.tag, cur.type);
}
} | [
"public",
"static",
"boolean",
"isStartOfChunk",
"(",
"LabelTagType",
"prev",
",",
"LabelTagType",
"cur",
")",
"{",
"if",
"(",
"prev",
"==",
"null",
")",
"{",
"return",
"isStartOfChunk",
"(",
"\"O\"",
",",
"\"O\"",
",",
"cur",
".",
"tag",
",",
"cur",
"."... | Returns whether a chunk started between the previous and current token
@param prev - the label/tag/type of the previous token
@param cur - the label/tag/type of the current token
@return true if the current token was the first token of a chunk | [
"Returns",
"whether",
"a",
"chunk",
"started",
"between",
"the",
"previous",
"and",
"current",
"token"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/pipeline/LabeledChunkIdentifier.java#L196-L203 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java | JDBCRepositoryBuilder.getDataSource | public DataSource getDataSource() throws ConfigurationException {
if (mDataSource == null) {
if (mDriverClassName != null && mURL != null) {
try {
mDataSource = new SimpleDataSource
(mDriverClassName, mURL, mUsername, mPassword);
} catch (SQLException e) {
Throwable cause = e.getCause();
if (cause == null) {
cause = e;
}
throw new ConfigurationException(cause);
}
}
}
DataSource ds = mDataSource;
if (getDataSourceLogging() && !(ds instanceof LoggingDataSource)) {
ds = LoggingDataSource.create(ds);
}
return ds;
} | java | public DataSource getDataSource() throws ConfigurationException {
if (mDataSource == null) {
if (mDriverClassName != null && mURL != null) {
try {
mDataSource = new SimpleDataSource
(mDriverClassName, mURL, mUsername, mPassword);
} catch (SQLException e) {
Throwable cause = e.getCause();
if (cause == null) {
cause = e;
}
throw new ConfigurationException(cause);
}
}
}
DataSource ds = mDataSource;
if (getDataSourceLogging() && !(ds instanceof LoggingDataSource)) {
ds = LoggingDataSource.create(ds);
}
return ds;
} | [
"public",
"DataSource",
"getDataSource",
"(",
")",
"throws",
"ConfigurationException",
"{",
"if",
"(",
"mDataSource",
"==",
"null",
")",
"{",
"if",
"(",
"mDriverClassName",
"!=",
"null",
"&&",
"mURL",
"!=",
"null",
")",
"{",
"try",
"{",
"mDataSource",
"=",
... | Returns the source of JDBC connections, which defaults to a non-pooling
source if driver class, driver URL, username, and password are all
supplied.
@throws ConfigurationException if driver class wasn't found | [
"Returns",
"the",
"source",
"of",
"JDBC",
"connections",
"which",
"defaults",
"to",
"a",
"non",
"-",
"pooling",
"source",
"if",
"driver",
"class",
"driver",
"URL",
"username",
"and",
"password",
"are",
"all",
"supplied",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java#L149-L171 |
facebook/fresco | samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/util/UI.java | UI.findViewById | public static <T extends View> T findViewById(Activity act, int viewId) {
View containerView = act.getWindow().getDecorView();
return findViewById(containerView, viewId);
} | java | public static <T extends View> T findViewById(Activity act, int viewId) {
View containerView = act.getWindow().getDecorView();
return findViewById(containerView, viewId);
} | [
"public",
"static",
"<",
"T",
"extends",
"View",
">",
"T",
"findViewById",
"(",
"Activity",
"act",
",",
"int",
"viewId",
")",
"{",
"View",
"containerView",
"=",
"act",
".",
"getWindow",
"(",
")",
".",
"getDecorView",
"(",
")",
";",
"return",
"findViewByI... | This method returns the reference of the View with the given Id in the layout of the
Activity passed as parameter
@param act The Activity that is using the layout with the given View
@param viewId The id of the View we want to get a reference
@return The View with the given id and type | [
"This",
"method",
"returns",
"the",
"reference",
"of",
"the",
"View",
"with",
"the",
"given",
"Id",
"in",
"the",
"layout",
"of",
"the",
"Activity",
"passed",
"as",
"parameter"
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/util/UI.java#L30-L33 |
calrissian/mango | mango-core/src/main/java/org/calrissian/mango/collect/FluentCloseableIterable.java | FluentCloseableIterable.filter | public final <E> FluentCloseableIterable<E> filter(Class<E> type) {
return from(CloseableIterables.filter(this, type));
} | java | public final <E> FluentCloseableIterable<E> filter(Class<E> type) {
return from(CloseableIterables.filter(this, type));
} | [
"public",
"final",
"<",
"E",
">",
"FluentCloseableIterable",
"<",
"E",
">",
"filter",
"(",
"Class",
"<",
"E",
">",
"type",
")",
"{",
"return",
"from",
"(",
"CloseableIterables",
".",
"filter",
"(",
"this",
",",
"type",
")",
")",
";",
"}"
] | Returns the elements from this fluent iterable that are instances of class {@code type}. | [
"Returns",
"the",
"elements",
"from",
"this",
"fluent",
"iterable",
"that",
"are",
"instances",
"of",
"class",
"{"
] | train | https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-core/src/main/java/org/calrissian/mango/collect/FluentCloseableIterable.java#L150-L152 |
apiman/apiman | gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/URLRewritingPolicy.java | URLRewritingPolicy.doHeaderReplaceAll | private String doHeaderReplaceAll(String headerValue, String fromRegex, String toReplacement) {
return headerValue.replaceAll(fromRegex, toReplacement);
} | java | private String doHeaderReplaceAll(String headerValue, String fromRegex, String toReplacement) {
return headerValue.replaceAll(fromRegex, toReplacement);
} | [
"private",
"String",
"doHeaderReplaceAll",
"(",
"String",
"headerValue",
",",
"String",
"fromRegex",
",",
"String",
"toReplacement",
")",
"{",
"return",
"headerValue",
".",
"replaceAll",
"(",
"fromRegex",
",",
"toReplacement",
")",
";",
"}"
] | Finds all matching instances of the regular expression and replaces them with
the replacement value.
@param headerValue
@param fromRegex
@param toReplacement | [
"Finds",
"all",
"matching",
"instances",
"of",
"the",
"regular",
"expression",
"and",
"replaces",
"them",
"with",
"the",
"replacement",
"value",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/URLRewritingPolicy.java#L109-L111 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/Matrix.java | Matrix.sameDimensions | public static boolean sameDimensions(Matrix A, Matrix B)
{
return A.rows() == B.rows() && A.cols() == B.cols();
} | java | public static boolean sameDimensions(Matrix A, Matrix B)
{
return A.rows() == B.rows() && A.cols() == B.cols();
} | [
"public",
"static",
"boolean",
"sameDimensions",
"(",
"Matrix",
"A",
",",
"Matrix",
"B",
")",
"{",
"return",
"A",
".",
"rows",
"(",
")",
"==",
"B",
".",
"rows",
"(",
")",
"&&",
"A",
".",
"cols",
"(",
")",
"==",
"B",
".",
"cols",
"(",
")",
";",
... | Convenience method that will return {@code true} only if the two input
matrices have the exact same dimensions.
@param A the first matrix
@param B the second matrix
@return {@code true} if they have the exact same dimensions,
{@code false} otherwise. | [
"Convenience",
"method",
"that",
"will",
"return",
"{"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/Matrix.java#L777-L780 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/ioc/Bean.java | Bean.resolveDependencies | private void resolveDependencies(final Object reference) {
final Class<?> superclass = reference.getClass().getSuperclass().getSuperclass(); // Proxy -> Orig -> Super
resolveSuperclassFieldDependencies(reference, superclass);
resolveCurrentclassFieldDependencies(reference);
} | java | private void resolveDependencies(final Object reference) {
final Class<?> superclass = reference.getClass().getSuperclass().getSuperclass(); // Proxy -> Orig -> Super
resolveSuperclassFieldDependencies(reference, superclass);
resolveCurrentclassFieldDependencies(reference);
} | [
"private",
"void",
"resolveDependencies",
"(",
"final",
"Object",
"reference",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"superclass",
"=",
"reference",
".",
"getClass",
"(",
")",
".",
"getSuperclass",
"(",
")",
".",
"getSuperclass",
"(",
")",
";",
"// Pr... | Resolves dependencies for the specified reference.
@param reference the specified reference | [
"Resolves",
"dependencies",
"for",
"the",
"specified",
"reference",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/Bean.java#L136-L141 |
apereo/cas | core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java | AbstractCasWebflowConfigurer.createMappingToSubflowState | public DefaultMapping createMappingToSubflowState(final String name, final String value, final boolean required, final Class type) {
val parser = this.flowBuilderServices.getExpressionParser();
val source = parser.parseExpression(value, new FluentParserContext());
val target = parser.parseExpression(name, new FluentParserContext());
val mapping = new DefaultMapping(source, target);
mapping.setRequired(required);
val typeConverter = new RuntimeBindingConversionExecutor(type, this.flowBuilderServices.getConversionService());
mapping.setTypeConverter(typeConverter);
return mapping;
} | java | public DefaultMapping createMappingToSubflowState(final String name, final String value, final boolean required, final Class type) {
val parser = this.flowBuilderServices.getExpressionParser();
val source = parser.parseExpression(value, new FluentParserContext());
val target = parser.parseExpression(name, new FluentParserContext());
val mapping = new DefaultMapping(source, target);
mapping.setRequired(required);
val typeConverter = new RuntimeBindingConversionExecutor(type, this.flowBuilderServices.getConversionService());
mapping.setTypeConverter(typeConverter);
return mapping;
} | [
"public",
"DefaultMapping",
"createMappingToSubflowState",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
",",
"final",
"boolean",
"required",
",",
"final",
"Class",
"type",
")",
"{",
"val",
"parser",
"=",
"this",
".",
"flowBuilderServices",
".... | Create mapping to subflow state.
@param name the name
@param value the value
@param required the required
@param type the type
@return the default mapping | [
"Create",
"mapping",
"to",
"subflow",
"state",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L517-L526 |
aws/aws-sdk-java | aws-java-sdk-cognitosync/src/main/java/com/amazonaws/services/cognitosync/model/GetCognitoEventsResult.java | GetCognitoEventsResult.withEvents | public GetCognitoEventsResult withEvents(java.util.Map<String, String> events) {
setEvents(events);
return this;
} | java | public GetCognitoEventsResult withEvents(java.util.Map<String, String> events) {
setEvents(events);
return this;
} | [
"public",
"GetCognitoEventsResult",
"withEvents",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"events",
")",
"{",
"setEvents",
"(",
"events",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The Cognito Events returned from the GetCognitoEvents request
</p>
@param events
The Cognito Events returned from the GetCognitoEvents request
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"Cognito",
"Events",
"returned",
"from",
"the",
"GetCognitoEvents",
"request",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitosync/src/main/java/com/amazonaws/services/cognitosync/model/GetCognitoEventsResult.java#L74-L77 |
OpenLiberty/open-liberty | dev/com.ibm.ws.management.security/src/com/ibm/ws/management/security/internal/AbstractManagementRole.java | AbstractManagementRole.updateBindings | private void updateBindings(Map<String, Object> props) {
// Process the user element
processProps(props, CFG_KEY_USER, users);
// Process the user-access-id element
processProps(props, CFG_KEY_USER_ACCESSID, users);
// Process the group element
processProps(props, CFG_KEY_GROUP, groups);
// Process the group-access-id element
processProps(props, CFG_KEY_GROUP_ACCESSID, groups);
} | java | private void updateBindings(Map<String, Object> props) {
// Process the user element
processProps(props, CFG_KEY_USER, users);
// Process the user-access-id element
processProps(props, CFG_KEY_USER_ACCESSID, users);
// Process the group element
processProps(props, CFG_KEY_GROUP, groups);
// Process the group-access-id element
processProps(props, CFG_KEY_GROUP_ACCESSID, groups);
} | [
"private",
"void",
"updateBindings",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
")",
"{",
"// Process the user element",
"processProps",
"(",
"props",
",",
"CFG_KEY_USER",
",",
"users",
")",
";",
"// Process the user-access-id element",
"processProps",
... | Update the binding sets based on the properties from the configuration.
@param props | [
"Update",
"the",
"binding",
"sets",
"based",
"on",
"the",
"properties",
"from",
"the",
"configuration",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.management.security/src/com/ibm/ws/management/security/internal/AbstractManagementRole.java#L66-L76 |
k3po/k3po | driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/udp/UdpBootstrapFactorySpi.java | UdpBootstrapFactorySpi.newServerBootstrap | @Override
public synchronized ServerBootstrap newServerBootstrap() throws Exception {
if (serverChannelFactory == null) {
Executor workerExecutor = executorServiceFactory.newExecutorService("worker.server");
NioDatagramWorkerPool workerPool = new NioDatagramWorkerPool(workerExecutor, 1);
serverChannelFactory = new UdpServerChannelFactory(workerPool, timer);
// unshared
channelFactories.add(serverChannelFactory);
}
return new ServerBootstrap(serverChannelFactory);
} | java | @Override
public synchronized ServerBootstrap newServerBootstrap() throws Exception {
if (serverChannelFactory == null) {
Executor workerExecutor = executorServiceFactory.newExecutorService("worker.server");
NioDatagramWorkerPool workerPool = new NioDatagramWorkerPool(workerExecutor, 1);
serverChannelFactory = new UdpServerChannelFactory(workerPool, timer);
// unshared
channelFactories.add(serverChannelFactory);
}
return new ServerBootstrap(serverChannelFactory);
} | [
"@",
"Override",
"public",
"synchronized",
"ServerBootstrap",
"newServerBootstrap",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"serverChannelFactory",
"==",
"null",
")",
"{",
"Executor",
"workerExecutor",
"=",
"executorServiceFactory",
".",
"newExecutorService",
... | Returns a {@link ServerBootstrap} instance for the named transport. | [
"Returns",
"a",
"{"
] | train | https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/udp/UdpBootstrapFactorySpi.java#L107-L119 |
buschmais/jqa-core-framework | rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/AsciidocRuleParserPlugin.java | AsciidocRuleParserPlugin.parseProperties | private Properties parseProperties(AbstractBlock part, String attributeName) {
Properties properties = new Properties();
Object attribute = part.getAttributes().get(attributeName);
if (attribute == null) {
return properties;
}
Scanner propertiesScanner = new Scanner(attribute.toString());
propertiesScanner.useDelimiter(";");
while (propertiesScanner.hasNext()) {
String next = propertiesScanner.next().trim();
if (next.length() > 0) {
Scanner propertyScanner = new Scanner(next);
propertyScanner.useDelimiter("=");
String key = propertyScanner.next().trim();
String value = propertyScanner.next().trim();
properties.setProperty(key, value);
}
}
return properties;
} | java | private Properties parseProperties(AbstractBlock part, String attributeName) {
Properties properties = new Properties();
Object attribute = part.getAttributes().get(attributeName);
if (attribute == null) {
return properties;
}
Scanner propertiesScanner = new Scanner(attribute.toString());
propertiesScanner.useDelimiter(";");
while (propertiesScanner.hasNext()) {
String next = propertiesScanner.next().trim();
if (next.length() > 0) {
Scanner propertyScanner = new Scanner(next);
propertyScanner.useDelimiter("=");
String key = propertyScanner.next().trim();
String value = propertyScanner.next().trim();
properties.setProperty(key, value);
}
}
return properties;
} | [
"private",
"Properties",
"parseProperties",
"(",
"AbstractBlock",
"part",
",",
"String",
"attributeName",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"Object",
"attribute",
"=",
"part",
".",
"getAttributes",
"(",
")",
".",
"g... | Parse properties from an attribute.
@param part
The content part containing the attribute.
@param attributeName
The attribute name.
@return The properties. | [
"Parse",
"properties",
"from",
"an",
"attribute",
"."
] | train | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/AsciidocRuleParserPlugin.java#L376-L395 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java | ScopedServletUtils.getScopedSessionAttr | public static Object getScopedSessionAttr( String attrName, HttpServletRequest request )
{
HttpSession session = request.getSession( false );
if ( session != null )
{
return session.getAttribute( getScopedSessionAttrName( attrName, request ) );
}
else
{
return null;
}
} | java | public static Object getScopedSessionAttr( String attrName, HttpServletRequest request )
{
HttpSession session = request.getSession( false );
if ( session != null )
{
return session.getAttribute( getScopedSessionAttrName( attrName, request ) );
}
else
{
return null;
}
} | [
"public",
"static",
"Object",
"getScopedSessionAttr",
"(",
"String",
"attrName",
",",
"HttpServletRequest",
"request",
")",
"{",
"HttpSession",
"session",
"=",
"request",
".",
"getSession",
"(",
"false",
")",
";",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
... | If the request is a ScopedRequest, this returns an attribute whose name is scoped to that request's scope-ID;
otherwise, it is a straight passthrough to {@link HttpSession#getAttribute}.
@exclude | [
"If",
"the",
"request",
"is",
"a",
"ScopedRequest",
"this",
"returns",
"an",
"attribute",
"whose",
"name",
"is",
"scoped",
"to",
"that",
"request",
"s",
"scope",
"-",
"ID",
";",
"otherwise",
"it",
"is",
"a",
"straight",
"passthrough",
"to",
"{",
"@link",
... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java#L310-L322 |
fcrepo4-labs/fcrepo4-client | fcrepo-client-impl/src/main/java/org/fcrepo/client/utils/HttpHelper.java | HttpHelper.createPatchMethod | public HttpPatch createPatchMethod(final String path, final String sparqlUpdate) throws FedoraException {
if ( isBlank(sparqlUpdate) ) {
throw new FedoraException("SPARQL Update command must not be blank");
}
final HttpPatch patch = new HttpPatch(repositoryURL + path);
patch.setEntity( new ByteArrayEntity(sparqlUpdate.getBytes()) );
patch.setHeader("Content-Type", contentTypeSPARQLUpdate);
return patch;
} | java | public HttpPatch createPatchMethod(final String path, final String sparqlUpdate) throws FedoraException {
if ( isBlank(sparqlUpdate) ) {
throw new FedoraException("SPARQL Update command must not be blank");
}
final HttpPatch patch = new HttpPatch(repositoryURL + path);
patch.setEntity( new ByteArrayEntity(sparqlUpdate.getBytes()) );
patch.setHeader("Content-Type", contentTypeSPARQLUpdate);
return patch;
} | [
"public",
"HttpPatch",
"createPatchMethod",
"(",
"final",
"String",
"path",
",",
"final",
"String",
"sparqlUpdate",
")",
"throws",
"FedoraException",
"{",
"if",
"(",
"isBlank",
"(",
"sparqlUpdate",
")",
")",
"{",
"throw",
"new",
"FedoraException",
"(",
"\"SPARQL... | Create a request to update triples with SPARQL Update.
@param path The datastream path.
@param sparqlUpdate SPARQL Update command.
@return created patch based on parameters
@throws FedoraException | [
"Create",
"a",
"request",
"to",
"update",
"triples",
"with",
"SPARQL",
"Update",
"."
] | train | https://github.com/fcrepo4-labs/fcrepo4-client/blob/21eaf27200c5b2542095f6ebb9dd8ec865b95bbd/fcrepo-client-impl/src/main/java/org/fcrepo/client/utils/HttpHelper.java#L244-L253 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java | ApacheHTTPClient.appendBaseURL | protected void appendBaseURL(StringBuilder buffer,String resource,HTTPClientConfiguration configuration)
{
buffer.append("http");
if(configuration.isSSL())
{
buffer.append("s");
}
buffer.append("://");
buffer.append(configuration.getHostName());
int port=configuration.getPort();
if(port>0)
{
buffer.append(":");
buffer.append(port);
}
if((resource!=null)&&(resource.length()>0))
{
if(!resource.startsWith("/"))
{
buffer.append("/");
}
buffer.append(resource);
}
} | java | protected void appendBaseURL(StringBuilder buffer,String resource,HTTPClientConfiguration configuration)
{
buffer.append("http");
if(configuration.isSSL())
{
buffer.append("s");
}
buffer.append("://");
buffer.append(configuration.getHostName());
int port=configuration.getPort();
if(port>0)
{
buffer.append(":");
buffer.append(port);
}
if((resource!=null)&&(resource.length()>0))
{
if(!resource.startsWith("/"))
{
buffer.append("/");
}
buffer.append(resource);
}
} | [
"protected",
"void",
"appendBaseURL",
"(",
"StringBuilder",
"buffer",
",",
"String",
"resource",
",",
"HTTPClientConfiguration",
"configuration",
")",
"{",
"buffer",
".",
"append",
"(",
"\"http\"",
")",
";",
"if",
"(",
"configuration",
".",
"isSSL",
"(",
")",
... | This function appends the base URL (protocol, host, port and resource) to the
provided buffer.
@param buffer
The buffer to update
@param resource
The HTTP resource
@param configuration
The HTTP configuration | [
"This",
"function",
"appends",
"the",
"base",
"URL",
"(",
"protocol",
"host",
"port",
"and",
"resource",
")",
"to",
"the",
"provided",
"buffer",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java#L130-L153 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/managementgraph/ManagementGroupVertex.java | ManagementGroupVertex.insertBackwardEdge | void insertBackwardEdge(final ManagementGroupEdge edge, final int index) {
while (index >= this.backwardEdges.size()) {
this.backwardEdges.add(null);
}
this.backwardEdges.set(index, edge);
} | java | void insertBackwardEdge(final ManagementGroupEdge edge, final int index) {
while (index >= this.backwardEdges.size()) {
this.backwardEdges.add(null);
}
this.backwardEdges.set(index, edge);
} | [
"void",
"insertBackwardEdge",
"(",
"final",
"ManagementGroupEdge",
"edge",
",",
"final",
"int",
"index",
")",
"{",
"while",
"(",
"index",
">=",
"this",
".",
"backwardEdges",
".",
"size",
"(",
")",
")",
"{",
"this",
".",
"backwardEdges",
".",
"add",
"(",
... | Inserts a new edge arriving at this group vertex at the given index.
@param edge
the edge to be added
@param index
the index at which the edge shall be added | [
"Inserts",
"a",
"new",
"edge",
"arriving",
"at",
"this",
"group",
"vertex",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/managementgraph/ManagementGroupVertex.java#L144-L151 |
aws/aws-sdk-java | aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/DefinitionInformation.java | DefinitionInformation.withTags | public DefinitionInformation withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public DefinitionInformation withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"DefinitionInformation",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | The tags for the definition.
@param tags
The tags for the definition.
@return Returns a reference to this object so that method calls can be chained together. | [
"The",
"tags",
"for",
"the",
"definition",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/DefinitionInformation.java#L313-L316 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.