repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkNonEmpty | private void checkNonEmpty(Decl.Variable d, LifetimeRelation lifetimes) {
if (relaxedSubtypeOperator.isVoid(d.getType(), lifetimes)) {
syntaxError(d.getType(), EMPTY_TYPE);
}
} | java | private void checkNonEmpty(Decl.Variable d, LifetimeRelation lifetimes) {
if (relaxedSubtypeOperator.isVoid(d.getType(), lifetimes)) {
syntaxError(d.getType(), EMPTY_TYPE);
}
} | [
"private",
"void",
"checkNonEmpty",
"(",
"Decl",
".",
"Variable",
"d",
",",
"LifetimeRelation",
"lifetimes",
")",
"{",
"if",
"(",
"relaxedSubtypeOperator",
".",
"isVoid",
"(",
"d",
".",
"getType",
"(",
")",
",",
"lifetimes",
")",
")",
"{",
"syntaxError",
"... | Check that a given variable declaration is not empty. That is, the declared
type is not equivalent to void. This is an important sanity check.
@param d | [
"Check",
"that",
"a",
"given",
"variable",
"declaration",
"is",
"not",
"empty",
".",
"That",
"is",
"the",
"declared",
"type",
"is",
"not",
"equivalent",
"to",
"void",
".",
"This",
"is",
"an",
"important",
"sanity",
"check",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1862-L1866 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsDestinationAddressFactoryImpl.java | JsDestinationAddressFactoryImpl.createSIDestinationAddress | public final SIDestinationAddress createSIDestinationAddress(String destinationName
,boolean localOnly
)
throws NullPointerException {
if (destinationName == null) {
throw new NullPointerException("destinationName");
}
return new JsDestinationAddressImpl(destinationName, localOnly, null, null, false);
} | java | public final SIDestinationAddress createSIDestinationAddress(String destinationName
,boolean localOnly
)
throws NullPointerException {
if (destinationName == null) {
throw new NullPointerException("destinationName");
}
return new JsDestinationAddressImpl(destinationName, localOnly, null, null, false);
} | [
"public",
"final",
"SIDestinationAddress",
"createSIDestinationAddress",
"(",
"String",
"destinationName",
",",
"boolean",
"localOnly",
")",
"throws",
"NullPointerException",
"{",
"if",
"(",
"destinationName",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerExceptio... | Create a new SIDestinationAddress to represent an SIBus Destination.
@param destinationName The name of the SIBus Destination
@param localOnly Indicates that the Destination should be limited
to only the queue or mediation point on the Messaging
Engine that the application is connected to, if one
exists. If no such message point exists then the option
is ignored.
@return SIDestinationAddress The new SIDestinationAddress.
@exception NullPointerException Thrown if the destinationName parameter is null. | [
"Create",
"a",
"new",
"SIDestinationAddress",
"to",
"represent",
"an",
"SIBus",
"Destination",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsDestinationAddressFactoryImpl.java#L58-L66 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/util/IoUtils.java | IoUtils.copyAsString | public static String copyAsString(final BufferedInputStream inputStream) throws IOException, IllegalStateException {
if (inputStream == null) return null;
try {
inputStream.mark(Integer.MAX_VALUE);
return new String(streamToBytes(inputStream, false));
} finally {
try {
inputStream.reset();
} catch (IOException ioe) {
throw new IllegalStateException("Unable to reset stream - original stream content may be corrupted");
}
}
} | java | public static String copyAsString(final BufferedInputStream inputStream) throws IOException, IllegalStateException {
if (inputStream == null) return null;
try {
inputStream.mark(Integer.MAX_VALUE);
return new String(streamToBytes(inputStream, false));
} finally {
try {
inputStream.reset();
} catch (IOException ioe) {
throw new IllegalStateException("Unable to reset stream - original stream content may be corrupted");
}
}
} | [
"public",
"static",
"String",
"copyAsString",
"(",
"final",
"BufferedInputStream",
"inputStream",
")",
"throws",
"IOException",
",",
"IllegalStateException",
"{",
"if",
"(",
"inputStream",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"inputStream",
".",
... | Safely copies the contents of the {@link BufferedInputStream} to a {@link String} and resets the stream.
This method is generally only useful for testing and logging purposes.
@param inputStream the BufferedInputStream
@return a String copy of the stream contents
@throws IOException if something goes wrong with the stream
@throws IllegalStateException if the stream cannot be reset | [
"Safely",
"copies",
"the",
"contents",
"of",
"the",
"{",
"@link",
"BufferedInputStream",
"}",
"to",
"a",
"{",
"@link",
"String",
"}",
"and",
"resets",
"the",
"stream",
".",
"This",
"method",
"is",
"generally",
"only",
"useful",
"for",
"testing",
"and",
"lo... | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/util/IoUtils.java#L67-L80 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/redis/JedisUtils.java | JedisUtils.newShardedJedisPool | public static ShardedJedisPool newShardedJedisPool(String hostsAndPorts, String password) {
return newShardedJedisPool(defaultJedisPoolConfig(), hostsAndPorts, password);
} | java | public static ShardedJedisPool newShardedJedisPool(String hostsAndPorts, String password) {
return newShardedJedisPool(defaultJedisPoolConfig(), hostsAndPorts, password);
} | [
"public",
"static",
"ShardedJedisPool",
"newShardedJedisPool",
"(",
"String",
"hostsAndPorts",
",",
"String",
"password",
")",
"{",
"return",
"newShardedJedisPool",
"(",
"defaultJedisPoolConfig",
"(",
")",
",",
"hostsAndPorts",
",",
"password",
")",
";",
"}"
] | Create a new {@link ShardedJedisPool} with default pool configs.
@param hostsAndPorts
format {@code host1:port1,host2:port2,...}, default Redis port is used if not
specified
@param password
@return | [
"Create",
"a",
"new",
"{",
"@link",
"ShardedJedisPool",
"}",
"with",
"default",
"pool",
"configs",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/redis/JedisUtils.java#L394-L396 |
hamnis/json-collection | src/main/java/net/hamnaberg/json/DataContainer.java | DataContainer.set | @SuppressWarnings("unchecked")
public A set(Iterable<Property> props) {
if (Iterables.isEmpty(props)) {
return (A) this;
}
return copy(delegate.put("data", Property.toArrayNode(props)));
} | java | @SuppressWarnings("unchecked")
public A set(Iterable<Property> props) {
if (Iterables.isEmpty(props)) {
return (A) this;
}
return copy(delegate.put("data", Property.toArrayNode(props)));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"A",
"set",
"(",
"Iterable",
"<",
"Property",
">",
"props",
")",
"{",
"if",
"(",
"Iterables",
".",
"isEmpty",
"(",
"props",
")",
")",
"{",
"return",
"(",
"A",
")",
"this",
";",
"}",
"retur... | Replaces all properties.
@param props the property to add
@return a new copy of the template. | [
"Replaces",
"all",
"properties",
"."
] | train | https://github.com/hamnis/json-collection/blob/fbd4a1c6ab75b70b3b4cb981b608b395e9c8c180/src/main/java/net/hamnaberg/json/DataContainer.java#L77-L83 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java | JBBPBitOutputStream.writeFloat | public void writeFloat(final float value, final JBBPByteOrder byteOrder) throws IOException {
final int intValue = Float.floatToIntBits(value);
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.writeShort(intValue >>> 16, byteOrder);
this.writeShort(intValue, byteOrder);
} else {
this.writeShort(intValue, byteOrder);
this.writeShort(intValue >>> 16, byteOrder);
}
} | java | public void writeFloat(final float value, final JBBPByteOrder byteOrder) throws IOException {
final int intValue = Float.floatToIntBits(value);
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.writeShort(intValue >>> 16, byteOrder);
this.writeShort(intValue, byteOrder);
} else {
this.writeShort(intValue, byteOrder);
this.writeShort(intValue >>> 16, byteOrder);
}
} | [
"public",
"void",
"writeFloat",
"(",
"final",
"float",
"value",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"final",
"int",
"intValue",
"=",
"Float",
".",
"floatToIntBits",
"(",
"value",
")",
";",
"if",
"(",
"byteOrder",
"=... | Write an float value into the output stream.
@param value a value to be written into the output stream.
@param byteOrder the byte order of the value bytes to be used for writing.
@throws IOException it will be thrown for transport errors
@see JBBPByteOrder#BIG_ENDIAN
@see JBBPByteOrder#LITTLE_ENDIAN
@since 1.4.0 | [
"Write",
"an",
"float",
"value",
"into",
"the",
"output",
"stream",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L131-L140 |
jbundle/jbundle | base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java | XBasePanel.printControlStartForm | public void printControlStartForm(PrintWriter out, int iPrintOptions)
{
if (((iPrintOptions & HtmlConstants.HEADING_SCREEN) == HtmlConstants.HEADING_SCREEN)
|| ((iPrintOptions & HtmlConstants.FOOTING_SCREEN) == HtmlConstants.FOOTING_SCREEN)
|| ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) == HtmlConstants.DETAIL_SCREEN))
return; // Don't need on nested forms
super.printControlStartForm(out, iPrintOptions);
String strAction = "post";
BasePanel modelScreen = (BasePanel)this.getScreenField();
//? strAction = "postxml";
out.println(Utility.startTag("hidden-params"));
this.addHiddenParams(out, this.getHiddenParams());
out.println(Utility.endTag("hidden-params"));
out.println("<xform id=\"form1\">");
out.println(" <submission");
out.println(" id=\"submit1\"");
out.println(" method=\"" + strAction + "\"");
out.println(" localfile=\"temp.xml\"");
out.println(" action=\"" + modelScreen.getServletPath(null) + "\" />");
//? out.println(" <model href=\"form.xsd\">");
//? out.println(" <!-- The model is currently ignored -->");
//? out.println(" </model>");
//? out.println(" <instance id=\"instance1\" xmlns=\"\">");
} | java | public void printControlStartForm(PrintWriter out, int iPrintOptions)
{
if (((iPrintOptions & HtmlConstants.HEADING_SCREEN) == HtmlConstants.HEADING_SCREEN)
|| ((iPrintOptions & HtmlConstants.FOOTING_SCREEN) == HtmlConstants.FOOTING_SCREEN)
|| ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) == HtmlConstants.DETAIL_SCREEN))
return; // Don't need on nested forms
super.printControlStartForm(out, iPrintOptions);
String strAction = "post";
BasePanel modelScreen = (BasePanel)this.getScreenField();
//? strAction = "postxml";
out.println(Utility.startTag("hidden-params"));
this.addHiddenParams(out, this.getHiddenParams());
out.println(Utility.endTag("hidden-params"));
out.println("<xform id=\"form1\">");
out.println(" <submission");
out.println(" id=\"submit1\"");
out.println(" method=\"" + strAction + "\"");
out.println(" localfile=\"temp.xml\"");
out.println(" action=\"" + modelScreen.getServletPath(null) + "\" />");
//? out.println(" <model href=\"form.xsd\">");
//? out.println(" <!-- The model is currently ignored -->");
//? out.println(" </model>");
//? out.println(" <instance id=\"instance1\" xmlns=\"\">");
} | [
"public",
"void",
"printControlStartForm",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"if",
"(",
"(",
"(",
"iPrintOptions",
"&",
"HtmlConstants",
".",
"HEADING_SCREEN",
")",
"==",
"HtmlConstants",
".",
"HEADING_SCREEN",
")",
"||",
"(",
"... | Display the start form in input format.
@param out The out stream.
@param iPrintOptions The view specific attributes. | [
"Display",
"the",
"start",
"form",
"in",
"input",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java#L386-L410 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/Clients.java | Clients.withHttpHeaders | public static SafeCloseable withHttpHeaders(Function<HttpHeaders, HttpHeaders> headerManipulator) {
requireNonNull(headerManipulator, "headerManipulator");
return withContextCustomizer(ctx -> {
final HttpHeaders additionalHeaders = ctx.additionalRequestHeaders();
final DefaultHttpHeaders headers = new DefaultHttpHeaders();
if (!additionalHeaders.isEmpty()) {
headers.set(additionalHeaders);
}
final HttpHeaders manipulatedHeaders = headerManipulator.apply(headers);
ctx.setAdditionalRequestHeaders(manipulatedHeaders);
});
} | java | public static SafeCloseable withHttpHeaders(Function<HttpHeaders, HttpHeaders> headerManipulator) {
requireNonNull(headerManipulator, "headerManipulator");
return withContextCustomizer(ctx -> {
final HttpHeaders additionalHeaders = ctx.additionalRequestHeaders();
final DefaultHttpHeaders headers = new DefaultHttpHeaders();
if (!additionalHeaders.isEmpty()) {
headers.set(additionalHeaders);
}
final HttpHeaders manipulatedHeaders = headerManipulator.apply(headers);
ctx.setAdditionalRequestHeaders(manipulatedHeaders);
});
} | [
"public",
"static",
"SafeCloseable",
"withHttpHeaders",
"(",
"Function",
"<",
"HttpHeaders",
",",
"HttpHeaders",
">",
"headerManipulator",
")",
"{",
"requireNonNull",
"(",
"headerManipulator",
",",
"\"headerManipulator\"",
")",
";",
"return",
"withContextCustomizer",
"(... | Sets the specified HTTP header manipulating function in a thread-local variable so that the manipulated
headers are sent by the client call made from the current thread. Use the `try-with-resources` block
with the returned {@link SafeCloseable} to unset the thread-local variable automatically:
<pre>{@code
import static com.linecorp.armeria.common.HttpHeaderNames.AUTHORIZATION;
import static com.linecorp.armeria.common.HttpHeaderNames.USER_AGENT;
try (SafeCloseable ignored = withHttpHeaders(headers -> {
headers.set(HttpHeaders.AUTHORIZATION, myCredential)
.set(HttpHeaders.USER_AGENT, myAgent);
})) {
client.executeSomething(..);
}
}</pre>
You can also nest the header manipulation:
<pre>{@code
import static com.linecorp.armeria.common.HttpHeaderNames.AUTHORIZATION;
import static com.linecorp.armeria.common.HttpHeaderNames.USER_AGENT;
try (SafeCloseable ignored = withHttpHeaders(h -> h.set(USER_AGENT, myAgent))) {
for (String secret : secrets) {
try (SafeCloseable ignored2 = withHttpHeaders(h -> h.set(AUTHORIZATION, secret))) {
// Both USER_AGENT and AUTHORIZATION will be set.
client.executeSomething(..);
}
}
}
}</pre>
@see #withHttpHeader(AsciiString, String) | [
"Sets",
"the",
"specified",
"HTTP",
"header",
"manipulating",
"function",
"in",
"a",
"thread",
"-",
"local",
"variable",
"so",
"that",
"the",
"manipulated",
"headers",
"are",
"sent",
"by",
"the",
"client",
"call",
"made",
"from",
"the",
"current",
"thread",
... | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/Clients.java#L329-L341 |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java | DateUtils.rollMonths | public static java.sql.Date rollMonths(java.util.Date startDate, int months) {
return rollDate(startDate, Calendar.MONTH, months);
} | java | public static java.sql.Date rollMonths(java.util.Date startDate, int months) {
return rollDate(startDate, Calendar.MONTH, months);
} | [
"public",
"static",
"java",
".",
"sql",
".",
"Date",
"rollMonths",
"(",
"java",
".",
"util",
".",
"Date",
"startDate",
",",
"int",
"months",
")",
"{",
"return",
"rollDate",
"(",
"startDate",
",",
"Calendar",
".",
"MONTH",
",",
"months",
")",
";",
"}"
] | Roll the days forward or backward.
@param startDate - The start date
@param months - Negative to rollbackwards. | [
"Roll",
"the",
"days",
"forward",
"or",
"backward",
"."
] | train | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L192-L194 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/util/HexHelper.java | HexHelper.toHex | public static final String toHex(final char separator, final byte... bin)
{
if (bin == null || bin.length == 0)
return "";
char[] buffer = new char[(bin.length * 3) - 1];
int end = bin.length - 1;
int base = 0; // Store the index of buffer we're inserting into
for (int i = 0; i < bin.length; i++)
{
byte b = bin[i];
buffer[base++] = hex[(b >> 4) & 0x0F];
buffer[base++] = hex[b & 0x0F];
if (i != end)
buffer[base++] = separator;
}
return new String(buffer);
} | java | public static final String toHex(final char separator, final byte... bin)
{
if (bin == null || bin.length == 0)
return "";
char[] buffer = new char[(bin.length * 3) - 1];
int end = bin.length - 1;
int base = 0; // Store the index of buffer we're inserting into
for (int i = 0; i < bin.length; i++)
{
byte b = bin[i];
buffer[base++] = hex[(b >> 4) & 0x0F];
buffer[base++] = hex[b & 0x0F];
if (i != end)
buffer[base++] = separator;
}
return new String(buffer);
} | [
"public",
"static",
"final",
"String",
"toHex",
"(",
"final",
"char",
"separator",
",",
"final",
"byte",
"...",
"bin",
")",
"{",
"if",
"(",
"bin",
"==",
"null",
"||",
"bin",
".",
"length",
"==",
"0",
")",
"return",
"\"\"",
";",
"char",
"[",
"]",
"b... | Encodes a series of bytes into a hexidecimal string with each source byte (represented in the output as a 2 digit
hexidecimal pair) separated by <code>separator</code><br />
@param separator
The character to insert between each byte (for example, <code>':'</code>)
@param bin
the series of bytes to encode
@return a hexidecimal string with each source byte (represented in the output as a 2 digit hexidecimal pair) separated by
<code>separator</code> | [
"Encodes",
"a",
"series",
"of",
"bytes",
"into",
"a",
"hexidecimal",
"string",
"with",
"each",
"source",
"byte",
"(",
"represented",
"in",
"the",
"output",
"as",
"a",
"2",
"digit",
"hexidecimal",
"pair",
")",
"separated",
"by",
"<code",
">",
"separator<",
... | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/util/HexHelper.java#L196-L215 |
voldemort/voldemort | src/java/voldemort/utils/ExceptionUtils.java | ExceptionUtils.recursiveClassEquals | public static boolean recursiveClassEquals(Throwable throwableToInspect, Class... throwableClassesToLookFor) {
for (Class clazz: throwableClassesToLookFor) {
Class classToInspect = throwableToInspect.getClass();
while (classToInspect != null) {
if (classToInspect.equals(clazz)) {
return true;
}
classToInspect = classToInspect.getSuperclass();
}
}
Throwable cause = throwableToInspect.getCause();
return cause != null && recursiveClassEquals(cause, throwableClassesToLookFor);
} | java | public static boolean recursiveClassEquals(Throwable throwableToInspect, Class... throwableClassesToLookFor) {
for (Class clazz: throwableClassesToLookFor) {
Class classToInspect = throwableToInspect.getClass();
while (classToInspect != null) {
if (classToInspect.equals(clazz)) {
return true;
}
classToInspect = classToInspect.getSuperclass();
}
}
Throwable cause = throwableToInspect.getCause();
return cause != null && recursiveClassEquals(cause, throwableClassesToLookFor);
} | [
"public",
"static",
"boolean",
"recursiveClassEquals",
"(",
"Throwable",
"throwableToInspect",
",",
"Class",
"...",
"throwableClassesToLookFor",
")",
"{",
"for",
"(",
"Class",
"clazz",
":",
"throwableClassesToLookFor",
")",
"{",
"Class",
"classToInspect",
"=",
"throwa... | Inspects a given {@link Throwable} as well as its nested causes, in order to look
for a specific set of exception classes. The function also detects if the throwable
to inspect is a subclass of one of the classes you look for, but not the other way
around (i.e.: if you're looking for the subclass but the throwableToInspect is the
parent class, then this function returns false).
@return true if a the throwableToInspect corresponds to or is caused by any of the throwableClassesToLookFor | [
"Inspects",
"a",
"given",
"{",
"@link",
"Throwable",
"}",
"as",
"well",
"as",
"its",
"nested",
"causes",
"in",
"order",
"to",
"look",
"for",
"a",
"specific",
"set",
"of",
"exception",
"classes",
".",
"The",
"function",
"also",
"detects",
"if",
"the",
"th... | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ExceptionUtils.java#L23-L35 |
classgraph/classgraph | src/main/java/io/github/classgraph/PackageInfo.java | PackageInfo.getClassInfoRecursive | public ClassInfoList getClassInfoRecursive() {
final Set<ClassInfo> reachableClassInfo = new HashSet<>();
obtainClassInfoRecursive(reachableClassInfo);
return new ClassInfoList(reachableClassInfo, /* sortByName = */ true);
} | java | public ClassInfoList getClassInfoRecursive() {
final Set<ClassInfo> reachableClassInfo = new HashSet<>();
obtainClassInfoRecursive(reachableClassInfo);
return new ClassInfoList(reachableClassInfo, /* sortByName = */ true);
} | [
"public",
"ClassInfoList",
"getClassInfoRecursive",
"(",
")",
"{",
"final",
"Set",
"<",
"ClassInfo",
">",
"reachableClassInfo",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"obtainClassInfoRecursive",
"(",
"reachableClassInfo",
")",
";",
"return",
"new",
"ClassInfo... | Get the {@link ClassInfo} objects for all classes that are members of this package or a sub-package.
@return the the {@link ClassInfo} objects for all classes that are members of this package or a sub-package. | [
"Get",
"the",
"{",
"@link",
"ClassInfo",
"}",
"objects",
"for",
"all",
"classes",
"that",
"are",
"members",
"of",
"this",
"package",
"or",
"a",
"sub",
"-",
"package",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/PackageInfo.java#L223-L227 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java | CommonOps_DDF4.fill | public static void fill( DMatrix4x4 a , double v ) {
a.a11 = v; a.a12 = v; a.a13 = v; a.a14 = v;
a.a21 = v; a.a22 = v; a.a23 = v; a.a24 = v;
a.a31 = v; a.a32 = v; a.a33 = v; a.a34 = v;
a.a41 = v; a.a42 = v; a.a43 = v; a.a44 = v;
} | java | public static void fill( DMatrix4x4 a , double v ) {
a.a11 = v; a.a12 = v; a.a13 = v; a.a14 = v;
a.a21 = v; a.a22 = v; a.a23 = v; a.a24 = v;
a.a31 = v; a.a32 = v; a.a33 = v; a.a34 = v;
a.a41 = v; a.a42 = v; a.a43 = v; a.a44 = v;
} | [
"public",
"static",
"void",
"fill",
"(",
"DMatrix4x4",
"a",
",",
"double",
"v",
")",
"{",
"a",
".",
"a11",
"=",
"v",
";",
"a",
".",
"a12",
"=",
"v",
";",
"a",
".",
"a13",
"=",
"v",
";",
"a",
".",
"a14",
"=",
"v",
";",
"a",
".",
"a21",
"="... | <p>
Sets every element in the matrix to the specified value.<br>
<br>
a<sub>ij</sub> = value
<p>
@param a A matrix whose elements are about to be set. Modified.
@param v The value each element will have. | [
"<p",
">",
"Sets",
"every",
"element",
"in",
"the",
"matrix",
"to",
"the",
"specified",
"value",
".",
"<br",
">",
"<br",
">",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
"=",
"value",
"<p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java#L1592-L1597 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/VirtualNetworkRulesInner.java | VirtualNetworkRulesInner.createOrUpdateAsync | public Observable<VirtualNetworkRuleInner> createOrUpdateAsync(String resourceGroupName, String accountName, String virtualNetworkRuleName, CreateOrUpdateVirtualNetworkRuleParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, virtualNetworkRuleName, parameters).map(new Func1<ServiceResponse<VirtualNetworkRuleInner>, VirtualNetworkRuleInner>() {
@Override
public VirtualNetworkRuleInner call(ServiceResponse<VirtualNetworkRuleInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualNetworkRuleInner> createOrUpdateAsync(String resourceGroupName, String accountName, String virtualNetworkRuleName, CreateOrUpdateVirtualNetworkRuleParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, virtualNetworkRuleName, parameters).map(new Func1<ServiceResponse<VirtualNetworkRuleInner>, VirtualNetworkRuleInner>() {
@Override
public VirtualNetworkRuleInner call(ServiceResponse<VirtualNetworkRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualNetworkRuleInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"virtualNetworkRuleName",
",",
"CreateOrUpdateVirtualNetworkRuleParameters",
"parameters",
")",
"{",
"return",
... | Creates or updates the specified virtual network rule. During update, the virtual network rule with the specified name will be replaced with this new virtual network rule.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@param virtualNetworkRuleName The name of the virtual network rule to create or update.
@param parameters Parameters supplied to create or update the virtual network rule.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualNetworkRuleInner object | [
"Creates",
"or",
"updates",
"the",
"specified",
"virtual",
"network",
"rule",
".",
"During",
"update",
"the",
"virtual",
"network",
"rule",
"with",
"the",
"specified",
"name",
"will",
"be",
"replaced",
"with",
"this",
"new",
"virtual",
"network",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/VirtualNetworkRulesInner.java#L257-L264 |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AstaDatabaseReader.java | AstaDatabaseReader.getRows | private List<Row> getRows(String sql) throws SQLException
{
allocateConnection();
try
{
List<Row> result = new LinkedList<Row>();
m_ps = m_connection.prepareStatement(sql);
m_rs = m_ps.executeQuery();
populateMetaData();
while (m_rs.next())
{
result.add(new MpdResultSetRow(m_rs, m_meta));
}
return (result);
}
finally
{
releaseConnection();
}
} | java | private List<Row> getRows(String sql) throws SQLException
{
allocateConnection();
try
{
List<Row> result = new LinkedList<Row>();
m_ps = m_connection.prepareStatement(sql);
m_rs = m_ps.executeQuery();
populateMetaData();
while (m_rs.next())
{
result.add(new MpdResultSetRow(m_rs, m_meta));
}
return (result);
}
finally
{
releaseConnection();
}
} | [
"private",
"List",
"<",
"Row",
">",
"getRows",
"(",
"String",
"sql",
")",
"throws",
"SQLException",
"{",
"allocateConnection",
"(",
")",
";",
"try",
"{",
"List",
"<",
"Row",
">",
"result",
"=",
"new",
"LinkedList",
"<",
"Row",
">",
"(",
")",
";",
"m_... | Retrieve a number of rows matching the supplied query.
@param sql query statement
@return result set
@throws SQLException | [
"Retrieve",
"a",
"number",
"of",
"rows",
"matching",
"the",
"supplied",
"query",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaDatabaseReader.java#L362-L385 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/AsciiArtUtils.java | AsciiArtUtils.printAsciiArtInfo | @SneakyThrows
public static void printAsciiArtInfo(final Logger out, final String asciiArt, final String additional) {
out.info(ANSI_CYAN);
out.info("\n\n".concat(FigletFont.convertOneLine(asciiArt)).concat(additional));
out.info(ANSI_RESET);
} | java | @SneakyThrows
public static void printAsciiArtInfo(final Logger out, final String asciiArt, final String additional) {
out.info(ANSI_CYAN);
out.info("\n\n".concat(FigletFont.convertOneLine(asciiArt)).concat(additional));
out.info(ANSI_RESET);
} | [
"@",
"SneakyThrows",
"public",
"static",
"void",
"printAsciiArtInfo",
"(",
"final",
"Logger",
"out",
",",
"final",
"String",
"asciiArt",
",",
"final",
"String",
"additional",
")",
"{",
"out",
".",
"info",
"(",
"ANSI_CYAN",
")",
";",
"out",
".",
"info",
"("... | Print ascii art info.
@param out the out
@param asciiArt the ascii art
@param additional the additional | [
"Print",
"ascii",
"art",
"info",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/AsciiArtUtils.java#L72-L77 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Waiter.java | Waiter.waitForView | public View waitForView(View view, int timeout){
return waitForView(view, timeout, true, true);
} | java | public View waitForView(View view, int timeout){
return waitForView(view, timeout, true, true);
} | [
"public",
"View",
"waitForView",
"(",
"View",
"view",
",",
"int",
"timeout",
")",
"{",
"return",
"waitForView",
"(",
"view",
",",
"timeout",
",",
"true",
",",
"true",
")",
";",
"}"
] | Waits for a given view.
@param view the view to wait for
@param timeout the amount of time in milliseconds to wait
@return {@code true} if view is shown and {@code false} if it is not shown before the timeout | [
"Waits",
"for",
"a",
"given",
"view",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L320-L322 |
beders/Resty | src/main/java/us/monoid/web/auth/RestyAuthenticator.java | RestyAuthenticator.addSite | public void addSite(URI aRootUrl, String login, char[] pwd) {
String rootUri = aRootUrl.normalize().toString();
boolean replaced = false;
// check if we already have a login/password for the root uri
for (Site site : sites) {
if (site.root.equals(rootUri)) { // TODO synchronisation
site.login = login;
site.pwd = pwd;
replaced = true;
break;
}
}
if (!replaced) {
Site s = new Site();
s.root = rootUri;
s.login = login;
s.pwd = pwd;
sites.add(s);
}
} | java | public void addSite(URI aRootUrl, String login, char[] pwd) {
String rootUri = aRootUrl.normalize().toString();
boolean replaced = false;
// check if we already have a login/password for the root uri
for (Site site : sites) {
if (site.root.equals(rootUri)) { // TODO synchronisation
site.login = login;
site.pwd = pwd;
replaced = true;
break;
}
}
if (!replaced) {
Site s = new Site();
s.root = rootUri;
s.login = login;
s.pwd = pwd;
sites.add(s);
}
} | [
"public",
"void",
"addSite",
"(",
"URI",
"aRootUrl",
",",
"String",
"login",
",",
"char",
"[",
"]",
"pwd",
")",
"{",
"String",
"rootUri",
"=",
"aRootUrl",
".",
"normalize",
"(",
")",
".",
"toString",
"(",
")",
";",
"boolean",
"replaced",
"=",
"false",
... | Add or replace an authentication for a root URL aka site.
@param aRootUrl
@param login
@param pwd | [
"Add",
"or",
"replace",
"an",
"authentication",
"for",
"a",
"root",
"URL",
"aka",
"site",
"."
] | train | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/auth/RestyAuthenticator.java#L60-L79 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java | WalkerFactory.getAxisFromStep | public static int getAxisFromStep(
Compiler compiler, int stepOpCodePos)
throws javax.xml.transform.TransformerException
{
int stepType = compiler.getOp(stepOpCodePos);
switch (stepType)
{
case OpCodes.FROM_FOLLOWING :
return Axis.FOLLOWING;
case OpCodes.FROM_FOLLOWING_SIBLINGS :
return Axis.FOLLOWINGSIBLING;
case OpCodes.FROM_PRECEDING :
return Axis.PRECEDING;
case OpCodes.FROM_PRECEDING_SIBLINGS :
return Axis.PRECEDINGSIBLING;
case OpCodes.FROM_PARENT :
return Axis.PARENT;
case OpCodes.FROM_NAMESPACE :
return Axis.NAMESPACE;
case OpCodes.FROM_ANCESTORS :
return Axis.ANCESTOR;
case OpCodes.FROM_ANCESTORS_OR_SELF :
return Axis.ANCESTORORSELF;
case OpCodes.FROM_ATTRIBUTES :
return Axis.ATTRIBUTE;
case OpCodes.FROM_ROOT :
return Axis.ROOT;
case OpCodes.FROM_CHILDREN :
return Axis.CHILD;
case OpCodes.FROM_DESCENDANTS_OR_SELF :
return Axis.DESCENDANTORSELF;
case OpCodes.FROM_DESCENDANTS :
return Axis.DESCENDANT;
case OpCodes.FROM_SELF :
return Axis.SELF;
case OpCodes.OP_EXTFUNCTION :
case OpCodes.OP_FUNCTION :
case OpCodes.OP_GROUP :
case OpCodes.OP_VARIABLE :
return Axis.FILTEREDLIST;
}
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: "
//+ stepType);
} | java | public static int getAxisFromStep(
Compiler compiler, int stepOpCodePos)
throws javax.xml.transform.TransformerException
{
int stepType = compiler.getOp(stepOpCodePos);
switch (stepType)
{
case OpCodes.FROM_FOLLOWING :
return Axis.FOLLOWING;
case OpCodes.FROM_FOLLOWING_SIBLINGS :
return Axis.FOLLOWINGSIBLING;
case OpCodes.FROM_PRECEDING :
return Axis.PRECEDING;
case OpCodes.FROM_PRECEDING_SIBLINGS :
return Axis.PRECEDINGSIBLING;
case OpCodes.FROM_PARENT :
return Axis.PARENT;
case OpCodes.FROM_NAMESPACE :
return Axis.NAMESPACE;
case OpCodes.FROM_ANCESTORS :
return Axis.ANCESTOR;
case OpCodes.FROM_ANCESTORS_OR_SELF :
return Axis.ANCESTORORSELF;
case OpCodes.FROM_ATTRIBUTES :
return Axis.ATTRIBUTE;
case OpCodes.FROM_ROOT :
return Axis.ROOT;
case OpCodes.FROM_CHILDREN :
return Axis.CHILD;
case OpCodes.FROM_DESCENDANTS_OR_SELF :
return Axis.DESCENDANTORSELF;
case OpCodes.FROM_DESCENDANTS :
return Axis.DESCENDANT;
case OpCodes.FROM_SELF :
return Axis.SELF;
case OpCodes.OP_EXTFUNCTION :
case OpCodes.OP_FUNCTION :
case OpCodes.OP_GROUP :
case OpCodes.OP_VARIABLE :
return Axis.FILTEREDLIST;
}
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: "
//+ stepType);
} | [
"public",
"static",
"int",
"getAxisFromStep",
"(",
"Compiler",
"compiler",
",",
"int",
"stepOpCodePos",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"int",
"stepType",
"=",
"compiler",
".",
"getOp",
"(",
"stepOpCodePos"... | Special purpose function to see if we can optimize the pattern for
a DescendantIterator.
@param compiler non-null reference to compiler object that has processed
the XPath operations into an opcode map.
@param stepOpCodePos The opcode position for the step.
@return 32 bits as an integer that give information about the location
path as a whole.
@throws javax.xml.transform.TransformerException | [
"Special",
"purpose",
"function",
"to",
"see",
"if",
"we",
"can",
"optimize",
"the",
"pattern",
"for",
"a",
"DescendantIterator",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java#L300-L346 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWMultiSelectList.java | AbstractWMultiSelectList.selectionsEqual | private boolean selectionsEqual(final List<?> list1, final List<?> list2) {
if (isSelectionOrderable()) {
return Util.equals(list1, list2);
}
// Empty or null lists
if ((list1 == null || list1.isEmpty()) && (list2 == null || list2.isEmpty())) {
return true;
}
// Same size and contain same entries
return list1 != null && list2 != null && list1.size() == list2.size() && list1.
containsAll(list2);
} | java | private boolean selectionsEqual(final List<?> list1, final List<?> list2) {
if (isSelectionOrderable()) {
return Util.equals(list1, list2);
}
// Empty or null lists
if ((list1 == null || list1.isEmpty()) && (list2 == null || list2.isEmpty())) {
return true;
}
// Same size and contain same entries
return list1 != null && list2 != null && list1.size() == list2.size() && list1.
containsAll(list2);
} | [
"private",
"boolean",
"selectionsEqual",
"(",
"final",
"List",
"<",
"?",
">",
"list1",
",",
"final",
"List",
"<",
"?",
">",
"list2",
")",
"{",
"if",
"(",
"isSelectionOrderable",
"(",
")",
")",
"{",
"return",
"Util",
".",
"equals",
"(",
"list1",
",",
... | Selection lists are considered equal if they have the same items (order is not important). An empty list is
considered equal to a null list.
@param list1 the first list to check.
@param list2 the second list to check.
@return true if the lists are equal, false otherwise. | [
"Selection",
"lists",
"are",
"considered",
"equal",
"if",
"they",
"have",
"the",
"same",
"items",
"(",
"order",
"is",
"not",
"important",
")",
".",
"An",
"empty",
"list",
"is",
"considered",
"equal",
"to",
"a",
"null",
"list",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWMultiSelectList.java#L514-L527 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java | DocTreeScanner.visitUnknownBlockTag | @Override
public R visitUnknownBlockTag(UnknownBlockTagTree node, P p) {
return scan(node.getContent(), p);
} | java | @Override
public R visitUnknownBlockTag(UnknownBlockTagTree node, P p) {
return scan(node.getContent(), p);
} | [
"@",
"Override",
"public",
"R",
"visitUnknownBlockTag",
"(",
"UnknownBlockTagTree",
"node",
",",
"P",
"p",
")",
"{",
"return",
"scan",
"(",
"node",
".",
"getContent",
"(",
")",
",",
"p",
")",
";",
"}"
] | {@inheritDoc} This implementation scans the children in left to right order.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of scanning | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"scans",
"the",
"children",
"in",
"left",
"to",
"right",
"order",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L473-L476 |
czyzby/gdx-lml | kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/scene2d/Tooltips.java | Tooltips.setDefaultTooltipManager | public static void setDefaultTooltipManager(final TooltipManager tooltipManager) {
try {
TooltipManager.getInstance();
Reflection.setFieldValue(ClassReflection.getDeclaredField(TooltipManager.class, "instance"), null,
tooltipManager);
} catch (final ReflectionException exception) {
throw new GdxRuntimeException("Unable to set default tooltip manager.", exception);
}
} | java | public static void setDefaultTooltipManager(final TooltipManager tooltipManager) {
try {
TooltipManager.getInstance();
Reflection.setFieldValue(ClassReflection.getDeclaredField(TooltipManager.class, "instance"), null,
tooltipManager);
} catch (final ReflectionException exception) {
throw new GdxRuntimeException("Unable to set default tooltip manager.", exception);
}
} | [
"public",
"static",
"void",
"setDefaultTooltipManager",
"(",
"final",
"TooltipManager",
"tooltipManager",
")",
"{",
"try",
"{",
"TooltipManager",
".",
"getInstance",
"(",
")",
";",
"Reflection",
".",
"setFieldValue",
"(",
"ClassReflection",
".",
"getDeclaredField",
... | Since main tooltip manager instance cannot be changed globally with a regular setter, this method modifies it
using reflection.
@param tooltipManager will be returned on {@link TooltipManager#getInstance()} calls.
@throws GdxRuntimeException if unable to change manager. | [
"Since",
"main",
"tooltip",
"manager",
"instance",
"cannot",
"be",
"changed",
"globally",
"with",
"a",
"regular",
"setter",
"this",
"method",
"modifies",
"it",
"using",
"reflection",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/scene2d/Tooltips.java#L22-L30 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/client/support/HttpAccessor.java | HttpAccessor.createRequest | protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException {
ClientHttpRequest request = getRequestFactory().createRequest(url, method);
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Created " + method.name() + " request for \"" + url + "\"");
}
return request;
} | java | protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException {
ClientHttpRequest request = getRequestFactory().createRequest(url, method);
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Created " + method.name() + " request for \"" + url + "\"");
}
return request;
} | [
"protected",
"ClientHttpRequest",
"createRequest",
"(",
"URI",
"url",
",",
"HttpMethod",
"method",
")",
"throws",
"IOException",
"{",
"ClientHttpRequest",
"request",
"=",
"getRequestFactory",
"(",
")",
".",
"createRequest",
"(",
"url",
",",
"method",
")",
";",
"... | Create a new {@link ClientHttpRequest} via this template's {@link ClientHttpRequestFactory}.
@param url the URL to connect to
@param method the HTTP method to exectute (GET, POST, etc.)
@return the created request
@throws IOException in case of I/O errors | [
"Create",
"a",
"new",
"{"
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/support/HttpAccessor.java#L106-L112 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CurrencyLocalizationUrl.java | CurrencyLocalizationUrl.updateCurrencyLocalizationUrl | public static MozuUrl updateCurrencyLocalizationUrl(String currencyCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/currency/{currencyCode}?responseFields={responseFields}");
formatter.formatUrl("currencyCode", currencyCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl updateCurrencyLocalizationUrl(String currencyCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/currency/{currencyCode}?responseFields={responseFields}");
formatter.formatUrl("currencyCode", currencyCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"updateCurrencyLocalizationUrl",
"(",
"String",
"currencyCode",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/currency/{currencyCode}?responseFields={responseF... | Get Resource Url for UpdateCurrencyLocalization
@param currencyCode The three character ISOÂ currency code, such as USDÂ for US Dollars.
@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",
"UpdateCurrencyLocalization"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CurrencyLocalizationUrl.java#L114-L120 |
mongodb/stitch-android-sdk | core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/ChangeEvents.java | ChangeEvents.changeEventForLocalInsert | static ChangeEvent<BsonDocument> changeEventForLocalInsert(
final MongoNamespace namespace,
final BsonDocument document,
final boolean writePending
) {
final BsonValue docId = BsonUtils.getDocumentId(document);
return new ChangeEvent<>(
new BsonDocument(),
OperationType.INSERT,
document,
namespace,
new BsonDocument("_id", docId),
null,
writePending);
} | java | static ChangeEvent<BsonDocument> changeEventForLocalInsert(
final MongoNamespace namespace,
final BsonDocument document,
final boolean writePending
) {
final BsonValue docId = BsonUtils.getDocumentId(document);
return new ChangeEvent<>(
new BsonDocument(),
OperationType.INSERT,
document,
namespace,
new BsonDocument("_id", docId),
null,
writePending);
} | [
"static",
"ChangeEvent",
"<",
"BsonDocument",
">",
"changeEventForLocalInsert",
"(",
"final",
"MongoNamespace",
"namespace",
",",
"final",
"BsonDocument",
"document",
",",
"final",
"boolean",
"writePending",
")",
"{",
"final",
"BsonValue",
"docId",
"=",
"BsonUtils",
... | Generates a change event for a local insert of the given document in the given namespace.
@param namespace the namespace where the document was inserted.
@param document the document that was inserted.
@return a change event for a local insert of the given document in the given namespace. | [
"Generates",
"a",
"change",
"event",
"for",
"a",
"local",
"insert",
"of",
"the",
"given",
"document",
"in",
"the",
"given",
"namespace",
"."
] | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/ChangeEvents.java#L40-L54 |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java | CmsMessageBundleEditorOptions.initLowerLeftComponent | private void initLowerLeftComponent() {
HorizontalLayout placeHolderLowerLeft = new HorizontalLayout();
placeHolderLowerLeft.setWidth("100%");
Label newKeyLabel = new Label(m_messages.key(Messages.GUI_CAPTION_ADD_KEY_0));
newKeyLabel.setWidthUndefined();
HorizontalLayout lowerLeft = new HorizontalLayout(placeHolderLowerLeft, newKeyLabel);
lowerLeft.setWidth("100%");
lowerLeft.setExpandRatio(placeHolderLowerLeft, 1f);
m_lowerLeftComponent = lowerLeft;
} | java | private void initLowerLeftComponent() {
HorizontalLayout placeHolderLowerLeft = new HorizontalLayout();
placeHolderLowerLeft.setWidth("100%");
Label newKeyLabel = new Label(m_messages.key(Messages.GUI_CAPTION_ADD_KEY_0));
newKeyLabel.setWidthUndefined();
HorizontalLayout lowerLeft = new HorizontalLayout(placeHolderLowerLeft, newKeyLabel);
lowerLeft.setWidth("100%");
lowerLeft.setExpandRatio(placeHolderLowerLeft, 1f);
m_lowerLeftComponent = lowerLeft;
} | [
"private",
"void",
"initLowerLeftComponent",
"(",
")",
"{",
"HorizontalLayout",
"placeHolderLowerLeft",
"=",
"new",
"HorizontalLayout",
"(",
")",
";",
"placeHolderLowerLeft",
".",
"setWidth",
"(",
"\"100%\"",
")",
";",
"Label",
"newKeyLabel",
"=",
"new",
"Label",
... | Initializes the lower left component {@link #m_lowerLeftComponent} with the correctly placed "Add key"-label. | [
"Initializes",
"the",
"lower",
"left",
"component",
"{"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java#L395-L406 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceClient.java | TargetInstanceClient.insertTargetInstance | @BetaApi
public final Operation insertTargetInstance(String zone, TargetInstance targetInstanceResource) {
InsertTargetInstanceHttpRequest request =
InsertTargetInstanceHttpRequest.newBuilder()
.setZone(zone)
.setTargetInstanceResource(targetInstanceResource)
.build();
return insertTargetInstance(request);
} | java | @BetaApi
public final Operation insertTargetInstance(String zone, TargetInstance targetInstanceResource) {
InsertTargetInstanceHttpRequest request =
InsertTargetInstanceHttpRequest.newBuilder()
.setZone(zone)
.setTargetInstanceResource(targetInstanceResource)
.build();
return insertTargetInstance(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"insertTargetInstance",
"(",
"String",
"zone",
",",
"TargetInstance",
"targetInstanceResource",
")",
"{",
"InsertTargetInstanceHttpRequest",
"request",
"=",
"InsertTargetInstanceHttpRequest",
".",
"newBuilder",
"(",
")",
"."... | Creates a TargetInstance resource in the specified project and zone using the data included in
the request.
<p>Sample code:
<pre><code>
try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
TargetInstance targetInstanceResource = TargetInstance.newBuilder().build();
Operation response = targetInstanceClient.insertTargetInstance(zone.toString(), targetInstanceResource);
}
</code></pre>
@param zone Name of the zone scoping this request.
@param targetInstanceResource A TargetInstance resource. This resource defines an endpoint
instance that terminates traffic of certain protocols. (== resource_for
beta.targetInstances ==) (== resource_for v1.targetInstances ==)
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"TargetInstance",
"resource",
"in",
"the",
"specified",
"project",
"and",
"zone",
"using",
"the",
"data",
"included",
"in",
"the",
"request",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceClient.java#L551-L560 |
vakinge/jeesuite-libs | jeesuite-common/src/main/java/com/jeesuite/common/util/DateUtils.java | DateUtils.formatDate | public static Date formatDate(Date orig, String... patterns) {
String pattern = TIMESTAMP_PATTERN;
if (patterns != null && patterns.length > 0
&& StringUtils.isNotBlank(patterns[0])) {
pattern = patterns[0];
}
return parseDate(DateFormatUtils.format(orig, pattern));
} | java | public static Date formatDate(Date orig, String... patterns) {
String pattern = TIMESTAMP_PATTERN;
if (patterns != null && patterns.length > 0
&& StringUtils.isNotBlank(patterns[0])) {
pattern = patterns[0];
}
return parseDate(DateFormatUtils.format(orig, pattern));
} | [
"public",
"static",
"Date",
"formatDate",
"(",
"Date",
"orig",
",",
"String",
"...",
"patterns",
")",
"{",
"String",
"pattern",
"=",
"TIMESTAMP_PATTERN",
";",
"if",
"(",
"patterns",
"!=",
"null",
"&&",
"patterns",
".",
"length",
">",
"0",
"&&",
"StringUtil... | 格式化日期为指定格式<br>
generate by: vakin jiang at 2012-3-7
@param orig
@param patterns
@return | [
"格式化日期为指定格式<br",
">",
"generate",
"by",
":",
"vakin",
"jiang",
"at",
"2012",
"-",
"3",
"-",
"7"
] | train | https://github.com/vakinge/jeesuite-libs/blob/c48fe2c7fbd294892cf4030dbec96e744dd3e386/jeesuite-common/src/main/java/com/jeesuite/common/util/DateUtils.java#L196-L203 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/io/StreamUtils.java | StreamUtils.copy | public static long copy(ReadableByteChannel inputChannel, WritableByteChannel outputChannel) throws IOException {
return new StreamCopier(inputChannel, outputChannel).copy();
} | java | public static long copy(ReadableByteChannel inputChannel, WritableByteChannel outputChannel) throws IOException {
return new StreamCopier(inputChannel, outputChannel).copy();
} | [
"public",
"static",
"long",
"copy",
"(",
"ReadableByteChannel",
"inputChannel",
",",
"WritableByteChannel",
"outputChannel",
")",
"throws",
"IOException",
"{",
"return",
"new",
"StreamCopier",
"(",
"inputChannel",
",",
"outputChannel",
")",
".",
"copy",
"(",
")",
... | Copies a {@link ReadableByteChannel} to a {@link WritableByteChannel}.
<p>
<b>Note:</b> The {@link ReadableByteChannel} and {@link WritableByteChannel}s are NOT closed by the method
</p>
@return Total bytes copied | [
"Copies",
"a",
"{",
"@link",
"ReadableByteChannel",
"}",
"to",
"a",
"{",
"@link",
"WritableByteChannel",
"}",
".",
"<p",
">",
"<b",
">",
"Note",
":",
"<",
"/",
"b",
">",
"The",
"{",
"@link",
"ReadableByteChannel",
"}",
"and",
"{",
"@link",
"WritableByteC... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/io/StreamUtils.java#L87-L89 |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java | JcrRdfTools.createValue | public Value createValue(final Node node,
final RDFNode data,
final String propertyName) throws RepositoryException {
final ValueFactory valueFactory = node.getSession().getValueFactory();
return createValue(valueFactory, data, getPropertyType(node, propertyName).orElse(UNDEFINED));
} | java | public Value createValue(final Node node,
final RDFNode data,
final String propertyName) throws RepositoryException {
final ValueFactory valueFactory = node.getSession().getValueFactory();
return createValue(valueFactory, data, getPropertyType(node, propertyName).orElse(UNDEFINED));
} | [
"public",
"Value",
"createValue",
"(",
"final",
"Node",
"node",
",",
"final",
"RDFNode",
"data",
",",
"final",
"String",
"propertyName",
")",
"throws",
"RepositoryException",
"{",
"final",
"ValueFactory",
"valueFactory",
"=",
"node",
".",
"getSession",
"(",
")",... | Create a JCR value from an RDFNode for a given JCR property
@param node the JCR node we want a property for
@param data an RDF Node (possibly with a DataType)
@param propertyName name of the property to populate (used to use the right type for the value)
@return the JCR value from an RDFNode for a given JCR property
@throws RepositoryException if repository exception occurred | [
"Create",
"a",
"JCR",
"value",
"from",
"an",
"RDFNode",
"for",
"a",
"given",
"JCR",
"property"
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java#L174-L179 |
bazaarvoice/emodb | web/src/main/java/com/bazaarvoice/emodb/web/scanner/writer/TemporaryFileScanWriter.java | TemporaryFileScanWriter.blockUntilOpenShardsAtMost | private boolean blockUntilOpenShardsAtMost(int maxOpenShards, @Nullable TransferKey permittedKey, Instant timeout)
throws IOException, InterruptedException {
Stopwatch stopWatch = Stopwatch.createStarted();
Instant now;
_lock.lock();
try {
while (!_closed &&
maxOpenShardsGreaterThan(maxOpenShards, permittedKey) &&
(now = Instant.now()).isBefore(timeout)) {
// Stop blocking if there is an exception
propagateExceptionIfPresent();
// Wait no longer than 30 seconds; we want to log at least every 30 seconds we've been waiting.
long waitTime = Math.min(Duration.ofSeconds(30).toMillis(), Duration.between(now, timeout).toMillis());
_shardFilesClosedOrExceptionCaught.await(waitTime, TimeUnit.MILLISECONDS);
if (!maxOpenShardsGreaterThan(maxOpenShards, permittedKey)) {
propagateExceptionIfPresent();
return true;
}
_log.debug("After {} seconds task {} still has {} open shards",
stopWatch.elapsed(TimeUnit.SECONDS), _taskId, _openShardFiles.size());
}
propagateExceptionIfPresent();
return !maxOpenShardsGreaterThan(maxOpenShards, permittedKey);
} finally {
_lock.unlock();
}
} | java | private boolean blockUntilOpenShardsAtMost(int maxOpenShards, @Nullable TransferKey permittedKey, Instant timeout)
throws IOException, InterruptedException {
Stopwatch stopWatch = Stopwatch.createStarted();
Instant now;
_lock.lock();
try {
while (!_closed &&
maxOpenShardsGreaterThan(maxOpenShards, permittedKey) &&
(now = Instant.now()).isBefore(timeout)) {
// Stop blocking if there is an exception
propagateExceptionIfPresent();
// Wait no longer than 30 seconds; we want to log at least every 30 seconds we've been waiting.
long waitTime = Math.min(Duration.ofSeconds(30).toMillis(), Duration.between(now, timeout).toMillis());
_shardFilesClosedOrExceptionCaught.await(waitTime, TimeUnit.MILLISECONDS);
if (!maxOpenShardsGreaterThan(maxOpenShards, permittedKey)) {
propagateExceptionIfPresent();
return true;
}
_log.debug("After {} seconds task {} still has {} open shards",
stopWatch.elapsed(TimeUnit.SECONDS), _taskId, _openShardFiles.size());
}
propagateExceptionIfPresent();
return !maxOpenShardsGreaterThan(maxOpenShards, permittedKey);
} finally {
_lock.unlock();
}
} | [
"private",
"boolean",
"blockUntilOpenShardsAtMost",
"(",
"int",
"maxOpenShards",
",",
"@",
"Nullable",
"TransferKey",
"permittedKey",
",",
"Instant",
"timeout",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"Stopwatch",
"stopWatch",
"=",
"Stopwatch",
... | Blocks until the number of open shards is equal to or less than the provided threshold or the current time
is after the timeout timestamp. | [
"Blocks",
"until",
"the",
"number",
"of",
"open",
"shards",
"is",
"equal",
"to",
"or",
"less",
"than",
"the",
"provided",
"threshold",
"or",
"the",
"current",
"time",
"is",
"after",
"the",
"timeout",
"timestamp",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/scanner/writer/TemporaryFileScanWriter.java#L232-L263 |
thorntail/thorntail | meta/fraction-metadata/src/main/java/org/wildfly/swarm/fractions/FractionDescriptor.java | FractionDescriptor.fromGav | public static FractionDescriptor fromGav(final FractionList fractionList, final String gav) {
final String[] parts = gav.split(":");
FractionDescriptor desc = null;
switch (parts.length) {
case 1:
desc = fractionList.getFractionDescriptor(THORNTAIL_GROUP_ID, parts[0]);
if (desc == null) {
throw new RuntimeException("Fraction not found: " + gav);
}
break;
case 2:
desc = fractionList.getFractionDescriptor(THORNTAIL_GROUP_ID, parts[0]);
if (desc == null) {
throw new RuntimeException("Fraction not found: " + gav);
}
if (!desc.getVersion().equals(parts[1])) {
throw new RuntimeException("Version mismatch: requested " + gav + ", found " + desc.av());
}
break;
case 3:
desc = fractionList.getFractionDescriptor(parts[0], parts[1]);
if (desc == null) {
throw new RuntimeException("Fraction not found: " + gav);
}
if (!desc.getVersion().equals(parts[2])) {
throw new RuntimeException("Version mismatch: requested " + gav + ", found " + desc.gav());
}
break;
default:
throw new RuntimeException("Invalid fraction spec: " + gav);
}
return desc;
} | java | public static FractionDescriptor fromGav(final FractionList fractionList, final String gav) {
final String[] parts = gav.split(":");
FractionDescriptor desc = null;
switch (parts.length) {
case 1:
desc = fractionList.getFractionDescriptor(THORNTAIL_GROUP_ID, parts[0]);
if (desc == null) {
throw new RuntimeException("Fraction not found: " + gav);
}
break;
case 2:
desc = fractionList.getFractionDescriptor(THORNTAIL_GROUP_ID, parts[0]);
if (desc == null) {
throw new RuntimeException("Fraction not found: " + gav);
}
if (!desc.getVersion().equals(parts[1])) {
throw new RuntimeException("Version mismatch: requested " + gav + ", found " + desc.av());
}
break;
case 3:
desc = fractionList.getFractionDescriptor(parts[0], parts[1]);
if (desc == null) {
throw new RuntimeException("Fraction not found: " + gav);
}
if (!desc.getVersion().equals(parts[2])) {
throw new RuntimeException("Version mismatch: requested " + gav + ", found " + desc.gav());
}
break;
default:
throw new RuntimeException("Invalid fraction spec: " + gav);
}
return desc;
} | [
"public",
"static",
"FractionDescriptor",
"fromGav",
"(",
"final",
"FractionList",
"fractionList",
",",
"final",
"String",
"gav",
")",
"{",
"final",
"String",
"[",
"]",
"parts",
"=",
"gav",
".",
"split",
"(",
"\":\"",
")",
";",
"FractionDescriptor",
"desc",
... | Retrieves a {@link FractionDescriptor} from the {@code fractionList} based on the {@code gav} string.
<p>The {@code gav} string contains colon-delimited Maven artifact coordinates. Supported formats are:</p>
<ul>
<li>{@code artifactId}: the groupId {@code org.wildfly.swarm} is presumed</li>
<li>{@code artifactId:version}: the groupId {@code org.wildfly.swarm} is presumed</li>
<li>{@code groupId:artifactId:version}</li>
</ul>
<p>If the {@code fractionList} doesn't contain such fraction, an exception is thrown.</p> | [
"Retrieves",
"a",
"{",
"@link",
"FractionDescriptor",
"}",
"from",
"the",
"{",
"@code",
"fractionList",
"}",
"based",
"on",
"the",
"{",
"@code",
"gav",
"}",
"string",
"."
] | train | https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/meta/fraction-metadata/src/main/java/org/wildfly/swarm/fractions/FractionDescriptor.java#L57-L91 |
playn/playn | core/src/playn/core/TextBlock.java | TextBlock.getBounds | public static Rectangle getBounds(TextLayout[] lines, Rectangle into) {
// some font glyphs start rendering at a negative inset, blowing outside their bounding box
// (naughty!); in such cases, we use xAdjust to shift everything to the right to ensure that we
// don't paint outside our reported bounding box (so that someone can create a single canvas of
// bounding box size and render this text layout into it at (0,0) and nothing will get cut off)
float xAdjust = 0, twidth = 0, theight = 0;
for (TextLayout layout : lines) {
IRectangle bounds = layout.bounds;
xAdjust = Math.max(xAdjust, -Math.min(0, bounds.x()));
// we use layout.width() here not bounds width because layout width includes extra space
// needed for lines that start rendering at a positive x offset whereas bounds.width() is
// only the precise width of the rendered text
twidth = Math.max(twidth, layout.size.width());
if (layout != lines[0])
theight += layout.leading(); // leading only applied to lines after 0
theight += layout.ascent() + layout.descent();
}
into.setBounds(xAdjust, 0, xAdjust+twidth, theight);
return into;
} | java | public static Rectangle getBounds(TextLayout[] lines, Rectangle into) {
// some font glyphs start rendering at a negative inset, blowing outside their bounding box
// (naughty!); in such cases, we use xAdjust to shift everything to the right to ensure that we
// don't paint outside our reported bounding box (so that someone can create a single canvas of
// bounding box size and render this text layout into it at (0,0) and nothing will get cut off)
float xAdjust = 0, twidth = 0, theight = 0;
for (TextLayout layout : lines) {
IRectangle bounds = layout.bounds;
xAdjust = Math.max(xAdjust, -Math.min(0, bounds.x()));
// we use layout.width() here not bounds width because layout width includes extra space
// needed for lines that start rendering at a positive x offset whereas bounds.width() is
// only the precise width of the rendered text
twidth = Math.max(twidth, layout.size.width());
if (layout != lines[0])
theight += layout.leading(); // leading only applied to lines after 0
theight += layout.ascent() + layout.descent();
}
into.setBounds(xAdjust, 0, xAdjust+twidth, theight);
return into;
} | [
"public",
"static",
"Rectangle",
"getBounds",
"(",
"TextLayout",
"[",
"]",
"lines",
",",
"Rectangle",
"into",
")",
"{",
"// some font glyphs start rendering at a negative inset, blowing outside their bounding box",
"// (naughty!); in such cases, we use xAdjust to shift everything to th... | Computes the bounds of a block of text. The {@code x} component of the bounds may be
positive, indicating that the text should be rendered at that offset. This is to account for
the fact that some text renders to the left of its reported origin due to font
extravagance. | [
"Computes",
"the",
"bounds",
"of",
"a",
"block",
"of",
"text",
".",
"The",
"{"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/TextBlock.java#L69-L88 |
assertthat/selenium-shutterbug | src/main/java/com/assertthat/selenium_shutterbug/core/PageSnapshot.java | PageSnapshot.highlightWithText | public PageSnapshot highlightWithText(WebElement element, Color elementColor, int lineWidth, String text, Color textColor, Font textFont) {
try {
highlight(element, elementColor, 0);
Coordinates coords = new Coordinates(element, devicePixelRatio);
image = ImageProcessor.addText(image, coords.getX(), coords.getY() - textFont.getSize() / 2, text, textColor, textFont);
} catch (RasterFormatException rfe) {
throw new ElementOutsideViewportException(ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE, rfe);
}
return this;
} | java | public PageSnapshot highlightWithText(WebElement element, Color elementColor, int lineWidth, String text, Color textColor, Font textFont) {
try {
highlight(element, elementColor, 0);
Coordinates coords = new Coordinates(element, devicePixelRatio);
image = ImageProcessor.addText(image, coords.getX(), coords.getY() - textFont.getSize() / 2, text, textColor, textFont);
} catch (RasterFormatException rfe) {
throw new ElementOutsideViewportException(ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE, rfe);
}
return this;
} | [
"public",
"PageSnapshot",
"highlightWithText",
"(",
"WebElement",
"element",
",",
"Color",
"elementColor",
",",
"int",
"lineWidth",
",",
"String",
"text",
",",
"Color",
"textColor",
",",
"Font",
"textFont",
")",
"{",
"try",
"{",
"highlight",
"(",
"element",
",... | Highlight WebElement within the page, same as in {@link #highlight(WebElement)}
but providing ability to override default color, font values.
@param element WebElement to be highlighted
@param elementColor element highlight color
@param lineWidth line width around the element
@param text text to be placed above the highlighted element
@param textColor color of the text
@param textFont text font
@return instance of type PageSnapshot | [
"Highlight",
"WebElement",
"within",
"the",
"page",
"same",
"as",
"in",
"{",
"@link",
"#highlight",
"(",
"WebElement",
")",
"}",
"but",
"providing",
"ability",
"to",
"override",
"default",
"color",
"font",
"values",
"."
] | train | https://github.com/assertthat/selenium-shutterbug/blob/770d9b92423200d262c9ab70e40405921d81e262/src/main/java/com/assertthat/selenium_shutterbug/core/PageSnapshot.java#L92-L101 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.addStorageAccount | public void addStorageAccount(String resourceGroupName, String accountName, String storageAccountName, AddStorageAccountParameters parameters) {
addStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName, parameters).toBlocking().single().body();
} | java | public void addStorageAccount(String resourceGroupName, String accountName, String storageAccountName, AddStorageAccountParameters parameters) {
addStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName, parameters).toBlocking().single().body();
} | [
"public",
"void",
"addStorageAccount",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"storageAccountName",
",",
"AddStorageAccountParameters",
"parameters",
")",
"{",
"addStorageAccountWithServiceResponseAsync",
"(",
"resourceGroupName",
","... | Updates the specified Data Lake Analytics account to add an Azure Storage account.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account.
@param accountName The name of the Data Lake Analytics account to which to add the Azure Storage account.
@param storageAccountName The name of the Azure Storage account to add
@param parameters The parameters containing the access key and optional suffix for the Azure Storage Account.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Updates",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
"to",
"add",
"an",
"Azure",
"Storage",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L477-L479 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/logging/StoringLocalLogs.java | StoringLocalLogs.addEntry | @Override
public void addEntry(String logType, LogEntry entry) {
if (!logTypesToInclude.contains(logType)) {
return;
}
if (!localLogs.containsKey(logType)) {
List<LogEntry> entries = new ArrayList<>();
entries.add(entry);
localLogs.put(logType, entries);
} else {
localLogs.get(logType).add(entry);
}
} | java | @Override
public void addEntry(String logType, LogEntry entry) {
if (!logTypesToInclude.contains(logType)) {
return;
}
if (!localLogs.containsKey(logType)) {
List<LogEntry> entries = new ArrayList<>();
entries.add(entry);
localLogs.put(logType, entries);
} else {
localLogs.get(logType).add(entry);
}
} | [
"@",
"Override",
"public",
"void",
"addEntry",
"(",
"String",
"logType",
",",
"LogEntry",
"entry",
")",
"{",
"if",
"(",
"!",
"logTypesToInclude",
".",
"contains",
"(",
"logType",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"localLogs",
".",
"con... | Add a new log entry to the local storage.
@param logType the log type to store
@param entry the entry to store | [
"Add",
"a",
"new",
"log",
"entry",
"to",
"the",
"local",
"storage",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/logging/StoringLocalLogs.java#L59-L72 |
joniles/mpxj | src/main/java/net/sf/mpxj/common/InputStreamHelper.java | InputStreamHelper.writeStreamToTempFile | public static File writeStreamToTempFile(InputStream inputStream, String tempFileSuffix) throws IOException
{
FileOutputStream outputStream = null;
try
{
File file = File.createTempFile("mpxj", tempFileSuffix);
outputStream = new FileOutputStream(file);
byte[] buffer = new byte[1024];
while (true)
{
int bytesRead = inputStream.read(buffer);
if (bytesRead == -1)
{
break;
}
outputStream.write(buffer, 0, bytesRead);
}
return file;
}
finally
{
if (outputStream != null)
{
outputStream.close();
}
}
} | java | public static File writeStreamToTempFile(InputStream inputStream, String tempFileSuffix) throws IOException
{
FileOutputStream outputStream = null;
try
{
File file = File.createTempFile("mpxj", tempFileSuffix);
outputStream = new FileOutputStream(file);
byte[] buffer = new byte[1024];
while (true)
{
int bytesRead = inputStream.read(buffer);
if (bytesRead == -1)
{
break;
}
outputStream.write(buffer, 0, bytesRead);
}
return file;
}
finally
{
if (outputStream != null)
{
outputStream.close();
}
}
} | [
"public",
"static",
"File",
"writeStreamToTempFile",
"(",
"InputStream",
"inputStream",
",",
"String",
"tempFileSuffix",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"outputStream",
"=",
"null",
";",
"try",
"{",
"File",
"file",
"=",
"File",
".",
"createT... | Copy the data from an InputStream to a temp file.
@param inputStream data source
@param tempFileSuffix suffix to use for temp file
@return File instance | [
"Copy",
"the",
"data",
"from",
"an",
"InputStream",
"to",
"a",
"temp",
"file",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/InputStreamHelper.java#L46-L74 |
reactor/reactor-netty | src/main/java/reactor/netty/tcp/TcpClient.java | TcpClient.doOnLifecycle | public final TcpClient doOnLifecycle(Consumer<? super Bootstrap> doOnConnect,
Consumer<? super Connection> doOnConnected,
Consumer<? super Connection> doOnDisconnected) {
Objects.requireNonNull(doOnConnect, "doOnConnect");
Objects.requireNonNull(doOnConnected, "doOnConnected");
Objects.requireNonNull(doOnDisconnected, "doOnDisconnected");
return new TcpClientDoOn(this, doOnConnect, doOnConnected, doOnDisconnected);
} | java | public final TcpClient doOnLifecycle(Consumer<? super Bootstrap> doOnConnect,
Consumer<? super Connection> doOnConnected,
Consumer<? super Connection> doOnDisconnected) {
Objects.requireNonNull(doOnConnect, "doOnConnect");
Objects.requireNonNull(doOnConnected, "doOnConnected");
Objects.requireNonNull(doOnDisconnected, "doOnDisconnected");
return new TcpClientDoOn(this, doOnConnect, doOnConnected, doOnDisconnected);
} | [
"public",
"final",
"TcpClient",
"doOnLifecycle",
"(",
"Consumer",
"<",
"?",
"super",
"Bootstrap",
">",
"doOnConnect",
",",
"Consumer",
"<",
"?",
"super",
"Connection",
">",
"doOnConnected",
",",
"Consumer",
"<",
"?",
"super",
"Connection",
">",
"doOnDisconnected... | Setup all lifecycle callbacks called on or after {@link io.netty.channel.Channel}
has been connected and after it has been disconnected.
@param doOnConnect a consumer observing client start event
@param doOnConnected a consumer observing client started event
@param doOnDisconnected a consumer observing client stop event
@return a new {@link TcpClient} | [
"Setup",
"all",
"lifecycle",
"callbacks",
"called",
"on",
"or",
"after",
"{",
"@link",
"io",
".",
"netty",
".",
"channel",
".",
"Channel",
"}",
"has",
"been",
"connected",
"and",
"after",
"it",
"has",
"been",
"disconnected",
"."
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/tcp/TcpClient.java#L277-L284 |
JOML-CI/JOML | src/org/joml/Intersectionf.java | Intersectionf.distancePointPlane | public static float distancePointPlane(float pointX, float pointY, float pointZ,
float v0X, float v0Y, float v0Z, float v1X, float v1Y, float v1Z, float v2X, float v2Y, float v2Z) {
float v1Y0Y = v1Y - v0Y;
float v2Z0Z = v2Z - v0Z;
float v2Y0Y = v2Y - v0Y;
float v1Z0Z = v1Z - v0Z;
float v2X0X = v2X - v0X;
float v1X0X = v1X - v0X;
float a = v1Y0Y * v2Z0Z - v2Y0Y * v1Z0Z;
float b = v1Z0Z * v2X0X - v2Z0Z * v1X0X;
float c = v1X0X * v2Y0Y - v2X0X * v1Y0Y;
float d = -(a * v0X + b * v0Y + c * v0Z);
return distancePointPlane(pointX, pointY, pointZ, a, b, c, d);
} | java | public static float distancePointPlane(float pointX, float pointY, float pointZ,
float v0X, float v0Y, float v0Z, float v1X, float v1Y, float v1Z, float v2X, float v2Y, float v2Z) {
float v1Y0Y = v1Y - v0Y;
float v2Z0Z = v2Z - v0Z;
float v2Y0Y = v2Y - v0Y;
float v1Z0Z = v1Z - v0Z;
float v2X0X = v2X - v0X;
float v1X0X = v1X - v0X;
float a = v1Y0Y * v2Z0Z - v2Y0Y * v1Z0Z;
float b = v1Z0Z * v2X0X - v2Z0Z * v1X0X;
float c = v1X0X * v2Y0Y - v2X0X * v1Y0Y;
float d = -(a * v0X + b * v0Y + c * v0Z);
return distancePointPlane(pointX, pointY, pointZ, a, b, c, d);
} | [
"public",
"static",
"float",
"distancePointPlane",
"(",
"float",
"pointX",
",",
"float",
"pointY",
",",
"float",
"pointZ",
",",
"float",
"v0X",
",",
"float",
"v0Y",
",",
"float",
"v0Z",
",",
"float",
"v1X",
",",
"float",
"v1Y",
",",
"float",
"v1Z",
",",
... | Determine the signed distance of the given point <code>(pointX, pointY, pointZ)</code> to the plane of the triangle specified by its three points
<code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code>.
<p>
If the point lies on the front-facing side of the triangle's plane, that is, if the triangle has counter-clockwise winding order
as seen from the point, then this method returns a positive number.
@param pointX
the x coordinate of the point
@param pointY
the y coordinate of the point
@param pointZ
the z coordinate of the point
@param v0X
the x coordinate of the first vertex of the triangle
@param v0Y
the y coordinate of the first vertex of the triangle
@param v0Z
the z coordinate of the first vertex of the triangle
@param v1X
the x coordinate of the second vertex of the triangle
@param v1Y
the y coordinate of the second vertex of the triangle
@param v1Z
the z coordinate of the second vertex of the triangle
@param v2X
the x coordinate of the third vertex of the triangle
@param v2Y
the y coordinate of the third vertex of the triangle
@param v2Z
the z coordinate of the third vertex of the triangle
@return the signed distance between the point and the plane of the triangle | [
"Determine",
"the",
"signed",
"distance",
"of",
"the",
"given",
"point",
"<code",
">",
"(",
"pointX",
"pointY",
"pointZ",
")",
"<",
"/",
"code",
">",
"to",
"the",
"plane",
"of",
"the",
"triangle",
"specified",
"by",
"its",
"three",
"points",
"<code",
">"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L996-L1009 |
HubSpot/Singularity | SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java | SingularityClient.getTaskState | public Optional<SingularityTaskState> getTaskState(String taskId) {
final Function<String, String> requestUri = (host) -> String.format(TRACK_BY_TASK_ID_FORMAT, getApiBase(host), taskId);
return getSingle(requestUri, "track by task id", taskId, SingularityTaskState.class);
} | java | public Optional<SingularityTaskState> getTaskState(String taskId) {
final Function<String, String> requestUri = (host) -> String.format(TRACK_BY_TASK_ID_FORMAT, getApiBase(host), taskId);
return getSingle(requestUri, "track by task id", taskId, SingularityTaskState.class);
} | [
"public",
"Optional",
"<",
"SingularityTaskState",
">",
"getTaskState",
"(",
"String",
"taskId",
")",
"{",
"final",
"Function",
"<",
"String",
",",
"String",
">",
"requestUri",
"=",
"(",
"host",
")",
"-",
">",
"String",
".",
"format",
"(",
"TRACK_BY_TASK_ID_... | Get the current state of a task by its task ID, will only search active/inactive tasks, not pending
@param taskId
The task ID to search for
@return
A {@link SingularityTaskState} if the task was found among active or inactive tasks | [
"Get",
"the",
"current",
"state",
"of",
"a",
"task",
"by",
"its",
"task",
"ID",
"will",
"only",
"search",
"active",
"/",
"inactive",
"tasks",
"not",
"pending"
] | train | https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java#L1561-L1564 |
pac4j/pac4j | pac4j-core/src/main/java/org/pac4j/core/engine/DefaultSecurityLogic.java | DefaultSecurityLogic.redirectToIdentityProvider | protected HttpAction redirectToIdentityProvider(final C context, final List<Client> currentClients) {
final IndirectClient currentClient = (IndirectClient) currentClients.get(0);
return (HttpAction) currentClient.redirect(context).get();
} | java | protected HttpAction redirectToIdentityProvider(final C context, final List<Client> currentClients) {
final IndirectClient currentClient = (IndirectClient) currentClients.get(0);
return (HttpAction) currentClient.redirect(context).get();
} | [
"protected",
"HttpAction",
"redirectToIdentityProvider",
"(",
"final",
"C",
"context",
",",
"final",
"List",
"<",
"Client",
">",
"currentClients",
")",
"{",
"final",
"IndirectClient",
"currentClient",
"=",
"(",
"IndirectClient",
")",
"currentClients",
".",
"get",
... | Perform a redirection to start the login process of the first indirect client.
@param context the web context
@param currentClients the current clients
@return the performed redirection | [
"Perform",
"a",
"redirection",
"to",
"start",
"the",
"login",
"process",
"of",
"the",
"first",
"indirect",
"client",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/engine/DefaultSecurityLogic.java#L217-L220 |
3pillarlabs/spring-data-simpledb | spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/attributeutil/AmazonSimpleDBUtil.java | AmazonSimpleDBUtil.encodeByteArray | public static String encodeByteArray(byte[] byteArray) {
try {
return new String(Base64.encodeBase64(byteArray), UTF8_ENCODING);
} catch(UnsupportedEncodingException e) {
throw new MappingException("Could not encode byteArray to UTF8 encoding", e);
}
} | java | public static String encodeByteArray(byte[] byteArray) {
try {
return new String(Base64.encodeBase64(byteArray), UTF8_ENCODING);
} catch(UnsupportedEncodingException e) {
throw new MappingException("Could not encode byteArray to UTF8 encoding", e);
}
} | [
"public",
"static",
"String",
"encodeByteArray",
"(",
"byte",
"[",
"]",
"byteArray",
")",
"{",
"try",
"{",
"return",
"new",
"String",
"(",
"Base64",
".",
"encodeBase64",
"(",
"byteArray",
")",
",",
"UTF8_ENCODING",
")",
";",
"}",
"catch",
"(",
"Unsupported... | Encodes byteArray value into a base64-encoded string.
@return string representation of the date value | [
"Encodes",
"byteArray",
"value",
"into",
"a",
"base64",
"-",
"encoded",
"string",
"."
] | train | https://github.com/3pillarlabs/spring-data-simpledb/blob/f1e0eb4e48ec4674d3966e8f5bc04c95031f93ae/spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/attributeutil/AmazonSimpleDBUtil.java#L172-L178 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/java/net/AddressCache.java | AddressCache.get | public Object get(String hostname, int netId) {
AddressCacheEntry entry = cache.get(new AddressCacheKey(hostname, netId));
// Do we have a valid cache entry?
if (entry != null && entry.expiryNanos >= System.nanoTime()) {
return entry.value;
}
// Either we didn't find anything, or it had expired.
// No need to remove expired entries: the caller will provide a replacement shortly.
return null;
} | java | public Object get(String hostname, int netId) {
AddressCacheEntry entry = cache.get(new AddressCacheKey(hostname, netId));
// Do we have a valid cache entry?
if (entry != null && entry.expiryNanos >= System.nanoTime()) {
return entry.value;
}
// Either we didn't find anything, or it had expired.
// No need to remove expired entries: the caller will provide a replacement shortly.
return null;
} | [
"public",
"Object",
"get",
"(",
"String",
"hostname",
",",
"int",
"netId",
")",
"{",
"AddressCacheEntry",
"entry",
"=",
"cache",
".",
"get",
"(",
"new",
"AddressCacheKey",
"(",
"hostname",
",",
"netId",
")",
")",
";",
"// Do we have a valid cache entry?",
"if"... | Returns the cached InetAddress[] for 'hostname' on network 'netId'. Returns null
if nothing is known about 'hostname'. Returns a String suitable for use as an
UnknownHostException detail message if 'hostname' is known not to exist. | [
"Returns",
"the",
"cached",
"InetAddress",
"[]",
"for",
"hostname",
"on",
"network",
"netId",
".",
"Returns",
"null",
"if",
"nothing",
"is",
"known",
"about",
"hostname",
".",
"Returns",
"a",
"String",
"suitable",
"for",
"use",
"as",
"an",
"UnknownHostExceptio... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/java/net/AddressCache.java#L102-L111 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.audit.reader/src/com/ibm/ws/security/audit/reader/tasks/BaseCommandTask.java | BaseCommandTask.promptForText | protected String promptForText(com.ibm.ws.security.audit.reader.utils.ConsoleWrapper stdin, PrintStream stdout) {
return promptForText(stdin, stdout,
"encode.enterText", "encode.reenterText",
"encode.readError", "encode.entriesDidNotMatch");
} | java | protected String promptForText(com.ibm.ws.security.audit.reader.utils.ConsoleWrapper stdin, PrintStream stdout) {
return promptForText(stdin, stdout,
"encode.enterText", "encode.reenterText",
"encode.readError", "encode.entriesDidNotMatch");
} | [
"protected",
"String",
"promptForText",
"(",
"com",
".",
"ibm",
".",
"ws",
".",
"security",
".",
"audit",
".",
"reader",
".",
"utils",
".",
"ConsoleWrapper",
"stdin",
",",
"PrintStream",
"stdout",
")",
"{",
"return",
"promptForText",
"(",
"stdin",
",",
"st... | Prompt the user to enter text to encode.
Prompts twice and compares to ensure it was entered correctly.
@return Entered String | [
"Prompt",
"the",
"user",
"to",
"enter",
"text",
"to",
"encode",
".",
"Prompts",
"twice",
"and",
"compares",
"to",
"ensure",
"it",
"was",
"entered",
"correctly",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.reader/src/com/ibm/ws/security/audit/reader/tasks/BaseCommandTask.java#L191-L195 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/SchedulesInner.java | SchedulesInner.createOrUpdateAsync | public Observable<ScheduleInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String scheduleName, ScheduleCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, scheduleName, parameters).map(new Func1<ServiceResponse<ScheduleInner>, ScheduleInner>() {
@Override
public ScheduleInner call(ServiceResponse<ScheduleInner> response) {
return response.body();
}
});
} | java | public Observable<ScheduleInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String scheduleName, ScheduleCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, scheduleName, parameters).map(new Func1<ServiceResponse<ScheduleInner>, ScheduleInner>() {
@Override
public ScheduleInner call(ServiceResponse<ScheduleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ScheduleInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"scheduleName",
",",
"ScheduleCreateOrUpdateParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWit... | Create a schedule.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param scheduleName The schedule name.
@param parameters The parameters supplied to the create or update schedule operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ScheduleInner object | [
"Create",
"a",
"schedule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/SchedulesInner.java#L134-L141 |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/LongArrayList.java | LongArrayList.addAll | @Override
public boolean addAll(int index, Collection<? extends Long> c) {
if (index > size || index < 0)
throw new IndexOutOfBoundsException(
"Index: " + index + ", Size: " + size);
int numNew = c.size();
ensureCapacity(size + numNew); // Increments modCount
int numMoved = size - index;
if (numMoved > 0)
System.arraycopy(elementData, index, elementData, index + numNew,
numMoved);
Iterator<? extends Long> iter=c.iterator();
int pos = index;
while(iter.hasNext()) elementData[pos++]=iter.next();
size += numNew;
return numNew != 0;
} | java | @Override
public boolean addAll(int index, Collection<? extends Long> c) {
if (index > size || index < 0)
throw new IndexOutOfBoundsException(
"Index: " + index + ", Size: " + size);
int numNew = c.size();
ensureCapacity(size + numNew); // Increments modCount
int numMoved = size - index;
if (numMoved > 0)
System.arraycopy(elementData, index, elementData, index + numNew,
numMoved);
Iterator<? extends Long> iter=c.iterator();
int pos = index;
while(iter.hasNext()) elementData[pos++]=iter.next();
size += numNew;
return numNew != 0;
} | [
"@",
"Override",
"public",
"boolean",
"addAll",
"(",
"int",
"index",
",",
"Collection",
"<",
"?",
"extends",
"Long",
">",
"c",
")",
"{",
"if",
"(",
"index",
">",
"size",
"||",
"index",
"<",
"0",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\... | Inserts all of the elements in the specified Collection into this
list, starting at the specified position. Shifts the element
currently at that position (if any) and any subsequent elements to
the right (increases their indices). The new elements will appear
in the list in the order that they are returned by the
specified Collection's iterator.
@param index index at which to insert first element
from the specified collection.
@param c elements to be inserted into this list.
@return <tt>true</tt> if this list changed as a result of the call.
@throws IndexOutOfBoundsException if index out of range <tt>(index
< 0 || index > size())</tt>.
@throws NullPointerException if the specified Collection is null. | [
"Inserts",
"all",
"of",
"the",
"elements",
"in",
"the",
"specified",
"Collection",
"into",
"this",
"list",
"starting",
"at",
"the",
"specified",
"position",
".",
"Shifts",
"the",
"element",
"currently",
"at",
"that",
"position",
"(",
"if",
"any",
")",
"and",... | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/LongArrayList.java#L605-L624 |
VoltDB/voltdb | src/frontend/org/voltdb/compiler/VoltCompiler.java | VoltCompiler.compileDDLString | public boolean compileDDLString(String ddl, String jarPath) {
final File schemaFile = VoltProjectBuilder.writeStringToTempFile(ddl);
schemaFile.deleteOnExit();
final String schemaPath = schemaFile.getPath();
return compileFromDDL(jarPath, schemaPath);
} | java | public boolean compileDDLString(String ddl, String jarPath) {
final File schemaFile = VoltProjectBuilder.writeStringToTempFile(ddl);
schemaFile.deleteOnExit();
final String schemaPath = schemaFile.getPath();
return compileFromDDL(jarPath, schemaPath);
} | [
"public",
"boolean",
"compileDDLString",
"(",
"String",
"ddl",
",",
"String",
"jarPath",
")",
"{",
"final",
"File",
"schemaFile",
"=",
"VoltProjectBuilder",
".",
"writeStringToTempFile",
"(",
"ddl",
")",
";",
"schemaFile",
".",
"deleteOnExit",
"(",
")",
";",
"... | Compile from DDL in a single string
@param ddl The inline DDL text
@param jarPath The location to put the finished JAR to.
@return true if successful
@throws VoltCompilerException | [
"Compile",
"from",
"DDL",
"in",
"a",
"single",
"string"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/VoltCompiler.java#L599-L605 |
real-logic/simple-binary-encoding | sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java | OtfHeaderDecoder.getTemplateId | public int getTemplateId(final DirectBuffer buffer, final int bufferOffset)
{
return Types.getInt(buffer, bufferOffset + templateIdOffset, templateIdType, templateIdByteOrder);
} | java | public int getTemplateId(final DirectBuffer buffer, final int bufferOffset)
{
return Types.getInt(buffer, bufferOffset + templateIdOffset, templateIdType, templateIdByteOrder);
} | [
"public",
"int",
"getTemplateId",
"(",
"final",
"DirectBuffer",
"buffer",
",",
"final",
"int",
"bufferOffset",
")",
"{",
"return",
"Types",
".",
"getInt",
"(",
"buffer",
",",
"bufferOffset",
"+",
"templateIdOffset",
",",
"templateIdType",
",",
"templateIdByteOrder... | Get the template id from the message header.
@param buffer from which to read the value.
@param bufferOffset in the buffer at which the message header begins.
@return the value of the template id. | [
"Get",
"the",
"template",
"id",
"from",
"the",
"message",
"header",
"."
] | train | https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java#L106-L109 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/SpinnerDraggingHandler.java | SpinnerDraggingHandler.addTimes | private Number addTimes(Object n, Number toAdd, int times)
{
Number m = (Number)n;
if (m instanceof Double)
{
return m.doubleValue() + times * toAdd.doubleValue();
}
return m.intValue() + times * toAdd.intValue();
} | java | private Number addTimes(Object n, Number toAdd, int times)
{
Number m = (Number)n;
if (m instanceof Double)
{
return m.doubleValue() + times * toAdd.doubleValue();
}
return m.intValue() + times * toAdd.intValue();
} | [
"private",
"Number",
"addTimes",
"(",
"Object",
"n",
",",
"Number",
"toAdd",
",",
"int",
"times",
")",
"{",
"Number",
"m",
"=",
"(",
"Number",
")",
"n",
";",
"if",
"(",
"m",
"instanceof",
"Double",
")",
"{",
"return",
"m",
".",
"doubleValue",
"(",
... | Computes n+toAdd*times, obeying the types of the numbers
@param n The input
@param toAdd The addend
@param times The factor
@return The result | [
"Computes",
"n",
"+",
"toAdd",
"*",
"times",
"obeying",
"the",
"types",
"of",
"the",
"numbers"
] | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/SpinnerDraggingHandler.java#L120-L128 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java | GVRLight.setFloat | public void setFloat(String key, float value)
{
checkKeyIsUniform(key);
checkFloatNotNaNOrInfinity("value", value);
NativeLight.setFloat(getNative(), key, value);
} | java | public void setFloat(String key, float value)
{
checkKeyIsUniform(key);
checkFloatNotNaNOrInfinity("value", value);
NativeLight.setFloat(getNative(), key, value);
} | [
"public",
"void",
"setFloat",
"(",
"String",
"key",
",",
"float",
"value",
")",
"{",
"checkKeyIsUniform",
"(",
"key",
")",
";",
"checkFloatNotNaNOrInfinity",
"(",
"\"value\"",
",",
"value",
")",
";",
"NativeLight",
".",
"setFloat",
"(",
"getNative",
"(",
")"... | Bind a {@code float} to the shader uniform {@code key}.
Throws an exception of the key is not found.
@param key Name of the shader uniform
@param value New data | [
"Bind",
"a",
"{",
"@code",
"float",
"}",
"to",
"the",
"shader",
"uniform",
"{",
"@code",
"key",
"}",
".",
"Throws",
"an",
"exception",
"of",
"the",
"key",
"is",
"not",
"found",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java#L323-L328 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addConstraintsLuhnCheckMessage | public FessMessages addConstraintsLuhnCheckMessage(String property, String value) {
assertPropertyNotNull(property);
add(property, new UserMessage(CONSTRAINTS_LuhnCheck_MESSAGE, value));
return this;
} | java | public FessMessages addConstraintsLuhnCheckMessage(String property, String value) {
assertPropertyNotNull(property);
add(property, new UserMessage(CONSTRAINTS_LuhnCheck_MESSAGE, value));
return this;
} | [
"public",
"FessMessages",
"addConstraintsLuhnCheckMessage",
"(",
"String",
"property",
",",
"String",
"value",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"CONSTRAINTS_LuhnCheck_MESSAGE",
",",
... | Add the created action message for the key 'constraints.LuhnCheck.message' with parameters.
<pre>
message: The check digit for ${value} is invalid, Luhn Modulo 10 checksum failed.
</pre>
@param property The property name for the message. (NotNull)
@param value The parameter value for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"constraints",
".",
"LuhnCheck",
".",
"message",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"The",
"check",
"digit",
"for",
"$",
"{",
"value",
"}",
"is",
"invalid",
"Luhn",
"... | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L859-L863 |
soi-toolkit/soi-toolkit-mule | tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/cli/util/OptionSet.java | OptionSet.addOption | public OptionSet addOption(String key, Options.Separator separator) {
return addOption(key, false, separator, true, defaultMultiplicity);
} | java | public OptionSet addOption(String key, Options.Separator separator) {
return addOption(key, false, separator, true, defaultMultiplicity);
} | [
"public",
"OptionSet",
"addOption",
"(",
"String",
"key",
",",
"Options",
".",
"Separator",
"separator",
")",
"{",
"return",
"addOption",
"(",
"key",
",",
"false",
",",
"separator",
",",
"true",
",",
"defaultMultiplicity",
")",
";",
"}"
] | Add a value option with the given key and separator, no details, and the default prefix and multiplicity
<p>
@param key The key for the option
@param separator The separator for the option
<p>
@return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
<p>
@throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined
or if <code>separator</code> is <code>null</code> | [
"Add",
"a",
"value",
"option",
"with",
"the",
"given",
"key",
"and",
"separator",
"no",
"details",
"and",
"the",
"default",
"prefix",
"and",
"multiplicity",
"<p",
">"
] | train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/cli/util/OptionSet.java#L208-L210 |
haraldk/TwelveMonkeys | imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/ImageWriterBase.java | ImageWriterBase.fakeSubsampling | protected static Image fakeSubsampling(final Image pImage, final ImageWriteParam pParam) {
return IIOUtil.fakeSubsampling(pImage, pParam);
} | java | protected static Image fakeSubsampling(final Image pImage, final ImageWriteParam pParam) {
return IIOUtil.fakeSubsampling(pImage, pParam);
} | [
"protected",
"static",
"Image",
"fakeSubsampling",
"(",
"final",
"Image",
"pImage",
",",
"final",
"ImageWriteParam",
"pParam",
")",
"{",
"return",
"IIOUtil",
".",
"fakeSubsampling",
"(",
"pImage",
",",
"pParam",
")",
";",
"}"
] | Utility method for getting the subsampled image.
The subsampling is defined by the
{@link javax.imageio.IIOParam#setSourceSubsampling(int, int, int, int)}
method.
<p/>
NOTE: This method does not take the subsampling offsets into
consideration.
<p/>
Note: If it is possible for the writer to subsample directly, such a
method should be used instead, for efficiency.
@param pImage the image to subsample
@param pParam the param optionally specifying subsampling
@return an {@code Image} containing the subsampled image, or the
original image, if no subsampling was specified, or
{@code pParam} was {@code null} | [
"Utility",
"method",
"for",
"getting",
"the",
"subsampled",
"image",
".",
"The",
"subsampling",
"is",
"defined",
"by",
"the",
"{",
"@link",
"javax",
".",
"imageio",
".",
"IIOParam#setSourceSubsampling",
"(",
"int",
"int",
"int",
"int",
")",
"}",
"method",
".... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/ImageWriterBase.java#L182-L184 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/ECKey.java | ECKey.toStringWithPrivate | public String toStringWithPrivate(@Nullable KeyParameter aesKey, NetworkParameters params) {
return toString(true, aesKey, params);
} | java | public String toStringWithPrivate(@Nullable KeyParameter aesKey, NetworkParameters params) {
return toString(true, aesKey, params);
} | [
"public",
"String",
"toStringWithPrivate",
"(",
"@",
"Nullable",
"KeyParameter",
"aesKey",
",",
"NetworkParameters",
"params",
")",
"{",
"return",
"toString",
"(",
"true",
",",
"aesKey",
",",
"params",
")",
";",
"}"
] | Produce a string rendering of the ECKey INCLUDING the private key.
Unless you absolutely need the private key it is better for security reasons to just use {@link #toString()}. | [
"Produce",
"a",
"string",
"rendering",
"of",
"the",
"ECKey",
"INCLUDING",
"the",
"private",
"key",
".",
"Unless",
"you",
"absolutely",
"need",
"the",
"private",
"key",
"it",
"is",
"better",
"for",
"security",
"reasons",
"to",
"just",
"use",
"{"
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/ECKey.java#L1254-L1256 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/processor/http/AddHeadersProcessor.java | AddHeadersProcessor.createFactoryWrapper | public static MfClientHttpRequestFactory createFactoryWrapper(
final MfClientHttpRequestFactory requestFactory,
final UriMatchers matchers, final Map<String, List<String>> headers) {
return new AbstractMfClientHttpRequestFactoryWrapper(requestFactory, matchers, false) {
@Override
protected ClientHttpRequest createRequest(
final URI uri,
final HttpMethod httpMethod,
final MfClientHttpRequestFactory requestFactory) throws IOException {
final ClientHttpRequest request = requestFactory.createRequest(uri, httpMethod);
request.getHeaders().putAll(headers);
return request;
}
};
} | java | public static MfClientHttpRequestFactory createFactoryWrapper(
final MfClientHttpRequestFactory requestFactory,
final UriMatchers matchers, final Map<String, List<String>> headers) {
return new AbstractMfClientHttpRequestFactoryWrapper(requestFactory, matchers, false) {
@Override
protected ClientHttpRequest createRequest(
final URI uri,
final HttpMethod httpMethod,
final MfClientHttpRequestFactory requestFactory) throws IOException {
final ClientHttpRequest request = requestFactory.createRequest(uri, httpMethod);
request.getHeaders().putAll(headers);
return request;
}
};
} | [
"public",
"static",
"MfClientHttpRequestFactory",
"createFactoryWrapper",
"(",
"final",
"MfClientHttpRequestFactory",
"requestFactory",
",",
"final",
"UriMatchers",
"matchers",
",",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"headers",
")",
... | Create a MfClientHttpRequestFactory for adding the specified headers.
@param requestFactory the basic request factory. It should be unmodified and just wrapped with
a proxy class.
@param matchers The matchers.
@param headers The headers.
@return | [
"Create",
"a",
"MfClientHttpRequestFactory",
"for",
"adding",
"the",
"specified",
"headers",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/http/AddHeadersProcessor.java#L44-L58 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/AbstractExtraLanguageGenerator.java | AbstractExtraLanguageGenerator.createGeneratorContext | protected IExtraLanguageGeneratorContext createGeneratorContext(IFileSystemAccess2 fsa, IGeneratorContext context,
Resource resource) {
if (context instanceof IExtraLanguageGeneratorContext) {
return (IExtraLanguageGeneratorContext) context;
}
return new ExtraLanguageGeneratorContext(context, fsa, this, resource, getPreferenceID());
} | java | protected IExtraLanguageGeneratorContext createGeneratorContext(IFileSystemAccess2 fsa, IGeneratorContext context,
Resource resource) {
if (context instanceof IExtraLanguageGeneratorContext) {
return (IExtraLanguageGeneratorContext) context;
}
return new ExtraLanguageGeneratorContext(context, fsa, this, resource, getPreferenceID());
} | [
"protected",
"IExtraLanguageGeneratorContext",
"createGeneratorContext",
"(",
"IFileSystemAccess2",
"fsa",
",",
"IGeneratorContext",
"context",
",",
"Resource",
"resource",
")",
"{",
"if",
"(",
"context",
"instanceof",
"IExtraLanguageGeneratorContext",
")",
"{",
"return",
... | Create the generator context for this generator.
@param fsa the file system access.
@param context the global context.
@param resource the resource.
@return the context. | [
"Create",
"the",
"generator",
"context",
"for",
"this",
"generator",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/AbstractExtraLanguageGenerator.java#L593-L599 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/utils/QueryDataUtils.java | QueryDataUtils.exportQueryPageCommentsAsCsv | private static List<String[]> exportQueryPageCommentsAsCsv(ReplierExportStrategy replierExportStrategy, List<QueryReply> replies, PanelStamp stamp, QueryPage queryPage) {
QueryPageHandler queryPageHandler = QueryPageHandlerFactory.getInstance().buildPageHandler(queryPage.getPageType());
if (queryPageHandler != null) {
ReportPageCommentProcessor processor = queryPageHandler.exportComments(queryPage, stamp, replies);
if (processor != null) {
return exportQueryPageCommentsAsCsv(replierExportStrategy, queryPage, processor);
}
}
return Collections.emptyList();
} | java | private static List<String[]> exportQueryPageCommentsAsCsv(ReplierExportStrategy replierExportStrategy, List<QueryReply> replies, PanelStamp stamp, QueryPage queryPage) {
QueryPageHandler queryPageHandler = QueryPageHandlerFactory.getInstance().buildPageHandler(queryPage.getPageType());
if (queryPageHandler != null) {
ReportPageCommentProcessor processor = queryPageHandler.exportComments(queryPage, stamp, replies);
if (processor != null) {
return exportQueryPageCommentsAsCsv(replierExportStrategy, queryPage, processor);
}
}
return Collections.emptyList();
} | [
"private",
"static",
"List",
"<",
"String",
"[",
"]",
">",
"exportQueryPageCommentsAsCsv",
"(",
"ReplierExportStrategy",
"replierExportStrategy",
",",
"List",
"<",
"QueryReply",
">",
"replies",
",",
"PanelStamp",
"stamp",
",",
"QueryPage",
"queryPage",
")",
"{",
"... | Exports single query page into CSV rows
@param replierExportStrategy replier export strategy
@param replies replies to be exported
@param stamp stamp
@param queryPage query page to be exported
@return CSV rows | [
"Exports",
"single",
"query",
"page",
"into",
"CSV",
"rows"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/QueryDataUtils.java#L189-L199 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MultiMEProxyHandler.java | MultiMEProxyHandler.createProxyListener | private void createProxyListener() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createProxyListener");
// Create the proxy listener instance
_proxyListener = new NeighbourProxyListener(_neighbours, this);
/*
* Now we can create our asynchronous consumer to listen on
* SYSTEM.MENAME.PROXY.QUEUE Queue for receiving subscription
* updates
*/
// 169897.1 modified parameters
try
{
_proxyAsyncConsumer =
_messageProcessor
.getSystemConnection()
.createSystemConsumerSession(
_messageProcessor.getProxyHandlerDestAddr(), // destination name
null, //Destination filter
null, // SelectionCriteria - discriminator and selector
Reliability.ASSURED_PERSISTENT, // reliability
false, // enable read ahead
false,
null,
false);
// 169897.1 modified parameters
_proxyAsyncConsumer.registerAsynchConsumerCallback(
_proxyListener,
0, 0, 1,
null);
_proxyAsyncConsumer.start(false);
}
catch (SIException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.proxyhandler.MultiMEProxyHandler.createProxyListener",
"1:1271:1.96",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createProxyListener", "SIResourceException");
// The Exceptions should already be NLS'd
throw new SIResourceException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createProxyListener");
} | java | private void createProxyListener() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createProxyListener");
// Create the proxy listener instance
_proxyListener = new NeighbourProxyListener(_neighbours, this);
/*
* Now we can create our asynchronous consumer to listen on
* SYSTEM.MENAME.PROXY.QUEUE Queue for receiving subscription
* updates
*/
// 169897.1 modified parameters
try
{
_proxyAsyncConsumer =
_messageProcessor
.getSystemConnection()
.createSystemConsumerSession(
_messageProcessor.getProxyHandlerDestAddr(), // destination name
null, //Destination filter
null, // SelectionCriteria - discriminator and selector
Reliability.ASSURED_PERSISTENT, // reliability
false, // enable read ahead
false,
null,
false);
// 169897.1 modified parameters
_proxyAsyncConsumer.registerAsynchConsumerCallback(
_proxyListener,
0, 0, 1,
null);
_proxyAsyncConsumer.start(false);
}
catch (SIException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.proxyhandler.MultiMEProxyHandler.createProxyListener",
"1:1271:1.96",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createProxyListener", "SIResourceException");
// The Exceptions should already be NLS'd
throw new SIResourceException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createProxyListener");
} | [
"private",
"void",
"createProxyListener",
"(",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createProxy... | Method that creates the NeighbourProxyListener instance for reading messages
from the Neighbours. It then registers the listener to start receiving
messages
@throws SIResourceException Thrown if there are errors while
creating the | [
"Method",
"that",
"creates",
"the",
"NeighbourProxyListener",
"instance",
"for",
"reading",
"messages",
"from",
"the",
"Neighbours",
".",
"It",
"then",
"registers",
"the",
"listener",
"to",
"start",
"receiving",
"messages"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MultiMEProxyHandler.java#L1202-L1259 |
OpenBEL/openbel-framework | org.openbel.framework.common/src/main/java/org/openbel/framework/common/record/Record.java | Record.writeToBuffer | public final void writeToBuffer(T t, byte[] buffer) {
if (t == null) {
throw new InvalidArgument("cannot write a null");
} else if (buffer == null) {
throw new InvalidArgument("cannot write to a null buffer");
} else if (buffer.length != recordSize) {
final String fmt = "invalid buffer (%d bytes, expected %d)";
final String msg = format(fmt, buffer.length, recordSize);
throw new InvalidArgument(msg);
}
writeTo(t, buffer);
} | java | public final void writeToBuffer(T t, byte[] buffer) {
if (t == null) {
throw new InvalidArgument("cannot write a null");
} else if (buffer == null) {
throw new InvalidArgument("cannot write to a null buffer");
} else if (buffer.length != recordSize) {
final String fmt = "invalid buffer (%d bytes, expected %d)";
final String msg = format(fmt, buffer.length, recordSize);
throw new InvalidArgument(msg);
}
writeTo(t, buffer);
} | [
"public",
"final",
"void",
"writeToBuffer",
"(",
"T",
"t",
",",
"byte",
"[",
"]",
"buffer",
")",
"{",
"if",
"(",
"t",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidArgument",
"(",
"\"cannot write a null\"",
")",
";",
"}",
"else",
"if",
"(",
"buffer",... | Writes {@code <T>} to the provided {@code buffer}.
@param t {@code <T>}
@param buffer {@code byte[]}; of size {@link #getRecordSize()}
@throws InvalidArgument Thrown if either argument is null or if | [
"Writes",
"{",
"@code",
"<T",
">",
"}",
"to",
"the",
"provided",
"{",
"@code",
"buffer",
"}",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/record/Record.java#L297-L308 |
dlemmermann/CalendarFX | CalendarFXRecurrence/src/main/java/com/google/ical/iter/Generators.java | Generators.byMonthGenerator | static Generator byMonthGenerator(int[] months, final DateValue dtStart) {
final int[] umonths = Util.uniquify(months);
return new Generator() {
int i;
int year = dtStart.year();
@Override
boolean generate(DTBuilder builder) {
if (year != builder.year) {
i = 0;
year = builder.year;
}
if (i >= umonths.length) {
return false;
}
builder.month = umonths[i++];
return true;
}
@Override
public String toString() {
return "byMonthGenerator:" + Arrays.toString(umonths);
}
};
} | java | static Generator byMonthGenerator(int[] months, final DateValue dtStart) {
final int[] umonths = Util.uniquify(months);
return new Generator() {
int i;
int year = dtStart.year();
@Override
boolean generate(DTBuilder builder) {
if (year != builder.year) {
i = 0;
year = builder.year;
}
if (i >= umonths.length) {
return false;
}
builder.month = umonths[i++];
return true;
}
@Override
public String toString() {
return "byMonthGenerator:" + Arrays.toString(umonths);
}
};
} | [
"static",
"Generator",
"byMonthGenerator",
"(",
"int",
"[",
"]",
"months",
",",
"final",
"DateValue",
"dtStart",
")",
"{",
"final",
"int",
"[",
"]",
"umonths",
"=",
"Util",
".",
"uniquify",
"(",
"months",
")",
";",
"return",
"new",
"Generator",
"(",
")",... | constructs a generator that yields the specified months in increasing order
for each year.
@param months values in [1-12]
@param dtStart non null | [
"constructs",
"a",
"generator",
"that",
"yields",
"the",
"specified",
"months",
"in",
"increasing",
"order",
"for",
"each",
"year",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXRecurrence/src/main/java/com/google/ical/iter/Generators.java#L411-L436 |
aws/aws-sdk-java | aws-java-sdk-alexaforbusiness/src/main/java/com/amazonaws/services/alexaforbusiness/model/PutSkillAuthorizationRequest.java | PutSkillAuthorizationRequest.withAuthorizationResult | public PutSkillAuthorizationRequest withAuthorizationResult(java.util.Map<String, String> authorizationResult) {
setAuthorizationResult(authorizationResult);
return this;
} | java | public PutSkillAuthorizationRequest withAuthorizationResult(java.util.Map<String, String> authorizationResult) {
setAuthorizationResult(authorizationResult);
return this;
} | [
"public",
"PutSkillAuthorizationRequest",
"withAuthorizationResult",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"authorizationResult",
")",
"{",
"setAuthorizationResult",
"(",
"authorizationResult",
")",
";",
"return",
"this",
";",
"}"
... | <p>
The authorization result specific to OAUTH code grant output. "Code” must be populated in the AuthorizationResult
map to establish the authorization.
</p>
@param authorizationResult
The authorization result specific to OAUTH code grant output. "Code” must be populated in the
AuthorizationResult map to establish the authorization.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"authorization",
"result",
"specific",
"to",
"OAUTH",
"code",
"grant",
"output",
".",
"Code”",
"must",
"be",
"populated",
"in",
"the",
"AuthorizationResult",
"map",
"to",
"establish",
"the",
"authorization",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-alexaforbusiness/src/main/java/com/amazonaws/services/alexaforbusiness/model/PutSkillAuthorizationRequest.java#L89-L92 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java | GeneratedDUserDaoImpl.queryByFriends | public Iterable<DUser> queryByFriends(java.lang.Object friends) {
return queryByField(null, DUserMapper.Field.FRIENDS.getFieldName(), friends);
} | java | public Iterable<DUser> queryByFriends(java.lang.Object friends) {
return queryByField(null, DUserMapper.Field.FRIENDS.getFieldName(), friends);
} | [
"public",
"Iterable",
"<",
"DUser",
">",
"queryByFriends",
"(",
"java",
".",
"lang",
".",
"Object",
"friends",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DUserMapper",
".",
"Field",
".",
"FRIENDS",
".",
"getFieldName",
"(",
")",
",",
"friends",... | query-by method for field friends
@param friends the specified attribute
@return an Iterable of DUsers for the specified friends | [
"query",
"-",
"by",
"method",
"for",
"field",
"friends"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L160-L162 |
bbossgroups/bboss-elasticsearch | bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java | RestClientUtil.addDateDocumentsWithIdOptions | public String addDateDocumentsWithIdOptions(String indexName, String indexType, List<Object> beans,String docIdField,String refreshOption) throws ElasticSearchException{
return addDocumentsWithIdField(this.indexNameBuilder.getIndexName(indexName), indexType, beans,docIdField,refreshOption);
} | java | public String addDateDocumentsWithIdOptions(String indexName, String indexType, List<Object> beans,String docIdField,String refreshOption) throws ElasticSearchException{
return addDocumentsWithIdField(this.indexNameBuilder.getIndexName(indexName), indexType, beans,docIdField,refreshOption);
} | [
"public",
"String",
"addDateDocumentsWithIdOptions",
"(",
"String",
"indexName",
",",
"String",
"indexType",
",",
"List",
"<",
"Object",
">",
"beans",
",",
"String",
"docIdField",
",",
"String",
"refreshOption",
")",
"throws",
"ElasticSearchException",
"{",
"return"... | 批量创建索引,根据时间格式建立新的索引表
@param indexName
@param indexType
@param beans
@param docIdField 对象中作为文档id的Field
@return
@throws ElasticSearchException | [
"批量创建索引",
"根据时间格式建立新的索引表"
] | train | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java#L3708-L3710 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/KeyEncoder.java | KeyEncoder.encodeDesc | public static void encodeDesc(double value, byte[] dst, int dstOffset) {
long bits = Double.doubleToLongBits(value);
if (bits >= 0) {
bits ^= 0x7fffffffffffffffL;
}
int w = (int)(bits >> 32);
dst[dstOffset ] = (byte)(w >> 24);
dst[dstOffset + 1] = (byte)(w >> 16);
dst[dstOffset + 2] = (byte)(w >> 8);
dst[dstOffset + 3] = (byte)w;
w = (int)bits;
dst[dstOffset + 4] = (byte)(w >> 24);
dst[dstOffset + 5] = (byte)(w >> 16);
dst[dstOffset + 6] = (byte)(w >> 8);
dst[dstOffset + 7] = (byte)w;
} | java | public static void encodeDesc(double value, byte[] dst, int dstOffset) {
long bits = Double.doubleToLongBits(value);
if (bits >= 0) {
bits ^= 0x7fffffffffffffffL;
}
int w = (int)(bits >> 32);
dst[dstOffset ] = (byte)(w >> 24);
dst[dstOffset + 1] = (byte)(w >> 16);
dst[dstOffset + 2] = (byte)(w >> 8);
dst[dstOffset + 3] = (byte)w;
w = (int)bits;
dst[dstOffset + 4] = (byte)(w >> 24);
dst[dstOffset + 5] = (byte)(w >> 16);
dst[dstOffset + 6] = (byte)(w >> 8);
dst[dstOffset + 7] = (byte)w;
} | [
"public",
"static",
"void",
"encodeDesc",
"(",
"double",
"value",
",",
"byte",
"[",
"]",
"dst",
",",
"int",
"dstOffset",
")",
"{",
"long",
"bits",
"=",
"Double",
".",
"doubleToLongBits",
"(",
"value",
")",
";",
"if",
"(",
"bits",
">=",
"0",
")",
"{",... | Encodes the given double into exactly 8 bytes for descending order.
@param value double value to encode
@param dst destination for encoded bytes
@param dstOffset offset into destination array | [
"Encodes",
"the",
"given",
"double",
"into",
"exactly",
"8",
"bytes",
"for",
"descending",
"order",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java#L270-L285 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/steps/node/impl/DefaultScriptFileNodeStepUtils.java | DefaultScriptFileNodeStepUtils.removeArgsForOsFamily | @Override
public ExecArgList removeArgsForOsFamily(String filepath, String osFamily) {
if ("windows".equalsIgnoreCase(osFamily)) {
return ExecArgList.fromStrings(false, "del", filepath);
} else {
return ExecArgList.fromStrings(false, "rm", "-f", filepath);
}
} | java | @Override
public ExecArgList removeArgsForOsFamily(String filepath, String osFamily) {
if ("windows".equalsIgnoreCase(osFamily)) {
return ExecArgList.fromStrings(false, "del", filepath);
} else {
return ExecArgList.fromStrings(false, "rm", "-f", filepath);
}
} | [
"@",
"Override",
"public",
"ExecArgList",
"removeArgsForOsFamily",
"(",
"String",
"filepath",
",",
"String",
"osFamily",
")",
"{",
"if",
"(",
"\"windows\"",
".",
"equalsIgnoreCase",
"(",
"osFamily",
")",
")",
"{",
"return",
"ExecArgList",
".",
"fromStrings",
"("... | Return ExecArgList for removing a file for the given OS family
@param filepath path
@param osFamily family
@return arg list | [
"Return",
"ExecArgList",
"for",
"removing",
"a",
"file",
"for",
"the",
"given",
"OS",
"family"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/steps/node/impl/DefaultScriptFileNodeStepUtils.java#L332-L339 |
WiQuery/wiquery | wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java | Options.putString | public Options putString(String key, IModel<String> value)
{
putOption(key, new StringOption(value));
return this;
} | java | public Options putString(String key, IModel<String> value)
{
putOption(key, new StringOption(value));
return this;
} | [
"public",
"Options",
"putString",
"(",
"String",
"key",
",",
"IModel",
"<",
"String",
">",
"value",
")",
"{",
"putOption",
"(",
"key",
",",
"new",
"StringOption",
"(",
"value",
")",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Puts a {@link String} value for the given option name.
</p>
@param key
the option name.
@param value
the {@link String} value. | [
"<p",
">",
"Puts",
"a",
"{",
"@link",
"String",
"}",
"value",
"for",
"the",
"given",
"option",
"name",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java#L564-L568 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.createVolume | public CreateVolumeResponse createVolume(CreateVolumeRequest request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
if (null == request.getBilling()) {
request.setBilling(generateDefaultBilling());
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, VOLUME_PREFIX);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
return invokeHttpClient(internalRequest, CreateVolumeResponse.class);
} | java | public CreateVolumeResponse createVolume(CreateVolumeRequest request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
if (null == request.getBilling()) {
request.setBilling(generateDefaultBilling());
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, VOLUME_PREFIX);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
return invokeHttpClient(internalRequest, CreateVolumeResponse.class);
} | [
"public",
"CreateVolumeResponse",
"createVolume",
"(",
"CreateVolumeRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"request",
".",
"getClientToken",
"(",... | Create a volume with the specified options.
You can use this method to create a new empty volume by specified options
or you can create a new volume from customized volume snapshot but not system disk snapshot.
By using the cdsSizeInGB parameter you can create a newly empty volume.
By using snapshotId parameter to create a volume form specific snapshot.
@param request The request containing all options for creating a volume.
@return The response with list of id of volumes newly created. | [
"Create",
"a",
"volume",
"with",
"the",
"specified",
"options",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L882-L894 |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/misc/ColumnCounts_DSCC.java | ColumnCounts_DSCC.isLeaf | int isLeaf( int i , int j ) {
jleaf = 0;
// see j is not a leaf
if( i <= j || w[first+j] <= w[maxfirst+i] )
return -1;
w[maxfirst+i] = w[first+j]; // update the max first[j] seen so far
int jprev = w[prevleaf+i];
w[prevleaf+i]=j;
if( jprev == -1 ) { // j is the first leaf
jleaf = 1;
return i;
} else { // j is a subsequent leaf
jleaf = 2;
}
// find the common ancestor with jprev
int q;
for( q = jprev; q != w[ancestor+q]; q = w[ancestor+q]){
}
// path compression
for( int s = jprev, sparent; s != q; s = sparent ) {
sparent = w[ancestor+s];
w[ancestor+s] = q;
}
return q;
} | java | int isLeaf( int i , int j ) {
jleaf = 0;
// see j is not a leaf
if( i <= j || w[first+j] <= w[maxfirst+i] )
return -1;
w[maxfirst+i] = w[first+j]; // update the max first[j] seen so far
int jprev = w[prevleaf+i];
w[prevleaf+i]=j;
if( jprev == -1 ) { // j is the first leaf
jleaf = 1;
return i;
} else { // j is a subsequent leaf
jleaf = 2;
}
// find the common ancestor with jprev
int q;
for( q = jprev; q != w[ancestor+q]; q = w[ancestor+q]){
}
// path compression
for( int s = jprev, sparent; s != q; s = sparent ) {
sparent = w[ancestor+s];
w[ancestor+s] = q;
}
return q;
} | [
"int",
"isLeaf",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"jleaf",
"=",
"0",
";",
"// see j is not a leaf",
"if",
"(",
"i",
"<=",
"j",
"||",
"w",
"[",
"first",
"+",
"j",
"]",
"<=",
"w",
"[",
"maxfirst",
"+",
"i",
"]",
")",
"return",
"-",
"... | <p>Determines if j is a leaf in the ith row subtree of T^t. If it is then it finds the least-common-ancestor
of the previously found leaf in T^i (jprev) and node j.</p>
<ul>
<li>jleaf == 0 then j is not a leaf
<li>jleaf == 1 then 1st leaf. returned value = root of ith subtree
<li>jleaf == 2 then j is a subsequent leaf. returned value = (jprev,j)
</ul>
<p>See cs_leaf on page 51</p>
@param i Specifies which row subtree in T.
@param j node in subtree.
@return Depends on jleaf. See above. | [
"<p",
">",
"Determines",
"if",
"j",
"is",
"a",
"leaf",
"in",
"the",
"ith",
"row",
"subtree",
"of",
"T^t",
".",
"If",
"it",
"is",
"then",
"it",
"finds",
"the",
"least",
"-",
"common",
"-",
"ancestor",
"of",
"the",
"previously",
"found",
"leaf",
"in",
... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/misc/ColumnCounts_DSCC.java#L203-L231 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java | StorageClientFactory.createClient | public SnowflakeStorageClient createClient(StageInfo stage,
int parallel,
RemoteStoreFileEncryptionMaterial encMat)
throws SnowflakeSQLException
{
logger.debug("createClient client type={}", stage.getStageType().name());
switch (stage.getStageType())
{
case S3:
return createS3Client(stage.getCredentials(), parallel, encMat, stage.getRegion());
case AZURE:
return createAzureClient(stage, encMat);
default:
// We don't create a storage client for FS_LOCAL,
// so we should only find ourselves here if an unsupported
// remote storage client type is specified
throw new IllegalArgumentException("Unsupported storage client specified: "
+ stage.getStageType().name());
}
} | java | public SnowflakeStorageClient createClient(StageInfo stage,
int parallel,
RemoteStoreFileEncryptionMaterial encMat)
throws SnowflakeSQLException
{
logger.debug("createClient client type={}", stage.getStageType().name());
switch (stage.getStageType())
{
case S3:
return createS3Client(stage.getCredentials(), parallel, encMat, stage.getRegion());
case AZURE:
return createAzureClient(stage, encMat);
default:
// We don't create a storage client for FS_LOCAL,
// so we should only find ourselves here if an unsupported
// remote storage client type is specified
throw new IllegalArgumentException("Unsupported storage client specified: "
+ stage.getStageType().name());
}
} | [
"public",
"SnowflakeStorageClient",
"createClient",
"(",
"StageInfo",
"stage",
",",
"int",
"parallel",
",",
"RemoteStoreFileEncryptionMaterial",
"encMat",
")",
"throws",
"SnowflakeSQLException",
"{",
"logger",
".",
"debug",
"(",
"\"createClient client type={}\"",
",",
"st... | Creates a storage client based on the value of stageLocationType
@param stage the stage properties
@param parallel the degree of parallelism to be used by the client
@param encMat encryption material for the client
@return a SnowflakeStorageClient interface to the instance created
@throws SnowflakeSQLException if any error occurs | [
"Creates",
"a",
"storage",
"client",
"based",
"on",
"the",
"value",
"of",
"stageLocationType"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java#L57-L79 |
VoltDB/voltdb | src/frontend/org/voltdb/utils/SystemStatsCollector.java | SystemStatsCollector.asyncSampleSystemNow | public static synchronized void asyncSampleSystemNow(final boolean medium, final boolean large) {
// slow mode starts an async thread
if (mode == GetRSSMode.PS) {
if (thread != null) {
if (thread.isAlive()) return;
else thread = null;
}
thread = new Thread(new Runnable() {
@Override
public void run() { sampleSystemNow(medium, large); }
});
thread.start();
}
// fast mode doesn't spawn a thread
else {
sampleSystemNow(medium, large);
}
} | java | public static synchronized void asyncSampleSystemNow(final boolean medium, final boolean large) {
// slow mode starts an async thread
if (mode == GetRSSMode.PS) {
if (thread != null) {
if (thread.isAlive()) return;
else thread = null;
}
thread = new Thread(new Runnable() {
@Override
public void run() { sampleSystemNow(medium, large); }
});
thread.start();
}
// fast mode doesn't spawn a thread
else {
sampleSystemNow(medium, large);
}
} | [
"public",
"static",
"synchronized",
"void",
"asyncSampleSystemNow",
"(",
"final",
"boolean",
"medium",
",",
"final",
"boolean",
"large",
")",
"{",
"// slow mode starts an async thread",
"if",
"(",
"mode",
"==",
"GetRSSMode",
".",
"PS",
")",
"{",
"if",
"(",
"thre... | Fire off a thread to asynchronously collect stats.
@param medium Add result to medium set?
@param large Add result to large set? | [
"Fire",
"off",
"a",
"thread",
"to",
"asynchronously",
"collect",
"stats",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/SystemStatsCollector.java#L260-L278 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure2/GeneratePairwiseImageGraph.java | GeneratePairwiseImageGraph.createEdge | protected void createEdge( String src , String dst ,
FastQueue<AssociatedPair> pairs , FastQueue<AssociatedIndex> matches ) {
// Fitting Essential/Fundamental works when the scene is not planar and not pure rotation
int countF = 0;
if( ransac3D.process(pairs.toList()) ) {
countF = ransac3D.getMatchSet().size();
}
// Fitting homography will work when all or part of the scene is planar or motion is pure rotation
int countH = 0;
if( ransacH.process(pairs.toList()) ) {
countH = ransacH.getMatchSet().size();
}
// fail if not enough features are remaining after RANSAC
if( Math.max(countF,countH) < minimumInliers )
return;
// The idea here is that if the number features for F is greater than H then it's a 3D scene.
// If they are similar then it might be a plane
boolean is3D = countF > countH*ratio3D;
PairwiseImageGraph2.Motion edge = graph.edges.grow();
edge.is3D = is3D;
edge.countF = countF;
edge.countH = countH;
edge.index = graph.edges.size-1;
edge.src = graph.lookupNode(src);
edge.dst = graph.lookupNode(dst);
edge.src.connections.add(edge);
edge.dst.connections.add(edge);
if( is3D ) {
saveInlierMatches(ransac3D, matches,edge);
edge.F.set(ransac3D.getModelParameters());
} else {
saveInlierMatches(ransacH, matches,edge);
Homography2D_F64 H = ransacH.getModelParameters();
ConvertDMatrixStruct.convert(H,edge.F);
}
} | java | protected void createEdge( String src , String dst ,
FastQueue<AssociatedPair> pairs , FastQueue<AssociatedIndex> matches ) {
// Fitting Essential/Fundamental works when the scene is not planar and not pure rotation
int countF = 0;
if( ransac3D.process(pairs.toList()) ) {
countF = ransac3D.getMatchSet().size();
}
// Fitting homography will work when all or part of the scene is planar or motion is pure rotation
int countH = 0;
if( ransacH.process(pairs.toList()) ) {
countH = ransacH.getMatchSet().size();
}
// fail if not enough features are remaining after RANSAC
if( Math.max(countF,countH) < minimumInliers )
return;
// The idea here is that if the number features for F is greater than H then it's a 3D scene.
// If they are similar then it might be a plane
boolean is3D = countF > countH*ratio3D;
PairwiseImageGraph2.Motion edge = graph.edges.grow();
edge.is3D = is3D;
edge.countF = countF;
edge.countH = countH;
edge.index = graph.edges.size-1;
edge.src = graph.lookupNode(src);
edge.dst = graph.lookupNode(dst);
edge.src.connections.add(edge);
edge.dst.connections.add(edge);
if( is3D ) {
saveInlierMatches(ransac3D, matches,edge);
edge.F.set(ransac3D.getModelParameters());
} else {
saveInlierMatches(ransacH, matches,edge);
Homography2D_F64 H = ransacH.getModelParameters();
ConvertDMatrixStruct.convert(H,edge.F);
}
} | [
"protected",
"void",
"createEdge",
"(",
"String",
"src",
",",
"String",
"dst",
",",
"FastQueue",
"<",
"AssociatedPair",
">",
"pairs",
",",
"FastQueue",
"<",
"AssociatedIndex",
">",
"matches",
")",
"{",
"// Fitting Essential/Fundamental works when the scene is not planar... | Connects two views together if they meet a minimal set of geometric requirements. Determines if there
is strong evidence that there is 3D information present and not just a homography
@param src ID of src image
@param dst ID of dst image
@param pairs Associated features pixels
@param matches Associated features feature indexes | [
"Connects",
"two",
"views",
"together",
"if",
"they",
"meet",
"a",
"minimal",
"set",
"of",
"geometric",
"requirements",
".",
"Determines",
"if",
"there",
"is",
"strong",
"evidence",
"that",
"there",
"is",
"3D",
"information",
"present",
"and",
"not",
"just",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure2/GeneratePairwiseImageGraph.java#L155-L195 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java | AbstractBpmnActivityBehavior.executeWithErrorPropagation | protected void executeWithErrorPropagation(ActivityExecution execution, Callable<Void> toExecute) throws Exception {
String activityInstanceId = execution.getActivityInstanceId();
try {
toExecute.call();
} catch (Exception ex) {
if (activityInstanceId.equals(execution.getActivityInstanceId())) {
try {
propagateException(execution, ex);
}
catch (ErrorPropagationException e) {
LOG.errorPropagationException(activityInstanceId, e.getCause());
// re-throw the original exception so that it is logged
// and set as cause of the failure
throw ex;
}
}
else {
throw ex;
}
}
} | java | protected void executeWithErrorPropagation(ActivityExecution execution, Callable<Void> toExecute) throws Exception {
String activityInstanceId = execution.getActivityInstanceId();
try {
toExecute.call();
} catch (Exception ex) {
if (activityInstanceId.equals(execution.getActivityInstanceId())) {
try {
propagateException(execution, ex);
}
catch (ErrorPropagationException e) {
LOG.errorPropagationException(activityInstanceId, e.getCause());
// re-throw the original exception so that it is logged
// and set as cause of the failure
throw ex;
}
}
else {
throw ex;
}
}
} | [
"protected",
"void",
"executeWithErrorPropagation",
"(",
"ActivityExecution",
"execution",
",",
"Callable",
"<",
"Void",
">",
"toExecute",
")",
"throws",
"Exception",
"{",
"String",
"activityInstanceId",
"=",
"execution",
".",
"getActivityInstanceId",
"(",
")",
";",
... | Takes an {@link ActivityExecution} and an {@link Callable} and wraps
the call to the Callable with the proper error propagation. This method
also makes sure that exceptions not caught by following activities in the
process will be thrown and not propagated.
@param execution
@param toExecute
@throws Exception | [
"Takes",
"an",
"{",
"@link",
"ActivityExecution",
"}",
"and",
"an",
"{",
"@link",
"Callable",
"}",
"and",
"wraps",
"the",
"call",
"to",
"the",
"Callable",
"with",
"the",
"proper",
"error",
"propagation",
".",
"This",
"method",
"also",
"makes",
"sure",
"tha... | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java#L108-L130 |
windup/windup | reporting/api/src/main/java/org/jboss/windup/reporting/service/ClassificationService.java | ClassificationService.attachClassification | public ClassificationModel attachClassification(GraphRewrite event, Rule rule, FileModel fileModel, String classificationText, String description)
{
return attachClassification(event, rule, fileModel, IssueCategoryRegistry.DEFAULT, classificationText, description);
} | java | public ClassificationModel attachClassification(GraphRewrite event, Rule rule, FileModel fileModel, String classificationText, String description)
{
return attachClassification(event, rule, fileModel, IssueCategoryRegistry.DEFAULT, classificationText, description);
} | [
"public",
"ClassificationModel",
"attachClassification",
"(",
"GraphRewrite",
"event",
",",
"Rule",
"rule",
",",
"FileModel",
"fileModel",
",",
"String",
"classificationText",
",",
"String",
"description",
")",
"{",
"return",
"attachClassification",
"(",
"event",
",",... | Attach a {@link ClassificationModel} with the given classificationText and description to the provided {@link FileModel}.
If an existing Model exists with the provided classificationText, that one will be used instead. | [
"Attach",
"a",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/service/ClassificationService.java#L221-L224 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/tree/filtered/FilteredTreeModel.java | FilteredTreeModel.fireTreeStructureChanged | protected void fireTreeStructureChanged(Object source, Object[] path,
int[] childIndices, Object[] children)
{
for (TreeModelListener listener : treeModelListeners)
{
listener.treeStructureChanged(
new TreeModelEvent(source, path, childIndices, children));
}
} | java | protected void fireTreeStructureChanged(Object source, Object[] path,
int[] childIndices, Object[] children)
{
for (TreeModelListener listener : treeModelListeners)
{
listener.treeStructureChanged(
new TreeModelEvent(source, path, childIndices, children));
}
} | [
"protected",
"void",
"fireTreeStructureChanged",
"(",
"Object",
"source",
",",
"Object",
"[",
"]",
"path",
",",
"int",
"[",
"]",
"childIndices",
",",
"Object",
"[",
"]",
"children",
")",
"{",
"for",
"(",
"TreeModelListener",
"listener",
":",
"treeModelListener... | Fires a treeStructureChanged event
@param source The source
@param path The tree paths
@param childIndices The child indices
@param children The children | [
"Fires",
"a",
"treeStructureChanged",
"event"
] | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/tree/filtered/FilteredTreeModel.java#L228-L236 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.getRouteForVnet | public List<VnetRouteInner> getRouteForVnet(String resourceGroupName, String name, String vnetName, String routeName) {
return getRouteForVnetWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName).toBlocking().single().body();
} | java | public List<VnetRouteInner> getRouteForVnet(String resourceGroupName, String name, String vnetName, String routeName) {
return getRouteForVnetWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName).toBlocking().single().body();
} | [
"public",
"List",
"<",
"VnetRouteInner",
">",
"getRouteForVnet",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"vnetName",
",",
"String",
"routeName",
")",
"{",
"return",
"getRouteForVnetWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Get a Virtual Network route in an App Service plan.
Get a Virtual Network route in an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@param vnetName Name of the Virtual Network.
@param routeName Name of the Virtual Network route.
@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 List<VnetRouteInner> object if successful. | [
"Get",
"a",
"Virtual",
"Network",
"route",
"in",
"an",
"App",
"Service",
"plan",
".",
"Get",
"a",
"Virtual",
"Network",
"route",
"in",
"an",
"App",
"Service",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L3487-L3489 |
graknlabs/grakn | server/src/server/kb/concept/ElementFactory.java | ElementFactory.addVertexElementWithEdgeIdProperty | public VertexElement addVertexElementWithEdgeIdProperty(Schema.BaseType baseType, ConceptId conceptId) {
Objects.requireNonNull(conceptId);
Vertex vertex = graph.addVertex(baseType.name());
long start = System.currentTimeMillis();
vertex.property(Schema.VertexProperty.EDGE_RELATION_ID.name(), conceptId.getValue());
assignVertexIdPropertyTime += System.currentTimeMillis() - start;
return new VertexElement(tx, vertex);
} | java | public VertexElement addVertexElementWithEdgeIdProperty(Schema.BaseType baseType, ConceptId conceptId) {
Objects.requireNonNull(conceptId);
Vertex vertex = graph.addVertex(baseType.name());
long start = System.currentTimeMillis();
vertex.property(Schema.VertexProperty.EDGE_RELATION_ID.name(), conceptId.getValue());
assignVertexIdPropertyTime += System.currentTimeMillis() - start;
return new VertexElement(tx, vertex);
} | [
"public",
"VertexElement",
"addVertexElementWithEdgeIdProperty",
"(",
"Schema",
".",
"BaseType",
"baseType",
",",
"ConceptId",
"conceptId",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"conceptId",
")",
";",
"Vertex",
"vertex",
"=",
"graph",
".",
"addVertex",
... | Creates a new Vertex in the graph and builds a VertexElement which wraps the newly created vertex
@param baseType The Schema.BaseType
@param conceptId the ConceptId to set as the new ConceptId
@return a new VertexElement
NB: this is only called when we reify an EdgeRelation - we want to preserve the ID property of the concept | [
"Creates",
"a",
"new",
"Vertex",
"in",
"the",
"graph",
"and",
"builds",
"a",
"VertexElement",
"which",
"wraps",
"the",
"newly",
"created",
"vertex",
"@param",
"baseType",
"The",
"Schema",
".",
"BaseType",
"@param",
"conceptId",
"the",
"ConceptId",
"to",
"set",... | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ElementFactory.java#L322-L329 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsPropertyAdvanced.java | CmsPropertyAdvanced.dialogButtonsOkCancelDefine | public String dialogButtonsOkCancelDefine() {
if (isEditable()) {
int okButton = BUTTON_OK;
if ((getParamDialogmode() != null) && getParamDialogmode().startsWith(MODE_WIZARD)) {
// in wizard mode, display finish button instead of ok button
okButton = BUTTON_FINISH;
}
return dialogButtons(
new int[] {okButton, BUTTON_CANCEL, BUTTON_DEFINE},
new String[] {null, null, "onclick=\"definePropertyForm();\""});
} else {
return dialogButtons(new int[] {BUTTON_CLOSE}, new String[] {null});
}
} | java | public String dialogButtonsOkCancelDefine() {
if (isEditable()) {
int okButton = BUTTON_OK;
if ((getParamDialogmode() != null) && getParamDialogmode().startsWith(MODE_WIZARD)) {
// in wizard mode, display finish button instead of ok button
okButton = BUTTON_FINISH;
}
return dialogButtons(
new int[] {okButton, BUTTON_CANCEL, BUTTON_DEFINE},
new String[] {null, null, "onclick=\"definePropertyForm();\""});
} else {
return dialogButtons(new int[] {BUTTON_CLOSE}, new String[] {null});
}
} | [
"public",
"String",
"dialogButtonsOkCancelDefine",
"(",
")",
"{",
"if",
"(",
"isEditable",
"(",
")",
")",
"{",
"int",
"okButton",
"=",
"BUTTON_OK",
";",
"if",
"(",
"(",
"getParamDialogmode",
"(",
")",
"!=",
"null",
")",
"&&",
"getParamDialogmode",
"(",
")"... | Builds a button row with an "Ok", a "Cancel" and a "Define" button.<p>
@return the button row | [
"Builds",
"a",
"button",
"row",
"with",
"an",
"Ok",
"a",
"Cancel",
"and",
"a",
"Define",
"button",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPropertyAdvanced.java#L543-L558 |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/IndirectJndiLookupObjectFactory.java | IndirectJndiLookupObjectFactory.createResourceWithFilter | @FFDCIgnore(PrivilegedActionException.class)
private Object createResourceWithFilter(final String filter, final ResourceInfo resourceRefInfo) throws Exception {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
return createResourceWithFilterPrivileged(filter, resourceRefInfo);
}
});
} catch (PrivilegedActionException paex) {
Throwable cause = paex.getCause();
if (cause instanceof Exception) {
throw (Exception) cause;
}
throw new Error(cause);
}
} | java | @FFDCIgnore(PrivilegedActionException.class)
private Object createResourceWithFilter(final String filter, final ResourceInfo resourceRefInfo) throws Exception {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
return createResourceWithFilterPrivileged(filter, resourceRefInfo);
}
});
} catch (PrivilegedActionException paex) {
Throwable cause = paex.getCause();
if (cause instanceof Exception) {
throw (Exception) cause;
}
throw new Error(cause);
}
} | [
"@",
"FFDCIgnore",
"(",
"PrivilegedActionException",
".",
"class",
")",
"private",
"Object",
"createResourceWithFilter",
"(",
"final",
"String",
"filter",
",",
"final",
"ResourceInfo",
"resourceRefInfo",
")",
"throws",
"Exception",
"{",
"try",
"{",
"return",
"Access... | Try to obtain an object instance by creating a resource using a
ResourceFactory with the specified filter. | [
"Try",
"to",
"obtain",
"an",
"object",
"instance",
"by",
"creating",
"a",
"resource",
"using",
"a",
"ResourceFactory",
"with",
"the",
"specified",
"filter",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/IndirectJndiLookupObjectFactory.java#L359-L375 |
RestExpress/PluginExpress | logging/src/main/java/org/restexpress/plugin/logging/LoggingMessageObserver.java | LoggingMessageObserver.createExceptionMessage | protected String createExceptionMessage(Throwable exception, Request request, Response response)
{
StringBuilder sb = new StringBuilder(request.getEffectiveHttpMethod().toString());
sb.append(' ');
sb.append(request.getUrl());
sb.append(" threw exception: ");
sb.append(exception.getClass().getSimpleName());
return sb.toString();
} | java | protected String createExceptionMessage(Throwable exception, Request request, Response response)
{
StringBuilder sb = new StringBuilder(request.getEffectiveHttpMethod().toString());
sb.append(' ');
sb.append(request.getUrl());
sb.append(" threw exception: ");
sb.append(exception.getClass().getSimpleName());
return sb.toString();
} | [
"protected",
"String",
"createExceptionMessage",
"(",
"Throwable",
"exception",
",",
"Request",
"request",
",",
"Response",
"response",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"request",
".",
"getEffectiveHttpMethod",
"(",
")",
".",
"toS... | Create the message to be logged when a request results in an exception.
Sub-classes can override.
@param exception the exception that occurred.
@param request the request.
@param response the response.
@return a string message. | [
"Create",
"the",
"message",
"to",
"be",
"logged",
"when",
"a",
"request",
"results",
"in",
"an",
"exception",
".",
"Sub",
"-",
"classes",
"can",
"override",
"."
] | train | https://github.com/RestExpress/PluginExpress/blob/aeb13907c23bf31ef2b2b17ae4c0ca4a6f5bee69/logging/src/main/java/org/restexpress/plugin/logging/LoggingMessageObserver.java#L120-L128 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/auth/internal/AWS4SignerRequestParams.java | AWS4SignerRequestParams.resolveRegion | private String resolveRegion(String endpointPrefix, String serviceSigningName) {
return AwsHostNameUtils.parseRegionName(request.getEndpoint().getHost(),
endpointPrefix != null ? endpointPrefix : serviceSigningName);
} | java | private String resolveRegion(String endpointPrefix, String serviceSigningName) {
return AwsHostNameUtils.parseRegionName(request.getEndpoint().getHost(),
endpointPrefix != null ? endpointPrefix : serviceSigningName);
} | [
"private",
"String",
"resolveRegion",
"(",
"String",
"endpointPrefix",
",",
"String",
"serviceSigningName",
")",
"{",
"return",
"AwsHostNameUtils",
".",
"parseRegionName",
"(",
"request",
".",
"getEndpoint",
"(",
")",
".",
"getHost",
"(",
")",
",",
"endpointPrefix... | /*
Ideally, we should be using endpoint prefix to parse the region from host.
Previously we were using service signing name to parse region. It is possible that
endpoint prefix is null if customers are still using older clients. So using
service signing name as alternative will prevent any behavior breaking change. | [
"/",
"*",
"Ideally",
"we",
"should",
"be",
"using",
"endpoint",
"prefix",
"to",
"parse",
"the",
"region",
"from",
"host",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/auth/internal/AWS4SignerRequestParams.java#L119-L123 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java | ObjectEnvelopeTable.replaceRegisteredIdentity | boolean replaceRegisteredIdentity(Identity newOid, Identity oldOid)
{
/*
TODO: Find a better solution
*/
boolean result = false;
Object oe = mhtObjectEnvelopes.remove(oldOid);
if(oe != null)
{
mhtObjectEnvelopes.put(newOid, oe);
int index = mvOrderOfIds.indexOf(oldOid);
mvOrderOfIds.remove(index);
mvOrderOfIds.add(index, newOid);
result = true;
if(log.isDebugEnabled()) log.debug("Replace identity: " + oldOid + " --replaced-by--> " + newOid);
}
else
{
log.warn("Can't replace unregistered object identity (" + oldOid + ") with new identity (" + newOid + ")");
}
return result;
} | java | boolean replaceRegisteredIdentity(Identity newOid, Identity oldOid)
{
/*
TODO: Find a better solution
*/
boolean result = false;
Object oe = mhtObjectEnvelopes.remove(oldOid);
if(oe != null)
{
mhtObjectEnvelopes.put(newOid, oe);
int index = mvOrderOfIds.indexOf(oldOid);
mvOrderOfIds.remove(index);
mvOrderOfIds.add(index, newOid);
result = true;
if(log.isDebugEnabled()) log.debug("Replace identity: " + oldOid + " --replaced-by--> " + newOid);
}
else
{
log.warn("Can't replace unregistered object identity (" + oldOid + ") with new identity (" + newOid + ")");
}
return result;
} | [
"boolean",
"replaceRegisteredIdentity",
"(",
"Identity",
"newOid",
",",
"Identity",
"oldOid",
")",
"{",
"/*\r\n TODO: Find a better solution\r\n */",
"boolean",
"result",
"=",
"false",
";",
"Object",
"oe",
"=",
"mhtObjectEnvelopes",
".",
"remove",
"(",
"ol... | Replace the {@link org.apache.ojb.broker.Identity}
of a registered {@link ObjectEnvelope} object.
@param newOid
@param oldOid
@return Returns <em>true</em> if successful. | [
"Replace",
"the",
"{",
"@link",
"org",
".",
"apache",
".",
"ojb",
".",
"broker",
".",
"Identity",
"}",
"of",
"a",
"registered",
"{",
"@link",
"ObjectEnvelope",
"}",
"object",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L825-L846 |
samskivert/samskivert | src/main/java/com/samskivert/util/ObserverList.java | ObserverList.checkedApply | protected boolean checkedApply (ObserverOp<T> obop, T obs)
{
try {
return obop.apply(obs);
} catch (Throwable thrown) {
log.warning("ObserverOp choked during notification",
"op", obop, "obs", observerForLog(obs), thrown);
// if they booched it, definitely don't remove them
return true;
}
} | java | protected boolean checkedApply (ObserverOp<T> obop, T obs)
{
try {
return obop.apply(obs);
} catch (Throwable thrown) {
log.warning("ObserverOp choked during notification",
"op", obop, "obs", observerForLog(obs), thrown);
// if they booched it, definitely don't remove them
return true;
}
} | [
"protected",
"boolean",
"checkedApply",
"(",
"ObserverOp",
"<",
"T",
">",
"obop",
",",
"T",
"obs",
")",
"{",
"try",
"{",
"return",
"obop",
".",
"apply",
"(",
"obs",
")",
";",
"}",
"catch",
"(",
"Throwable",
"thrown",
")",
"{",
"log",
".",
"warning",
... | Applies the operation to the observer, catching and logging any exceptions thrown in the
process. | [
"Applies",
"the",
"operation",
"to",
"the",
"observer",
"catching",
"and",
"logging",
"any",
"exceptions",
"thrown",
"in",
"the",
"process",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ObserverList.java#L198-L208 |
Azure/azure-sdk-for-java | applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/EventsImpl.java | EventsImpl.getByType | public EventsResults getByType(String appId, EventType eventType) {
return getByTypeWithServiceResponseAsync(appId, eventType).toBlocking().single().body();
} | java | public EventsResults getByType(String appId, EventType eventType) {
return getByTypeWithServiceResponseAsync(appId, eventType).toBlocking().single().body();
} | [
"public",
"EventsResults",
"getByType",
"(",
"String",
"appId",
",",
"EventType",
"eventType",
")",
"{",
"return",
"getByTypeWithServiceResponseAsync",
"(",
"appId",
",",
"eventType",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",... | Execute OData query.
Executes an OData query for events.
@param appId ID of the application. This is Application ID from the API Access settings blade in the Azure portal.
@param eventType The type of events to query; either a standard event type (`traces`, `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, `availabilityResults`) or `$all` to query across all event types. Possible values include: '$all', 'traces', 'customEvents', 'pageViews', 'browserTimings', 'requests', 'dependencies', 'exceptions', 'availabilityResults', 'performanceCounters', 'customMetrics'
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the EventsResults object if successful. | [
"Execute",
"OData",
"query",
".",
"Executes",
"an",
"OData",
"query",
"for",
"events",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/EventsImpl.java#L78-L80 |
lessthanoptimal/BoofCV | demonstrations/src/main/java/boofcv/demonstrations/fiducial/DetectQrCodeApp.java | DetectQrCodeApp.processImage | @Override
public void processImage(int sourceID, long frameID, final BufferedImage buffered, ImageBase input) {
System.out.flush();
synchronized (bufferedImageLock) {
original = ConvertBufferedImage.checkCopy(buffered, original);
work = ConvertBufferedImage.checkDeclare(buffered, work);
}
if( saveRequested ) {
saveInputImage();
saveRequested = false;
}
final double timeInSeconds;
// TODO Copy all data that's visualized outside so that GUI doesn't lock
synchronized (this) {
long before = System.nanoTime();
detector.process((T)input);
long after = System.nanoTime();
timeInSeconds = (after-before)*1e-9;
}
// create a local copy so that gui and processing thread's dont conflict
synchronized (detected) {
this.detected.reset();
for (QrCode d : detector.getDetections()) {
this.detected.grow().set(d);
}
this.failures.reset();
for (QrCode d : detector.getFailures()) {
if( d.failureCause.ordinal() >= QrCode.Failure.READING_BITS.ordinal())
this.failures.grow().set(d);
}
// System.out.println("Failed "+failures.size());
// for( QrCode qr : failures.toList() ) {
// System.out.println(" cause "+qr.failureCause);
// }
}
controlPanel.polygonPanel.thresholdPanel.updateHistogram((T)input);
SwingUtilities.invokeLater(() -> {
controls.setProcessingTimeS(timeInSeconds);
viewUpdated();
synchronized (detected) {
controlPanel.messagePanel.updateList(detected.toList(),failures.toList());
}
});
} | java | @Override
public void processImage(int sourceID, long frameID, final BufferedImage buffered, ImageBase input) {
System.out.flush();
synchronized (bufferedImageLock) {
original = ConvertBufferedImage.checkCopy(buffered, original);
work = ConvertBufferedImage.checkDeclare(buffered, work);
}
if( saveRequested ) {
saveInputImage();
saveRequested = false;
}
final double timeInSeconds;
// TODO Copy all data that's visualized outside so that GUI doesn't lock
synchronized (this) {
long before = System.nanoTime();
detector.process((T)input);
long after = System.nanoTime();
timeInSeconds = (after-before)*1e-9;
}
// create a local copy so that gui and processing thread's dont conflict
synchronized (detected) {
this.detected.reset();
for (QrCode d : detector.getDetections()) {
this.detected.grow().set(d);
}
this.failures.reset();
for (QrCode d : detector.getFailures()) {
if( d.failureCause.ordinal() >= QrCode.Failure.READING_BITS.ordinal())
this.failures.grow().set(d);
}
// System.out.println("Failed "+failures.size());
// for( QrCode qr : failures.toList() ) {
// System.out.println(" cause "+qr.failureCause);
// }
}
controlPanel.polygonPanel.thresholdPanel.updateHistogram((T)input);
SwingUtilities.invokeLater(() -> {
controls.setProcessingTimeS(timeInSeconds);
viewUpdated();
synchronized (detected) {
controlPanel.messagePanel.updateList(detected.toList(),failures.toList());
}
});
} | [
"@",
"Override",
"public",
"void",
"processImage",
"(",
"int",
"sourceID",
",",
"long",
"frameID",
",",
"final",
"BufferedImage",
"buffered",
",",
"ImageBase",
"input",
")",
"{",
"System",
".",
"out",
".",
"flush",
"(",
")",
";",
"synchronized",
"(",
"buff... | Override this function so that it doesn't threshold the image twice | [
"Override",
"this",
"function",
"so",
"that",
"it",
"doesn",
"t",
"threshold",
"the",
"image",
"twice"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/demonstrations/src/main/java/boofcv/demonstrations/fiducial/DetectQrCodeApp.java#L191-L241 |
VoltDB/voltdb | src/catgen/in/javasrc/CatalogType.java | CatalogType.setBaseValues | void setBaseValues(CatalogMap<? extends CatalogType> parentMap, String name) {
if (name == null) {
throw new CatalogException("Null value where it shouldn't be.");
}
m_parentMap = parentMap;
m_typename = name;
} | java | void setBaseValues(CatalogMap<? extends CatalogType> parentMap, String name) {
if (name == null) {
throw new CatalogException("Null value where it shouldn't be.");
}
m_parentMap = parentMap;
m_typename = name;
} | [
"void",
"setBaseValues",
"(",
"CatalogMap",
"<",
"?",
"extends",
"CatalogType",
">",
"parentMap",
",",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"CatalogException",
"(",
"\"Null value where it shouldn't be.\"",
")",
... | This is my lazy hack to avoid using reflection to instantiate records. | [
"This",
"is",
"my",
"lazy",
"hack",
"to",
"avoid",
"using",
"reflection",
"to",
"instantiate",
"records",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/catgen/in/javasrc/CatalogType.java#L215-L221 |
gocd/gocd | config/config-api/src/main/java/com/thoughtworks/go/config/BasicCruiseConfig.java | BasicCruiseConfig.addPipeline | @Override
public void addPipeline(String groupName, PipelineConfig pipelineConfig) {
groups.addPipeline(groupName, pipelineConfig);
} | java | @Override
public void addPipeline(String groupName, PipelineConfig pipelineConfig) {
groups.addPipeline(groupName, pipelineConfig);
} | [
"@",
"Override",
"public",
"void",
"addPipeline",
"(",
"String",
"groupName",
",",
"PipelineConfig",
"pipelineConfig",
")",
"{",
"groups",
".",
"addPipeline",
"(",
"groupName",
",",
"pipelineConfig",
")",
";",
"}"
] | when adding pipelines, groups or environments we must make sure that both merged and basic scopes are updated | [
"when",
"adding",
"pipelines",
"groups",
"or",
"environments",
"we",
"must",
"make",
"sure",
"that",
"both",
"merged",
"and",
"basic",
"scopes",
"are",
"updated"
] | train | https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/config/config-api/src/main/java/com/thoughtworks/go/config/BasicCruiseConfig.java#L877-L880 |
op4j/op4j | src/main/java/org/op4j/Op.java | Op.onArrayFor | public static <T> Level0ArrayOperator<Byte[],Byte> onArrayFor(final Byte... elements) {
return onArrayOf(Types.BYTE, VarArgsUtil.asRequiredObjectArray(elements));
} | java | public static <T> Level0ArrayOperator<Byte[],Byte> onArrayFor(final Byte... elements) {
return onArrayOf(Types.BYTE, VarArgsUtil.asRequiredObjectArray(elements));
} | [
"public",
"static",
"<",
"T",
">",
"Level0ArrayOperator",
"<",
"Byte",
"[",
"]",
",",
"Byte",
">",
"onArrayFor",
"(",
"final",
"Byte",
"...",
"elements",
")",
"{",
"return",
"onArrayOf",
"(",
"Types",
".",
"BYTE",
",",
"VarArgsUtil",
".",
"asRequiredObject... | <p>
Creates an array with the specified elements and an <i>operation expression</i> on it.
</p>
@param elements the elements of the array being created
@return an operator, ready for chaining | [
"<p",
">",
"Creates",
"an",
"array",
"with",
"the",
"specified",
"elements",
"and",
"an",
"<i",
">",
"operation",
"expression<",
"/",
"i",
">",
"on",
"it",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L880-L882 |
jpaoletti/java-presentation-manager | modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java | Entity.getHighlight | public Highlight getHighlight(Field field, Object instance) {
if (getHighlights() == null) {
return null;
}
return getHighlights().getHighlight(this, field, instance);
} | java | public Highlight getHighlight(Field field, Object instance) {
if (getHighlights() == null) {
return null;
}
return getHighlights().getHighlight(this, field, instance);
} | [
"public",
"Highlight",
"getHighlight",
"(",
"Field",
"field",
",",
"Object",
"instance",
")",
"{",
"if",
"(",
"getHighlights",
"(",
")",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"getHighlights",
"(",
")",
".",
"getHighlight",
"(",
"t... | Looks for an apropiate highlight for this field+instance
@param field
@param instance
@return the highlight | [
"Looks",
"for",
"an",
"apropiate",
"highlight",
"for",
"this",
"field",
"+",
"instance"
] | train | https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L556-L561 |
jMetal/jMetal | jmetal-core/src/main/java/org/uma/jmetal/qualityindicator/impl/hypervolume/PISAHypervolume.java | PISAHypervolume.surfaceUnchangedTo | private double surfaceUnchangedTo(double[][] front, int noPoints, int objective) {
int i;
double minValue, value;
if (noPoints < 1) {
new JMetalException("run-time error");
}
minValue = front[0][objective];
for (i = 1; i < noPoints; i++) {
value = front[i][objective];
if (value < minValue) {
minValue = value;
}
}
return minValue;
} | java | private double surfaceUnchangedTo(double[][] front, int noPoints, int objective) {
int i;
double minValue, value;
if (noPoints < 1) {
new JMetalException("run-time error");
}
minValue = front[0][objective];
for (i = 1; i < noPoints; i++) {
value = front[i][objective];
if (value < minValue) {
minValue = value;
}
}
return minValue;
} | [
"private",
"double",
"surfaceUnchangedTo",
"(",
"double",
"[",
"]",
"[",
"]",
"front",
",",
"int",
"noPoints",
",",
"int",
"objective",
")",
"{",
"int",
"i",
";",
"double",
"minValue",
",",
"value",
";",
"if",
"(",
"noPoints",
"<",
"1",
")",
"{",
"ne... | /* calculate next value regarding dimension 'objective'; consider
points referenced in 'front[0..noPoints-1]' | [
"/",
"*",
"calculate",
"next",
"value",
"regarding",
"dimension",
"objective",
";",
"consider",
"points",
"referenced",
"in",
"front",
"[",
"0",
"..",
"noPoints",
"-",
"1",
"]"
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/qualityindicator/impl/hypervolume/PISAHypervolume.java#L135-L151 |
apache/groovy | src/main/groovy/groovy/util/GroovyScriptEngine.java | GroovyScriptEngine.initGroovyLoader | private GroovyClassLoader initGroovyLoader() {
GroovyClassLoader groovyClassLoader =
AccessController.doPrivileged(new PrivilegedAction<ScriptClassLoader>() {
public ScriptClassLoader run() {
if (parentLoader instanceof GroovyClassLoader) {
return new ScriptClassLoader((GroovyClassLoader) parentLoader);
} else {
return new ScriptClassLoader(parentLoader, config);
}
}
});
for (URL root : roots) groovyClassLoader.addURL(root);
return groovyClassLoader;
} | java | private GroovyClassLoader initGroovyLoader() {
GroovyClassLoader groovyClassLoader =
AccessController.doPrivileged(new PrivilegedAction<ScriptClassLoader>() {
public ScriptClassLoader run() {
if (parentLoader instanceof GroovyClassLoader) {
return new ScriptClassLoader((GroovyClassLoader) parentLoader);
} else {
return new ScriptClassLoader(parentLoader, config);
}
}
});
for (URL root : roots) groovyClassLoader.addURL(root);
return groovyClassLoader;
} | [
"private",
"GroovyClassLoader",
"initGroovyLoader",
"(",
")",
"{",
"GroovyClassLoader",
"groovyClassLoader",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"ScriptClassLoader",
">",
"(",
")",
"{",
"public",
"ScriptClassLoader",
"run",... | Initialize a new GroovyClassLoader with a default or
constructor-supplied parentClassLoader.
@return the parent classloader used to load scripts | [
"Initialize",
"a",
"new",
"GroovyClassLoader",
"with",
"a",
"default",
"or",
"constructor",
"-",
"supplied",
"parentClassLoader",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/GroovyScriptEngine.java#L350-L363 |
alkacon/opencms-core | src/org/opencms/relations/CmsCategoryService.java | CmsCategoryService.removeResourceFromCategory | public void removeResourceFromCategory(CmsObject cms, String resourceName, CmsCategory category)
throws CmsException {
// remove the resource just from this category
CmsRelationFilter filter = CmsRelationFilter.TARGETS;
filter = filter.filterType(CmsRelationType.CATEGORY);
filter = filter.filterResource(
cms.readResource(cms.getRequestContext().removeSiteRoot(category.getRootPath())));
filter = filter.filterIncludeChildren();
cms.deleteRelationsFromResource(resourceName, filter);
} | java | public void removeResourceFromCategory(CmsObject cms, String resourceName, CmsCategory category)
throws CmsException {
// remove the resource just from this category
CmsRelationFilter filter = CmsRelationFilter.TARGETS;
filter = filter.filterType(CmsRelationType.CATEGORY);
filter = filter.filterResource(
cms.readResource(cms.getRequestContext().removeSiteRoot(category.getRootPath())));
filter = filter.filterIncludeChildren();
cms.deleteRelationsFromResource(resourceName, filter);
} | [
"public",
"void",
"removeResourceFromCategory",
"(",
"CmsObject",
"cms",
",",
"String",
"resourceName",
",",
"CmsCategory",
"category",
")",
"throws",
"CmsException",
"{",
"// remove the resource just from this category",
"CmsRelationFilter",
"filter",
"=",
"CmsRelationFilter... | Removes a resource identified by the given resource name from the given category.<p>
The resource has to be previously locked.<p>
@param cms the current cms context
@param resourceName the site relative path to the resource to remove
@param category the category to remove the resource from
@throws CmsException if something goes wrong | [
"Removes",
"a",
"resource",
"identified",
"by",
"the",
"given",
"resource",
"name",
"from",
"the",
"given",
"category",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L680-L690 |
devnied/EMV-NFC-Paycard-Enrollment | library/src/main/java/com/github/devnied/emvnfccard/utils/TlvUtil.java | TlvUtil.parseTagAndLength | public static List<TagAndLength> parseTagAndLength(final byte[] data) {
List<TagAndLength> tagAndLengthList = new ArrayList<TagAndLength>();
if (data != null) {
TLVInputStream stream = new TLVInputStream(new ByteArrayInputStream(data));
try {
while (stream.available() > 0) {
if (stream.available() < 2) {
throw new TlvException("Data length < 2 : " + stream.available());
}
ITag tag = searchTagById(stream.readTag());
int tagValueLength = stream.readLength();
tagAndLengthList.add(new TagAndLength(tag, tagValueLength));
}
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
} finally {
IOUtils.closeQuietly(stream);
}
}
return tagAndLengthList;
} | java | public static List<TagAndLength> parseTagAndLength(final byte[] data) {
List<TagAndLength> tagAndLengthList = new ArrayList<TagAndLength>();
if (data != null) {
TLVInputStream stream = new TLVInputStream(new ByteArrayInputStream(data));
try {
while (stream.available() > 0) {
if (stream.available() < 2) {
throw new TlvException("Data length < 2 : " + stream.available());
}
ITag tag = searchTagById(stream.readTag());
int tagValueLength = stream.readLength();
tagAndLengthList.add(new TagAndLength(tag, tagValueLength));
}
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
} finally {
IOUtils.closeQuietly(stream);
}
}
return tagAndLengthList;
} | [
"public",
"static",
"List",
"<",
"TagAndLength",
">",
"parseTagAndLength",
"(",
"final",
"byte",
"[",
"]",
"data",
")",
"{",
"List",
"<",
"TagAndLength",
">",
"tagAndLengthList",
"=",
"new",
"ArrayList",
"<",
"TagAndLength",
">",
"(",
")",
";",
"if",
"(",
... | Method used to parser Tag and length
@param data
data to parse
@return tag and length | [
"Method",
"used",
"to",
"parser",
"Tag",
"and",
"length"
] | train | https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/utils/TlvUtil.java#L162-L185 |
KyoriPowered/text | api/src/main/java/net/kyori/text/TranslatableComponent.java | TranslatableComponent.of | public static TranslatableComponent of(final @NonNull String key, final @Nullable TextColor color, final @NonNull Set<TextDecoration> decorations, final @NonNull Component... args) {
return of(key, color, decorations, Arrays.asList(args));
} | java | public static TranslatableComponent of(final @NonNull String key, final @Nullable TextColor color, final @NonNull Set<TextDecoration> decorations, final @NonNull Component... args) {
return of(key, color, decorations, Arrays.asList(args));
} | [
"public",
"static",
"TranslatableComponent",
"of",
"(",
"final",
"@",
"NonNull",
"String",
"key",
",",
"final",
"@",
"Nullable",
"TextColor",
"color",
",",
"final",
"@",
"NonNull",
"Set",
"<",
"TextDecoration",
">",
"decorations",
",",
"final",
"@",
"NonNull",... | Creates a translatable component with a translation key and arguments.
@param key the translation key
@param color the color
@param decorations the decorations
@param args the translation arguments
@return the translatable component | [
"Creates",
"a",
"translatable",
"component",
"with",
"a",
"translation",
"key",
"and",
"arguments",
"."
] | train | https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/TranslatableComponent.java#L146-L148 |
danieldk/dictomaton | src/main/java/eu/danieldk/dictomaton/PerfectHashDictionaryStateCard.java | PerfectHashDictionaryStateCard.computeStateSuffixesTopological | private void computeStateSuffixesTopological(final int initialState, final int magicMarker) {
for (Iterator<Integer> iterator = sortStatesTopological(initialState).iterator(); iterator.hasNext(); ) {
Integer currentState = iterator.next();
int currentSuffixes = d_stateNSuffixes.get(currentState);
if (currentSuffixes == magicMarker) { // is not yet computed
int trans = d_stateOffsets.get(currentState);
int transUpperBound = transitionsUpperBound(currentState);
if (trans < transUpperBound) { // has children
int suffixes = d_finalStates.get(currentState) ? 1 : 0; // add one if current state is final
for (; trans < transUpperBound; ++trans) { // add known number of suffixes of children
int childState = d_transitionTo.get(trans);
assert d_stateNSuffixes.get(childState) != magicMarker : "suffxies should have been calculated for state " + childState;
suffixes += d_stateNSuffixes.get(childState);
}
d_stateNSuffixes.set(currentState, suffixes);
} else {
d_stateNSuffixes.set(currentState, d_finalStates.get(currentState) ? 1 : 0);
}
} // else already computed from a different path in the DAG
}
} | java | private void computeStateSuffixesTopological(final int initialState, final int magicMarker) {
for (Iterator<Integer> iterator = sortStatesTopological(initialState).iterator(); iterator.hasNext(); ) {
Integer currentState = iterator.next();
int currentSuffixes = d_stateNSuffixes.get(currentState);
if (currentSuffixes == magicMarker) { // is not yet computed
int trans = d_stateOffsets.get(currentState);
int transUpperBound = transitionsUpperBound(currentState);
if (trans < transUpperBound) { // has children
int suffixes = d_finalStates.get(currentState) ? 1 : 0; // add one if current state is final
for (; trans < transUpperBound; ++trans) { // add known number of suffixes of children
int childState = d_transitionTo.get(trans);
assert d_stateNSuffixes.get(childState) != magicMarker : "suffxies should have been calculated for state " + childState;
suffixes += d_stateNSuffixes.get(childState);
}
d_stateNSuffixes.set(currentState, suffixes);
} else {
d_stateNSuffixes.set(currentState, d_finalStates.get(currentState) ? 1 : 0);
}
} // else already computed from a different path in the DAG
}
} | [
"private",
"void",
"computeStateSuffixesTopological",
"(",
"final",
"int",
"initialState",
",",
"final",
"int",
"magicMarker",
")",
"{",
"for",
"(",
"Iterator",
"<",
"Integer",
">",
"iterator",
"=",
"sortStatesTopological",
"(",
"initialState",
")",
".",
"iterator... | Iteratively computes the number of suffixes by topological order
@param initialState the root of the graph
@param magicMarker the value in d_stateNSuffixes indicating that the value has not yet been computed | [
"Iteratively",
"computes",
"the",
"number",
"of",
"suffixes",
"by",
"topological",
"order"
] | train | https://github.com/danieldk/dictomaton/blob/c0a3ae2d407ebd88023ea2d0f02a4882b0492df0/src/main/java/eu/danieldk/dictomaton/PerfectHashDictionaryStateCard.java#L199-L220 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBox.java | BeanBox.addMethodAop | public synchronized BeanBox addMethodAop(Object aop, Method method) {
checkOrCreateMethodAops();
List<Object> aops = methodAops.get(method);
if (aops == null) {
aops = new ArrayList<Object>();
methodAops.put(method, aops);
}
aops.add(BeanBoxUtils.checkAOP(aop));
return this;
} | java | public synchronized BeanBox addMethodAop(Object aop, Method method) {
checkOrCreateMethodAops();
List<Object> aops = methodAops.get(method);
if (aops == null) {
aops = new ArrayList<Object>();
methodAops.put(method, aops);
}
aops.add(BeanBoxUtils.checkAOP(aop));
return this;
} | [
"public",
"synchronized",
"BeanBox",
"addMethodAop",
"(",
"Object",
"aop",
",",
"Method",
"method",
")",
"{",
"checkOrCreateMethodAops",
"(",
")",
";",
"List",
"<",
"Object",
">",
"aops",
"=",
"methodAops",
".",
"get",
"(",
"method",
")",
";",
"if",
"(",
... | This is Java configuration method equal to put a AOP annotation on method. a
AOP annotation is a kind of annotation be binded to an AOP alliance
interceptor like ctx.bind(Tx.class, MyInterceptor.class); then you can put
a @Tx annotation on method. But this method allow aop can be annotation class
or interceptor class for both | [
"This",
"is",
"Java",
"configuration",
"method",
"equal",
"to",
"put",
"a",
"AOP",
"annotation",
"on",
"method",
".",
"a",
"AOP",
"annotation",
"is",
"a",
"kind",
"of",
"annotation",
"be",
"binded",
"to",
"an",
"AOP",
"alliance",
"interceptor",
"like",
"ct... | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBox.java#L233-L242 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/SubClass.java | SubClass.resolveMethodIndex | int resolveMethodIndex(ExecutableElement method)
{
int size = 0;
int index = 0;
constantReadLock.lock();
TypeElement declaringClass = (TypeElement) method.getEnclosingElement();
String declaringClassname = declaringClass.getQualifiedName().toString();
String descriptor = Descriptor.getDesriptor(method);
String name = method.getSimpleName().toString();
try
{
size = getConstantPoolSize();
index = getRefIndex(Methodref.class, declaringClassname, name, descriptor);
}
finally
{
constantReadLock.unlock();
}
if (index == -1)
{
// add entry to constant pool
int ci = resolveClassIndex(declaringClass);
int nati = resolveNameAndTypeIndex(name, descriptor);
index = addConstantInfo(new Methodref(ci, nati), size);
}
addIndexedElement(index, method);
return index;
} | java | int resolveMethodIndex(ExecutableElement method)
{
int size = 0;
int index = 0;
constantReadLock.lock();
TypeElement declaringClass = (TypeElement) method.getEnclosingElement();
String declaringClassname = declaringClass.getQualifiedName().toString();
String descriptor = Descriptor.getDesriptor(method);
String name = method.getSimpleName().toString();
try
{
size = getConstantPoolSize();
index = getRefIndex(Methodref.class, declaringClassname, name, descriptor);
}
finally
{
constantReadLock.unlock();
}
if (index == -1)
{
// add entry to constant pool
int ci = resolveClassIndex(declaringClass);
int nati = resolveNameAndTypeIndex(name, descriptor);
index = addConstantInfo(new Methodref(ci, nati), size);
}
addIndexedElement(index, method);
return index;
} | [
"int",
"resolveMethodIndex",
"(",
"ExecutableElement",
"method",
")",
"{",
"int",
"size",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"constantReadLock",
".",
"lock",
"(",
")",
";",
"TypeElement",
"declaringClass",
"=",
"(",
"TypeElement",
")",
"method",
... | Returns the constant map index to method
If entry doesn't exist it is created.
@param method
@return | [
"Returns",
"the",
"constant",
"map",
"index",
"to",
"method",
"If",
"entry",
"doesn",
"t",
"exist",
"it",
"is",
"created",
"."
] | train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L224-L251 |
future-architect/uroborosql | src/main/java/jp/co/future/uroborosql/client/completer/AbstractCompleter.java | AbstractCompleter.accept | protected boolean accept(final int startArgNo, final String buffer, final int len) {
// 対象引数が-1、または開始引数にlenが満たない場合は該当なしなのでコード補完しない
return startArgNo != -1 && (buffer.endsWith(" ") && startArgNo <= len
|| !buffer.endsWith(" ") && startArgNo + 1 <= len);
} | java | protected boolean accept(final int startArgNo, final String buffer, final int len) {
// 対象引数が-1、または開始引数にlenが満たない場合は該当なしなのでコード補完しない
return startArgNo != -1 && (buffer.endsWith(" ") && startArgNo <= len
|| !buffer.endsWith(" ") && startArgNo + 1 <= len);
} | [
"protected",
"boolean",
"accept",
"(",
"final",
"int",
"startArgNo",
",",
"final",
"String",
"buffer",
",",
"final",
"int",
"len",
")",
"{",
"// 対象引数が-1、または開始引数にlenが満たない場合は該当なしなのでコード補完しない",
"return",
"startArgNo",
"!=",
"-",
"1",
"&&",
"(",
"buffer",
".",
"endsW... | コード補完対象かどうかを判定する
@param startArgNo 開始引数No
@param buffer 入力文字列
@param len partsのlength
@return コード補完対象の場合<code>true</code> | [
"コード補完対象かどうかを判定する"
] | train | https://github.com/future-architect/uroborosql/blob/4c26db51defdac3c6ed16866e33ab45e190e2e0c/src/main/java/jp/co/future/uroborosql/client/completer/AbstractCompleter.java#L51-L55 |
radkovo/Pdf2Dom | src/main/java/org/fit/pdfdom/PDFDomTree.java | PDFDomTree.writeText | @Override
public void writeText(PDDocument doc, Writer outputStream) throws IOException
{
try
{
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
LSSerializer writer = impl.createLSSerializer();
LSOutput output = impl.createLSOutput();
writer.getDomConfig().setParameter("format-pretty-print", true);
output.setCharacterStream(outputStream);
createDOM(doc);
writer.write(getDocument(), output);
} catch (ClassCastException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
} catch (ClassNotFoundException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
} catch (InstantiationException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
} catch (IllegalAccessException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
}
} | java | @Override
public void writeText(PDDocument doc, Writer outputStream) throws IOException
{
try
{
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
LSSerializer writer = impl.createLSSerializer();
LSOutput output = impl.createLSOutput();
writer.getDomConfig().setParameter("format-pretty-print", true);
output.setCharacterStream(outputStream);
createDOM(doc);
writer.write(getDocument(), output);
} catch (ClassCastException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
} catch (ClassNotFoundException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
} catch (InstantiationException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
} catch (IllegalAccessException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
}
} | [
"@",
"Override",
"public",
"void",
"writeText",
"(",
"PDDocument",
"doc",
",",
"Writer",
"outputStream",
")",
"throws",
"IOException",
"{",
"try",
"{",
"DOMImplementationRegistry",
"registry",
"=",
"DOMImplementationRegistry",
".",
"newInstance",
"(",
")",
";",
"D... | Parses a PDF document and serializes the resulting DOM tree to an output. This requires
a DOM Level 3 capable implementation to be available. | [
"Parses",
"a",
"PDF",
"document",
"and",
"serializes",
"the",
"resulting",
"DOM",
"tree",
"to",
"an",
"output",
".",
"This",
"requires",
"a",
"DOM",
"Level",
"3",
"capable",
"implementation",
"to",
"be",
"available",
"."
] | train | https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/pdfdom/PDFDomTree.java#L183-L205 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java | CommonOps_DDF5.addEquals | public static void addEquals( DMatrix5x5 a , DMatrix5x5 b ) {
a.a11 += b.a11;
a.a12 += b.a12;
a.a13 += b.a13;
a.a14 += b.a14;
a.a15 += b.a15;
a.a21 += b.a21;
a.a22 += b.a22;
a.a23 += b.a23;
a.a24 += b.a24;
a.a25 += b.a25;
a.a31 += b.a31;
a.a32 += b.a32;
a.a33 += b.a33;
a.a34 += b.a34;
a.a35 += b.a35;
a.a41 += b.a41;
a.a42 += b.a42;
a.a43 += b.a43;
a.a44 += b.a44;
a.a45 += b.a45;
a.a51 += b.a51;
a.a52 += b.a52;
a.a53 += b.a53;
a.a54 += b.a54;
a.a55 += b.a55;
} | java | public static void addEquals( DMatrix5x5 a , DMatrix5x5 b ) {
a.a11 += b.a11;
a.a12 += b.a12;
a.a13 += b.a13;
a.a14 += b.a14;
a.a15 += b.a15;
a.a21 += b.a21;
a.a22 += b.a22;
a.a23 += b.a23;
a.a24 += b.a24;
a.a25 += b.a25;
a.a31 += b.a31;
a.a32 += b.a32;
a.a33 += b.a33;
a.a34 += b.a34;
a.a35 += b.a35;
a.a41 += b.a41;
a.a42 += b.a42;
a.a43 += b.a43;
a.a44 += b.a44;
a.a45 += b.a45;
a.a51 += b.a51;
a.a52 += b.a52;
a.a53 += b.a53;
a.a54 += b.a54;
a.a55 += b.a55;
} | [
"public",
"static",
"void",
"addEquals",
"(",
"DMatrix5x5",
"a",
",",
"DMatrix5x5",
"b",
")",
"{",
"a",
".",
"a11",
"+=",
"b",
".",
"a11",
";",
"a",
".",
"a12",
"+=",
"b",
".",
"a12",
";",
"a",
".",
"a13",
"+=",
"b",
".",
"a13",
";",
"a",
"."... | <p>Performs the following operation:<br>
<br>
a = a + b <br>
a<sub>ij</sub> = a<sub>ij</sub> + b<sub>ij</sub> <br>
</p>
@param a A Matrix. Modified.
@param b A Matrix. Not modified. | [
"<p",
">",
"Performs",
"the",
"following",
"operation",
":",
"<br",
">",
"<br",
">",
"a",
"=",
"a",
"+",
"b",
"<br",
">",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
"+",
"b<sub",
">",
"ij<",
"/",
"sub",
"... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java#L108-L134 |
xerial/larray | larray-buffer/src/main/java/xerial/larray/buffer/UnsafeUtil.java | UnsafeUtil.newDirectByteBuffer | public static ByteBuffer newDirectByteBuffer(long addr, int size, Object att) {
dbbCC.setAccessible(true);
Object b = null;
try {
b = dbbCC.newInstance(new Long(addr), new Integer(size), att);
return ByteBuffer.class.cast(b);
}
catch(Exception e) {
throw new IllegalStateException(String.format("Failed to create DirectByteBuffer: %s", e.getMessage()));
}
} | java | public static ByteBuffer newDirectByteBuffer(long addr, int size, Object att) {
dbbCC.setAccessible(true);
Object b = null;
try {
b = dbbCC.newInstance(new Long(addr), new Integer(size), att);
return ByteBuffer.class.cast(b);
}
catch(Exception e) {
throw new IllegalStateException(String.format("Failed to create DirectByteBuffer: %s", e.getMessage()));
}
} | [
"public",
"static",
"ByteBuffer",
"newDirectByteBuffer",
"(",
"long",
"addr",
",",
"int",
"size",
",",
"Object",
"att",
")",
"{",
"dbbCC",
".",
"setAccessible",
"(",
"true",
")",
";",
"Object",
"b",
"=",
"null",
";",
"try",
"{",
"b",
"=",
"dbbCC",
".",... | Create a new DirectByteBuffer from a given address and size.
The returned DirectByteBuffer does not release the memory by itself.
@param addr
@param size
@param att object holding the underlying memory to attach to the buffer.
This will prevent the garbage collection of the memory area that's
associated with the new <code>DirectByteBuffer</code>
@return | [
"Create",
"a",
"new",
"DirectByteBuffer",
"from",
"a",
"given",
"address",
"and",
"size",
".",
"The",
"returned",
"DirectByteBuffer",
"does",
"not",
"release",
"the",
"memory",
"by",
"itself",
"."
] | train | https://github.com/xerial/larray/blob/9a1462623c0e56ca67c5341ea29832963c29479f/larray-buffer/src/main/java/xerial/larray/buffer/UnsafeUtil.java#L57-L67 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.