repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
JodaOrg/joda-time | src/main/java/org/joda/time/MonthDay.java | MonthDay.withDayOfMonth | public MonthDay withDayOfMonth(int dayOfMonth) {
"""
Returns a copy of this month-day with the day of month field updated.
<p>
MonthDay is immutable, so there are no set methods.
Instead, this method returns a new instance with the value of
day of month changed.
@param dayOfMonth the day of month to set
@return a copy of this object with the field set, never null
@throws IllegalArgumentException if the value is invalid
"""
int[] newValues = getValues();
newValues = getChronology().dayOfMonth().set(this, DAY_OF_MONTH, newValues, dayOfMonth);
return new MonthDay(this, newValues);
} | java | public MonthDay withDayOfMonth(int dayOfMonth) {
int[] newValues = getValues();
newValues = getChronology().dayOfMonth().set(this, DAY_OF_MONTH, newValues, dayOfMonth);
return new MonthDay(this, newValues);
} | [
"public",
"MonthDay",
"withDayOfMonth",
"(",
"int",
"dayOfMonth",
")",
"{",
"int",
"[",
"]",
"newValues",
"=",
"getValues",
"(",
")",
";",
"newValues",
"=",
"getChronology",
"(",
")",
".",
"dayOfMonth",
"(",
")",
".",
"set",
"(",
"this",
",",
"DAY_OF_MONTH",
",",
"newValues",
",",
"dayOfMonth",
")",
";",
"return",
"new",
"MonthDay",
"(",
"this",
",",
"newValues",
")",
";",
"}"
] | Returns a copy of this month-day with the day of month field updated.
<p>
MonthDay is immutable, so there are no set methods.
Instead, this method returns a new instance with the value of
day of month changed.
@param dayOfMonth the day of month to set
@return a copy of this object with the field set, never null
@throws IllegalArgumentException if the value is invalid | [
"Returns",
"a",
"copy",
"of",
"this",
"month",
"-",
"day",
"with",
"the",
"day",
"of",
"month",
"field",
"updated",
".",
"<p",
">",
"MonthDay",
"is",
"immutable",
"so",
"there",
"are",
"no",
"set",
"methods",
".",
"Instead",
"this",
"method",
"returns",
"a",
"new",
"instance",
"with",
"the",
"value",
"of",
"day",
"of",
"month",
"changed",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/MonthDay.java#L737-L741 |
reactor/reactor-netty | src/main/java/reactor/netty/http/server/ConnectionInfo.java | ConnectionInfo.newConnectionInfo | static ConnectionInfo newConnectionInfo(Channel c) {
"""
Retrieve the connection information from the current connection directly
@param c the current channel
@return the connection information
"""
SocketChannel channel = (SocketChannel) c;
InetSocketAddress hostAddress = channel.localAddress();
InetSocketAddress remoteAddress = getRemoteAddress(channel);
String scheme = channel.pipeline().get(SslHandler.class) != null ? "https" : "http";
return new ConnectionInfo(hostAddress, remoteAddress, scheme);
} | java | static ConnectionInfo newConnectionInfo(Channel c) {
SocketChannel channel = (SocketChannel) c;
InetSocketAddress hostAddress = channel.localAddress();
InetSocketAddress remoteAddress = getRemoteAddress(channel);
String scheme = channel.pipeline().get(SslHandler.class) != null ? "https" : "http";
return new ConnectionInfo(hostAddress, remoteAddress, scheme);
} | [
"static",
"ConnectionInfo",
"newConnectionInfo",
"(",
"Channel",
"c",
")",
"{",
"SocketChannel",
"channel",
"=",
"(",
"SocketChannel",
")",
"c",
";",
"InetSocketAddress",
"hostAddress",
"=",
"channel",
".",
"localAddress",
"(",
")",
";",
"InetSocketAddress",
"remoteAddress",
"=",
"getRemoteAddress",
"(",
"channel",
")",
";",
"String",
"scheme",
"=",
"channel",
".",
"pipeline",
"(",
")",
".",
"get",
"(",
"SslHandler",
".",
"class",
")",
"!=",
"null",
"?",
"\"https\"",
":",
"\"http\"",
";",
"return",
"new",
"ConnectionInfo",
"(",
"hostAddress",
",",
"remoteAddress",
",",
"scheme",
")",
";",
"}"
] | Retrieve the connection information from the current connection directly
@param c the current channel
@return the connection information | [
"Retrieve",
"the",
"connection",
"information",
"from",
"the",
"current",
"connection",
"directly"
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/http/server/ConnectionInfo.java#L77-L83 |
inferred/FreeBuilder | src/main/java/org/inferred/freebuilder/processor/model/ModelUtils.java | ModelUtils.needsSafeVarargs | public static boolean needsSafeVarargs(TypeMirror elementType) {
"""
Returns true if a method with a variable number of {@code elementType} arguments needs a
{@code @SafeVarargs} annotation to avoid compiler warnings in Java 7+.
"""
return elementType.accept(new SimpleTypeVisitor8<Boolean, Void>() {
@Override
public Boolean visitDeclared(DeclaredType t, Void p) {
// Set<?>... does not need @SafeVarargs; Set<Integer>... or Set<? extends Number> does.
for (TypeMirror typeArgument : t.getTypeArguments()) {
if (!isPlainWildcard(typeArgument)) {
return true;
}
}
return false;
}
@Override
public Boolean visitTypeVariable(TypeVariable t, Void p) {
return true;
}
@Override
protected Boolean defaultAction(TypeMirror e, Void p) {
return false;
}
@Override
public Boolean visitUnknown(TypeMirror t, Void p) {
return false;
}
}, null);
} | java | public static boolean needsSafeVarargs(TypeMirror elementType) {
return elementType.accept(new SimpleTypeVisitor8<Boolean, Void>() {
@Override
public Boolean visitDeclared(DeclaredType t, Void p) {
// Set<?>... does not need @SafeVarargs; Set<Integer>... or Set<? extends Number> does.
for (TypeMirror typeArgument : t.getTypeArguments()) {
if (!isPlainWildcard(typeArgument)) {
return true;
}
}
return false;
}
@Override
public Boolean visitTypeVariable(TypeVariable t, Void p) {
return true;
}
@Override
protected Boolean defaultAction(TypeMirror e, Void p) {
return false;
}
@Override
public Boolean visitUnknown(TypeMirror t, Void p) {
return false;
}
}, null);
} | [
"public",
"static",
"boolean",
"needsSafeVarargs",
"(",
"TypeMirror",
"elementType",
")",
"{",
"return",
"elementType",
".",
"accept",
"(",
"new",
"SimpleTypeVisitor8",
"<",
"Boolean",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolean",
"visitDeclared",
"(",
"DeclaredType",
"t",
",",
"Void",
"p",
")",
"{",
"// Set<?>... does not need @SafeVarargs; Set<Integer>... or Set<? extends Number> does.",
"for",
"(",
"TypeMirror",
"typeArgument",
":",
"t",
".",
"getTypeArguments",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isPlainWildcard",
"(",
"typeArgument",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"@",
"Override",
"public",
"Boolean",
"visitTypeVariable",
"(",
"TypeVariable",
"t",
",",
"Void",
"p",
")",
"{",
"return",
"true",
";",
"}",
"@",
"Override",
"protected",
"Boolean",
"defaultAction",
"(",
"TypeMirror",
"e",
",",
"Void",
"p",
")",
"{",
"return",
"false",
";",
"}",
"@",
"Override",
"public",
"Boolean",
"visitUnknown",
"(",
"TypeMirror",
"t",
",",
"Void",
"p",
")",
"{",
"return",
"false",
";",
"}",
"}",
",",
"null",
")",
";",
"}"
] | Returns true if a method with a variable number of {@code elementType} arguments needs a
{@code @SafeVarargs} annotation to avoid compiler warnings in Java 7+. | [
"Returns",
"true",
"if",
"a",
"method",
"with",
"a",
"variable",
"number",
"of",
"{"
] | train | https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/model/ModelUtils.java#L169-L197 |
xfcjscn/sudoor-server-lib | src/main/java/net/gplatform/sudoor/server/spring/SpringContextsUtil.java | SpringContextsUtil.getBean | public static Object getBean(String name, Class requiredType) throws BeansException {
"""
获取类型为requiredType的对象
如果bean不能被类型转换,相应的异常将会被抛出(BeanNotOfRequiredTypeException)
@param name bean注册名
@param requiredType 返回对象类型
@return Object 返回requiredType类型对象
@throws BeansException
"""
return applicationContext.getBean(name, requiredType);
} | java | public static Object getBean(String name, Class requiredType) throws BeansException {
return applicationContext.getBean(name, requiredType);
} | [
"public",
"static",
"Object",
"getBean",
"(",
"String",
"name",
",",
"Class",
"requiredType",
")",
"throws",
"BeansException",
"{",
"return",
"applicationContext",
".",
"getBean",
"(",
"name",
",",
"requiredType",
")",
";",
"}"
] | 获取类型为requiredType的对象
如果bean不能被类型转换,相应的异常将会被抛出(BeanNotOfRequiredTypeException)
@param name bean注册名
@param requiredType 返回对象类型
@return Object 返回requiredType类型对象
@throws BeansException | [
"获取类型为requiredType的对象",
"如果bean不能被类型转换,相应的异常将会被抛出(BeanNotOfRequiredTypeException)"
] | train | https://github.com/xfcjscn/sudoor-server-lib/blob/37dc1996eaa9cad25c82abd1de315ba565e32097/src/main/java/net/gplatform/sudoor/server/spring/SpringContextsUtil.java#L88-L90 |
dnsjava/dnsjava | org/xbill/DNS/utils/base64.java | base64.formatString | public static String
formatString(byte [] b, int lineLength, String prefix, boolean addClose) {
"""
Formats data into a nicely formatted base64 encoded String
@param b An array containing binary data
@param lineLength The number of characters per line
@param prefix A string prefixing the characters on each line
@param addClose Whether to add a close parenthesis or not
@return A String representing the formatted output
"""
String s = toString(b);
StringBuffer sb = new StringBuffer();
for (int i = 0; i < s.length(); i += lineLength) {
sb.append (prefix);
if (i + lineLength >= s.length()) {
sb.append(s.substring(i));
if (addClose)
sb.append(" )");
}
else {
sb.append(s.substring(i, i + lineLength));
sb.append("\n");
}
}
return sb.toString();
} | java | public static String
formatString(byte [] b, int lineLength, String prefix, boolean addClose) {
String s = toString(b);
StringBuffer sb = new StringBuffer();
for (int i = 0; i < s.length(); i += lineLength) {
sb.append (prefix);
if (i + lineLength >= s.length()) {
sb.append(s.substring(i));
if (addClose)
sb.append(" )");
}
else {
sb.append(s.substring(i, i + lineLength));
sb.append("\n");
}
}
return sb.toString();
} | [
"public",
"static",
"String",
"formatString",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"lineLength",
",",
"String",
"prefix",
",",
"boolean",
"addClose",
")",
"{",
"String",
"s",
"=",
"toString",
"(",
"b",
")",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
"(",
")",
";",
"i",
"+=",
"lineLength",
")",
"{",
"sb",
".",
"append",
"(",
"prefix",
")",
";",
"if",
"(",
"i",
"+",
"lineLength",
">=",
"s",
".",
"length",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"s",
".",
"substring",
"(",
"i",
")",
")",
";",
"if",
"(",
"addClose",
")",
"sb",
".",
"append",
"(",
"\" )\"",
")",
";",
"}",
"else",
"{",
"sb",
".",
"append",
"(",
"s",
".",
"substring",
"(",
"i",
",",
"i",
"+",
"lineLength",
")",
")",
";",
"sb",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"}",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | Formats data into a nicely formatted base64 encoded String
@param b An array containing binary data
@param lineLength The number of characters per line
@param prefix A string prefixing the characters on each line
@param addClose Whether to add a close parenthesis or not
@return A String representing the formatted output | [
"Formats",
"data",
"into",
"a",
"nicely",
"formatted",
"base64",
"encoded",
"String"
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/utils/base64.java#L69-L86 |
google/closure-compiler | src/com/google/javascript/jscomp/PassConfig.java | PassConfig.patchGlobalTypedScope | void patchGlobalTypedScope(AbstractCompiler compiler, Node scriptRoot) {
"""
Regenerates the top scope potentially only for a sub-tree of AST and then
copies information for the old global scope.
@param compiler The compiler for which the global scope is generated.
@param scriptRoot The root of the AST used to generate global scope.
"""
checkNotNull(typedScopeCreator);
typedScopeCreator.patchGlobalScope(topScope, scriptRoot);
} | java | void patchGlobalTypedScope(AbstractCompiler compiler, Node scriptRoot) {
checkNotNull(typedScopeCreator);
typedScopeCreator.patchGlobalScope(topScope, scriptRoot);
} | [
"void",
"patchGlobalTypedScope",
"(",
"AbstractCompiler",
"compiler",
",",
"Node",
"scriptRoot",
")",
"{",
"checkNotNull",
"(",
"typedScopeCreator",
")",
";",
"typedScopeCreator",
".",
"patchGlobalScope",
"(",
"topScope",
",",
"scriptRoot",
")",
";",
"}"
] | Regenerates the top scope potentially only for a sub-tree of AST and then
copies information for the old global scope.
@param compiler The compiler for which the global scope is generated.
@param scriptRoot The root of the AST used to generate global scope. | [
"Regenerates",
"the",
"top",
"scope",
"potentially",
"only",
"for",
"a",
"sub",
"-",
"tree",
"of",
"AST",
"and",
"then",
"copies",
"information",
"for",
"the",
"old",
"global",
"scope",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PassConfig.java#L70-L73 |
amaembo/streamex | src/main/java/one/util/streamex/IntStreamEx.java | IntStreamEx.ofIndices | public static IntStreamEx ofIndices(int[] array, IntPredicate predicate) {
"""
Returns a sequential ordered {@code IntStreamEx} containing all the
indices of the supplied array elements which match given predicate.
@param array array to get the stream of its indices
@param predicate a predicate to test array elements
@return a sequential {@code IntStreamEx} of the matched array indices
@since 0.1.1
"""
return seq(IntStream.range(0, array.length).filter(i -> predicate.test(array[i])));
} | java | public static IntStreamEx ofIndices(int[] array, IntPredicate predicate) {
return seq(IntStream.range(0, array.length).filter(i -> predicate.test(array[i])));
} | [
"public",
"static",
"IntStreamEx",
"ofIndices",
"(",
"int",
"[",
"]",
"array",
",",
"IntPredicate",
"predicate",
")",
"{",
"return",
"seq",
"(",
"IntStream",
".",
"range",
"(",
"0",
",",
"array",
".",
"length",
")",
".",
"filter",
"(",
"i",
"->",
"predicate",
".",
"test",
"(",
"array",
"[",
"i",
"]",
")",
")",
")",
";",
"}"
] | Returns a sequential ordered {@code IntStreamEx} containing all the
indices of the supplied array elements which match given predicate.
@param array array to get the stream of its indices
@param predicate a predicate to test array elements
@return a sequential {@code IntStreamEx} of the matched array indices
@since 0.1.1 | [
"Returns",
"a",
"sequential",
"ordered",
"{",
"@code",
"IntStreamEx",
"}",
"containing",
"all",
"the",
"indices",
"of",
"the",
"supplied",
"array",
"elements",
"which",
"match",
"given",
"predicate",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L2083-L2085 |
ziccardi/jnrpe | jnrpe-plugins/src/main/java/it/jnrpe/plugin/utils/HttpUtils.java | HttpUtils.doPOST | public static String doPOST(final URL url, final Properties requestProps, final Integer timeout, final String encodedData,
boolean includeHeaders, boolean ignoreBody) throws IOException {
"""
Do a http post request and return response
@param url target url
@param requestProps props to be requested
@param timeout connection timeout
@param includeHeaders whether to include headers or not
@param ignoreBody whether to ignore body content or not
@return server answer
@throws IOException on any connection
"""
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
setRequestProperties(requestProps, conn, timeout);
sendPostData(conn, encodedData);
return parseHttpResponse(conn, includeHeaders, ignoreBody);
} | java | public static String doPOST(final URL url, final Properties requestProps, final Integer timeout, final String encodedData,
boolean includeHeaders, boolean ignoreBody) throws IOException {
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
setRequestProperties(requestProps, conn, timeout);
sendPostData(conn, encodedData);
return parseHttpResponse(conn, includeHeaders, ignoreBody);
} | [
"public",
"static",
"String",
"doPOST",
"(",
"final",
"URL",
"url",
",",
"final",
"Properties",
"requestProps",
",",
"final",
"Integer",
"timeout",
",",
"final",
"String",
"encodedData",
",",
"boolean",
"includeHeaders",
",",
"boolean",
"ignoreBody",
")",
"throws",
"IOException",
"{",
"HttpURLConnection",
"conn",
"=",
"(",
"HttpURLConnection",
")",
"url",
".",
"openConnection",
"(",
")",
";",
"setRequestProperties",
"(",
"requestProps",
",",
"conn",
",",
"timeout",
")",
";",
"sendPostData",
"(",
"conn",
",",
"encodedData",
")",
";",
"return",
"parseHttpResponse",
"(",
"conn",
",",
"includeHeaders",
",",
"ignoreBody",
")",
";",
"}"
] | Do a http post request and return response
@param url target url
@param requestProps props to be requested
@param timeout connection timeout
@param includeHeaders whether to include headers or not
@param ignoreBody whether to ignore body content or not
@return server answer
@throws IOException on any connection | [
"Do",
"a",
"http",
"post",
"request",
"and",
"return",
"response"
] | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-plugins/src/main/java/it/jnrpe/plugin/utils/HttpUtils.java#L80-L86 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.listClosedLists | public List<ClosedListEntityExtractor> listClosedLists(UUID appId, String versionId, ListClosedListsOptionalParameter listClosedListsOptionalParameter) {
"""
Gets information about the closedlist models.
@param appId The application ID.
@param versionId The version ID.
@param listClosedListsOptionalParameter the object representing the optional parameters to be set before calling this API
@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 List<ClosedListEntityExtractor> object if successful.
"""
return listClosedListsWithServiceResponseAsync(appId, versionId, listClosedListsOptionalParameter).toBlocking().single().body();
} | java | public List<ClosedListEntityExtractor> listClosedLists(UUID appId, String versionId, ListClosedListsOptionalParameter listClosedListsOptionalParameter) {
return listClosedListsWithServiceResponseAsync(appId, versionId, listClosedListsOptionalParameter).toBlocking().single().body();
} | [
"public",
"List",
"<",
"ClosedListEntityExtractor",
">",
"listClosedLists",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"ListClosedListsOptionalParameter",
"listClosedListsOptionalParameter",
")",
"{",
"return",
"listClosedListsWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"listClosedListsOptionalParameter",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Gets information about the closedlist models.
@param appId The application ID.
@param versionId The version ID.
@param listClosedListsOptionalParameter the object representing the optional parameters to be set before calling this API
@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 List<ClosedListEntityExtractor> object if successful. | [
"Gets",
"information",
"about",
"the",
"closedlist",
"models",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L1821-L1823 |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java | StreamUtils.copyReaderToWriter | public static void copyReaderToWriter( Reader input, Writer output, boolean close )
throws IOException {
"""
Copies the Reader to the Writer.
@param input The input characters.
@param output The destination of the characters.
@param close true if the reader and writer should be closed after the operation is completed.
@throws IOException If an underlying I/O problem occured.
"""
try
{
BufferedReader in = bufferInput( input );
BufferedWriter out = bufferOutput( output );
int ch = in.read();
while( ch != -1 )
{
out.write( ch );
ch = in.read();
}
out.flush();
out.close();
}
finally
{
if( close )
{
input.close();
output.close();
}
}
} | java | public static void copyReaderToWriter( Reader input, Writer output, boolean close )
throws IOException
{
try
{
BufferedReader in = bufferInput( input );
BufferedWriter out = bufferOutput( output );
int ch = in.read();
while( ch != -1 )
{
out.write( ch );
ch = in.read();
}
out.flush();
out.close();
}
finally
{
if( close )
{
input.close();
output.close();
}
}
} | [
"public",
"static",
"void",
"copyReaderToWriter",
"(",
"Reader",
"input",
",",
"Writer",
"output",
",",
"boolean",
"close",
")",
"throws",
"IOException",
"{",
"try",
"{",
"BufferedReader",
"in",
"=",
"bufferInput",
"(",
"input",
")",
";",
"BufferedWriter",
"out",
"=",
"bufferOutput",
"(",
"output",
")",
";",
"int",
"ch",
"=",
"in",
".",
"read",
"(",
")",
";",
"while",
"(",
"ch",
"!=",
"-",
"1",
")",
"{",
"out",
".",
"write",
"(",
"ch",
")",
";",
"ch",
"=",
"in",
".",
"read",
"(",
")",
";",
"}",
"out",
".",
"flush",
"(",
")",
";",
"out",
".",
"close",
"(",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"close",
")",
"{",
"input",
".",
"close",
"(",
")",
";",
"output",
".",
"close",
"(",
")",
";",
"}",
"}",
"}"
] | Copies the Reader to the Writer.
@param input The input characters.
@param output The destination of the characters.
@param close true if the reader and writer should be closed after the operation is completed.
@throws IOException If an underlying I/O problem occured. | [
"Copies",
"the",
"Reader",
"to",
"the",
"Writer",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L204-L228 |
virgo47/javasimon | core/src/main/java/org/javasimon/utils/SimonUtils.java | SimonUtils.compact | public static String compact(String input, int limitTo) {
"""
Shrinks the middle of the input string if it is too long, so it does not exceed limitTo.
@since 3.2
"""
if (input == null || input.length() <= limitTo) {
return input;
}
int headLength = limitTo / 2;
int tailLength = limitTo - SHRINKED_STRING.length() - headLength;
if (tailLength < 0) {
tailLength = 1;
}
return input.substring(0, headLength) + SHRINKED_STRING + input.substring(input.length() - tailLength);
} | java | public static String compact(String input, int limitTo) {
if (input == null || input.length() <= limitTo) {
return input;
}
int headLength = limitTo / 2;
int tailLength = limitTo - SHRINKED_STRING.length() - headLength;
if (tailLength < 0) {
tailLength = 1;
}
return input.substring(0, headLength) + SHRINKED_STRING + input.substring(input.length() - tailLength);
} | [
"public",
"static",
"String",
"compact",
"(",
"String",
"input",
",",
"int",
"limitTo",
")",
"{",
"if",
"(",
"input",
"==",
"null",
"||",
"input",
".",
"length",
"(",
")",
"<=",
"limitTo",
")",
"{",
"return",
"input",
";",
"}",
"int",
"headLength",
"=",
"limitTo",
"/",
"2",
";",
"int",
"tailLength",
"=",
"limitTo",
"-",
"SHRINKED_STRING",
".",
"length",
"(",
")",
"-",
"headLength",
";",
"if",
"(",
"tailLength",
"<",
"0",
")",
"{",
"tailLength",
"=",
"1",
";",
"}",
"return",
"input",
".",
"substring",
"(",
"0",
",",
"headLength",
")",
"+",
"SHRINKED_STRING",
"+",
"input",
".",
"substring",
"(",
"input",
".",
"length",
"(",
")",
"-",
"tailLength",
")",
";",
"}"
] | Shrinks the middle of the input string if it is too long, so it does not exceed limitTo.
@since 3.2 | [
"Shrinks",
"the",
"middle",
"of",
"the",
"input",
"string",
"if",
"it",
"is",
"too",
"long",
"so",
"it",
"does",
"not",
"exceed",
"limitTo",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/SimonUtils.java#L371-L383 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/collect/Iterables.java | Iterables.getLast | @Nullable
public static <T> T getLast(Iterable<? extends T> iterable, @Nullable T defaultValue) {
"""
Returns the last element of {@code iterable} or {@code defaultValue} if
the iterable is empty. If {@code iterable} is a {@link List} with
{@link RandomAccess} support, then this operation is guaranteed to be {@code O(1)}.
@param defaultValue the value to return if {@code iterable} is empty
@return the last element of {@code iterable} or the default value
@since 3.0
"""
if (iterable instanceof Collection) {
Collection<? extends T> c = Collections2.cast(iterable);
if (c.isEmpty()) {
return defaultValue;
} else if (iterable instanceof List) {
return getLastInNonemptyList(Lists.cast(iterable));
}
}
return Iterators.getLast(iterable.iterator(), defaultValue);
} | java | @Nullable
public static <T> T getLast(Iterable<? extends T> iterable, @Nullable T defaultValue) {
if (iterable instanceof Collection) {
Collection<? extends T> c = Collections2.cast(iterable);
if (c.isEmpty()) {
return defaultValue;
} else if (iterable instanceof List) {
return getLastInNonemptyList(Lists.cast(iterable));
}
}
return Iterators.getLast(iterable.iterator(), defaultValue);
} | [
"@",
"Nullable",
"public",
"static",
"<",
"T",
">",
"T",
"getLast",
"(",
"Iterable",
"<",
"?",
"extends",
"T",
">",
"iterable",
",",
"@",
"Nullable",
"T",
"defaultValue",
")",
"{",
"if",
"(",
"iterable",
"instanceof",
"Collection",
")",
"{",
"Collection",
"<",
"?",
"extends",
"T",
">",
"c",
"=",
"Collections2",
".",
"cast",
"(",
"iterable",
")",
";",
"if",
"(",
"c",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"defaultValue",
";",
"}",
"else",
"if",
"(",
"iterable",
"instanceof",
"List",
")",
"{",
"return",
"getLastInNonemptyList",
"(",
"Lists",
".",
"cast",
"(",
"iterable",
")",
")",
";",
"}",
"}",
"return",
"Iterators",
".",
"getLast",
"(",
"iterable",
".",
"iterator",
"(",
")",
",",
"defaultValue",
")",
";",
"}"
] | Returns the last element of {@code iterable} or {@code defaultValue} if
the iterable is empty. If {@code iterable} is a {@link List} with
{@link RandomAccess} support, then this operation is guaranteed to be {@code O(1)}.
@param defaultValue the value to return if {@code iterable} is empty
@return the last element of {@code iterable} or the default value
@since 3.0 | [
"Returns",
"the",
"last",
"element",
"of",
"{",
"@code",
"iterable",
"}",
"or",
"{",
"@code",
"defaultValue",
"}",
"if",
"the",
"iterable",
"is",
"empty",
".",
"If",
"{",
"@code",
"iterable",
"}",
"is",
"a",
"{",
"@link",
"List",
"}",
"with",
"{",
"@link",
"RandomAccess",
"}",
"support",
"then",
"this",
"operation",
"is",
"guaranteed",
"to",
"be",
"{",
"@code",
"O",
"(",
"1",
")",
"}",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/Iterables.java#L785-L797 |
knowm/Datasets | datasets-hja-birdsong/src/main/java/com/musicg/wave/SpectrogramRender.java | SpectrogramRender.renderSpectrogram | public BufferedImage renderSpectrogram(Spectrogram spectrogram) {
"""
Render a spectrogram of a wave file
@param spectrogram spectrogram object
"""
double[][] spectrogramData = spectrogram.getNormalizedSpectrogramData();
int width = spectrogramData.length;
int height = spectrogramData[0].length;
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
int value;
value = (int) (spectrogramData[i][j] * 255);
bufferedImage.setRGB(i, j, value << 16 | value << 8 | value);
}
}
return bufferedImage;
} | java | public BufferedImage renderSpectrogram(Spectrogram spectrogram) {
double[][] spectrogramData = spectrogram.getNormalizedSpectrogramData();
int width = spectrogramData.length;
int height = spectrogramData[0].length;
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
int value;
value = (int) (spectrogramData[i][j] * 255);
bufferedImage.setRGB(i, j, value << 16 | value << 8 | value);
}
}
return bufferedImage;
} | [
"public",
"BufferedImage",
"renderSpectrogram",
"(",
"Spectrogram",
"spectrogram",
")",
"{",
"double",
"[",
"]",
"[",
"]",
"spectrogramData",
"=",
"spectrogram",
".",
"getNormalizedSpectrogramData",
"(",
")",
";",
"int",
"width",
"=",
"spectrogramData",
".",
"length",
";",
"int",
"height",
"=",
"spectrogramData",
"[",
"0",
"]",
".",
"length",
";",
"BufferedImage",
"bufferedImage",
"=",
"new",
"BufferedImage",
"(",
"width",
",",
"height",
",",
"BufferedImage",
".",
"TYPE_INT_RGB",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"width",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"height",
";",
"j",
"++",
")",
"{",
"int",
"value",
";",
"value",
"=",
"(",
"int",
")",
"(",
"spectrogramData",
"[",
"i",
"]",
"[",
"j",
"]",
"*",
"255",
")",
";",
"bufferedImage",
".",
"setRGB",
"(",
"i",
",",
"j",
",",
"value",
"<<",
"16",
"|",
"value",
"<<",
"8",
"|",
"value",
")",
";",
"}",
"}",
"return",
"bufferedImage",
";",
"}"
] | Render a spectrogram of a wave file
@param spectrogram spectrogram object | [
"Render",
"a",
"spectrogram",
"of",
"a",
"wave",
"file"
] | train | https://github.com/knowm/Datasets/blob/4ea16ccda1d4190a551accff78bbbe05c9c38c79/datasets-hja-birdsong/src/main/java/com/musicg/wave/SpectrogramRender.java#L32-L50 |
square/okhttp | samples/slack/src/main/java/okhttp3/slack/SlackClient.java | SlackClient.requestOauthSession | public void requestOauthSession(String scopes, String team) throws Exception {
"""
Shows a browser URL to authorize this app to act as this user.
"""
if (sessionFactory == null) {
sessionFactory = new OAuthSessionFactory(slackApi);
sessionFactory.start();
}
HttpUrl authorizeUrl = sessionFactory.newAuthorizeUrl(scopes, team, session -> {
initOauthSession(session);
System.out.printf("session granted: %s\n", session);
});
System.out.printf("open this URL in a browser: %s\n", authorizeUrl);
} | java | public void requestOauthSession(String scopes, String team) throws Exception {
if (sessionFactory == null) {
sessionFactory = new OAuthSessionFactory(slackApi);
sessionFactory.start();
}
HttpUrl authorizeUrl = sessionFactory.newAuthorizeUrl(scopes, team, session -> {
initOauthSession(session);
System.out.printf("session granted: %s\n", session);
});
System.out.printf("open this URL in a browser: %s\n", authorizeUrl);
} | [
"public",
"void",
"requestOauthSession",
"(",
"String",
"scopes",
",",
"String",
"team",
")",
"throws",
"Exception",
"{",
"if",
"(",
"sessionFactory",
"==",
"null",
")",
"{",
"sessionFactory",
"=",
"new",
"OAuthSessionFactory",
"(",
"slackApi",
")",
";",
"sessionFactory",
".",
"start",
"(",
")",
";",
"}",
"HttpUrl",
"authorizeUrl",
"=",
"sessionFactory",
".",
"newAuthorizeUrl",
"(",
"scopes",
",",
"team",
",",
"session",
"->",
"{",
"initOauthSession",
"(",
"session",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"session granted: %s\\n\"",
",",
"session",
")",
";",
"}",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"open this URL in a browser: %s\\n\"",
",",
"authorizeUrl",
")",
";",
"}"
] | Shows a browser URL to authorize this app to act as this user. | [
"Shows",
"a",
"browser",
"URL",
"to",
"authorize",
"this",
"app",
"to",
"act",
"as",
"this",
"user",
"."
] | train | https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/samples/slack/src/main/java/okhttp3/slack/SlackClient.java#L36-L48 |
powermock/powermock | powermock-modules/powermock-module-javaagent/src/main/java/sun/tools/attach/HotSpotVirtualMachine.java | HotSpotVirtualMachine.loadAgent | @Override
public void loadAgent(String agent, String options)
throws AgentLoadException, AgentInitializationException, IOException {
"""
/*
Load JPLIS agent which will load the agent JAR file and invoke
the agentmain method.
"""
String args = agent;
if (options != null) {
args = args + "=" + options;
}
try {
loadAgentLibrary("instrument", args);
} catch (AgentLoadException x) {
throw new InternalError("instrument library is missing in target VM");
} catch (AgentInitializationException x) {
/*
* Translate interesting errors into the right exception and
* message (FIXME: create a better interface to the instrument
* implementation so this isn't necessary)
*/
int rc = x.returnValue();
switch (rc) {
case JNI_ENOMEM:
throw new AgentLoadException("Insuffient memory");
case ATTACH_ERROR_BADJAR:
throw new AgentLoadException("Agent JAR not found or no Agent-Class attribute");
case ATTACH_ERROR_NOTONCP:
throw new AgentLoadException("Unable to add JAR file to system class path");
case ATTACH_ERROR_STARTFAIL:
throw new AgentInitializationException("Agent JAR loaded but agent failed to initialize");
default :
throw new AgentLoadException("Failed to load agent - unknown reason: " + rc);
}
}
} | java | @Override
public void loadAgent(String agent, String options)
throws AgentLoadException, AgentInitializationException, IOException
{
String args = agent;
if (options != null) {
args = args + "=" + options;
}
try {
loadAgentLibrary("instrument", args);
} catch (AgentLoadException x) {
throw new InternalError("instrument library is missing in target VM");
} catch (AgentInitializationException x) {
/*
* Translate interesting errors into the right exception and
* message (FIXME: create a better interface to the instrument
* implementation so this isn't necessary)
*/
int rc = x.returnValue();
switch (rc) {
case JNI_ENOMEM:
throw new AgentLoadException("Insuffient memory");
case ATTACH_ERROR_BADJAR:
throw new AgentLoadException("Agent JAR not found or no Agent-Class attribute");
case ATTACH_ERROR_NOTONCP:
throw new AgentLoadException("Unable to add JAR file to system class path");
case ATTACH_ERROR_STARTFAIL:
throw new AgentInitializationException("Agent JAR loaded but agent failed to initialize");
default :
throw new AgentLoadException("Failed to load agent - unknown reason: " + rc);
}
}
} | [
"@",
"Override",
"public",
"void",
"loadAgent",
"(",
"String",
"agent",
",",
"String",
"options",
")",
"throws",
"AgentLoadException",
",",
"AgentInitializationException",
",",
"IOException",
"{",
"String",
"args",
"=",
"agent",
";",
"if",
"(",
"options",
"!=",
"null",
")",
"{",
"args",
"=",
"args",
"+",
"\"=\"",
"+",
"options",
";",
"}",
"try",
"{",
"loadAgentLibrary",
"(",
"\"instrument\"",
",",
"args",
")",
";",
"}",
"catch",
"(",
"AgentLoadException",
"x",
")",
"{",
"throw",
"new",
"InternalError",
"(",
"\"instrument library is missing in target VM\"",
")",
";",
"}",
"catch",
"(",
"AgentInitializationException",
"x",
")",
"{",
"/*\n * Translate interesting errors into the right exception and\n * message (FIXME: create a better interface to the instrument\n * implementation so this isn't necessary)\n */",
"int",
"rc",
"=",
"x",
".",
"returnValue",
"(",
")",
";",
"switch",
"(",
"rc",
")",
"{",
"case",
"JNI_ENOMEM",
":",
"throw",
"new",
"AgentLoadException",
"(",
"\"Insuffient memory\"",
")",
";",
"case",
"ATTACH_ERROR_BADJAR",
":",
"throw",
"new",
"AgentLoadException",
"(",
"\"Agent JAR not found or no Agent-Class attribute\"",
")",
";",
"case",
"ATTACH_ERROR_NOTONCP",
":",
"throw",
"new",
"AgentLoadException",
"(",
"\"Unable to add JAR file to system class path\"",
")",
";",
"case",
"ATTACH_ERROR_STARTFAIL",
":",
"throw",
"new",
"AgentInitializationException",
"(",
"\"Agent JAR loaded but agent failed to initialize\"",
")",
";",
"default",
":",
"throw",
"new",
"AgentLoadException",
"(",
"\"Failed to load agent - unknown reason: \"",
"+",
"rc",
")",
";",
"}",
"}",
"}"
] | /*
Load JPLIS agent which will load the agent JAR file and invoke
the agentmain method. | [
"/",
"*",
"Load",
"JPLIS",
"agent",
"which",
"will",
"load",
"the",
"agent",
"JAR",
"file",
"and",
"invoke",
"the",
"agentmain",
"method",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-modules/powermock-module-javaagent/src/main/java/sun/tools/attach/HotSpotVirtualMachine.java#L96-L128 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/headerfooter/RtfHeaderFooterGroup.java | RtfHeaderFooterGroup.setHasTitlePage | public void setHasTitlePage() {
"""
Set that this RtfHeaderFooterGroup should have a title page. If only
a header / footer for all pages exists, then it will be copied to the
first page as well.
"""
if(this.mode == MODE_SINGLE) {
this.mode = MODE_MULTIPLE;
headerFirst = new RtfHeaderFooter(this.document, headerAll, RtfHeaderFooter.DISPLAY_FIRST_PAGE);
headerFirst.setType(this.type);
}
} | java | public void setHasTitlePage() {
if(this.mode == MODE_SINGLE) {
this.mode = MODE_MULTIPLE;
headerFirst = new RtfHeaderFooter(this.document, headerAll, RtfHeaderFooter.DISPLAY_FIRST_PAGE);
headerFirst.setType(this.type);
}
} | [
"public",
"void",
"setHasTitlePage",
"(",
")",
"{",
"if",
"(",
"this",
".",
"mode",
"==",
"MODE_SINGLE",
")",
"{",
"this",
".",
"mode",
"=",
"MODE_MULTIPLE",
";",
"headerFirst",
"=",
"new",
"RtfHeaderFooter",
"(",
"this",
".",
"document",
",",
"headerAll",
",",
"RtfHeaderFooter",
".",
"DISPLAY_FIRST_PAGE",
")",
";",
"headerFirst",
".",
"setType",
"(",
"this",
".",
"type",
")",
";",
"}",
"}"
] | Set that this RtfHeaderFooterGroup should have a title page. If only
a header / footer for all pages exists, then it will be copied to the
first page as well. | [
"Set",
"that",
"this",
"RtfHeaderFooterGroup",
"should",
"have",
"a",
"title",
"page",
".",
"If",
"only",
"a",
"header",
"/",
"footer",
"for",
"all",
"pages",
"exists",
"then",
"it",
"will",
"be",
"copied",
"to",
"the",
"first",
"page",
"as",
"well",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/headerfooter/RtfHeaderFooterGroup.java#L297-L303 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ProjectApi.java | ProjectApi.getMember | public Member getMember(Object projectIdOrPath, Integer userId) throws GitLabApiException {
"""
Gets a project team member.
<pre><code>GET /projects/:id/members/:user_id</code></pre>
@param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param userId the user ID of the member
@return the member specified by the project ID/user ID pair
@throws GitLabApiException if any exception occurs
"""
Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "members", userId);
return (response.readEntity(Member.class));
} | java | public Member getMember(Object projectIdOrPath, Integer userId) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "members", userId);
return (response.readEntity(Member.class));
} | [
"public",
"Member",
"getMember",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"userId",
")",
"throws",
"GitLabApiException",
"{",
"Response",
"response",
"=",
"get",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
"null",
",",
"\"projects\"",
",",
"getProjectIdOrPath",
"(",
"projectIdOrPath",
")",
",",
"\"members\"",
",",
"userId",
")",
";",
"return",
"(",
"response",
".",
"readEntity",
"(",
"Member",
".",
"class",
")",
")",
";",
"}"
] | Gets a project team member.
<pre><code>GET /projects/:id/members/:user_id</code></pre>
@param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param userId the user ID of the member
@return the member specified by the project ID/user ID pair
@throws GitLabApiException if any exception occurs | [
"Gets",
"a",
"project",
"team",
"member",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L1226-L1229 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.enumTemplate | public static <T extends Enum<T>> EnumTemplate<T> enumTemplate(Class<? extends T> cl, String template, List<?> args) {
"""
Create a new Template expression
@param cl type of expression
@param template template
@param args template parameters
@return template expression
"""
return enumTemplate(cl, createTemplate(template), args);
} | java | public static <T extends Enum<T>> EnumTemplate<T> enumTemplate(Class<? extends T> cl, String template, List<?> args) {
return enumTemplate(cl, createTemplate(template), args);
} | [
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"EnumTemplate",
"<",
"T",
">",
"enumTemplate",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"cl",
",",
"String",
"template",
",",
"List",
"<",
"?",
">",
"args",
")",
"{",
"return",
"enumTemplate",
"(",
"cl",
",",
"createTemplate",
"(",
"template",
")",
",",
"args",
")",
";",
"}"
] | Create a new Template expression
@param cl type of expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L754-L756 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/EntityNameHelper.java | EntityNameHelper.formatRulePath | public static String formatRulePath(String topicPath, String subscriptionName, String ruleName) {
"""
Formats the rule path, based on the topic path, subscription name and the rule name.
@param topicPath - The name of the topic, including slashes.
@param subscriptionName - The name of the subscription.
@param ruleName - The name of the rule.
@return The path of the rule
"""
return String.join(pathDelimiter,
topicPath,
subscriptionsSubPath,
subscriptionName,
rulesSubPath,
ruleName);
} | java | public static String formatRulePath(String topicPath, String subscriptionName, String ruleName) {
return String.join(pathDelimiter,
topicPath,
subscriptionsSubPath,
subscriptionName,
rulesSubPath,
ruleName);
} | [
"public",
"static",
"String",
"formatRulePath",
"(",
"String",
"topicPath",
",",
"String",
"subscriptionName",
",",
"String",
"ruleName",
")",
"{",
"return",
"String",
".",
"join",
"(",
"pathDelimiter",
",",
"topicPath",
",",
"subscriptionsSubPath",
",",
"subscriptionName",
",",
"rulesSubPath",
",",
"ruleName",
")",
";",
"}"
] | Formats the rule path, based on the topic path, subscription name and the rule name.
@param topicPath - The name of the topic, including slashes.
@param subscriptionName - The name of the subscription.
@param ruleName - The name of the rule.
@return The path of the rule | [
"Formats",
"the",
"rule",
"path",
"based",
"on",
"the",
"topic",
"path",
"subscription",
"name",
"and",
"the",
"rule",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/EntityNameHelper.java#L42-L49 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.booleanTemplate | public static BooleanTemplate booleanTemplate(Template template, Object... args) {
"""
Create a new Template expression
@param template template
@param args template parameters
@return template expression
"""
return booleanTemplate(template, ImmutableList.copyOf(args));
} | java | public static BooleanTemplate booleanTemplate(Template template, Object... args) {
return booleanTemplate(template, ImmutableList.copyOf(args));
} | [
"public",
"static",
"BooleanTemplate",
"booleanTemplate",
"(",
"Template",
"template",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"booleanTemplate",
"(",
"template",
",",
"ImmutableList",
".",
"copyOf",
"(",
"args",
")",
")",
";",
"}"
] | Create a new Template expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L996-L998 |
lessthanoptimal/BoofCV | main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java | SelfCalibrationGuessAndCheckFocus.setSampling | public void setSampling( double min , double max , int total ) {
"""
Specifies how focal lengths are sampled on a log scale. Remember 1.0 = nominal length
@param min min value. 0.3 is default
@param max max value. 3.0 is default
@param total Number of sample points. 50 is default
"""
this.sampleMin = min;
this.sampleMax = max;
this.numSamples = total;
this.scores = new double[numSamples];
} | java | public void setSampling( double min , double max , int total ) {
this.sampleMin = min;
this.sampleMax = max;
this.numSamples = total;
this.scores = new double[numSamples];
} | [
"public",
"void",
"setSampling",
"(",
"double",
"min",
",",
"double",
"max",
",",
"int",
"total",
")",
"{",
"this",
".",
"sampleMin",
"=",
"min",
";",
"this",
".",
"sampleMax",
"=",
"max",
";",
"this",
".",
"numSamples",
"=",
"total",
";",
"this",
".",
"scores",
"=",
"new",
"double",
"[",
"numSamples",
"]",
";",
"}"
] | Specifies how focal lengths are sampled on a log scale. Remember 1.0 = nominal length
@param min min value. 0.3 is default
@param max max value. 3.0 is default
@param total Number of sample points. 50 is default | [
"Specifies",
"how",
"focal",
"lengths",
"are",
"sampled",
"on",
"a",
"log",
"scale",
".",
"Remember",
"1",
".",
"0",
"=",
"nominal",
"length"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java#L154-L159 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/util/ThreeDHashMap.java | ThreeDHashMap.size | public int size(final K1 firstKey, final K2 secondKey) {
"""
Returns the number of key-value mappings in this map for the third key.
@param firstKey
the first key
@param secondKey
the second key
@return Returns the number of key-value mappings in this map for the third key.
"""
// existence check on inner map
final HashMap<K2, HashMap<K3, V>> innerMap1 = map.get(firstKey);
if( innerMap1 == null ) {
return 0;
}
// existence check on inner map1
final HashMap<K3, V> innerMap2 = innerMap1.get(secondKey);
if( innerMap2 == null ) {
return 0;
}
return innerMap2.size();
} | java | public int size(final K1 firstKey, final K2 secondKey) {
// existence check on inner map
final HashMap<K2, HashMap<K3, V>> innerMap1 = map.get(firstKey);
if( innerMap1 == null ) {
return 0;
}
// existence check on inner map1
final HashMap<K3, V> innerMap2 = innerMap1.get(secondKey);
if( innerMap2 == null ) {
return 0;
}
return innerMap2.size();
} | [
"public",
"int",
"size",
"(",
"final",
"K1",
"firstKey",
",",
"final",
"K2",
"secondKey",
")",
"{",
"// existence check on inner map",
"final",
"HashMap",
"<",
"K2",
",",
"HashMap",
"<",
"K3",
",",
"V",
">",
">",
"innerMap1",
"=",
"map",
".",
"get",
"(",
"firstKey",
")",
";",
"if",
"(",
"innerMap1",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"// existence check on inner map1",
"final",
"HashMap",
"<",
"K3",
",",
"V",
">",
"innerMap2",
"=",
"innerMap1",
".",
"get",
"(",
"secondKey",
")",
";",
"if",
"(",
"innerMap2",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"return",
"innerMap2",
".",
"size",
"(",
")",
";",
"}"
] | Returns the number of key-value mappings in this map for the third key.
@param firstKey
the first key
@param secondKey
the second key
@return Returns the number of key-value mappings in this map for the third key. | [
"Returns",
"the",
"number",
"of",
"key",
"-",
"value",
"mappings",
"in",
"this",
"map",
"for",
"the",
"third",
"key",
"."
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/ThreeDHashMap.java#L226-L239 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/TerminalTextUtils.java | TerminalTextUtils.getStringCharacterIndex | public static int getStringCharacterIndex(String s, int columnIndex) {
"""
This method does the reverse of getColumnIndex, given a String and imagining it has been printed out to the
top-left corner of a terminal, in the column specified by {@code columnIndex}, what is the index of that
character in the string. If the string contains no CJK characters, this will always be the same as
{@code columnIndex}. If the index specified is the right column of a CJK character, the index is the same as if
the column was the left column. So calling {@code getStringCharacterIndex("英", 0)} and
{@code getStringCharacterIndex("英", 1)} will both return 0.
@param s String to translate the index to
@param columnIndex Column index of the string written to a terminal
@return The index in the string of the character in terminal column {@code columnIndex}
"""
int index = 0;
int counter = 0;
while(counter < columnIndex) {
if(isCharCJK(s.charAt(index++))) {
counter++;
if(counter == columnIndex) {
return index - 1;
}
}
counter++;
}
return index;
} | java | public static int getStringCharacterIndex(String s, int columnIndex) {
int index = 0;
int counter = 0;
while(counter < columnIndex) {
if(isCharCJK(s.charAt(index++))) {
counter++;
if(counter == columnIndex) {
return index - 1;
}
}
counter++;
}
return index;
} | [
"public",
"static",
"int",
"getStringCharacterIndex",
"(",
"String",
"s",
",",
"int",
"columnIndex",
")",
"{",
"int",
"index",
"=",
"0",
";",
"int",
"counter",
"=",
"0",
";",
"while",
"(",
"counter",
"<",
"columnIndex",
")",
"{",
"if",
"(",
"isCharCJK",
"(",
"s",
".",
"charAt",
"(",
"index",
"++",
")",
")",
")",
"{",
"counter",
"++",
";",
"if",
"(",
"counter",
"==",
"columnIndex",
")",
"{",
"return",
"index",
"-",
"1",
";",
"}",
"}",
"counter",
"++",
";",
"}",
"return",
"index",
";",
"}"
] | This method does the reverse of getColumnIndex, given a String and imagining it has been printed out to the
top-left corner of a terminal, in the column specified by {@code columnIndex}, what is the index of that
character in the string. If the string contains no CJK characters, this will always be the same as
{@code columnIndex}. If the index specified is the right column of a CJK character, the index is the same as if
the column was the left column. So calling {@code getStringCharacterIndex("英", 0)} and
{@code getStringCharacterIndex("英", 1)} will both return 0.
@param s String to translate the index to
@param columnIndex Column index of the string written to a terminal
@return The index in the string of the character in terminal column {@code columnIndex} | [
"This",
"method",
"does",
"the",
"reverse",
"of",
"getColumnIndex",
"given",
"a",
"String",
"and",
"imagining",
"it",
"has",
"been",
"printed",
"out",
"to",
"the",
"top",
"-",
"left",
"corner",
"of",
"a",
"terminal",
"in",
"the",
"column",
"specified",
"by",
"{"
] | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/TerminalTextUtils.java#L226-L239 |
playn/playn | core/src/playn/core/Platform.java | Platform.dispatchEvent | public <E> void dispatchEvent (Signal<E> signal, E event) {
"""
Dispatches {@code event} on {@code signal} and catches any error that propagates out of the
event dispatch, reporting it via {@link #reportError}.
"""
try {
signal.emit(event);
} catch (Throwable cause) {
reportError("Event dispatch failure", cause);
}
} | java | public <E> void dispatchEvent (Signal<E> signal, E event) {
try {
signal.emit(event);
} catch (Throwable cause) {
reportError("Event dispatch failure", cause);
}
} | [
"public",
"<",
"E",
">",
"void",
"dispatchEvent",
"(",
"Signal",
"<",
"E",
">",
"signal",
",",
"E",
"event",
")",
"{",
"try",
"{",
"signal",
".",
"emit",
"(",
"event",
")",
";",
"}",
"catch",
"(",
"Throwable",
"cause",
")",
"{",
"reportError",
"(",
"\"Event dispatch failure\"",
",",
"cause",
")",
";",
"}",
"}"
] | Dispatches {@code event} on {@code signal} and catches any error that propagates out of the
event dispatch, reporting it via {@link #reportError}. | [
"Dispatches",
"{"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Platform.java#L108-L114 |
ansell/restlet-utils | src/main/java/com/github/ansell/restletutils/FixedRedirectCookieAuthenticator.java | FixedRedirectCookieAuthenticator.getCredentialsCookie | protected CookieSetting getCredentialsCookie(final Request request, final Response response) {
"""
Returns the credentials cookie setting. It first try to find an existing cookie. If
necessary, it creates a new one.
@param request
The current request.
@param response
The current response.
@return The credentials cookie setting.
"""
CookieSetting credentialsCookie = response.getCookieSettings().getFirst(this.getCookieName());
if(credentialsCookie == null)
{
credentialsCookie = new CookieSetting(this.getCookieName(), null);
credentialsCookie.setAccessRestricted(true);
// authCookie.setVersion(1);
if(request.getRootRef() != null)
{
final String p = request.getRootRef().getPath();
credentialsCookie.setPath(p == null ? "/" : p);
}
else
{
// authCookie.setPath("/");
}
response.getCookieSettings().add(credentialsCookie);
}
return credentialsCookie;
} | java | protected CookieSetting getCredentialsCookie(final Request request, final Response response)
{
CookieSetting credentialsCookie = response.getCookieSettings().getFirst(this.getCookieName());
if(credentialsCookie == null)
{
credentialsCookie = new CookieSetting(this.getCookieName(), null);
credentialsCookie.setAccessRestricted(true);
// authCookie.setVersion(1);
if(request.getRootRef() != null)
{
final String p = request.getRootRef().getPath();
credentialsCookie.setPath(p == null ? "/" : p);
}
else
{
// authCookie.setPath("/");
}
response.getCookieSettings().add(credentialsCookie);
}
return credentialsCookie;
} | [
"protected",
"CookieSetting",
"getCredentialsCookie",
"(",
"final",
"Request",
"request",
",",
"final",
"Response",
"response",
")",
"{",
"CookieSetting",
"credentialsCookie",
"=",
"response",
".",
"getCookieSettings",
"(",
")",
".",
"getFirst",
"(",
"this",
".",
"getCookieName",
"(",
")",
")",
";",
"if",
"(",
"credentialsCookie",
"==",
"null",
")",
"{",
"credentialsCookie",
"=",
"new",
"CookieSetting",
"(",
"this",
".",
"getCookieName",
"(",
")",
",",
"null",
")",
";",
"credentialsCookie",
".",
"setAccessRestricted",
"(",
"true",
")",
";",
"// authCookie.setVersion(1);",
"if",
"(",
"request",
".",
"getRootRef",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"String",
"p",
"=",
"request",
".",
"getRootRef",
"(",
")",
".",
"getPath",
"(",
")",
";",
"credentialsCookie",
".",
"setPath",
"(",
"p",
"==",
"null",
"?",
"\"/\"",
":",
"p",
")",
";",
"}",
"else",
"{",
"// authCookie.setPath(\"/\");",
"}",
"response",
".",
"getCookieSettings",
"(",
")",
".",
"add",
"(",
"credentialsCookie",
")",
";",
"}",
"return",
"credentialsCookie",
";",
"}"
] | Returns the credentials cookie setting. It first try to find an existing cookie. If
necessary, it creates a new one.
@param request
The current request.
@param response
The current response.
@return The credentials cookie setting. | [
"Returns",
"the",
"credentials",
"cookie",
"setting",
".",
"It",
"first",
"try",
"to",
"find",
"an",
"existing",
"cookie",
".",
"If",
"necessary",
"it",
"creates",
"a",
"new",
"one",
"."
] | train | https://github.com/ansell/restlet-utils/blob/6c39a3e91aa8295936af1dbfccd6ba27230c40a9/src/main/java/com/github/ansell/restletutils/FixedRedirectCookieAuthenticator.java#L432-L456 |
Waikato/moa | moa/src/main/java/moa/classifiers/core/attributeclassobservers/FIMTDDNumericAttributeClassObserver.java | FIMTDDNumericAttributeClassObserver.removeBadSplitNodes | private boolean removeBadSplitNodes(SplitCriterion criterion, Node currentNode, double lastCheckRatio, double lastCheckSDR, double lastCheckE) {
"""
Recursive method that first checks all of a node's children before
deciding if it is 'bad' and may be removed
"""
boolean isBad = false;
if (currentNode == null) {
return true;
}
if (currentNode.left != null) {
isBad = removeBadSplitNodes(criterion, currentNode.left, lastCheckRatio, lastCheckSDR, lastCheckE);
}
if (currentNode.right != null && isBad) {
isBad = removeBadSplitNodes(criterion, currentNode.left, lastCheckRatio, lastCheckSDR, lastCheckE);
}
if (isBad) {
double[][] postSplitDists = new double[][]{{currentNode.leftStatistics.getValue(0), currentNode.leftStatistics.getValue(1), currentNode.leftStatistics.getValue(2)}, {currentNode.rightStatistics.getValue(0), currentNode.rightStatistics.getValue(1), currentNode.rightStatistics.getValue(2)}};
double[] preSplitDist = new double[]{(currentNode.leftStatistics.getValue(0) + currentNode.rightStatistics.getValue(0)), (currentNode.leftStatistics.getValue(1) + currentNode.rightStatistics.getValue(1)), (currentNode.leftStatistics.getValue(2) + currentNode.rightStatistics.getValue(2))};
double merit = criterion.getMeritOfSplit(preSplitDist, postSplitDists);
if ((merit / lastCheckSDR) < (lastCheckRatio - (2 * lastCheckE))) {
currentNode = null;
return true;
}
}
return false;
} | java | private boolean removeBadSplitNodes(SplitCriterion criterion, Node currentNode, double lastCheckRatio, double lastCheckSDR, double lastCheckE) {
boolean isBad = false;
if (currentNode == null) {
return true;
}
if (currentNode.left != null) {
isBad = removeBadSplitNodes(criterion, currentNode.left, lastCheckRatio, lastCheckSDR, lastCheckE);
}
if (currentNode.right != null && isBad) {
isBad = removeBadSplitNodes(criterion, currentNode.left, lastCheckRatio, lastCheckSDR, lastCheckE);
}
if (isBad) {
double[][] postSplitDists = new double[][]{{currentNode.leftStatistics.getValue(0), currentNode.leftStatistics.getValue(1), currentNode.leftStatistics.getValue(2)}, {currentNode.rightStatistics.getValue(0), currentNode.rightStatistics.getValue(1), currentNode.rightStatistics.getValue(2)}};
double[] preSplitDist = new double[]{(currentNode.leftStatistics.getValue(0) + currentNode.rightStatistics.getValue(0)), (currentNode.leftStatistics.getValue(1) + currentNode.rightStatistics.getValue(1)), (currentNode.leftStatistics.getValue(2) + currentNode.rightStatistics.getValue(2))};
double merit = criterion.getMeritOfSplit(preSplitDist, postSplitDists);
if ((merit / lastCheckSDR) < (lastCheckRatio - (2 * lastCheckE))) {
currentNode = null;
return true;
}
}
return false;
} | [
"private",
"boolean",
"removeBadSplitNodes",
"(",
"SplitCriterion",
"criterion",
",",
"Node",
"currentNode",
",",
"double",
"lastCheckRatio",
",",
"double",
"lastCheckSDR",
",",
"double",
"lastCheckE",
")",
"{",
"boolean",
"isBad",
"=",
"false",
";",
"if",
"(",
"currentNode",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"currentNode",
".",
"left",
"!=",
"null",
")",
"{",
"isBad",
"=",
"removeBadSplitNodes",
"(",
"criterion",
",",
"currentNode",
".",
"left",
",",
"lastCheckRatio",
",",
"lastCheckSDR",
",",
"lastCheckE",
")",
";",
"}",
"if",
"(",
"currentNode",
".",
"right",
"!=",
"null",
"&&",
"isBad",
")",
"{",
"isBad",
"=",
"removeBadSplitNodes",
"(",
"criterion",
",",
"currentNode",
".",
"left",
",",
"lastCheckRatio",
",",
"lastCheckSDR",
",",
"lastCheckE",
")",
";",
"}",
"if",
"(",
"isBad",
")",
"{",
"double",
"[",
"]",
"[",
"]",
"postSplitDists",
"=",
"new",
"double",
"[",
"]",
"[",
"]",
"{",
"{",
"currentNode",
".",
"leftStatistics",
".",
"getValue",
"(",
"0",
")",
",",
"currentNode",
".",
"leftStatistics",
".",
"getValue",
"(",
"1",
")",
",",
"currentNode",
".",
"leftStatistics",
".",
"getValue",
"(",
"2",
")",
"}",
",",
"{",
"currentNode",
".",
"rightStatistics",
".",
"getValue",
"(",
"0",
")",
",",
"currentNode",
".",
"rightStatistics",
".",
"getValue",
"(",
"1",
")",
",",
"currentNode",
".",
"rightStatistics",
".",
"getValue",
"(",
"2",
")",
"}",
"}",
";",
"double",
"[",
"]",
"preSplitDist",
"=",
"new",
"double",
"[",
"]",
"{",
"(",
"currentNode",
".",
"leftStatistics",
".",
"getValue",
"(",
"0",
")",
"+",
"currentNode",
".",
"rightStatistics",
".",
"getValue",
"(",
"0",
")",
")",
",",
"(",
"currentNode",
".",
"leftStatistics",
".",
"getValue",
"(",
"1",
")",
"+",
"currentNode",
".",
"rightStatistics",
".",
"getValue",
"(",
"1",
")",
")",
",",
"(",
"currentNode",
".",
"leftStatistics",
".",
"getValue",
"(",
"2",
")",
"+",
"currentNode",
".",
"rightStatistics",
".",
"getValue",
"(",
"2",
")",
")",
"}",
";",
"double",
"merit",
"=",
"criterion",
".",
"getMeritOfSplit",
"(",
"preSplitDist",
",",
"postSplitDists",
")",
";",
"if",
"(",
"(",
"merit",
"/",
"lastCheckSDR",
")",
"<",
"(",
"lastCheckRatio",
"-",
"(",
"2",
"*",
"lastCheckE",
")",
")",
")",
"{",
"currentNode",
"=",
"null",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Recursive method that first checks all of a node's children before
deciding if it is 'bad' and may be removed | [
"Recursive",
"method",
"that",
"first",
"checks",
"all",
"of",
"a",
"node",
"s",
"children",
"before",
"deciding",
"if",
"it",
"is",
"bad",
"and",
"may",
"be",
"removed"
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/core/attributeclassobservers/FIMTDDNumericAttributeClassObserver.java#L201-L229 |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java | AbstractSubscriptionPublisher.unregisterBroadcastListener | @Override
public void unregisterBroadcastListener(String broadcastName, BroadcastListener broadcastListener) {
"""
Unregisters a broadcast listener.
@param broadcastName the broadcast name as defined in the Franca model
to unsubscribe from.
@param broadcastListener the listener to remove.
"""
List<BroadcastListener> listeners = broadcastListeners.get(broadcastName);
if (listeners == null) {
LOG.error("trying to unregister a listener for broadcast \"" + broadcastName
+ "\" that was never registered");
return;
}
synchronized (listeners) {
boolean success = listeners.remove(broadcastListener);
if (!success) {
LOG.error("trying to unregister a listener for broadcast \"" + broadcastName
+ "\" that was never registered");
return;
}
}
} | java | @Override
public void unregisterBroadcastListener(String broadcastName, BroadcastListener broadcastListener) {
List<BroadcastListener> listeners = broadcastListeners.get(broadcastName);
if (listeners == null) {
LOG.error("trying to unregister a listener for broadcast \"" + broadcastName
+ "\" that was never registered");
return;
}
synchronized (listeners) {
boolean success = listeners.remove(broadcastListener);
if (!success) {
LOG.error("trying to unregister a listener for broadcast \"" + broadcastName
+ "\" that was never registered");
return;
}
}
} | [
"@",
"Override",
"public",
"void",
"unregisterBroadcastListener",
"(",
"String",
"broadcastName",
",",
"BroadcastListener",
"broadcastListener",
")",
"{",
"List",
"<",
"BroadcastListener",
">",
"listeners",
"=",
"broadcastListeners",
".",
"get",
"(",
"broadcastName",
")",
";",
"if",
"(",
"listeners",
"==",
"null",
")",
"{",
"LOG",
".",
"error",
"(",
"\"trying to unregister a listener for broadcast \\\"\"",
"+",
"broadcastName",
"+",
"\"\\\" that was never registered\"",
")",
";",
"return",
";",
"}",
"synchronized",
"(",
"listeners",
")",
"{",
"boolean",
"success",
"=",
"listeners",
".",
"remove",
"(",
"broadcastListener",
")",
";",
"if",
"(",
"!",
"success",
")",
"{",
"LOG",
".",
"error",
"(",
"\"trying to unregister a listener for broadcast \\\"\"",
"+",
"broadcastName",
"+",
"\"\\\" that was never registered\"",
")",
";",
"return",
";",
"}",
"}",
"}"
] | Unregisters a broadcast listener.
@param broadcastName the broadcast name as defined in the Franca model
to unsubscribe from.
@param broadcastListener the listener to remove. | [
"Unregisters",
"a",
"broadcast",
"listener",
"."
] | train | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java#L185-L201 |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java | BitfinexApiCallbackListeners.onRawOrderbookEvent | public Closeable onRawOrderbookEvent(final BiConsumer<BitfinexOrderBookSymbol, Collection<BitfinexOrderBookEntry>> listener) {
"""
registers listener for raw orderbook events
@param listener of event
@return hook of this listener
"""
rawOrderbookEntryConsumers.offer(listener);
return () -> rawOrderbookEntryConsumers.remove(listener);
} | java | public Closeable onRawOrderbookEvent(final BiConsumer<BitfinexOrderBookSymbol, Collection<BitfinexOrderBookEntry>> listener) {
rawOrderbookEntryConsumers.offer(listener);
return () -> rawOrderbookEntryConsumers.remove(listener);
} | [
"public",
"Closeable",
"onRawOrderbookEvent",
"(",
"final",
"BiConsumer",
"<",
"BitfinexOrderBookSymbol",
",",
"Collection",
"<",
"BitfinexOrderBookEntry",
">",
">",
"listener",
")",
"{",
"rawOrderbookEntryConsumers",
".",
"offer",
"(",
"listener",
")",
";",
"return",
"(",
")",
"->",
"rawOrderbookEntryConsumers",
".",
"remove",
"(",
"listener",
")",
";",
"}"
] | registers listener for raw orderbook events
@param listener of event
@return hook of this listener | [
"registers",
"listener",
"for",
"raw",
"orderbook",
"events"
] | train | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java#L178-L181 |
andi12/msbuild-maven-plugin | msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildMojo.java | AbstractMSBuildMojo.runMSBuild | protected void runMSBuild( List<String> targets, Map<String, String> environment )
throws MojoExecutionException, MojoFailureException {
"""
Run MSBuild for each platform and configuration pair.
@param targets the build targets to pass to MSBuild
@param environment optional environment variable Map (my be null)
@throws MojoExecutionException if there is a problem running MSBuild
@throws MojoFailureException if MSBuild returns a non-zero exit code
"""
try
{
MSBuildExecutor msbuild = new MSBuildExecutor( getLog(), msbuildPath, msbuildMaxCpuCount, projectFile );
msbuild.setPlatforms( platforms );
msbuild.setTargets( targets );
msbuild.setEnvironment( environment );
if ( msbuild.execute() != 0 )
{
throw new MojoFailureException(
"MSBuild execution failed, see log for details." );
}
}
catch ( IOException ioe )
{
throw new MojoExecutionException(
"MSBUild execution failed", ioe );
}
catch ( InterruptedException ie )
{
throw new MojoExecutionException( "Interrupted waiting for "
+ "MSBUild execution to complete", ie );
}
} | java | protected void runMSBuild( List<String> targets, Map<String, String> environment )
throws MojoExecutionException, MojoFailureException
{
try
{
MSBuildExecutor msbuild = new MSBuildExecutor( getLog(), msbuildPath, msbuildMaxCpuCount, projectFile );
msbuild.setPlatforms( platforms );
msbuild.setTargets( targets );
msbuild.setEnvironment( environment );
if ( msbuild.execute() != 0 )
{
throw new MojoFailureException(
"MSBuild execution failed, see log for details." );
}
}
catch ( IOException ioe )
{
throw new MojoExecutionException(
"MSBUild execution failed", ioe );
}
catch ( InterruptedException ie )
{
throw new MojoExecutionException( "Interrupted waiting for "
+ "MSBUild execution to complete", ie );
}
} | [
"protected",
"void",
"runMSBuild",
"(",
"List",
"<",
"String",
">",
"targets",
",",
"Map",
"<",
"String",
",",
"String",
">",
"environment",
")",
"throws",
"MojoExecutionException",
",",
"MojoFailureException",
"{",
"try",
"{",
"MSBuildExecutor",
"msbuild",
"=",
"new",
"MSBuildExecutor",
"(",
"getLog",
"(",
")",
",",
"msbuildPath",
",",
"msbuildMaxCpuCount",
",",
"projectFile",
")",
";",
"msbuild",
".",
"setPlatforms",
"(",
"platforms",
")",
";",
"msbuild",
".",
"setTargets",
"(",
"targets",
")",
";",
"msbuild",
".",
"setEnvironment",
"(",
"environment",
")",
";",
"if",
"(",
"msbuild",
".",
"execute",
"(",
")",
"!=",
"0",
")",
"{",
"throw",
"new",
"MojoFailureException",
"(",
"\"MSBuild execution failed, see log for details.\"",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"MojoExecutionException",
"(",
"\"MSBUild execution failed\"",
",",
"ioe",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ie",
")",
"{",
"throw",
"new",
"MojoExecutionException",
"(",
"\"Interrupted waiting for \"",
"+",
"\"MSBUild execution to complete\"",
",",
"ie",
")",
";",
"}",
"}"
] | Run MSBuild for each platform and configuration pair.
@param targets the build targets to pass to MSBuild
@param environment optional environment variable Map (my be null)
@throws MojoExecutionException if there is a problem running MSBuild
@throws MojoFailureException if MSBuild returns a non-zero exit code | [
"Run",
"MSBuild",
"for",
"each",
"platform",
"and",
"configuration",
"pair",
"."
] | train | https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildMojo.java#L96-L121 |
eobermuhlner/big-math | ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigComplexMath.java | BigComplexMath.asin | public static BigComplex asin(BigComplex x, MathContext mathContext) {
"""
Calculates the arc sine (inverted sine) of {@link BigComplex} x in the complex domain.
<p>See: <a href="https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#Extension_to_complex_plane">Wikipedia: Inverse trigonometric functions (Extension to complex plane)</a></p>
@param x the {@link BigComplex} to calculate the arc sine for
@param mathContext the {@link MathContext} used for the result
@return the calculated arc sine {@link BigComplex} with the precision specified in the <code>mathContext</code>
"""
MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode());
return I.negate().multiply(log(I.multiply(x, mc).add(sqrt(BigComplex.ONE.subtract(x.multiply(x, mc), mc), mc), mc), mc), mc).round(mathContext);
} | java | public static BigComplex asin(BigComplex x, MathContext mathContext) {
MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode());
return I.negate().multiply(log(I.multiply(x, mc).add(sqrt(BigComplex.ONE.subtract(x.multiply(x, mc), mc), mc), mc), mc), mc).round(mathContext);
} | [
"public",
"static",
"BigComplex",
"asin",
"(",
"BigComplex",
"x",
",",
"MathContext",
"mathContext",
")",
"{",
"MathContext",
"mc",
"=",
"new",
"MathContext",
"(",
"mathContext",
".",
"getPrecision",
"(",
")",
"+",
"4",
",",
"mathContext",
".",
"getRoundingMode",
"(",
")",
")",
";",
"return",
"I",
".",
"negate",
"(",
")",
".",
"multiply",
"(",
"log",
"(",
"I",
".",
"multiply",
"(",
"x",
",",
"mc",
")",
".",
"add",
"(",
"sqrt",
"(",
"BigComplex",
".",
"ONE",
".",
"subtract",
"(",
"x",
".",
"multiply",
"(",
"x",
",",
"mc",
")",
",",
"mc",
")",
",",
"mc",
")",
",",
"mc",
")",
",",
"mc",
")",
",",
"mc",
")",
".",
"round",
"(",
"mathContext",
")",
";",
"}"
] | Calculates the arc sine (inverted sine) of {@link BigComplex} x in the complex domain.
<p>See: <a href="https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#Extension_to_complex_plane">Wikipedia: Inverse trigonometric functions (Extension to complex plane)</a></p>
@param x the {@link BigComplex} to calculate the arc sine for
@param mathContext the {@link MathContext} used for the result
@return the calculated arc sine {@link BigComplex} with the precision specified in the <code>mathContext</code> | [
"Calculates",
"the",
"arc",
"sine",
"(",
"inverted",
"sine",
")",
"of",
"{",
"@link",
"BigComplex",
"}",
"x",
"in",
"the",
"complex",
"domain",
"."
] | train | https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigComplexMath.java#L254-L258 |
cose-wg/COSE-JAVA | src/main/java/COSE/Attribute.java | Attribute.findAttribute | public CBORObject findAttribute(CBORObject label, int where) {
"""
Locate an attribute in one of the attribute buckets The buckets are
searched in the order protected, unprotected, unsent.
@param label - HeaderKey enumeration value to search for
@param where which maps to search for the label
@return - CBORObject with the value if found; otherwise null
"""
if (((where & PROTECTED) == PROTECTED) && objProtected.ContainsKey(label)) return objProtected.get(label);
if (((where & UNPROTECTED) == UNPROTECTED) && objUnprotected.ContainsKey(label)) return objUnprotected.get(label);
if (((where & DO_NOT_SEND) == DO_NOT_SEND) && objDontSend.ContainsKey(label)) return objDontSend.get(label);
return null;
} | java | public CBORObject findAttribute(CBORObject label, int where) {
if (((where & PROTECTED) == PROTECTED) && objProtected.ContainsKey(label)) return objProtected.get(label);
if (((where & UNPROTECTED) == UNPROTECTED) && objUnprotected.ContainsKey(label)) return objUnprotected.get(label);
if (((where & DO_NOT_SEND) == DO_NOT_SEND) && objDontSend.ContainsKey(label)) return objDontSend.get(label);
return null;
} | [
"public",
"CBORObject",
"findAttribute",
"(",
"CBORObject",
"label",
",",
"int",
"where",
")",
"{",
"if",
"(",
"(",
"(",
"where",
"&",
"PROTECTED",
")",
"==",
"PROTECTED",
")",
"&&",
"objProtected",
".",
"ContainsKey",
"(",
"label",
")",
")",
"return",
"objProtected",
".",
"get",
"(",
"label",
")",
";",
"if",
"(",
"(",
"(",
"where",
"&",
"UNPROTECTED",
")",
"==",
"UNPROTECTED",
")",
"&&",
"objUnprotected",
".",
"ContainsKey",
"(",
"label",
")",
")",
"return",
"objUnprotected",
".",
"get",
"(",
"label",
")",
";",
"if",
"(",
"(",
"(",
"where",
"&",
"DO_NOT_SEND",
")",
"==",
"DO_NOT_SEND",
")",
"&&",
"objDontSend",
".",
"ContainsKey",
"(",
"label",
")",
")",
"return",
"objDontSend",
".",
"get",
"(",
"label",
")",
";",
"return",
"null",
";",
"}"
] | Locate an attribute in one of the attribute buckets The buckets are
searched in the order protected, unprotected, unsent.
@param label - HeaderKey enumeration value to search for
@param where which maps to search for the label
@return - CBORObject with the value if found; otherwise null | [
"Locate",
"an",
"attribute",
"in",
"one",
"of",
"the",
"attribute",
"buckets",
"The",
"buckets",
"are",
"searched",
"in",
"the",
"order",
"protected",
"unprotected",
"unsent",
"."
] | train | https://github.com/cose-wg/COSE-JAVA/blob/f972b11ab4c9a18f911bc49a15225a6951cf6f63/src/main/java/COSE/Attribute.java#L271-L276 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/service/util/SecureAction.java | SecureAction.createThread | public Thread createThread(final Runnable target, final String name, final ClassLoader contextLoader) {
"""
Creates a new Thread from a Runnable. Same as calling
new Thread(target,name).setContextClassLoader(contextLoader).
@param target the Runnable to create the Thread from.
@param name The name of the Thread.
@param contextLoader the context class loader for the thread
@return The new Thread
"""
if (System.getSecurityManager() == null)
return createThread0(target, name, contextLoader);
return AccessController.doPrivileged(new PrivilegedAction<Thread>() {
@Override
public Thread run() {
return createThread0(target, name, contextLoader);
}
}, controlContext);
} | java | public Thread createThread(final Runnable target, final String name, final ClassLoader contextLoader) {
if (System.getSecurityManager() == null)
return createThread0(target, name, contextLoader);
return AccessController.doPrivileged(new PrivilegedAction<Thread>() {
@Override
public Thread run() {
return createThread0(target, name, contextLoader);
}
}, controlContext);
} | [
"public",
"Thread",
"createThread",
"(",
"final",
"Runnable",
"target",
",",
"final",
"String",
"name",
",",
"final",
"ClassLoader",
"contextLoader",
")",
"{",
"if",
"(",
"System",
".",
"getSecurityManager",
"(",
")",
"==",
"null",
")",
"return",
"createThread0",
"(",
"target",
",",
"name",
",",
"contextLoader",
")",
";",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Thread",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Thread",
"run",
"(",
")",
"{",
"return",
"createThread0",
"(",
"target",
",",
"name",
",",
"contextLoader",
")",
";",
"}",
"}",
",",
"controlContext",
")",
";",
"}"
] | Creates a new Thread from a Runnable. Same as calling
new Thread(target,name).setContextClassLoader(contextLoader).
@param target the Runnable to create the Thread from.
@param name The name of the Thread.
@param contextLoader the context class loader for the thread
@return The new Thread | [
"Creates",
"a",
"new",
"Thread",
"from",
"a",
"Runnable",
".",
"Same",
"as",
"calling",
"new",
"Thread",
"(",
"target",
"name",
")",
".",
"setContextClassLoader",
"(",
"contextLoader",
")",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/service/util/SecureAction.java#L427-L436 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Request.java | Request.addAttribute | public void addAttribute(String key, Object value) {
"""
Adds an attribute to the internal attributes map
@param key The key to store the attribute
@param value The value to store
"""
Objects.requireNonNull(key, Required.KEY.toString());
this.attributes.put(key, value);
} | java | public void addAttribute(String key, Object value) {
Objects.requireNonNull(key, Required.KEY.toString());
this.attributes.put(key, value);
} | [
"public",
"void",
"addAttribute",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"key",
",",
"Required",
".",
"KEY",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"attributes",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Adds an attribute to the internal attributes map
@param key The key to store the attribute
@param value The value to store | [
"Adds",
"an",
"attribute",
"to",
"the",
"internal",
"attributes",
"map"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Request.java#L242-L245 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QrHelperFunctions_ZDRM.java | QrHelperFunctions_ZDRM.findMax | public static double findMax( double[] u, int startU , int length ) {
"""
Returns the maximum magnitude of the complex numbers
@param u Array of complex numbers
@param startU first index to consider in u
@param length Number of complex numebrs to consider
@return magnitude
"""
double max = -1;
int index = startU*2;
int stopIndex = (startU + length)*2;
for( ; index < stopIndex;) {
double real = u[index++];
double img = u[index++];
double val = real*real + img*img;
if( val > max ) {
max = val;
}
}
return Math.sqrt(max);
} | java | public static double findMax( double[] u, int startU , int length ) {
double max = -1;
int index = startU*2;
int stopIndex = (startU + length)*2;
for( ; index < stopIndex;) {
double real = u[index++];
double img = u[index++];
double val = real*real + img*img;
if( val > max ) {
max = val;
}
}
return Math.sqrt(max);
} | [
"public",
"static",
"double",
"findMax",
"(",
"double",
"[",
"]",
"u",
",",
"int",
"startU",
",",
"int",
"length",
")",
"{",
"double",
"max",
"=",
"-",
"1",
";",
"int",
"index",
"=",
"startU",
"*",
"2",
";",
"int",
"stopIndex",
"=",
"(",
"startU",
"+",
"length",
")",
"*",
"2",
";",
"for",
"(",
";",
"index",
"<",
"stopIndex",
";",
")",
"{",
"double",
"real",
"=",
"u",
"[",
"index",
"++",
"]",
";",
"double",
"img",
"=",
"u",
"[",
"index",
"++",
"]",
";",
"double",
"val",
"=",
"real",
"*",
"real",
"+",
"img",
"*",
"img",
";",
"if",
"(",
"val",
">",
"max",
")",
"{",
"max",
"=",
"val",
";",
"}",
"}",
"return",
"Math",
".",
"sqrt",
"(",
"max",
")",
";",
"}"
] | Returns the maximum magnitude of the complex numbers
@param u Array of complex numbers
@param startU first index to consider in u
@param length Number of complex numebrs to consider
@return magnitude | [
"Returns",
"the",
"maximum",
"magnitude",
"of",
"the",
"complex",
"numbers"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QrHelperFunctions_ZDRM.java#L55-L72 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/internal/MessagingSecurityServiceImpl.java | MessagingSecurityServiceImpl.modify | @Modified
protected void modify(ComponentContext cc, Map<String, Object> properties) {
"""
Called by OSGI framework when there is a modification in server.xml for tag associated with this component
@param cc
Component Context object
@param properties
Properties for this component from server.xml
"""
SibTr.entry(tc, CLASS_NAME + "modify", properties);
this.properties = properties;
populateDestinationPermissions();
runtimeSecurityService.modifyMessagingServices(this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, CLASS_NAME + "modify");
}
} | java | @Modified
protected void modify(ComponentContext cc, Map<String, Object> properties) {
SibTr.entry(tc, CLASS_NAME + "modify", properties);
this.properties = properties;
populateDestinationPermissions();
runtimeSecurityService.modifyMessagingServices(this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, CLASS_NAME + "modify");
}
} | [
"@",
"Modified",
"protected",
"void",
"modify",
"(",
"ComponentContext",
"cc",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"CLASS_NAME",
"+",
"\"modify\"",
",",
"properties",
")",
";",
"this",
".",
"properties",
"=",
"properties",
";",
"populateDestinationPermissions",
"(",
")",
";",
"runtimeSecurityService",
".",
"modifyMessagingServices",
"(",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"CLASS_NAME",
"+",
"\"modify\"",
")",
";",
"}",
"}"
] | Called by OSGI framework when there is a modification in server.xml for tag associated with this component
@param cc
Component Context object
@param properties
Properties for this component from server.xml | [
"Called",
"by",
"OSGI",
"framework",
"when",
"there",
"is",
"a",
"modification",
"in",
"server",
".",
"xml",
"for",
"tag",
"associated",
"with",
"this",
"component"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/internal/MessagingSecurityServiceImpl.java#L140-L150 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.exportIterationAsync | public Observable<Export> exportIterationAsync(UUID projectId, UUID iterationId, String platform, ExportIterationOptionalParameter exportIterationOptionalParameter) {
"""
Export a trained iteration.
@param projectId The project id
@param iterationId The iteration id
@param platform The target platform (coreml or tensorflow). Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX'
@param exportIterationOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Export object
"""
return exportIterationWithServiceResponseAsync(projectId, iterationId, platform, exportIterationOptionalParameter).map(new Func1<ServiceResponse<Export>, Export>() {
@Override
public Export call(ServiceResponse<Export> response) {
return response.body();
}
});
} | java | public Observable<Export> exportIterationAsync(UUID projectId, UUID iterationId, String platform, ExportIterationOptionalParameter exportIterationOptionalParameter) {
return exportIterationWithServiceResponseAsync(projectId, iterationId, platform, exportIterationOptionalParameter).map(new Func1<ServiceResponse<Export>, Export>() {
@Override
public Export call(ServiceResponse<Export> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Export",
">",
"exportIterationAsync",
"(",
"UUID",
"projectId",
",",
"UUID",
"iterationId",
",",
"String",
"platform",
",",
"ExportIterationOptionalParameter",
"exportIterationOptionalParameter",
")",
"{",
"return",
"exportIterationWithServiceResponseAsync",
"(",
"projectId",
",",
"iterationId",
",",
"platform",
",",
"exportIterationOptionalParameter",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Export",
">",
",",
"Export",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Export",
"call",
"(",
"ServiceResponse",
"<",
"Export",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Export a trained iteration.
@param projectId The project id
@param iterationId The iteration id
@param platform The target platform (coreml or tensorflow). Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX'
@param exportIterationOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Export object | [
"Export",
"a",
"trained",
"iteration",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L975-L982 |
alamkanak/Android-Week-View | library/src/main/java/com/alamkanak/weekview/WeekView.java | WeekView.sortEvents | private void sortEvents(List<? extends WeekViewEvent> events) {
"""
Sorts the events in ascending order.
@param events The events to be sorted.
"""
Collections.sort(events, new Comparator<WeekViewEvent>() {
@Override
public int compare(WeekViewEvent event1, WeekViewEvent event2) {
long start1 = event1.getStartTime().getTimeInMillis();
long start2 = event2.getStartTime().getTimeInMillis();
int comparator = start1 > start2 ? 1 : (start1 < start2 ? -1 : 0);
if (comparator == 0) {
long end1 = event1.getEndTime().getTimeInMillis();
long end2 = event2.getEndTime().getTimeInMillis();
comparator = end1 > end2 ? 1 : (end1 < end2 ? -1 : 0);
}
return comparator;
}
});
} | java | private void sortEvents(List<? extends WeekViewEvent> events) {
Collections.sort(events, new Comparator<WeekViewEvent>() {
@Override
public int compare(WeekViewEvent event1, WeekViewEvent event2) {
long start1 = event1.getStartTime().getTimeInMillis();
long start2 = event2.getStartTime().getTimeInMillis();
int comparator = start1 > start2 ? 1 : (start1 < start2 ? -1 : 0);
if (comparator == 0) {
long end1 = event1.getEndTime().getTimeInMillis();
long end2 = event2.getEndTime().getTimeInMillis();
comparator = end1 > end2 ? 1 : (end1 < end2 ? -1 : 0);
}
return comparator;
}
});
} | [
"private",
"void",
"sortEvents",
"(",
"List",
"<",
"?",
"extends",
"WeekViewEvent",
">",
"events",
")",
"{",
"Collections",
".",
"sort",
"(",
"events",
",",
"new",
"Comparator",
"<",
"WeekViewEvent",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"WeekViewEvent",
"event1",
",",
"WeekViewEvent",
"event2",
")",
"{",
"long",
"start1",
"=",
"event1",
".",
"getStartTime",
"(",
")",
".",
"getTimeInMillis",
"(",
")",
";",
"long",
"start2",
"=",
"event2",
".",
"getStartTime",
"(",
")",
".",
"getTimeInMillis",
"(",
")",
";",
"int",
"comparator",
"=",
"start1",
">",
"start2",
"?",
"1",
":",
"(",
"start1",
"<",
"start2",
"?",
"-",
"1",
":",
"0",
")",
";",
"if",
"(",
"comparator",
"==",
"0",
")",
"{",
"long",
"end1",
"=",
"event1",
".",
"getEndTime",
"(",
")",
".",
"getTimeInMillis",
"(",
")",
";",
"long",
"end2",
"=",
"event2",
".",
"getEndTime",
"(",
")",
".",
"getTimeInMillis",
"(",
")",
";",
"comparator",
"=",
"end1",
">",
"end2",
"?",
"1",
":",
"(",
"end1",
"<",
"end2",
"?",
"-",
"1",
":",
"0",
")",
";",
"}",
"return",
"comparator",
";",
"}",
"}",
")",
";",
"}"
] | Sorts the events in ascending order.
@param events The events to be sorted. | [
"Sorts",
"the",
"events",
"in",
"ascending",
"order",
"."
] | train | https://github.com/alamkanak/Android-Week-View/blob/dc3f97d65d44785d1a761b52b58527c86c4eee1b/library/src/main/java/com/alamkanak/weekview/WeekView.java#L1077-L1092 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java | MapUtils.isPointOnPolygon | public static boolean isPointOnPolygon(LatLng point, PolygonOptions polygon, boolean geodesic, double tolerance) {
"""
Is the point of the polygon
@param point point
@param polygon polygon
@param geodesic geodesic check flag
@param tolerance distance tolerance
@return true if on the polygon
"""
boolean onPolygon = PolyUtil.containsLocation(point, polygon.getPoints(), geodesic) ||
PolyUtil.isLocationOnEdge(point, polygon.getPoints(), geodesic, tolerance);
if (onPolygon) {
for (List<LatLng> hole : polygon.getHoles()) {
if (PolyUtil.containsLocation(point, hole, geodesic)) {
onPolygon = false;
break;
}
}
}
return onPolygon;
} | java | public static boolean isPointOnPolygon(LatLng point, PolygonOptions polygon, boolean geodesic, double tolerance) {
boolean onPolygon = PolyUtil.containsLocation(point, polygon.getPoints(), geodesic) ||
PolyUtil.isLocationOnEdge(point, polygon.getPoints(), geodesic, tolerance);
if (onPolygon) {
for (List<LatLng> hole : polygon.getHoles()) {
if (PolyUtil.containsLocation(point, hole, geodesic)) {
onPolygon = false;
break;
}
}
}
return onPolygon;
} | [
"public",
"static",
"boolean",
"isPointOnPolygon",
"(",
"LatLng",
"point",
",",
"PolygonOptions",
"polygon",
",",
"boolean",
"geodesic",
",",
"double",
"tolerance",
")",
"{",
"boolean",
"onPolygon",
"=",
"PolyUtil",
".",
"containsLocation",
"(",
"point",
",",
"polygon",
".",
"getPoints",
"(",
")",
",",
"geodesic",
")",
"||",
"PolyUtil",
".",
"isLocationOnEdge",
"(",
"point",
",",
"polygon",
".",
"getPoints",
"(",
")",
",",
"geodesic",
",",
"tolerance",
")",
";",
"if",
"(",
"onPolygon",
")",
"{",
"for",
"(",
"List",
"<",
"LatLng",
">",
"hole",
":",
"polygon",
".",
"getHoles",
"(",
")",
")",
"{",
"if",
"(",
"PolyUtil",
".",
"containsLocation",
"(",
"point",
",",
"hole",
",",
"geodesic",
")",
")",
"{",
"onPolygon",
"=",
"false",
";",
"break",
";",
"}",
"}",
"}",
"return",
"onPolygon",
";",
"}"
] | Is the point of the polygon
@param point point
@param polygon polygon
@param geodesic geodesic check flag
@param tolerance distance tolerance
@return true if on the polygon | [
"Is",
"the",
"point",
"of",
"the",
"polygon"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java#L358-L373 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/PathMetadataFactory.java | PathMetadataFactory.forProperty | public static PathMetadata forProperty(Path<?> parent, String property) {
"""
Create a new PathMetadata instance for property access
@param parent parent path
@param property property name
@return property path
"""
return new PathMetadata(parent, property, PathType.PROPERTY);
} | java | public static PathMetadata forProperty(Path<?> parent, String property) {
return new PathMetadata(parent, property, PathType.PROPERTY);
} | [
"public",
"static",
"PathMetadata",
"forProperty",
"(",
"Path",
"<",
"?",
">",
"parent",
",",
"String",
"property",
")",
"{",
"return",
"new",
"PathMetadata",
"(",
"parent",
",",
"property",
",",
"PathType",
".",
"PROPERTY",
")",
";",
"}"
] | Create a new PathMetadata instance for property access
@param parent parent path
@param property property name
@return property path | [
"Create",
"a",
"new",
"PathMetadata",
"instance",
"for",
"property",
"access"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/PathMetadataFactory.java#L119-L121 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/APIClient.java | APIClient.addApiKey | public JSONObject addApiKey(List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, RequestOptions requestOptions) throws AlgoliaException {
"""
Create a new api key
@param acls the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)
@param validity the number of seconds after which the key will be automatically removed (0 means no time limit for this key)
@param maxQueriesPerIPPerHour Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit).
@param maxHitsPerQuery Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited)
@param requestOptions Options to pass to this request
"""
return addApiKey(acls, validity, maxQueriesPerIPPerHour, maxHitsPerQuery, null, requestOptions);
} | java | public JSONObject addApiKey(List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, RequestOptions requestOptions) throws AlgoliaException {
return addApiKey(acls, validity, maxQueriesPerIPPerHour, maxHitsPerQuery, null, requestOptions);
} | [
"public",
"JSONObject",
"addApiKey",
"(",
"List",
"<",
"String",
">",
"acls",
",",
"int",
"validity",
",",
"int",
"maxQueriesPerIPPerHour",
",",
"int",
"maxHitsPerQuery",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"return",
"addApiKey",
"(",
"acls",
",",
"validity",
",",
"maxQueriesPerIPPerHour",
",",
"maxHitsPerQuery",
",",
"null",
",",
"requestOptions",
")",
";",
"}"
] | Create a new api key
@param acls the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)
@param validity the number of seconds after which the key will be automatically removed (0 means no time limit for this key)
@param maxQueriesPerIPPerHour Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit).
@param maxHitsPerQuery Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited)
@param requestOptions Options to pass to this request | [
"Create",
"a",
"new",
"api",
"key"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L799-L801 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/storage/GraphHopperStorage.java | GraphHopperStorage.getGraph | public <T extends Graph> T getGraph(Class<T> clazz, Weighting weighting) {
"""
This method returns the routing graph for the specified weighting, could be potentially
filled with shortcuts.
"""
if (clazz.equals(Graph.class))
return (T) baseGraph;
Collection<CHGraphImpl> chGraphs = getAllCHGraphs();
if (chGraphs.isEmpty())
throw new IllegalStateException("Cannot find graph implementation for " + clazz);
if (weighting == null)
throw new IllegalStateException("Cannot find CHGraph with null weighting");
List<Weighting> existing = new ArrayList<>();
for (CHGraphImpl cg : chGraphs) {
if (cg.getWeighting() == weighting)
return (T) cg;
existing.add(cg.getWeighting());
}
throw new IllegalStateException("Cannot find CHGraph for specified weighting: " + weighting + ", existing:" + existing);
} | java | public <T extends Graph> T getGraph(Class<T> clazz, Weighting weighting) {
if (clazz.equals(Graph.class))
return (T) baseGraph;
Collection<CHGraphImpl> chGraphs = getAllCHGraphs();
if (chGraphs.isEmpty())
throw new IllegalStateException("Cannot find graph implementation for " + clazz);
if (weighting == null)
throw new IllegalStateException("Cannot find CHGraph with null weighting");
List<Weighting> existing = new ArrayList<>();
for (CHGraphImpl cg : chGraphs) {
if (cg.getWeighting() == weighting)
return (T) cg;
existing.add(cg.getWeighting());
}
throw new IllegalStateException("Cannot find CHGraph for specified weighting: " + weighting + ", existing:" + existing);
} | [
"public",
"<",
"T",
"extends",
"Graph",
">",
"T",
"getGraph",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Weighting",
"weighting",
")",
"{",
"if",
"(",
"clazz",
".",
"equals",
"(",
"Graph",
".",
"class",
")",
")",
"return",
"(",
"T",
")",
"baseGraph",
";",
"Collection",
"<",
"CHGraphImpl",
">",
"chGraphs",
"=",
"getAllCHGraphs",
"(",
")",
";",
"if",
"(",
"chGraphs",
".",
"isEmpty",
"(",
")",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot find graph implementation for \"",
"+",
"clazz",
")",
";",
"if",
"(",
"weighting",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot find CHGraph with null weighting\"",
")",
";",
"List",
"<",
"Weighting",
">",
"existing",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"CHGraphImpl",
"cg",
":",
"chGraphs",
")",
"{",
"if",
"(",
"cg",
".",
"getWeighting",
"(",
")",
"==",
"weighting",
")",
"return",
"(",
"T",
")",
"cg",
";",
"existing",
".",
"add",
"(",
"cg",
".",
"getWeighting",
"(",
")",
")",
";",
"}",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot find CHGraph for specified weighting: \"",
"+",
"weighting",
"+",
"\", existing:\"",
"+",
"existing",
")",
";",
"}"
] | This method returns the routing graph for the specified weighting, could be potentially
filled with shortcuts. | [
"This",
"method",
"returns",
"the",
"routing",
"graph",
"for",
"the",
"specified",
"weighting",
"could",
"be",
"potentially",
"filled",
"with",
"shortcuts",
"."
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/storage/GraphHopperStorage.java#L102-L122 |
deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java | SparkStorageUtils.saveMapFile | public static void saveMapFile(String path, JavaRDD<List<Writable>> rdd) {
"""
Save a {@code JavaRDD<List<Writable>>} to a Hadoop {@link org.apache.hadoop.io.MapFile}. Each record is
given a <i>unique and contiguous</i> {@link LongWritable} key, and values are stored as
{@link RecordWritable} instances.<br>
<b>Note 1</b>: If contiguous keys are not required, using a sequence file instead is preferable from a performance
point of view. Contiguous keys are often only required for non-Spark use cases, such as with
{@link org.datavec.hadoop.records.reader.mapfile.MapFileRecordReader}<br>
<b>Note 2</b>: This use a MapFile interval of {@link #DEFAULT_MAP_FILE_INTERVAL}, which is usually suitable for
use cases such as {@link org.datavec.hadoop.records.reader.mapfile.MapFileRecordReader}. Use
{@link #saveMapFile(String, JavaRDD, int, Integer)} or {@link #saveMapFile(String, JavaRDD, Configuration, Integer)}
to customize this. <br>
<p>
Use {@link #restoreMapFile(String, JavaSparkContext)} to restore values saved with this method.
@param path Path to save the MapFile
@param rdd RDD to save
@see #saveMapFileSequences(String, JavaRDD)
@see #saveSequenceFile(String, JavaRDD)
"""
saveMapFile(path, rdd, DEFAULT_MAP_FILE_INTERVAL, null);
} | java | public static void saveMapFile(String path, JavaRDD<List<Writable>> rdd) {
saveMapFile(path, rdd, DEFAULT_MAP_FILE_INTERVAL, null);
} | [
"public",
"static",
"void",
"saveMapFile",
"(",
"String",
"path",
",",
"JavaRDD",
"<",
"List",
"<",
"Writable",
">",
">",
"rdd",
")",
"{",
"saveMapFile",
"(",
"path",
",",
"rdd",
",",
"DEFAULT_MAP_FILE_INTERVAL",
",",
"null",
")",
";",
"}"
] | Save a {@code JavaRDD<List<Writable>>} to a Hadoop {@link org.apache.hadoop.io.MapFile}. Each record is
given a <i>unique and contiguous</i> {@link LongWritable} key, and values are stored as
{@link RecordWritable} instances.<br>
<b>Note 1</b>: If contiguous keys are not required, using a sequence file instead is preferable from a performance
point of view. Contiguous keys are often only required for non-Spark use cases, such as with
{@link org.datavec.hadoop.records.reader.mapfile.MapFileRecordReader}<br>
<b>Note 2</b>: This use a MapFile interval of {@link #DEFAULT_MAP_FILE_INTERVAL}, which is usually suitable for
use cases such as {@link org.datavec.hadoop.records.reader.mapfile.MapFileRecordReader}. Use
{@link #saveMapFile(String, JavaRDD, int, Integer)} or {@link #saveMapFile(String, JavaRDD, Configuration, Integer)}
to customize this. <br>
<p>
Use {@link #restoreMapFile(String, JavaSparkContext)} to restore values saved with this method.
@param path Path to save the MapFile
@param rdd RDD to save
@see #saveMapFileSequences(String, JavaRDD)
@see #saveSequenceFile(String, JavaRDD) | [
"Save",
"a",
"{",
"@code",
"JavaRDD<List<Writable",
">>",
"}",
"to",
"a",
"Hadoop",
"{",
"@link",
"org",
".",
"apache",
".",
"hadoop",
".",
"io",
".",
"MapFile",
"}",
".",
"Each",
"record",
"is",
"given",
"a",
"<i",
">",
"unique",
"and",
"contiguous<",
"/",
"i",
">",
"{",
"@link",
"LongWritable",
"}",
"key",
"and",
"values",
"are",
"stored",
"as",
"{",
"@link",
"RecordWritable",
"}",
"instances",
".",
"<br",
">",
"<b",
">",
"Note",
"1<",
"/",
"b",
">",
":",
"If",
"contiguous",
"keys",
"are",
"not",
"required",
"using",
"a",
"sequence",
"file",
"instead",
"is",
"preferable",
"from",
"a",
"performance",
"point",
"of",
"view",
".",
"Contiguous",
"keys",
"are",
"often",
"only",
"required",
"for",
"non",
"-",
"Spark",
"use",
"cases",
"such",
"as",
"with",
"{",
"@link",
"org",
".",
"datavec",
".",
"hadoop",
".",
"records",
".",
"reader",
".",
"mapfile",
".",
"MapFileRecordReader",
"}",
"<br",
">",
"<b",
">",
"Note",
"2<",
"/",
"b",
">",
":",
"This",
"use",
"a",
"MapFile",
"interval",
"of",
"{",
"@link",
"#DEFAULT_MAP_FILE_INTERVAL",
"}",
"which",
"is",
"usually",
"suitable",
"for",
"use",
"cases",
"such",
"as",
"{",
"@link",
"org",
".",
"datavec",
".",
"hadoop",
".",
"records",
".",
"reader",
".",
"mapfile",
".",
"MapFileRecordReader",
"}",
".",
"Use",
"{",
"@link",
"#saveMapFile",
"(",
"String",
"JavaRDD",
"int",
"Integer",
")",
"}",
"or",
"{",
"@link",
"#saveMapFile",
"(",
"String",
"JavaRDD",
"Configuration",
"Integer",
")",
"}",
"to",
"customize",
"this",
".",
"<br",
">",
"<p",
">",
"Use",
"{",
"@link",
"#restoreMapFile",
"(",
"String",
"JavaSparkContext",
")",
"}",
"to",
"restore",
"values",
"saved",
"with",
"this",
"method",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java#L189-L191 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRanges.java | PluralRanges.get | @Deprecated
public StandardPlural get(StandardPlural start, StandardPlural end) {
"""
Returns the appropriate plural category for a range from start to end. If there is no available data, then
'end' is returned as an implicit value. (Such an implicit value can be tested for with {@link #isExplicit}.)
@param start
plural category for the start of the range
@param end
plural category for the end of the range
@return the resulting plural category, or 'end' if there is no data.
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android
"""
StandardPlural result = matrix.get(start, end);
return result == null ? end : result;
} | java | @Deprecated
public StandardPlural get(StandardPlural start, StandardPlural end) {
StandardPlural result = matrix.get(start, end);
return result == null ? end : result;
} | [
"@",
"Deprecated",
"public",
"StandardPlural",
"get",
"(",
"StandardPlural",
"start",
",",
"StandardPlural",
"end",
")",
"{",
"StandardPlural",
"result",
"=",
"matrix",
".",
"get",
"(",
"start",
",",
"end",
")",
";",
"return",
"result",
"==",
"null",
"?",
"end",
":",
"result",
";",
"}"
] | Returns the appropriate plural category for a range from start to end. If there is no available data, then
'end' is returned as an implicit value. (Such an implicit value can be tested for with {@link #isExplicit}.)
@param start
plural category for the start of the range
@param end
plural category for the end of the range
@return the resulting plural category, or 'end' if there is no data.
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Returns",
"the",
"appropriate",
"plural",
"category",
"for",
"a",
"range",
"from",
"start",
"to",
"end",
".",
"If",
"there",
"is",
"no",
"available",
"data",
"then",
"end",
"is",
"returned",
"as",
"an",
"implicit",
"value",
".",
"(",
"Such",
"an",
"implicit",
"value",
"can",
"be",
"tested",
"for",
"with",
"{",
"@link",
"#isExplicit",
"}",
".",
")"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRanges.java#L244-L248 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java | ExpressRouteConnectionsInner.createOrUpdateAsync | public Observable<ExpressRouteConnectionInner> createOrUpdateAsync(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
"""
Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param connectionName The name of the connection subresource.
@param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).map(new Func1<ServiceResponse<ExpressRouteConnectionInner>, ExpressRouteConnectionInner>() {
@Override
public ExpressRouteConnectionInner call(ServiceResponse<ExpressRouteConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteConnectionInner> createOrUpdateAsync(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).map(new Func1<ServiceResponse<ExpressRouteConnectionInner>, ExpressRouteConnectionInner>() {
@Override
public ExpressRouteConnectionInner call(ServiceResponse<ExpressRouteConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteConnectionInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRouteGatewayName",
",",
"String",
"connectionName",
",",
"ExpressRouteConnectionInner",
"putExpressRouteConnectionParameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"expressRouteGatewayName",
",",
"connectionName",
",",
"putExpressRouteConnectionParameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ExpressRouteConnectionInner",
">",
",",
"ExpressRouteConnectionInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ExpressRouteConnectionInner",
"call",
"(",
"ServiceResponse",
"<",
"ExpressRouteConnectionInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param connectionName The name of the connection subresource.
@param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"a",
"connection",
"between",
"an",
"ExpressRoute",
"gateway",
"and",
"an",
"ExpressRoute",
"circuit",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java#L125-L132 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/util/ExpressionUtil.java | ExpressionUtil.substituteImages | public static String substituteImages(String input, Map<String,String> imageMap) {
"""
Input is email template with image tags:
<code>
<img src="${image:com.centurylink.mdw.base/mdw.png}" alt="MDW">
</code>
Uses the unqualified image name as its CID. Populates imageMap with results.
"""
StringBuffer substituted = new StringBuffer(input.length());
Matcher matcher = tokenPattern.matcher(input);
int index = 0;
while (matcher.find()) {
String match = matcher.group();
substituted.append(input.substring(index, matcher.start()));
if (imageMap != null && (match.startsWith("${image:"))) {
String imageFile = match.substring(8, match.length() - 1);
String imageId = imageFile.substring(imageFile.lastIndexOf('/') + 1);
substituted.append("cid:" + imageId);
imageMap.put(imageId, imageFile);
}
else {
// ignore everything but images
substituted.append(match);
}
index = matcher.end();
}
substituted.append(input.substring(index));
return substituted.toString();
} | java | public static String substituteImages(String input, Map<String,String> imageMap) {
StringBuffer substituted = new StringBuffer(input.length());
Matcher matcher = tokenPattern.matcher(input);
int index = 0;
while (matcher.find()) {
String match = matcher.group();
substituted.append(input.substring(index, matcher.start()));
if (imageMap != null && (match.startsWith("${image:"))) {
String imageFile = match.substring(8, match.length() - 1);
String imageId = imageFile.substring(imageFile.lastIndexOf('/') + 1);
substituted.append("cid:" + imageId);
imageMap.put(imageId, imageFile);
}
else {
// ignore everything but images
substituted.append(match);
}
index = matcher.end();
}
substituted.append(input.substring(index));
return substituted.toString();
} | [
"public",
"static",
"String",
"substituteImages",
"(",
"String",
"input",
",",
"Map",
"<",
"String",
",",
"String",
">",
"imageMap",
")",
"{",
"StringBuffer",
"substituted",
"=",
"new",
"StringBuffer",
"(",
"input",
".",
"length",
"(",
")",
")",
";",
"Matcher",
"matcher",
"=",
"tokenPattern",
".",
"matcher",
"(",
"input",
")",
";",
"int",
"index",
"=",
"0",
";",
"while",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"String",
"match",
"=",
"matcher",
".",
"group",
"(",
")",
";",
"substituted",
".",
"append",
"(",
"input",
".",
"substring",
"(",
"index",
",",
"matcher",
".",
"start",
"(",
")",
")",
")",
";",
"if",
"(",
"imageMap",
"!=",
"null",
"&&",
"(",
"match",
".",
"startsWith",
"(",
"\"${image:\"",
")",
")",
")",
"{",
"String",
"imageFile",
"=",
"match",
".",
"substring",
"(",
"8",
",",
"match",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"String",
"imageId",
"=",
"imageFile",
".",
"substring",
"(",
"imageFile",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"substituted",
".",
"append",
"(",
"\"cid:\"",
"+",
"imageId",
")",
";",
"imageMap",
".",
"put",
"(",
"imageId",
",",
"imageFile",
")",
";",
"}",
"else",
"{",
"// ignore everything but images",
"substituted",
".",
"append",
"(",
"match",
")",
";",
"}",
"index",
"=",
"matcher",
".",
"end",
"(",
")",
";",
"}",
"substituted",
".",
"append",
"(",
"input",
".",
"substring",
"(",
"index",
")",
")",
";",
"return",
"substituted",
".",
"toString",
"(",
")",
";",
"}"
] | Input is email template with image tags:
<code>
<img src="${image:com.centurylink.mdw.base/mdw.png}" alt="MDW">
</code>
Uses the unqualified image name as its CID. Populates imageMap with results. | [
"Input",
"is",
"email",
"template",
"with",
"image",
"tags",
":",
"<code",
">",
"<",
";",
"img",
"src",
"=",
"$",
"{",
"image",
":",
"com",
".",
"centurylink",
".",
"mdw",
".",
"base",
"/",
"mdw",
".",
"png",
"}",
"alt",
"=",
"MDW",
">",
";",
"<",
"/",
"code",
">",
"Uses",
"the",
"unqualified",
"image",
"name",
"as",
"its",
"CID",
".",
"Populates",
"imageMap",
"with",
"results",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/ExpressionUtil.java#L144-L165 |
grails/grails-core | grails-bootstrap/src/main/groovy/org/grails/io/watch/DirectoryWatcher.java | DirectoryWatcher.addWatchDirectory | public void addWatchDirectory(File dir, String extension) {
"""
Adds a directory to watch for the given file and extensions.
@param dir The directory
@param extension The extension
"""
extension = removeStartingDotIfPresent(extension);
List<String> fileExtensions = new ArrayList<String>();
if (extension != null && extension.length() > 0) {
int i = extension.lastIndexOf('.');
if(i > -1) {
extension = extension.substring(i + 1);
}
fileExtensions.add(extension);
}
else {
fileExtensions.add("*");
}
addWatchDirectory(dir, fileExtensions);
} | java | public void addWatchDirectory(File dir, String extension) {
extension = removeStartingDotIfPresent(extension);
List<String> fileExtensions = new ArrayList<String>();
if (extension != null && extension.length() > 0) {
int i = extension.lastIndexOf('.');
if(i > -1) {
extension = extension.substring(i + 1);
}
fileExtensions.add(extension);
}
else {
fileExtensions.add("*");
}
addWatchDirectory(dir, fileExtensions);
} | [
"public",
"void",
"addWatchDirectory",
"(",
"File",
"dir",
",",
"String",
"extension",
")",
"{",
"extension",
"=",
"removeStartingDotIfPresent",
"(",
"extension",
")",
";",
"List",
"<",
"String",
">",
"fileExtensions",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"extension",
"!=",
"null",
"&&",
"extension",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"int",
"i",
"=",
"extension",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"i",
">",
"-",
"1",
")",
"{",
"extension",
"=",
"extension",
".",
"substring",
"(",
"i",
"+",
"1",
")",
";",
"}",
"fileExtensions",
".",
"add",
"(",
"extension",
")",
";",
"}",
"else",
"{",
"fileExtensions",
".",
"add",
"(",
"\"*\"",
")",
";",
"}",
"addWatchDirectory",
"(",
"dir",
",",
"fileExtensions",
")",
";",
"}"
] | Adds a directory to watch for the given file and extensions.
@param dir The directory
@param extension The extension | [
"Adds",
"a",
"directory",
"to",
"watch",
"for",
"the",
"given",
"file",
"and",
"extensions",
"."
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-bootstrap/src/main/groovy/org/grails/io/watch/DirectoryWatcher.java#L147-L161 |
dita-ot/dita-ot | src/main/plugins/org.dita.eclipsehelp/src/main/java/org/dita/dost/writer/EclipseIndexWriter.java | EclipseIndexWriter.outputIndexTermEndElement | private void outputIndexTermEndElement(final IndexTerm term, final XMLStreamWriter serializer, final boolean indexsee) throws XMLStreamException {
"""
/*
Logic for adding various end index entry elements for Eclipse help.
@param term The indexterm to be processed.
@param printWriter The Writer used for writing content to disk.
@param indexsee Boolean value for using the new markup for see references.
"""
if (indexsee){
if (term.getTermPrefix() != null) {
serializer.writeEndElement(); // see
inIndexsee = false;
} else if (inIndexsee) {
// NOOP
} else {
serializer.writeEndElement(); // entry
}
} else {
serializer.writeEndElement(); // entry
}
} | java | private void outputIndexTermEndElement(final IndexTerm term, final XMLStreamWriter serializer, final boolean indexsee) throws XMLStreamException {
if (indexsee){
if (term.getTermPrefix() != null) {
serializer.writeEndElement(); // see
inIndexsee = false;
} else if (inIndexsee) {
// NOOP
} else {
serializer.writeEndElement(); // entry
}
} else {
serializer.writeEndElement(); // entry
}
} | [
"private",
"void",
"outputIndexTermEndElement",
"(",
"final",
"IndexTerm",
"term",
",",
"final",
"XMLStreamWriter",
"serializer",
",",
"final",
"boolean",
"indexsee",
")",
"throws",
"XMLStreamException",
"{",
"if",
"(",
"indexsee",
")",
"{",
"if",
"(",
"term",
".",
"getTermPrefix",
"(",
")",
"!=",
"null",
")",
"{",
"serializer",
".",
"writeEndElement",
"(",
")",
";",
"// see",
"inIndexsee",
"=",
"false",
";",
"}",
"else",
"if",
"(",
"inIndexsee",
")",
"{",
"// NOOP",
"}",
"else",
"{",
"serializer",
".",
"writeEndElement",
"(",
")",
";",
"// entry",
"}",
"}",
"else",
"{",
"serializer",
".",
"writeEndElement",
"(",
")",
";",
"// entry",
"}",
"}"
] | /*
Logic for adding various end index entry elements for Eclipse help.
@param term The indexterm to be processed.
@param printWriter The Writer used for writing content to disk.
@param indexsee Boolean value for using the new markup for see references. | [
"/",
"*",
"Logic",
"for",
"adding",
"various",
"end",
"index",
"entry",
"elements",
"for",
"Eclipse",
"help",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.eclipsehelp/src/main/java/org/dita/dost/writer/EclipseIndexWriter.java#L346-L359 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java | DateTimeFormatter.parseUnresolved | public TemporalAccessor parseUnresolved(CharSequence text, ParsePosition position) {
"""
Parses the text using this formatter, without resolving the result, intended
for advanced use cases.
<p>
Parsing is implemented as a two-phase operation.
First, the text is parsed using the layout defined by the formatter, producing
a {@code Map} of field to value, a {@code ZoneId} and a {@code Chronology}.
Second, the parsed data is <em>resolved</em>, by validating, combining and
simplifying the various fields into more useful ones.
This method performs the parsing stage but not the resolving stage.
<p>
The result of this method is {@code TemporalAccessor} which represents the
data as seen in the input. Values are not validated, thus parsing a date string
of '2012-00-65' would result in a temporal with three fields - year of '2012',
month of '0' and day-of-month of '65'.
<p>
The text will be parsed from the specified start {@code ParsePosition}.
The entire length of the text does not have to be parsed, the {@code ParsePosition}
will be updated with the index at the end of parsing.
<p>
Errors are returned using the error index field of the {@code ParsePosition}
instead of {@code DateTimeParseException}.
The returned error index will be set to an index indicative of the error.
Callers must check for errors before using the result.
<p>
If the formatter parses the same field more than once with different values,
the result will be an error.
<p>
This method is intended for advanced use cases that need access to the
internal state during parsing. Typical application code should use
{@link #parse(CharSequence, TemporalQuery)} or the parse method on the target type.
@param text the text to parse, not null
@param position the position to parse from, updated with length parsed
and the index of any error, not null
@return the parsed text, null if the parse results in an error
@throws DateTimeException if some problem occurs during parsing
@throws IndexOutOfBoundsException if the position is invalid
"""
DateTimeParseContext context = parseUnresolved0(text, position);
if (context == null) {
return null;
}
return context.toUnresolved();
} | java | public TemporalAccessor parseUnresolved(CharSequence text, ParsePosition position) {
DateTimeParseContext context = parseUnresolved0(text, position);
if (context == null) {
return null;
}
return context.toUnresolved();
} | [
"public",
"TemporalAccessor",
"parseUnresolved",
"(",
"CharSequence",
"text",
",",
"ParsePosition",
"position",
")",
"{",
"DateTimeParseContext",
"context",
"=",
"parseUnresolved0",
"(",
"text",
",",
"position",
")",
";",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"context",
".",
"toUnresolved",
"(",
")",
";",
"}"
] | Parses the text using this formatter, without resolving the result, intended
for advanced use cases.
<p>
Parsing is implemented as a two-phase operation.
First, the text is parsed using the layout defined by the formatter, producing
a {@code Map} of field to value, a {@code ZoneId} and a {@code Chronology}.
Second, the parsed data is <em>resolved</em>, by validating, combining and
simplifying the various fields into more useful ones.
This method performs the parsing stage but not the resolving stage.
<p>
The result of this method is {@code TemporalAccessor} which represents the
data as seen in the input. Values are not validated, thus parsing a date string
of '2012-00-65' would result in a temporal with three fields - year of '2012',
month of '0' and day-of-month of '65'.
<p>
The text will be parsed from the specified start {@code ParsePosition}.
The entire length of the text does not have to be parsed, the {@code ParsePosition}
will be updated with the index at the end of parsing.
<p>
Errors are returned using the error index field of the {@code ParsePosition}
instead of {@code DateTimeParseException}.
The returned error index will be set to an index indicative of the error.
Callers must check for errors before using the result.
<p>
If the formatter parses the same field more than once with different values,
the result will be an error.
<p>
This method is intended for advanced use cases that need access to the
internal state during parsing. Typical application code should use
{@link #parse(CharSequence, TemporalQuery)} or the parse method on the target type.
@param text the text to parse, not null
@param position the position to parse from, updated with length parsed
and the index of any error, not null
@return the parsed text, null if the parse results in an error
@throws DateTimeException if some problem occurs during parsing
@throws IndexOutOfBoundsException if the position is invalid | [
"Parses",
"the",
"text",
"using",
"this",
"formatter",
"without",
"resolving",
"the",
"result",
"intended",
"for",
"advanced",
"use",
"cases",
".",
"<p",
">",
"Parsing",
"is",
"implemented",
"as",
"a",
"two",
"-",
"phase",
"operation",
".",
"First",
"the",
"text",
"is",
"parsed",
"using",
"the",
"layout",
"defined",
"by",
"the",
"formatter",
"producing",
"a",
"{",
"@code",
"Map",
"}",
"of",
"field",
"to",
"value",
"a",
"{",
"@code",
"ZoneId",
"}",
"and",
"a",
"{",
"@code",
"Chronology",
"}",
".",
"Second",
"the",
"parsed",
"data",
"is",
"<em",
">",
"resolved<",
"/",
"em",
">",
"by",
"validating",
"combining",
"and",
"simplifying",
"the",
"various",
"fields",
"into",
"more",
"useful",
"ones",
".",
"This",
"method",
"performs",
"the",
"parsing",
"stage",
"but",
"not",
"the",
"resolving",
"stage",
".",
"<p",
">",
"The",
"result",
"of",
"this",
"method",
"is",
"{",
"@code",
"TemporalAccessor",
"}",
"which",
"represents",
"the",
"data",
"as",
"seen",
"in",
"the",
"input",
".",
"Values",
"are",
"not",
"validated",
"thus",
"parsing",
"a",
"date",
"string",
"of",
"2012",
"-",
"00",
"-",
"65",
"would",
"result",
"in",
"a",
"temporal",
"with",
"three",
"fields",
"-",
"year",
"of",
"2012",
"month",
"of",
"0",
"and",
"day",
"-",
"of",
"-",
"month",
"of",
"65",
".",
"<p",
">",
"The",
"text",
"will",
"be",
"parsed",
"from",
"the",
"specified",
"start",
"{",
"@code",
"ParsePosition",
"}",
".",
"The",
"entire",
"length",
"of",
"the",
"text",
"does",
"not",
"have",
"to",
"be",
"parsed",
"the",
"{",
"@code",
"ParsePosition",
"}",
"will",
"be",
"updated",
"with",
"the",
"index",
"at",
"the",
"end",
"of",
"parsing",
".",
"<p",
">",
"Errors",
"are",
"returned",
"using",
"the",
"error",
"index",
"field",
"of",
"the",
"{",
"@code",
"ParsePosition",
"}",
"instead",
"of",
"{",
"@code",
"DateTimeParseException",
"}",
".",
"The",
"returned",
"error",
"index",
"will",
"be",
"set",
"to",
"an",
"index",
"indicative",
"of",
"the",
"error",
".",
"Callers",
"must",
"check",
"for",
"errors",
"before",
"using",
"the",
"result",
".",
"<p",
">",
"If",
"the",
"formatter",
"parses",
"the",
"same",
"field",
"more",
"than",
"once",
"with",
"different",
"values",
"the",
"result",
"will",
"be",
"an",
"error",
".",
"<p",
">",
"This",
"method",
"is",
"intended",
"for",
"advanced",
"use",
"cases",
"that",
"need",
"access",
"to",
"the",
"internal",
"state",
"during",
"parsing",
".",
"Typical",
"application",
"code",
"should",
"use",
"{",
"@link",
"#parse",
"(",
"CharSequence",
"TemporalQuery",
")",
"}",
"or",
"the",
"parse",
"method",
"on",
"the",
"target",
"type",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java#L1997-L2003 |
StripesFramework/stripes-stuff | src/main/java/org/stripesstuff/plugin/session/SessionStoreInterceptor.java | SessionStoreInterceptor.getFieldKey | protected String getFieldKey(Field field, Class<? extends ActionBean> actionBeanClass) {
"""
Returns session key under which field should be saved or read.
@param field Field.
@param actionBeanClass Action bean class.
@return Session key under which field should be saved or read.
"""
// Use key attribute if it is defined.
String sessionKey = ((Session)field.getAnnotation(Session.class)).key();
if (sessionKey != null && !"".equals(sessionKey)) {
return sessionKey;
}
else {
// Use default key since no custom key is defined.
return actionBeanClass + "#" + field.getName();
}
} | java | protected String getFieldKey(Field field, Class<? extends ActionBean> actionBeanClass) {
// Use key attribute if it is defined.
String sessionKey = ((Session)field.getAnnotation(Session.class)).key();
if (sessionKey != null && !"".equals(sessionKey)) {
return sessionKey;
}
else {
// Use default key since no custom key is defined.
return actionBeanClass + "#" + field.getName();
}
} | [
"protected",
"String",
"getFieldKey",
"(",
"Field",
"field",
",",
"Class",
"<",
"?",
"extends",
"ActionBean",
">",
"actionBeanClass",
")",
"{",
"// Use key attribute if it is defined.\r",
"String",
"sessionKey",
"=",
"(",
"(",
"Session",
")",
"field",
".",
"getAnnotation",
"(",
"Session",
".",
"class",
")",
")",
".",
"key",
"(",
")",
";",
"if",
"(",
"sessionKey",
"!=",
"null",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"sessionKey",
")",
")",
"{",
"return",
"sessionKey",
";",
"}",
"else",
"{",
"// Use default key since no custom key is defined.\r",
"return",
"actionBeanClass",
"+",
"\"#\"",
"+",
"field",
".",
"getName",
"(",
")",
";",
"}",
"}"
] | Returns session key under which field should be saved or read.
@param field Field.
@param actionBeanClass Action bean class.
@return Session key under which field should be saved or read. | [
"Returns",
"session",
"key",
"under",
"which",
"field",
"should",
"be",
"saved",
"or",
"read",
"."
] | train | https://github.com/StripesFramework/stripes-stuff/blob/51ad92b4bd5862ba34d7c18c5829fb00ea3a3811/src/main/java/org/stripesstuff/plugin/session/SessionStoreInterceptor.java#L139-L149 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/stats/Counters.java | Counters.addInPlace | public static <T1, T2> void addInPlace(TwoDimensionalCounter<T1, T2> target, TwoDimensionalCounter<T1, T2> arg, double scale) {
"""
For all keys (u,v) in arg, sets target[u,v] to be target[u,v] + scale *
arg[u,v]
@param <T1>
@param <T2>
"""
for (T1 outer : arg.firstKeySet())
for (T2 inner : arg.secondKeySet()) {
target.incrementCount(outer, inner, scale * arg.getCount(outer, inner));
}
} | java | public static <T1, T2> void addInPlace(TwoDimensionalCounter<T1, T2> target, TwoDimensionalCounter<T1, T2> arg, double scale) {
for (T1 outer : arg.firstKeySet())
for (T2 inner : arg.secondKeySet()) {
target.incrementCount(outer, inner, scale * arg.getCount(outer, inner));
}
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"void",
"addInPlace",
"(",
"TwoDimensionalCounter",
"<",
"T1",
",",
"T2",
">",
"target",
",",
"TwoDimensionalCounter",
"<",
"T1",
",",
"T2",
">",
"arg",
",",
"double",
"scale",
")",
"{",
"for",
"(",
"T1",
"outer",
":",
"arg",
".",
"firstKeySet",
"(",
")",
")",
"for",
"(",
"T2",
"inner",
":",
"arg",
".",
"secondKeySet",
"(",
")",
")",
"{",
"target",
".",
"incrementCount",
"(",
"outer",
",",
"inner",
",",
"scale",
"*",
"arg",
".",
"getCount",
"(",
"outer",
",",
"inner",
")",
")",
";",
"}",
"}"
] | For all keys (u,v) in arg, sets target[u,v] to be target[u,v] + scale *
arg[u,v]
@param <T1>
@param <T2> | [
"For",
"all",
"keys",
"(",
"u",
"v",
")",
"in",
"arg",
"sets",
"target",
"[",
"u",
"v",
"]",
"to",
"be",
"target",
"[",
"u",
"v",
"]",
"+",
"scale",
"*",
"arg",
"[",
"u",
"v",
"]"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L348-L353 |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/method/DestinationPatternsMessageCondition.java | DestinationPatternsMessageCondition.compareTo | @Override
public int compareTo(DestinationPatternsMessageCondition other, Message<?> message) {
"""
Compare the two conditions based on the destination patterns they contain. Patterns
are compared one at a time, from top to bottom via
{@link org.springframework.util.PathMatcher#getPatternComparator(String)}. If all
compared patterns match equally, but one instance has more patterns, it is
considered a closer match.
<p>
It is assumed that both instances have been obtained via
{@link #getMatchingCondition(Message)} to ensure they contain only patterns that
match the request and are sorted with the best matches on top.
"""
WampMessage wampMessage = (WampMessage) message;
String destination = wampMessage.getDestination();
Comparator<String> patternComparator = this.pathMatcher
.getPatternComparator(destination);
Iterator<String> iterator = this.patterns.iterator();
Iterator<String> iteratorOther = other.patterns.iterator();
while (iterator.hasNext() && iteratorOther.hasNext()) {
int result = patternComparator.compare(iterator.next(), iteratorOther.next());
if (result != 0) {
return result;
}
}
if (iterator.hasNext()) {
return -1;
}
else if (iteratorOther.hasNext()) {
return 1;
}
else {
return 0;
}
} | java | @Override
public int compareTo(DestinationPatternsMessageCondition other, Message<?> message) {
WampMessage wampMessage = (WampMessage) message;
String destination = wampMessage.getDestination();
Comparator<String> patternComparator = this.pathMatcher
.getPatternComparator(destination);
Iterator<String> iterator = this.patterns.iterator();
Iterator<String> iteratorOther = other.patterns.iterator();
while (iterator.hasNext() && iteratorOther.hasNext()) {
int result = patternComparator.compare(iterator.next(), iteratorOther.next());
if (result != 0) {
return result;
}
}
if (iterator.hasNext()) {
return -1;
}
else if (iteratorOther.hasNext()) {
return 1;
}
else {
return 0;
}
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"DestinationPatternsMessageCondition",
"other",
",",
"Message",
"<",
"?",
">",
"message",
")",
"{",
"WampMessage",
"wampMessage",
"=",
"(",
"WampMessage",
")",
"message",
";",
"String",
"destination",
"=",
"wampMessage",
".",
"getDestination",
"(",
")",
";",
"Comparator",
"<",
"String",
">",
"patternComparator",
"=",
"this",
".",
"pathMatcher",
".",
"getPatternComparator",
"(",
"destination",
")",
";",
"Iterator",
"<",
"String",
">",
"iterator",
"=",
"this",
".",
"patterns",
".",
"iterator",
"(",
")",
";",
"Iterator",
"<",
"String",
">",
"iteratorOther",
"=",
"other",
".",
"patterns",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
"&&",
"iteratorOther",
".",
"hasNext",
"(",
")",
")",
"{",
"int",
"result",
"=",
"patternComparator",
".",
"compare",
"(",
"iterator",
".",
"next",
"(",
")",
",",
"iteratorOther",
".",
"next",
"(",
")",
")",
";",
"if",
"(",
"result",
"!=",
"0",
")",
"{",
"return",
"result",
";",
"}",
"}",
"if",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"else",
"if",
"(",
"iteratorOther",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"1",
";",
"}",
"else",
"{",
"return",
"0",
";",
"}",
"}"
] | Compare the two conditions based on the destination patterns they contain. Patterns
are compared one at a time, from top to bottom via
{@link org.springframework.util.PathMatcher#getPatternComparator(String)}. If all
compared patterns match equally, but one instance has more patterns, it is
considered a closer match.
<p>
It is assumed that both instances have been obtained via
{@link #getMatchingCondition(Message)} to ensure they contain only patterns that
match the request and are sorted with the best matches on top. | [
"Compare",
"the",
"two",
"conditions",
"based",
"on",
"the",
"destination",
"patterns",
"they",
"contain",
".",
"Patterns",
"are",
"compared",
"one",
"at",
"a",
"time",
"from",
"top",
"to",
"bottom",
"via",
"{"
] | train | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/method/DestinationPatternsMessageCondition.java#L171-L196 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java | WatchUtil.createModify | public static WatchMonitor createModify(File file, int maxDepth, Watcher watcher) {
"""
创建并初始化监听,监听修改事件
@param file 被监听文件
@param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录
@param watcher {@link Watcher}
@return {@link WatchMonitor}
@since 4.5.2
"""
return createModify(file.toPath(), 0, watcher);
} | java | public static WatchMonitor createModify(File file, int maxDepth, Watcher watcher) {
return createModify(file.toPath(), 0, watcher);
} | [
"public",
"static",
"WatchMonitor",
"createModify",
"(",
"File",
"file",
",",
"int",
"maxDepth",
",",
"Watcher",
"watcher",
")",
"{",
"return",
"createModify",
"(",
"file",
".",
"toPath",
"(",
")",
",",
"0",
",",
"watcher",
")",
";",
"}"
] | 创建并初始化监听,监听修改事件
@param file 被监听文件
@param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录
@param watcher {@link Watcher}
@return {@link WatchMonitor}
@since 4.5.2 | [
"创建并初始化监听,监听修改事件"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java#L325-L327 |
mikepenz/FastAdapter | app/src/main/java/com/mikepenz/fastadapter/app/helpers/CustomStickyRecyclerHeadersDecoration.java | CustomStickyRecyclerHeadersDecoration.setItemOffsetsForHeader | private void setItemOffsetsForHeader(Rect itemOffsets, View header, int orientation) {
"""
Sets the offsets for the first item in a section to make room for the header view
@param itemOffsets rectangle to define offsets for the item
@param header view used to calculate offset for the item
@param orientation used to calculate offset for the item
"""
mDimensionCalculator.initMargins(mTempRect, header);
if (orientation == LinearLayoutManager.VERTICAL) {
itemOffsets.top = header.getHeight() + mTempRect.top + mTempRect.bottom;
} else {
itemOffsets.left = header.getWidth() + mTempRect.left + mTempRect.right;
}
} | java | private void setItemOffsetsForHeader(Rect itemOffsets, View header, int orientation) {
mDimensionCalculator.initMargins(mTempRect, header);
if (orientation == LinearLayoutManager.VERTICAL) {
itemOffsets.top = header.getHeight() + mTempRect.top + mTempRect.bottom;
} else {
itemOffsets.left = header.getWidth() + mTempRect.left + mTempRect.right;
}
} | [
"private",
"void",
"setItemOffsetsForHeader",
"(",
"Rect",
"itemOffsets",
",",
"View",
"header",
",",
"int",
"orientation",
")",
"{",
"mDimensionCalculator",
".",
"initMargins",
"(",
"mTempRect",
",",
"header",
")",
";",
"if",
"(",
"orientation",
"==",
"LinearLayoutManager",
".",
"VERTICAL",
")",
"{",
"itemOffsets",
".",
"top",
"=",
"header",
".",
"getHeight",
"(",
")",
"+",
"mTempRect",
".",
"top",
"+",
"mTempRect",
".",
"bottom",
";",
"}",
"else",
"{",
"itemOffsets",
".",
"left",
"=",
"header",
".",
"getWidth",
"(",
")",
"+",
"mTempRect",
".",
"left",
"+",
"mTempRect",
".",
"right",
";",
"}",
"}"
] | Sets the offsets for the first item in a section to make room for the header view
@param itemOffsets rectangle to define offsets for the item
@param header view used to calculate offset for the item
@param orientation used to calculate offset for the item | [
"Sets",
"the",
"offsets",
"for",
"the",
"first",
"item",
"in",
"a",
"section",
"to",
"make",
"room",
"for",
"the",
"header",
"view"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/helpers/CustomStickyRecyclerHeadersDecoration.java#L87-L94 |
tacitknowledge/discovery | src/main/java/com/tacitknowledge/util/discovery/ArchiveResourceListSource.java | ArchiveResourceListSource.getResources | private List getResources(ZipFile file, String root) {
"""
Returns a list of file resources contained in the specified directory
within a given Zip'd archive file.
@param file the zip file containing the resources to return
@param root the directory within the zip file containing the resources
@return a list of file resources contained in the specified directory
within a given Zip'd archive file
"""
List resourceNames = new ArrayList();
Enumeration e = file.entries();
while (e.hasMoreElements())
{
ZipEntry entry = (ZipEntry) e.nextElement();
String name = entry.getName();
if (name.startsWith(root)
&& !(name.indexOf('/') > root.length())
&& !entry.isDirectory())
{
// Calling File.getPath() cleans up the path so that it's using
// the proper path separators for the host OS
name = new File(name).getPath();
resourceNames.add(name);
}
}
return resourceNames;
} | java | private List getResources(ZipFile file, String root)
{
List resourceNames = new ArrayList();
Enumeration e = file.entries();
while (e.hasMoreElements())
{
ZipEntry entry = (ZipEntry) e.nextElement();
String name = entry.getName();
if (name.startsWith(root)
&& !(name.indexOf('/') > root.length())
&& !entry.isDirectory())
{
// Calling File.getPath() cleans up the path so that it's using
// the proper path separators for the host OS
name = new File(name).getPath();
resourceNames.add(name);
}
}
return resourceNames;
} | [
"private",
"List",
"getResources",
"(",
"ZipFile",
"file",
",",
"String",
"root",
")",
"{",
"List",
"resourceNames",
"=",
"new",
"ArrayList",
"(",
")",
";",
"Enumeration",
"e",
"=",
"file",
".",
"entries",
"(",
")",
";",
"while",
"(",
"e",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"ZipEntry",
"entry",
"=",
"(",
"ZipEntry",
")",
"e",
".",
"nextElement",
"(",
")",
";",
"String",
"name",
"=",
"entry",
".",
"getName",
"(",
")",
";",
"if",
"(",
"name",
".",
"startsWith",
"(",
"root",
")",
"&&",
"!",
"(",
"name",
".",
"indexOf",
"(",
"'",
"'",
")",
">",
"root",
".",
"length",
"(",
")",
")",
"&&",
"!",
"entry",
".",
"isDirectory",
"(",
")",
")",
"{",
"// Calling File.getPath() cleans up the path so that it's using",
"// the proper path separators for the host OS",
"name",
"=",
"new",
"File",
"(",
"name",
")",
".",
"getPath",
"(",
")",
";",
"resourceNames",
".",
"add",
"(",
"name",
")",
";",
"}",
"}",
"return",
"resourceNames",
";",
"}"
] | Returns a list of file resources contained in the specified directory
within a given Zip'd archive file.
@param file the zip file containing the resources to return
@param root the directory within the zip file containing the resources
@return a list of file resources contained in the specified directory
within a given Zip'd archive file | [
"Returns",
"a",
"list",
"of",
"file",
"resources",
"contained",
"in",
"the",
"specified",
"directory",
"within",
"a",
"given",
"Zip",
"d",
"archive",
"file",
"."
] | train | https://github.com/tacitknowledge/discovery/blob/700f5492c9cb5c0146d684acb38b71fd4ef4e97a/src/main/java/com/tacitknowledge/util/discovery/ArchiveResourceListSource.java#L95-L114 |
ziccardi/jnrpe | jnrpe-lib/src/main/java/it/jnrpe/plugins/MetricValue.java | MetricValue.valueOf | public static MetricValue valueOf(BigDecimal val, final String format) {
"""
Returns the MetricValue representation of the passed in BigDecimal.
If <code>val</code> is already a {@link MetricValue} object, val is returned.
WARNING: as of this version, no check is performed that the passed in value format, if a {@link MetricValue},
is equal to <code>format</code>
@param val value to be converted
@param format format of the resulting output
@return the converted value
"""
if (val instanceof MetricValue) {
// TODO: check that val.format == format
return (MetricValue) val;
}
return new MetricValue(val, new DecimalFormat(format));
} | java | public static MetricValue valueOf(BigDecimal val, final String format) {
if (val instanceof MetricValue) {
// TODO: check that val.format == format
return (MetricValue) val;
}
return new MetricValue(val, new DecimalFormat(format));
} | [
"public",
"static",
"MetricValue",
"valueOf",
"(",
"BigDecimal",
"val",
",",
"final",
"String",
"format",
")",
"{",
"if",
"(",
"val",
"instanceof",
"MetricValue",
")",
"{",
"// TODO: check that val.format == format",
"return",
"(",
"MetricValue",
")",
"val",
";",
"}",
"return",
"new",
"MetricValue",
"(",
"val",
",",
"new",
"DecimalFormat",
"(",
"format",
")",
")",
";",
"}"
] | Returns the MetricValue representation of the passed in BigDecimal.
If <code>val</code> is already a {@link MetricValue} object, val is returned.
WARNING: as of this version, no check is performed that the passed in value format, if a {@link MetricValue},
is equal to <code>format</code>
@param val value to be converted
@param format format of the resulting output
@return the converted value | [
"Returns",
"the",
"MetricValue",
"representation",
"of",
"the",
"passed",
"in",
"BigDecimal",
".",
"If",
"<code",
">",
"val<",
"/",
"code",
">",
"is",
"already",
"a",
"{",
"@link",
"MetricValue",
"}",
"object",
"val",
"is",
"returned",
"."
] | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/plugins/MetricValue.java#L176-L182 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java | NTLMResponses.getLMResponse | public static byte[] getLMResponse(String password, byte[] challenge)
throws Exception {
"""
Calculates the LM Response for the given challenge, using the specified
password.
@param password The user's password.
@param challenge The Type 2 challenge from the server.
@return The LM Response.
"""
byte[] lmHash = lmHash(password);
return lmResponse(lmHash, challenge);
} | java | public static byte[] getLMResponse(String password, byte[] challenge)
throws Exception {
byte[] lmHash = lmHash(password);
return lmResponse(lmHash, challenge);
} | [
"public",
"static",
"byte",
"[",
"]",
"getLMResponse",
"(",
"String",
"password",
",",
"byte",
"[",
"]",
"challenge",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"lmHash",
"=",
"lmHash",
"(",
"password",
")",
";",
"return",
"lmResponse",
"(",
"lmHash",
",",
"challenge",
")",
";",
"}"
] | Calculates the LM Response for the given challenge, using the specified
password.
@param password The user's password.
@param challenge The Type 2 challenge from the server.
@return The LM Response. | [
"Calculates",
"the",
"LM",
"Response",
"for",
"the",
"given",
"challenge",
"using",
"the",
"specified",
"password",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java#L61-L65 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper._hasSideEffects | protected Boolean _hasSideEffects(XReturnExpression expression, ISideEffectContext context) {
"""
Test if the given expression has side effects.
@param expression the expression.
@param context the list of context expressions.
@return {@code true} if the expression has side effects.
"""
return hasSideEffects(expression.getExpression(), context);
} | java | protected Boolean _hasSideEffects(XReturnExpression expression, ISideEffectContext context) {
return hasSideEffects(expression.getExpression(), context);
} | [
"protected",
"Boolean",
"_hasSideEffects",
"(",
"XReturnExpression",
"expression",
",",
"ISideEffectContext",
"context",
")",
"{",
"return",
"hasSideEffects",
"(",
"expression",
".",
"getExpression",
"(",
")",
",",
"context",
")",
";",
"}"
] | Test if the given expression has side effects.
@param expression the expression.
@param context the list of context expressions.
@return {@code true} if the expression has side effects. | [
"Test",
"if",
"the",
"given",
"expression",
"has",
"side",
"effects",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L339-L341 |
Berico-Technologies/CLAVIN | src/main/java/com/bericotech/clavin/gazetteer/BasicGeoName.java | BasicGeoName.parseFromGeoNamesRecord | public static GeoName parseFromGeoNamesRecord(final String inputLine, final String preferredName) {
"""
Builds a {@link BasicGeoName} object based on a single gazetteer
record in the GeoNames geographical database.
@param inputLine single line of tab-delimited text representing one record from the GeoNames gazetteer
@param preferredName the preferred name of this GeoName as indicated by the GeoNames alternate names table
@return new GeoName object
"""
String[] ancestry = inputLine.split("\n");
GeoName geoName = parseGeoName(ancestry[0], preferredName);
// if more records exist, assume they are the ancestory of the target GeoName
if (ancestry.length > 1) {
GeoName current = geoName;
for (int idx = 1; idx < ancestry.length; idx++) {
GeoName parent = parseGeoName(ancestry[idx], null);
if (!current.setParent(parent)) {
LOG.error("Invalid ancestry path for GeoName [{}]: {}", geoName, inputLine.replaceAll("\n", " |@| "));
break;
}
current = parent;
}
}
return geoName;
} | java | public static GeoName parseFromGeoNamesRecord(final String inputLine, final String preferredName) {
String[] ancestry = inputLine.split("\n");
GeoName geoName = parseGeoName(ancestry[0], preferredName);
// if more records exist, assume they are the ancestory of the target GeoName
if (ancestry.length > 1) {
GeoName current = geoName;
for (int idx = 1; idx < ancestry.length; idx++) {
GeoName parent = parseGeoName(ancestry[idx], null);
if (!current.setParent(parent)) {
LOG.error("Invalid ancestry path for GeoName [{}]: {}", geoName, inputLine.replaceAll("\n", " |@| "));
break;
}
current = parent;
}
}
return geoName;
} | [
"public",
"static",
"GeoName",
"parseFromGeoNamesRecord",
"(",
"final",
"String",
"inputLine",
",",
"final",
"String",
"preferredName",
")",
"{",
"String",
"[",
"]",
"ancestry",
"=",
"inputLine",
".",
"split",
"(",
"\"\\n\"",
")",
";",
"GeoName",
"geoName",
"=",
"parseGeoName",
"(",
"ancestry",
"[",
"0",
"]",
",",
"preferredName",
")",
";",
"// if more records exist, assume they are the ancestory of the target GeoName",
"if",
"(",
"ancestry",
".",
"length",
">",
"1",
")",
"{",
"GeoName",
"current",
"=",
"geoName",
";",
"for",
"(",
"int",
"idx",
"=",
"1",
";",
"idx",
"<",
"ancestry",
".",
"length",
";",
"idx",
"++",
")",
"{",
"GeoName",
"parent",
"=",
"parseGeoName",
"(",
"ancestry",
"[",
"idx",
"]",
",",
"null",
")",
";",
"if",
"(",
"!",
"current",
".",
"setParent",
"(",
"parent",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Invalid ancestry path for GeoName [{}]: {}\"",
",",
"geoName",
",",
"inputLine",
".",
"replaceAll",
"(",
"\"\\n\"",
",",
"\" |@| \"",
")",
")",
";",
"break",
";",
"}",
"current",
"=",
"parent",
";",
"}",
"}",
"return",
"geoName",
";",
"}"
] | Builds a {@link BasicGeoName} object based on a single gazetteer
record in the GeoNames geographical database.
@param inputLine single line of tab-delimited text representing one record from the GeoNames gazetteer
@param preferredName the preferred name of this GeoName as indicated by the GeoNames alternate names table
@return new GeoName object | [
"Builds",
"a",
"{",
"@link",
"BasicGeoName",
"}",
"object",
"based",
"on",
"a",
"single",
"gazetteer",
"record",
"in",
"the",
"GeoNames",
"geographical",
"database",
"."
] | train | https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/gazetteer/BasicGeoName.java#L304-L320 |
JodaOrg/joda-time | src/main/java/org/joda/time/chrono/ISOChronology.java | ISOChronology.getInstance | public static ISOChronology getInstance(DateTimeZone zone) {
"""
Gets an instance of the ISOChronology in the given time zone.
@param zone the time zone to get the chronology in, null is default
@return a chronology in the specified time zone
"""
if (zone == null) {
zone = DateTimeZone.getDefault();
}
ISOChronology chrono = cCache.get(zone);
if (chrono == null) {
chrono = new ISOChronology(ZonedChronology.getInstance(INSTANCE_UTC, zone));
ISOChronology oldChrono = cCache.putIfAbsent(zone, chrono);
if (oldChrono != null) {
chrono = oldChrono;
}
}
return chrono;
} | java | public static ISOChronology getInstance(DateTimeZone zone) {
if (zone == null) {
zone = DateTimeZone.getDefault();
}
ISOChronology chrono = cCache.get(zone);
if (chrono == null) {
chrono = new ISOChronology(ZonedChronology.getInstance(INSTANCE_UTC, zone));
ISOChronology oldChrono = cCache.putIfAbsent(zone, chrono);
if (oldChrono != null) {
chrono = oldChrono;
}
}
return chrono;
} | [
"public",
"static",
"ISOChronology",
"getInstance",
"(",
"DateTimeZone",
"zone",
")",
"{",
"if",
"(",
"zone",
"==",
"null",
")",
"{",
"zone",
"=",
"DateTimeZone",
".",
"getDefault",
"(",
")",
";",
"}",
"ISOChronology",
"chrono",
"=",
"cCache",
".",
"get",
"(",
"zone",
")",
";",
"if",
"(",
"chrono",
"==",
"null",
")",
"{",
"chrono",
"=",
"new",
"ISOChronology",
"(",
"ZonedChronology",
".",
"getInstance",
"(",
"INSTANCE_UTC",
",",
"zone",
")",
")",
";",
"ISOChronology",
"oldChrono",
"=",
"cCache",
".",
"putIfAbsent",
"(",
"zone",
",",
"chrono",
")",
";",
"if",
"(",
"oldChrono",
"!=",
"null",
")",
"{",
"chrono",
"=",
"oldChrono",
";",
"}",
"}",
"return",
"chrono",
";",
"}"
] | Gets an instance of the ISOChronology in the given time zone.
@param zone the time zone to get the chronology in, null is default
@return a chronology in the specified time zone | [
"Gets",
"an",
"instance",
"of",
"the",
"ISOChronology",
"in",
"the",
"given",
"time",
"zone",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/chrono/ISOChronology.java#L88-L101 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/GEMFFile.java | GEMFFile.openFiles | private void openFiles() throws FileNotFoundException {
"""
/*
Find all files composing this GEMF archive, open them as RandomAccessFile
and add to the mFiles list.
"""
// Populate the mFiles array
final File base = new File(mLocation);
mFiles.add(new RandomAccessFile(base, "r"));
mFileNames.add(base.getPath());
int i = 0;
for(;;) {
i = i + 1;
final File nextFile = new File(mLocation + "-" + i);
if (nextFile.exists()) {
mFiles.add(new RandomAccessFile(nextFile, "r"));
mFileNames.add(nextFile.getPath());
} else {
break;
}
}
} | java | private void openFiles() throws FileNotFoundException {
// Populate the mFiles array
final File base = new File(mLocation);
mFiles.add(new RandomAccessFile(base, "r"));
mFileNames.add(base.getPath());
int i = 0;
for(;;) {
i = i + 1;
final File nextFile = new File(mLocation + "-" + i);
if (nextFile.exists()) {
mFiles.add(new RandomAccessFile(nextFile, "r"));
mFileNames.add(nextFile.getPath());
} else {
break;
}
}
} | [
"private",
"void",
"openFiles",
"(",
")",
"throws",
"FileNotFoundException",
"{",
"// Populate the mFiles array",
"final",
"File",
"base",
"=",
"new",
"File",
"(",
"mLocation",
")",
";",
"mFiles",
".",
"add",
"(",
"new",
"RandomAccessFile",
"(",
"base",
",",
"\"r\"",
")",
")",
";",
"mFileNames",
".",
"add",
"(",
"base",
".",
"getPath",
"(",
")",
")",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
";",
";",
")",
"{",
"i",
"=",
"i",
"+",
"1",
";",
"final",
"File",
"nextFile",
"=",
"new",
"File",
"(",
"mLocation",
"+",
"\"-\"",
"+",
"i",
")",
";",
"if",
"(",
"nextFile",
".",
"exists",
"(",
")",
")",
"{",
"mFiles",
".",
"add",
"(",
"new",
"RandomAccessFile",
"(",
"nextFile",
",",
"\"r\"",
")",
")",
";",
"mFileNames",
".",
"add",
"(",
"nextFile",
".",
"getPath",
"(",
")",
")",
";",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"}"
] | /*
Find all files composing this GEMF archive, open them as RandomAccessFile
and add to the mFiles list. | [
"/",
"*",
"Find",
"all",
"files",
"composing",
"this",
"GEMF",
"archive",
"open",
"them",
"as",
"RandomAccessFile",
"and",
"add",
"to",
"the",
"mFiles",
"list",
"."
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/GEMFFile.java#L431-L449 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.getUntaggedImages | public List<Image> getUntaggedImages(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter) {
"""
Get untagged images for a given project iteration.
This API supports batching and range selection. By default it will only return first 50 images matching images.
Use the {take} and {skip} parameters to control how many images to return in a given batch.
@param projectId The project id
@param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API
@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<Image> object if successful.
"""
return getUntaggedImagesWithServiceResponseAsync(projectId, getUntaggedImagesOptionalParameter).toBlocking().single().body();
} | java | public List<Image> getUntaggedImages(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter) {
return getUntaggedImagesWithServiceResponseAsync(projectId, getUntaggedImagesOptionalParameter).toBlocking().single().body();
} | [
"public",
"List",
"<",
"Image",
">",
"getUntaggedImages",
"(",
"UUID",
"projectId",
",",
"GetUntaggedImagesOptionalParameter",
"getUntaggedImagesOptionalParameter",
")",
"{",
"return",
"getUntaggedImagesWithServiceResponseAsync",
"(",
"projectId",
",",
"getUntaggedImagesOptionalParameter",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Get untagged images for a given project iteration.
This API supports batching and range selection. By default it will only return first 50 images matching images.
Use the {take} and {skip} parameters to control how many images to return in a given batch.
@param projectId The project id
@param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API
@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<Image> object if successful. | [
"Get",
"untagged",
"images",
"for",
"a",
"given",
"project",
"iteration",
".",
"This",
"API",
"supports",
"batching",
"and",
"range",
"selection",
".",
"By",
"default",
"it",
"will",
"only",
"return",
"first",
"50",
"images",
"matching",
"images",
".",
"Use",
"the",
"{",
"take",
"}",
"and",
"{",
"skip",
"}",
"parameters",
"to",
"control",
"how",
"many",
"images",
"to",
"return",
"in",
"a",
"given",
"batch",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L4785-L4787 |
rapidpro/expressions | java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java | ExcelFunctions._if | public static Object _if(EvaluationContext ctx, Object logicalTest, @IntegerDefault(0) Object valueIfTrue, @BooleanDefault(false) Object valueIfFalse) {
"""
Returns one value if the condition evaluates to TRUE, and another value if it evaluates to FALSE
"""
return Conversions.toBoolean(logicalTest, ctx) ? valueIfTrue : valueIfFalse;
} | java | public static Object _if(EvaluationContext ctx, Object logicalTest, @IntegerDefault(0) Object valueIfTrue, @BooleanDefault(false) Object valueIfFalse) {
return Conversions.toBoolean(logicalTest, ctx) ? valueIfTrue : valueIfFalse;
} | [
"public",
"static",
"Object",
"_if",
"(",
"EvaluationContext",
"ctx",
",",
"Object",
"logicalTest",
",",
"@",
"IntegerDefault",
"(",
"0",
")",
"Object",
"valueIfTrue",
",",
"@",
"BooleanDefault",
"(",
"false",
")",
"Object",
"valueIfFalse",
")",
"{",
"return",
"Conversions",
".",
"toBoolean",
"(",
"logicalTest",
",",
"ctx",
")",
"?",
"valueIfTrue",
":",
"valueIfFalse",
";",
"}"
] | Returns one value if the condition evaluates to TRUE, and another value if it evaluates to FALSE | [
"Returns",
"one",
"value",
"if",
"the",
"condition",
"evaluates",
"to",
"TRUE",
"and",
"another",
"value",
"if",
"it",
"evaluates",
"to",
"FALSE"
] | train | https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java#L527-L529 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java | WorkbookUtil.writeBook | public static void writeBook(Workbook book, OutputStream out) throws IORuntimeException {
"""
将Excel Workbook刷出到输出流,不关闭流
@param book {@link Workbook}
@param out 输出流
@throws IORuntimeException IO异常
@since 3.2.0
"""
try {
book.write(out);
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static void writeBook(Workbook book, OutputStream out) throws IORuntimeException {
try {
book.write(out);
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"void",
"writeBook",
"(",
"Workbook",
"book",
",",
"OutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"try",
"{",
"book",
".",
"write",
"(",
"out",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IORuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] | 将Excel Workbook刷出到输出流,不关闭流
@param book {@link Workbook}
@param out 输出流
@throws IORuntimeException IO异常
@since 3.2.0 | [
"将Excel",
"Workbook刷出到输出流,不关闭流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java#L203-L209 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java | DiagonalMatrix.checkIndices | private void checkIndices(int row, int col) {
"""
Checks that the given row and column values are non-negative, and less
than the number of diagonals in this {@code DiagonalMatrix}.
@param row The row index to check.
@param col The col index to check.
@throws IllegalArgumentException if either index is invalid.
"""
if (row < 0 || col < 0 || row >= values.length || col >= values.length)
throw new ArrayIndexOutOfBoundsException();
} | java | private void checkIndices(int row, int col) {
if (row < 0 || col < 0 || row >= values.length || col >= values.length)
throw new ArrayIndexOutOfBoundsException();
} | [
"private",
"void",
"checkIndices",
"(",
"int",
"row",
",",
"int",
"col",
")",
"{",
"if",
"(",
"row",
"<",
"0",
"||",
"col",
"<",
"0",
"||",
"row",
">=",
"values",
".",
"length",
"||",
"col",
">=",
"values",
".",
"length",
")",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
")",
";",
"}"
] | Checks that the given row and column values are non-negative, and less
than the number of diagonals in this {@code DiagonalMatrix}.
@param row The row index to check.
@param col The col index to check.
@throws IllegalArgumentException if either index is invalid. | [
"Checks",
"that",
"the",
"given",
"row",
"and",
"column",
"values",
"are",
"non",
"-",
"negative",
"and",
"less",
"than",
"the",
"number",
"of",
"diagonals",
"in",
"this",
"{",
"@code",
"DiagonalMatrix",
"}",
"."
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java#L79-L82 |
kiegroup/jbpmmigration | src/main/java/org/jbpm/migration/XmlUtils.java | XmlUtils.createTransformer | private static Transformer createTransformer(final Source xsltSource) throws Exception {
"""
Create a {@link Transformer} from the given sheet.
@param xsltSource
The sheet to be used for the transformation, or <code>null</code> if an identity transformator is needed.
@return The created {@link Transformer}
@throws Exception
If the creation or instrumentation of the {@link Transformer} runs into trouble.
"""
final TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = null;
if (xsltSource != null) {
// Create a resolver for imported sheets (assumption: available from classpath or the root of the jar).
final URIResolver resolver = new URIResolver() {
@Override
public Source resolve(final String href, final String base) throws TransformerException {
return new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream(href));
}
};
transformerFactory.setURIResolver(resolver);
// Transformer using the given sheet.
transformer = transformerFactory.newTransformer(xsltSource);
transformer.setURIResolver(resolver);
} else {
// Transformer without a sheet, i.e. for "identity transform" (e.g. formatting).
transformer = transformerFactory.newTransformer();
}
if (LOGGER.isDebugEnabled()) {
instrumentTransformer(transformer);
}
return transformer;
} | java | private static Transformer createTransformer(final Source xsltSource) throws Exception {
final TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = null;
if (xsltSource != null) {
// Create a resolver for imported sheets (assumption: available from classpath or the root of the jar).
final URIResolver resolver = new URIResolver() {
@Override
public Source resolve(final String href, final String base) throws TransformerException {
return new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream(href));
}
};
transformerFactory.setURIResolver(resolver);
// Transformer using the given sheet.
transformer = transformerFactory.newTransformer(xsltSource);
transformer.setURIResolver(resolver);
} else {
// Transformer without a sheet, i.e. for "identity transform" (e.g. formatting).
transformer = transformerFactory.newTransformer();
}
if (LOGGER.isDebugEnabled()) {
instrumentTransformer(transformer);
}
return transformer;
} | [
"private",
"static",
"Transformer",
"createTransformer",
"(",
"final",
"Source",
"xsltSource",
")",
"throws",
"Exception",
"{",
"final",
"TransformerFactory",
"transformerFactory",
"=",
"TransformerFactory",
".",
"newInstance",
"(",
")",
";",
"Transformer",
"transformer",
"=",
"null",
";",
"if",
"(",
"xsltSource",
"!=",
"null",
")",
"{",
"// Create a resolver for imported sheets (assumption: available from classpath or the root of the jar).\r",
"final",
"URIResolver",
"resolver",
"=",
"new",
"URIResolver",
"(",
")",
"{",
"@",
"Override",
"public",
"Source",
"resolve",
"(",
"final",
"String",
"href",
",",
"final",
"String",
"base",
")",
"throws",
"TransformerException",
"{",
"return",
"new",
"StreamSource",
"(",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"href",
")",
")",
";",
"}",
"}",
";",
"transformerFactory",
".",
"setURIResolver",
"(",
"resolver",
")",
";",
"// Transformer using the given sheet.\r",
"transformer",
"=",
"transformerFactory",
".",
"newTransformer",
"(",
"xsltSource",
")",
";",
"transformer",
".",
"setURIResolver",
"(",
"resolver",
")",
";",
"}",
"else",
"{",
"// Transformer without a sheet, i.e. for \"identity transform\" (e.g. formatting).\r",
"transformer",
"=",
"transformerFactory",
".",
"newTransformer",
"(",
")",
";",
"}",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"instrumentTransformer",
"(",
"transformer",
")",
";",
"}",
"return",
"transformer",
";",
"}"
] | Create a {@link Transformer} from the given sheet.
@param xsltSource
The sheet to be used for the transformation, or <code>null</code> if an identity transformator is needed.
@return The created {@link Transformer}
@throws Exception
If the creation or instrumentation of the {@link Transformer} runs into trouble. | [
"Create",
"a",
"{",
"@link",
"Transformer",
"}",
"from",
"the",
"given",
"sheet",
"."
] | train | https://github.com/kiegroup/jbpmmigration/blob/5e133e2824aa38f316a2eb061123313a7276aba0/src/main/java/org/jbpm/migration/XmlUtils.java#L238-L264 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/StringUtilities.java | StringUtilities.isWildcardMatch | public static boolean isWildcardMatch(String str, String expr, boolean whole) {
"""
Returns <CODE>true</CODE> if the given string matches the given regular expression.
@param str The string against which the expression is to be matched
@param expr The regular expression to match with the input string
@param whole Indicates that a whole word match is required
@return <CODE>true</CODE> if a match was found
"""
return getWildcardMatcher(str, expr, whole).find();
} | java | public static boolean isWildcardMatch(String str, String expr, boolean whole)
{
return getWildcardMatcher(str, expr, whole).find();
} | [
"public",
"static",
"boolean",
"isWildcardMatch",
"(",
"String",
"str",
",",
"String",
"expr",
",",
"boolean",
"whole",
")",
"{",
"return",
"getWildcardMatcher",
"(",
"str",
",",
"expr",
",",
"whole",
")",
".",
"find",
"(",
")",
";",
"}"
] | Returns <CODE>true</CODE> if the given string matches the given regular expression.
@param str The string against which the expression is to be matched
@param expr The regular expression to match with the input string
@param whole Indicates that a whole word match is required
@return <CODE>true</CODE> if a match was found | [
"Returns",
"<CODE",
">",
"true<",
"/",
"CODE",
">",
"if",
"the",
"given",
"string",
"matches",
"the",
"given",
"regular",
"expression",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/StringUtilities.java#L346-L349 |
mgormley/prim | src/main/java/edu/jhu/prim/arrays/DoubleArrays.java | DoubleArrays.indexOf | public static int indexOf(double[] array, double val) {
"""
Gets the first index of a given value in an array or -1 if not present.
"""
for (int i=0; i<array.length; i++) {
if (array[i] == val) {
return i;
}
}
return -1;
} | java | public static int indexOf(double[] array, double val) {
for (int i=0; i<array.length; i++) {
if (array[i] == val) {
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"double",
"[",
"]",
"array",
",",
"double",
"val",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"array",
"[",
"i",
"]",
"==",
"val",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] | Gets the first index of a given value in an array or -1 if not present. | [
"Gets",
"the",
"first",
"index",
"of",
"a",
"given",
"value",
"in",
"an",
"array",
"or",
"-",
"1",
"if",
"not",
"present",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/DoubleArrays.java#L514-L521 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cache/impl/journal/RingbufferCacheEventJournalImpl.java | RingbufferCacheEventJournalImpl.getRingbufferOrFail | private RingbufferContainer<InternalEventJournalCacheEvent, Object> getRingbufferOrFail(ObjectNamespace namespace,
int partitionId) {
"""
Gets or creates a ringbuffer for an event journal or throws an exception if no
event journal is configured. The caller should call
{@link #hasEventJournal(ObjectNamespace)} before invoking this method to avoid getting
the exception. This method can be used to get the ringbuffer on which future events
will be added once the cache has been created.
<p>
NOTE: The cache config should have already been created in the cache service before
invoking this method.
@param namespace the cache namespace, containing the full prefixed cache name
@param partitionId the cache partition ID
@return the cache partition event journal
@throws CacheNotExistsException if the cache configuration was not found
@throws IllegalStateException if there is no event journal configured for this cache
"""
RingbufferService ringbufferService = getRingbufferService();
RingbufferContainer<InternalEventJournalCacheEvent, Object> container
= ringbufferService.getContainerOrNull(partitionId, namespace);
if (container != null) {
return container;
}
EventJournalConfig config = getEventJournalConfig(namespace);
if (config == null) {
throw new IllegalStateException(format(
"There is no event journal configured for cache %s or the journal is disabled",
namespace.getObjectName()));
}
return getOrCreateRingbufferContainer(namespace, partitionId, config);
} | java | private RingbufferContainer<InternalEventJournalCacheEvent, Object> getRingbufferOrFail(ObjectNamespace namespace,
int partitionId) {
RingbufferService ringbufferService = getRingbufferService();
RingbufferContainer<InternalEventJournalCacheEvent, Object> container
= ringbufferService.getContainerOrNull(partitionId, namespace);
if (container != null) {
return container;
}
EventJournalConfig config = getEventJournalConfig(namespace);
if (config == null) {
throw new IllegalStateException(format(
"There is no event journal configured for cache %s or the journal is disabled",
namespace.getObjectName()));
}
return getOrCreateRingbufferContainer(namespace, partitionId, config);
} | [
"private",
"RingbufferContainer",
"<",
"InternalEventJournalCacheEvent",
",",
"Object",
">",
"getRingbufferOrFail",
"(",
"ObjectNamespace",
"namespace",
",",
"int",
"partitionId",
")",
"{",
"RingbufferService",
"ringbufferService",
"=",
"getRingbufferService",
"(",
")",
";",
"RingbufferContainer",
"<",
"InternalEventJournalCacheEvent",
",",
"Object",
">",
"container",
"=",
"ringbufferService",
".",
"getContainerOrNull",
"(",
"partitionId",
",",
"namespace",
")",
";",
"if",
"(",
"container",
"!=",
"null",
")",
"{",
"return",
"container",
";",
"}",
"EventJournalConfig",
"config",
"=",
"getEventJournalConfig",
"(",
"namespace",
")",
";",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"format",
"(",
"\"There is no event journal configured for cache %s or the journal is disabled\"",
",",
"namespace",
".",
"getObjectName",
"(",
")",
")",
")",
";",
"}",
"return",
"getOrCreateRingbufferContainer",
"(",
"namespace",
",",
"partitionId",
",",
"config",
")",
";",
"}"
] | Gets or creates a ringbuffer for an event journal or throws an exception if no
event journal is configured. The caller should call
{@link #hasEventJournal(ObjectNamespace)} before invoking this method to avoid getting
the exception. This method can be used to get the ringbuffer on which future events
will be added once the cache has been created.
<p>
NOTE: The cache config should have already been created in the cache service before
invoking this method.
@param namespace the cache namespace, containing the full prefixed cache name
@param partitionId the cache partition ID
@return the cache partition event journal
@throws CacheNotExistsException if the cache configuration was not found
@throws IllegalStateException if there is no event journal configured for this cache | [
"Gets",
"or",
"creates",
"a",
"ringbuffer",
"for",
"an",
"event",
"journal",
"or",
"throws",
"an",
"exception",
"if",
"no",
"event",
"journal",
"is",
"configured",
".",
"The",
"caller",
"should",
"call",
"{",
"@link",
"#hasEventJournal",
"(",
"ObjectNamespace",
")",
"}",
"before",
"invoking",
"this",
"method",
"to",
"avoid",
"getting",
"the",
"exception",
".",
"This",
"method",
"can",
"be",
"used",
"to",
"get",
"the",
"ringbuffer",
"on",
"which",
"future",
"events",
"will",
"be",
"added",
"once",
"the",
"cache",
"has",
"been",
"created",
".",
"<p",
">",
"NOTE",
":",
"The",
"cache",
"config",
"should",
"have",
"already",
"been",
"created",
"in",
"the",
"cache",
"service",
"before",
"invoking",
"this",
"method",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/impl/journal/RingbufferCacheEventJournalImpl.java#L242-L258 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/query/planner/Planner.java | Planner.createQueryPlan | public Plan createQueryPlan(String qry, Transaction tx) {
"""
Creates a plan for an SQL select statement, using the supplied planner.
@param qry
the SQL query string
@param tx
the transaction
@return the scan corresponding to the query plan
"""
Parser parser = new Parser(qry);
QueryData data = parser.queryCommand();
Verifier.verifyQueryData(data, tx);
return qPlanner.createPlan(data, tx);
} | java | public Plan createQueryPlan(String qry, Transaction tx) {
Parser parser = new Parser(qry);
QueryData data = parser.queryCommand();
Verifier.verifyQueryData(data, tx);
return qPlanner.createPlan(data, tx);
} | [
"public",
"Plan",
"createQueryPlan",
"(",
"String",
"qry",
",",
"Transaction",
"tx",
")",
"{",
"Parser",
"parser",
"=",
"new",
"Parser",
"(",
"qry",
")",
";",
"QueryData",
"data",
"=",
"parser",
".",
"queryCommand",
"(",
")",
";",
"Verifier",
".",
"verifyQueryData",
"(",
"data",
",",
"tx",
")",
";",
"return",
"qPlanner",
".",
"createPlan",
"(",
"data",
",",
"tx",
")",
";",
"}"
] | Creates a plan for an SQL select statement, using the supplied planner.
@param qry
the SQL query string
@param tx
the transaction
@return the scan corresponding to the query plan | [
"Creates",
"a",
"plan",
"for",
"an",
"SQL",
"select",
"statement",
"using",
"the",
"supplied",
"planner",
"."
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/planner/Planner.java#L55-L60 |
oboehm/jfachwert | src/main/java/de/jfachwert/FachwertFactory.java | FachwertFactory.getFachwert | public Fachwert getFachwert(String name, Object... args) {
"""
Liefert einen Fachwert zum angegebenen (Klassen-)Namen. Als Name wird
der Klassennamen erwartet. Wird keine Klasse gefunden, wird die Klasse
genommen, die am ehesten passt. So wird bei "IBAN1" als Name eine
Instanz der IBAN-Klasse zurueckgeliefert.
<p>
Anmerkung: Die Aehnlichkeit des uebergebenen Namens mit dem
tatsaechlichen Namen wird anhand der Levenshtein-Distanz bestimmt.
Ist die Differenz zu groß, wird als Fallback die {@link Text}-Klasse
verwendet.
</p>
@param name Namen der Fachwert-Klasse, z.B. "IBAN"
@param args Argument(e) fuer den Konstruktor der Fachwert-Klasse
@return ein Fachwert
"""
Class<? extends Fachwert> fachwertClass = getClassFor(name);
return getFachwert(fachwertClass, args);
} | java | public Fachwert getFachwert(String name, Object... args) {
Class<? extends Fachwert> fachwertClass = getClassFor(name);
return getFachwert(fachwertClass, args);
} | [
"public",
"Fachwert",
"getFachwert",
"(",
"String",
"name",
",",
"Object",
"...",
"args",
")",
"{",
"Class",
"<",
"?",
"extends",
"Fachwert",
">",
"fachwertClass",
"=",
"getClassFor",
"(",
"name",
")",
";",
"return",
"getFachwert",
"(",
"fachwertClass",
",",
"args",
")",
";",
"}"
] | Liefert einen Fachwert zum angegebenen (Klassen-)Namen. Als Name wird
der Klassennamen erwartet. Wird keine Klasse gefunden, wird die Klasse
genommen, die am ehesten passt. So wird bei "IBAN1" als Name eine
Instanz der IBAN-Klasse zurueckgeliefert.
<p>
Anmerkung: Die Aehnlichkeit des uebergebenen Namens mit dem
tatsaechlichen Namen wird anhand der Levenshtein-Distanz bestimmt.
Ist die Differenz zu groß, wird als Fallback die {@link Text}-Klasse
verwendet.
</p>
@param name Namen der Fachwert-Klasse, z.B. "IBAN"
@param args Argument(e) fuer den Konstruktor der Fachwert-Klasse
@return ein Fachwert | [
"Liefert",
"einen",
"Fachwert",
"zum",
"angegebenen",
"(",
"Klassen",
"-",
")",
"Namen",
".",
"Als",
"Name",
"wird",
"der",
"Klassennamen",
"erwartet",
".",
"Wird",
"keine",
"Klasse",
"gefunden",
"wird",
"die",
"Klasse",
"genommen",
"die",
"am",
"ehesten",
"passt",
".",
"So",
"wird",
"bei",
"IBAN1",
"als",
"Name",
"eine",
"Instanz",
"der",
"IBAN",
"-",
"Klasse",
"zurueckgeliefert",
".",
"<p",
">",
"Anmerkung",
":",
"Die",
"Aehnlichkeit",
"des",
"uebergebenen",
"Namens",
"mit",
"dem",
"tatsaechlichen",
"Namen",
"wird",
"anhand",
"der",
"Levenshtein",
"-",
"Distanz",
"bestimmt",
".",
"Ist",
"die",
"Differenz",
"zu",
"groß",
"wird",
"als",
"Fallback",
"die",
"{",
"@link",
"Text",
"}",
"-",
"Klasse",
"verwendet",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/FachwertFactory.java#L169-L172 |
awslabs/jsii | packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java | JsiiRuntime.assertVersionCompatible | static void assertVersionCompatible(final String expectedVersion, final String actualVersion) {
"""
Asserts that a peer runtimeVersion is compatible with this Java runtime version, which means
they share the same version components, with the possible exception of the build number.
@param expectedVersion The version this client expects from the runtime
@param actualVersion The actual version the runtime reports
@throws JsiiException if versions mismatch
"""
final String shortActualVersion = actualVersion.replaceAll(VERSION_BUILD_PART_REGEX, "");
final String shortExpectedVersion = expectedVersion.replaceAll(VERSION_BUILD_PART_REGEX, "");
if (shortExpectedVersion.compareTo(shortActualVersion) != 0) {
throw new JsiiException("Incompatible jsii-runtime version. Expecting "
+ shortExpectedVersion
+ ", actual was " + shortActualVersion);
}
} | java | static void assertVersionCompatible(final String expectedVersion, final String actualVersion) {
final String shortActualVersion = actualVersion.replaceAll(VERSION_BUILD_PART_REGEX, "");
final String shortExpectedVersion = expectedVersion.replaceAll(VERSION_BUILD_PART_REGEX, "");
if (shortExpectedVersion.compareTo(shortActualVersion) != 0) {
throw new JsiiException("Incompatible jsii-runtime version. Expecting "
+ shortExpectedVersion
+ ", actual was " + shortActualVersion);
}
} | [
"static",
"void",
"assertVersionCompatible",
"(",
"final",
"String",
"expectedVersion",
",",
"final",
"String",
"actualVersion",
")",
"{",
"final",
"String",
"shortActualVersion",
"=",
"actualVersion",
".",
"replaceAll",
"(",
"VERSION_BUILD_PART_REGEX",
",",
"\"\"",
")",
";",
"final",
"String",
"shortExpectedVersion",
"=",
"expectedVersion",
".",
"replaceAll",
"(",
"VERSION_BUILD_PART_REGEX",
",",
"\"\"",
")",
";",
"if",
"(",
"shortExpectedVersion",
".",
"compareTo",
"(",
"shortActualVersion",
")",
"!=",
"0",
")",
"{",
"throw",
"new",
"JsiiException",
"(",
"\"Incompatible jsii-runtime version. Expecting \"",
"+",
"shortExpectedVersion",
"+",
"\", actual was \"",
"+",
"shortActualVersion",
")",
";",
"}",
"}"
] | Asserts that a peer runtimeVersion is compatible with this Java runtime version, which means
they share the same version components, with the possible exception of the build number.
@param expectedVersion The version this client expects from the runtime
@param actualVersion The actual version the runtime reports
@throws JsiiException if versions mismatch | [
"Asserts",
"that",
"a",
"peer",
"runtimeVersion",
"is",
"compatible",
"with",
"this",
"Java",
"runtime",
"version",
"which",
"means",
"they",
"share",
"the",
"same",
"version",
"components",
"with",
"the",
"possible",
"exception",
"of",
"the",
"build",
"number",
"."
] | train | https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java#L330-L338 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/JMapper.java | JMapper.getDestination | public D getDestination(final S source,final MappingType mtSource) {
"""
This method returns a new instance of Destination Class with this setting:
<table summary = "">
<tr>
<td><code>NullPointerControl</code></td><td><code>SOURCE</code></td>
</tr><tr>
<td><code>MappingType</code> of Destination</td><td><code>ALL_FIELDS</code></td>
</tr><tr>
<td><code>MappingType</code> of Source</td><td>mtSource</td>
</tr>
</table>
@param source instance that contains the data
@param mtSource type of mapping
@return new instance of destination
@see NullPointerControl
@see MappingType
"""
return getDestination(source,NullPointerControl.SOURCE,mtSource);
} | java | public D getDestination(final S source,final MappingType mtSource){
return getDestination(source,NullPointerControl.SOURCE,mtSource);
} | [
"public",
"D",
"getDestination",
"(",
"final",
"S",
"source",
",",
"final",
"MappingType",
"mtSource",
")",
"{",
"return",
"getDestination",
"(",
"source",
",",
"NullPointerControl",
".",
"SOURCE",
",",
"mtSource",
")",
";",
"}"
] | This method returns a new instance of Destination Class with this setting:
<table summary = "">
<tr>
<td><code>NullPointerControl</code></td><td><code>SOURCE</code></td>
</tr><tr>
<td><code>MappingType</code> of Destination</td><td><code>ALL_FIELDS</code></td>
</tr><tr>
<td><code>MappingType</code> of Source</td><td>mtSource</td>
</tr>
</table>
@param source instance that contains the data
@param mtSource type of mapping
@return new instance of destination
@see NullPointerControl
@see MappingType | [
"This",
"method",
"returns",
"a",
"new",
"instance",
"of",
"Destination",
"Class",
"with",
"this",
"setting",
":",
"<table",
"summary",
"=",
">",
"<tr",
">",
"<td",
">",
"<code",
">",
"NullPointerControl<",
"/",
"code",
">",
"<",
"/",
"td",
">",
"<td",
">",
"<code",
">",
"SOURCE<",
"/",
"code",
">",
"<",
"/",
"td",
">",
"<",
"/",
"tr",
">",
"<tr",
">",
"<td",
">",
"<code",
">",
"MappingType<",
"/",
"code",
">",
"of",
"Destination<",
"/",
"td",
">",
"<td",
">",
"<code",
">",
"ALL_FIELDS<",
"/",
"code",
">",
"<",
"/",
"td",
">",
"<",
"/",
"tr",
">",
"<tr",
">",
"<td",
">",
"<code",
">",
"MappingType<",
"/",
"code",
">",
"of",
"Source<",
"/",
"td",
">",
"<td",
">",
"mtSource<",
"/",
"td",
">",
"<",
"/",
"tr",
">",
"<",
"/",
"table",
">"
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/JMapper.java#L201-L203 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java | CodeBuilderUtil.throwConcatException | public static void throwConcatException(CodeBuilder b, Class type, String... messages) {
"""
Generate code to throw an exception with a message concatenated at runtime.
@param b {@link CodeBuilder} to which to add code
@param type type of the object to throw
@param messages messages to concat at runtime
"""
if (messages == null || messages.length == 0) {
throwException(b, type, null);
return;
}
if (messages.length == 1) {
throwException(b, type, messages[0]);
return;
}
TypeDesc desc = TypeDesc.forClass(type);
b.newObject(desc);
b.dup();
TypeDesc[] params = new TypeDesc[] {TypeDesc.STRING};
for (int i=0; i<messages.length; i++) {
b.loadConstant(String.valueOf(messages[i]));
if (i > 0) {
b.invokeVirtual(TypeDesc.STRING, "concat", TypeDesc.STRING, params);
}
}
b.invokeConstructor(desc, params);
b.throwObject();
} | java | public static void throwConcatException(CodeBuilder b, Class type, String... messages) {
if (messages == null || messages.length == 0) {
throwException(b, type, null);
return;
}
if (messages.length == 1) {
throwException(b, type, messages[0]);
return;
}
TypeDesc desc = TypeDesc.forClass(type);
b.newObject(desc);
b.dup();
TypeDesc[] params = new TypeDesc[] {TypeDesc.STRING};
for (int i=0; i<messages.length; i++) {
b.loadConstant(String.valueOf(messages[i]));
if (i > 0) {
b.invokeVirtual(TypeDesc.STRING, "concat", TypeDesc.STRING, params);
}
}
b.invokeConstructor(desc, params);
b.throwObject();
} | [
"public",
"static",
"void",
"throwConcatException",
"(",
"CodeBuilder",
"b",
",",
"Class",
"type",
",",
"String",
"...",
"messages",
")",
"{",
"if",
"(",
"messages",
"==",
"null",
"||",
"messages",
".",
"length",
"==",
"0",
")",
"{",
"throwException",
"(",
"b",
",",
"type",
",",
"null",
")",
";",
"return",
";",
"}",
"if",
"(",
"messages",
".",
"length",
"==",
"1",
")",
"{",
"throwException",
"(",
"b",
",",
"type",
",",
"messages",
"[",
"0",
"]",
")",
";",
"return",
";",
"}",
"TypeDesc",
"desc",
"=",
"TypeDesc",
".",
"forClass",
"(",
"type",
")",
";",
"b",
".",
"newObject",
"(",
"desc",
")",
";",
"b",
".",
"dup",
"(",
")",
";",
"TypeDesc",
"[",
"]",
"params",
"=",
"new",
"TypeDesc",
"[",
"]",
"{",
"TypeDesc",
".",
"STRING",
"}",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"messages",
".",
"length",
";",
"i",
"++",
")",
"{",
"b",
".",
"loadConstant",
"(",
"String",
".",
"valueOf",
"(",
"messages",
"[",
"i",
"]",
")",
")",
";",
"if",
"(",
"i",
">",
"0",
")",
"{",
"b",
".",
"invokeVirtual",
"(",
"TypeDesc",
".",
"STRING",
",",
"\"concat\"",
",",
"TypeDesc",
".",
"STRING",
",",
"params",
")",
";",
"}",
"}",
"b",
".",
"invokeConstructor",
"(",
"desc",
",",
"params",
")",
";",
"b",
".",
"throwObject",
"(",
")",
";",
"}"
] | Generate code to throw an exception with a message concatenated at runtime.
@param b {@link CodeBuilder} to which to add code
@param type type of the object to throw
@param messages messages to concat at runtime | [
"Generate",
"code",
"to",
"throw",
"an",
"exception",
"with",
"a",
"message",
"concatenated",
"at",
"runtime",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java#L109-L134 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java | AbstractHibernateCriteriaBuilder.geProperty | public org.grails.datastore.mapping.query.api.Criteria geProperty(String propertyName, String otherPropertyName) {
"""
Creates a Criterion that tests if the first property is greater than or equal to the second property
@param propertyName The first property name
@param otherPropertyName The second property name
@return A Criterion instance
"""
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [geProperty] with propertyName [" +
propertyName + "] and other property name [" + otherPropertyName + "] not allowed here."));
}
propertyName = calculatePropertyName(propertyName);
otherPropertyName = calculatePropertyName(otherPropertyName);
addToCriteria(Restrictions.geProperty(propertyName, otherPropertyName));
return this;
} | java | public org.grails.datastore.mapping.query.api.Criteria geProperty(String propertyName, String otherPropertyName) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [geProperty] with propertyName [" +
propertyName + "] and other property name [" + otherPropertyName + "] not allowed here."));
}
propertyName = calculatePropertyName(propertyName);
otherPropertyName = calculatePropertyName(otherPropertyName);
addToCriteria(Restrictions.geProperty(propertyName, otherPropertyName));
return this;
} | [
"public",
"org",
".",
"grails",
".",
"datastore",
".",
"mapping",
".",
"query",
".",
"api",
".",
"Criteria",
"geProperty",
"(",
"String",
"propertyName",
",",
"String",
"otherPropertyName",
")",
"{",
"if",
"(",
"!",
"validateSimpleExpression",
"(",
")",
")",
"{",
"throwRuntimeException",
"(",
"new",
"IllegalArgumentException",
"(",
"\"Call to [geProperty] with propertyName [\"",
"+",
"propertyName",
"+",
"\"] and other property name [\"",
"+",
"otherPropertyName",
"+",
"\"] not allowed here.\"",
")",
")",
";",
"}",
"propertyName",
"=",
"calculatePropertyName",
"(",
"propertyName",
")",
";",
"otherPropertyName",
"=",
"calculatePropertyName",
"(",
"otherPropertyName",
")",
";",
"addToCriteria",
"(",
"Restrictions",
".",
"geProperty",
"(",
"propertyName",
",",
"otherPropertyName",
")",
")",
";",
"return",
"this",
";",
"}"
] | Creates a Criterion that tests if the first property is greater than or equal to the second property
@param propertyName The first property name
@param otherPropertyName The second property name
@return A Criterion instance | [
"Creates",
"a",
"Criterion",
"that",
"tests",
"if",
"the",
"first",
"property",
"is",
"greater",
"than",
"or",
"equal",
"to",
"the",
"second",
"property"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java#L639-L649 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/MutableDocument.java | MutableDocument.setDouble | @NonNull
@Override
public MutableDocument setDouble(@NonNull String key, double value) {
"""
Set a double value for the given key
@param key the key.
@param key the double value.
@return this MutableDocument instance
"""
return setValue(key, value);
} | java | @NonNull
@Override
public MutableDocument setDouble(@NonNull String key, double value) {
return setValue(key, value);
} | [
"@",
"NonNull",
"@",
"Override",
"public",
"MutableDocument",
"setDouble",
"(",
"@",
"NonNull",
"String",
"key",
",",
"double",
"value",
")",
"{",
"return",
"setValue",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Set a double value for the given key
@param key the key.
@param key the double value.
@return this MutableDocument instance | [
"Set",
"a",
"double",
"value",
"for",
"the",
"given",
"key"
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableDocument.java#L223-L227 |
resilience4j/resilience4j | resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/BulkheadExports.java | BulkheadExports.ofSupplier | public static BulkheadExports ofSupplier(String prefix, Supplier<Iterable<Bulkhead>> bulkheadSupplier) {
"""
Creates a new instance of {@link BulkheadExports} with specified metrics names prefix and
{@link Supplier} of bulkheads
@param prefix the prefix of metrics names
@param bulkheadSupplier the supplier of bulkheads
"""
return new BulkheadExports(prefix, bulkheadSupplier);
} | java | public static BulkheadExports ofSupplier(String prefix, Supplier<Iterable<Bulkhead>> bulkheadSupplier) {
return new BulkheadExports(prefix, bulkheadSupplier);
} | [
"public",
"static",
"BulkheadExports",
"ofSupplier",
"(",
"String",
"prefix",
",",
"Supplier",
"<",
"Iterable",
"<",
"Bulkhead",
">",
">",
"bulkheadSupplier",
")",
"{",
"return",
"new",
"BulkheadExports",
"(",
"prefix",
",",
"bulkheadSupplier",
")",
";",
"}"
] | Creates a new instance of {@link BulkheadExports} with specified metrics names prefix and
{@link Supplier} of bulkheads
@param prefix the prefix of metrics names
@param bulkheadSupplier the supplier of bulkheads | [
"Creates",
"a",
"new",
"instance",
"of",
"{",
"@link",
"BulkheadExports",
"}",
"with",
"specified",
"metrics",
"names",
"prefix",
"and",
"{",
"@link",
"Supplier",
"}",
"of",
"bulkheads"
] | train | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/BulkheadExports.java#L54-L56 |
JDBDT/jdbdt | src/main/java/org/jdbdt/DBAssert.java | DBAssert.dataSetAssertion | static void dataSetAssertion(CallInfo callInfo, DataSet expected, DataSet actual) {
"""
Perform a data set assertion.
@param callInfo Call info.
@param expected Expected data.
@param actual Actual data.
@throws DBAssertionError If the assertion fails.
@throws InvalidOperationException If the arguments are invalid.
"""
validateDataSetAssertion(expected, actual);
DataSource source = expected.getSource();
Delta delta = new Delta(expected, actual);
DataSetAssertion assertion = new DataSetAssertion(expected, delta);
source.getDB().log(callInfo, assertion);
if (! assertion.passed()) {
throw new DBAssertionError(callInfo.getMessage());
}
} | java | static void dataSetAssertion(CallInfo callInfo, DataSet expected, DataSet actual) {
validateDataSetAssertion(expected, actual);
DataSource source = expected.getSource();
Delta delta = new Delta(expected, actual);
DataSetAssertion assertion = new DataSetAssertion(expected, delta);
source.getDB().log(callInfo, assertion);
if (! assertion.passed()) {
throw new DBAssertionError(callInfo.getMessage());
}
} | [
"static",
"void",
"dataSetAssertion",
"(",
"CallInfo",
"callInfo",
",",
"DataSet",
"expected",
",",
"DataSet",
"actual",
")",
"{",
"validateDataSetAssertion",
"(",
"expected",
",",
"actual",
")",
";",
"DataSource",
"source",
"=",
"expected",
".",
"getSource",
"(",
")",
";",
"Delta",
"delta",
"=",
"new",
"Delta",
"(",
"expected",
",",
"actual",
")",
";",
"DataSetAssertion",
"assertion",
"=",
"new",
"DataSetAssertion",
"(",
"expected",
",",
"delta",
")",
";",
"source",
".",
"getDB",
"(",
")",
".",
"log",
"(",
"callInfo",
",",
"assertion",
")",
";",
"if",
"(",
"!",
"assertion",
".",
"passed",
"(",
")",
")",
"{",
"throw",
"new",
"DBAssertionError",
"(",
"callInfo",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | Perform a data set assertion.
@param callInfo Call info.
@param expected Expected data.
@param actual Actual data.
@throws DBAssertionError If the assertion fails.
@throws InvalidOperationException If the arguments are invalid. | [
"Perform",
"a",
"data",
"set",
"assertion",
"."
] | train | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DBAssert.java#L113-L123 |
sdl/Testy | src/main/java/com/sdl/selenium/web/WebLocatorAbstractBuilder.java | WebLocatorAbstractBuilder.setAttribute | @SuppressWarnings("unchecked")
public <T extends WebLocatorAbstractBuilder> T setAttribute(final String attribute, String value, final SearchType... searchTypes) {
"""
<p><b>Used for finding element process (to generate xpath address)</b></p>
<p>Result Example:</p>
<pre>
//*[@placeholder='Search']
</pre>
@param attribute eg. placeholder
@param value eg. Search
@param searchTypes see {@link SearchType}
@param <T> the element which calls this method
@return this element
"""
pathBuilder.setAttribute(attribute, value, searchTypes);
return (T) this;
} | java | @SuppressWarnings("unchecked")
public <T extends WebLocatorAbstractBuilder> T setAttribute(final String attribute, String value, final SearchType... searchTypes) {
pathBuilder.setAttribute(attribute, value, searchTypes);
return (T) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"WebLocatorAbstractBuilder",
">",
"T",
"setAttribute",
"(",
"final",
"String",
"attribute",
",",
"String",
"value",
",",
"final",
"SearchType",
"...",
"searchTypes",
")",
"{",
"pathBuilder",
".",
"setAttribute",
"(",
"attribute",
",",
"value",
",",
"searchTypes",
")",
";",
"return",
"(",
"T",
")",
"this",
";",
"}"
] | <p><b>Used for finding element process (to generate xpath address)</b></p>
<p>Result Example:</p>
<pre>
//*[@placeholder='Search']
</pre>
@param attribute eg. placeholder
@param value eg. Search
@param searchTypes see {@link SearchType}
@param <T> the element which calls this method
@return this element | [
"<p",
">",
"<b",
">",
"Used",
"for",
"finding",
"element",
"process",
"(",
"to",
"generate",
"xpath",
"address",
")",
"<",
"/",
"b",
">",
"<",
"/",
"p",
">",
"<p",
">",
"Result",
"Example",
":",
"<",
"/",
"p",
">",
"<pre",
">",
"//",
"*",
"[",
"@placeholder",
"=",
"Search",
"]",
"<",
"/",
"pre",
">"
] | train | https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/web/WebLocatorAbstractBuilder.java#L534-L538 |
igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java | AgentSession.setNote | public void setNote(String sessionID, String note) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
Creates a ChatNote that will be mapped to the given chat session.
@param sessionID the session id of a Chat Session.
@param note the chat note to add.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
"""
ChatNotes notes = new ChatNotes();
notes.setType(IQ.Type.set);
notes.setTo(workgroupJID);
notes.setSessionID(sessionID);
notes.setNotes(note);
connection.createStanzaCollectorAndSend(notes).nextResultOrThrow();
} | java | public void setNote(String sessionID, String note) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
ChatNotes notes = new ChatNotes();
notes.setType(IQ.Type.set);
notes.setTo(workgroupJID);
notes.setSessionID(sessionID);
notes.setNotes(note);
connection.createStanzaCollectorAndSend(notes).nextResultOrThrow();
} | [
"public",
"void",
"setNote",
"(",
"String",
"sessionID",
",",
"String",
"note",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"ChatNotes",
"notes",
"=",
"new",
"ChatNotes",
"(",
")",
";",
"notes",
".",
"setType",
"(",
"IQ",
".",
"Type",
".",
"set",
")",
";",
"notes",
".",
"setTo",
"(",
"workgroupJID",
")",
";",
"notes",
".",
"setSessionID",
"(",
"sessionID",
")",
";",
"notes",
".",
"setNotes",
"(",
"note",
")",
";",
"connection",
".",
"createStanzaCollectorAndSend",
"(",
"notes",
")",
".",
"nextResultOrThrow",
"(",
")",
";",
"}"
] | Creates a ChatNote that will be mapped to the given chat session.
@param sessionID the session id of a Chat Session.
@param note the chat note to add.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Creates",
"a",
"ChatNote",
"that",
"will",
"be",
"mapped",
"to",
"the",
"given",
"chat",
"session",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java#L856-L863 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/SparkUtils.java | SparkUtils.repartitionBalanceIfRequired | public static <T> JavaRDD<T> repartitionBalanceIfRequired(JavaRDD<T> rdd, Repartition repartition,
int objectsPerPartition, int numPartitions) {
"""
Repartition a RDD (given the {@link Repartition} setting) such that we have approximately
{@code numPartitions} partitions, each of which has {@code objectsPerPartition} objects.
@param rdd RDD to repartition
@param repartition Repartitioning setting
@param objectsPerPartition Number of objects we want in each partition
@param numPartitions Number of partitions to have
@param <T> Type of RDD
@return Repartitioned RDD, or the original RDD if no repartitioning was performed
"""
int origNumPartitions = rdd.partitions().size();
switch (repartition) {
case Never:
return rdd;
case NumPartitionsWorkersDiffers:
if (origNumPartitions == numPartitions)
return rdd;
case Always:
//Repartition: either always, or origNumPartitions != numWorkers
//First: count number of elements in each partition. Need to know this so we can work out how to properly index each example,
// so we can in turn create properly balanced partitions after repartitioning
//Because the objects (DataSets etc) should be small, this should be OK
//Count each partition...
List<Tuple2<Integer, Integer>> partitionCounts =
rdd.mapPartitionsWithIndex(new CountPartitionsFunction<T>(), true).collect();
int totalObjects = 0;
int initialPartitions = partitionCounts.size();
boolean allCorrectSize = true;
int x = 0;
for (Tuple2<Integer, Integer> t2 : partitionCounts) {
int partitionSize = t2._2();
allCorrectSize &= (partitionSize == objectsPerPartition);
totalObjects += t2._2();
}
if (numPartitions * objectsPerPartition < totalObjects) {
allCorrectSize = true;
for (Tuple2<Integer, Integer> t2 : partitionCounts) {
allCorrectSize &= (t2._2() == objectsPerPartition);
}
}
if (initialPartitions == numPartitions && allCorrectSize) {
//Don't need to do any repartitioning here - already in the format we want
return rdd;
}
//Index each element for repartitioning (can only do manual repartitioning on a JavaPairRDD)
JavaPairRDD<Integer, T> pairIndexed = indexedRDD(rdd);
int remainder = (totalObjects - numPartitions * objectsPerPartition) % numPartitions;
log.info("Amount to rebalance: numPartitions={}, objectsPerPartition={}, remainder={}", numPartitions, objectsPerPartition, remainder);
pairIndexed = pairIndexed
.partitionBy(new BalancedPartitioner(numPartitions, objectsPerPartition, remainder));
return pairIndexed.values();
default:
throw new RuntimeException("Unknown setting for repartition: " + repartition);
}
} | java | public static <T> JavaRDD<T> repartitionBalanceIfRequired(JavaRDD<T> rdd, Repartition repartition,
int objectsPerPartition, int numPartitions) {
int origNumPartitions = rdd.partitions().size();
switch (repartition) {
case Never:
return rdd;
case NumPartitionsWorkersDiffers:
if (origNumPartitions == numPartitions)
return rdd;
case Always:
//Repartition: either always, or origNumPartitions != numWorkers
//First: count number of elements in each partition. Need to know this so we can work out how to properly index each example,
// so we can in turn create properly balanced partitions after repartitioning
//Because the objects (DataSets etc) should be small, this should be OK
//Count each partition...
List<Tuple2<Integer, Integer>> partitionCounts =
rdd.mapPartitionsWithIndex(new CountPartitionsFunction<T>(), true).collect();
int totalObjects = 0;
int initialPartitions = partitionCounts.size();
boolean allCorrectSize = true;
int x = 0;
for (Tuple2<Integer, Integer> t2 : partitionCounts) {
int partitionSize = t2._2();
allCorrectSize &= (partitionSize == objectsPerPartition);
totalObjects += t2._2();
}
if (numPartitions * objectsPerPartition < totalObjects) {
allCorrectSize = true;
for (Tuple2<Integer, Integer> t2 : partitionCounts) {
allCorrectSize &= (t2._2() == objectsPerPartition);
}
}
if (initialPartitions == numPartitions && allCorrectSize) {
//Don't need to do any repartitioning here - already in the format we want
return rdd;
}
//Index each element for repartitioning (can only do manual repartitioning on a JavaPairRDD)
JavaPairRDD<Integer, T> pairIndexed = indexedRDD(rdd);
int remainder = (totalObjects - numPartitions * objectsPerPartition) % numPartitions;
log.info("Amount to rebalance: numPartitions={}, objectsPerPartition={}, remainder={}", numPartitions, objectsPerPartition, remainder);
pairIndexed = pairIndexed
.partitionBy(new BalancedPartitioner(numPartitions, objectsPerPartition, remainder));
return pairIndexed.values();
default:
throw new RuntimeException("Unknown setting for repartition: " + repartition);
}
} | [
"public",
"static",
"<",
"T",
">",
"JavaRDD",
"<",
"T",
">",
"repartitionBalanceIfRequired",
"(",
"JavaRDD",
"<",
"T",
">",
"rdd",
",",
"Repartition",
"repartition",
",",
"int",
"objectsPerPartition",
",",
"int",
"numPartitions",
")",
"{",
"int",
"origNumPartitions",
"=",
"rdd",
".",
"partitions",
"(",
")",
".",
"size",
"(",
")",
";",
"switch",
"(",
"repartition",
")",
"{",
"case",
"Never",
":",
"return",
"rdd",
";",
"case",
"NumPartitionsWorkersDiffers",
":",
"if",
"(",
"origNumPartitions",
"==",
"numPartitions",
")",
"return",
"rdd",
";",
"case",
"Always",
":",
"//Repartition: either always, or origNumPartitions != numWorkers",
"//First: count number of elements in each partition. Need to know this so we can work out how to properly index each example,",
"// so we can in turn create properly balanced partitions after repartitioning",
"//Because the objects (DataSets etc) should be small, this should be OK",
"//Count each partition...",
"List",
"<",
"Tuple2",
"<",
"Integer",
",",
"Integer",
">",
">",
"partitionCounts",
"=",
"rdd",
".",
"mapPartitionsWithIndex",
"(",
"new",
"CountPartitionsFunction",
"<",
"T",
">",
"(",
")",
",",
"true",
")",
".",
"collect",
"(",
")",
";",
"int",
"totalObjects",
"=",
"0",
";",
"int",
"initialPartitions",
"=",
"partitionCounts",
".",
"size",
"(",
")",
";",
"boolean",
"allCorrectSize",
"=",
"true",
";",
"int",
"x",
"=",
"0",
";",
"for",
"(",
"Tuple2",
"<",
"Integer",
",",
"Integer",
">",
"t2",
":",
"partitionCounts",
")",
"{",
"int",
"partitionSize",
"=",
"t2",
".",
"_2",
"(",
")",
";",
"allCorrectSize",
"&=",
"(",
"partitionSize",
"==",
"objectsPerPartition",
")",
";",
"totalObjects",
"+=",
"t2",
".",
"_2",
"(",
")",
";",
"}",
"if",
"(",
"numPartitions",
"*",
"objectsPerPartition",
"<",
"totalObjects",
")",
"{",
"allCorrectSize",
"=",
"true",
";",
"for",
"(",
"Tuple2",
"<",
"Integer",
",",
"Integer",
">",
"t2",
":",
"partitionCounts",
")",
"{",
"allCorrectSize",
"&=",
"(",
"t2",
".",
"_2",
"(",
")",
"==",
"objectsPerPartition",
")",
";",
"}",
"}",
"if",
"(",
"initialPartitions",
"==",
"numPartitions",
"&&",
"allCorrectSize",
")",
"{",
"//Don't need to do any repartitioning here - already in the format we want",
"return",
"rdd",
";",
"}",
"//Index each element for repartitioning (can only do manual repartitioning on a JavaPairRDD)",
"JavaPairRDD",
"<",
"Integer",
",",
"T",
">",
"pairIndexed",
"=",
"indexedRDD",
"(",
"rdd",
")",
";",
"int",
"remainder",
"=",
"(",
"totalObjects",
"-",
"numPartitions",
"*",
"objectsPerPartition",
")",
"%",
"numPartitions",
";",
"log",
".",
"info",
"(",
"\"Amount to rebalance: numPartitions={}, objectsPerPartition={}, remainder={}\"",
",",
"numPartitions",
",",
"objectsPerPartition",
",",
"remainder",
")",
";",
"pairIndexed",
"=",
"pairIndexed",
".",
"partitionBy",
"(",
"new",
"BalancedPartitioner",
"(",
"numPartitions",
",",
"objectsPerPartition",
",",
"remainder",
")",
")",
";",
"return",
"pairIndexed",
".",
"values",
"(",
")",
";",
"default",
":",
"throw",
"new",
"RuntimeException",
"(",
"\"Unknown setting for repartition: \"",
"+",
"repartition",
")",
";",
"}",
"}"
] | Repartition a RDD (given the {@link Repartition} setting) such that we have approximately
{@code numPartitions} partitions, each of which has {@code objectsPerPartition} objects.
@param rdd RDD to repartition
@param repartition Repartitioning setting
@param objectsPerPartition Number of objects we want in each partition
@param numPartitions Number of partitions to have
@param <T> Type of RDD
@return Repartitioned RDD, or the original RDD if no repartitioning was performed | [
"Repartition",
"a",
"RDD",
"(",
"given",
"the",
"{",
"@link",
"Repartition",
"}",
"setting",
")",
"such",
"that",
"we",
"have",
"approximately",
"{",
"@code",
"numPartitions",
"}",
"partitions",
"each",
"of",
"which",
"has",
"{",
"@code",
"objectsPerPartition",
"}",
"objects",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/SparkUtils.java#L363-L416 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/ConfigWebUtil.java | ConfigWebUtil.getFile | public static Resource getFile(Config config, Resource directory, String path, short type) {
"""
touch a file object by the string definition
@param config
@param directory
@param path
@param type
@return matching file
"""
path = replacePlaceholder(path, config);
if (!StringUtil.isEmpty(path, true)) {
Resource file = getFile(directory.getRealResource(path), type);
if (file != null) return file;
file = getFile(config.getResource(path), type);
if (file != null) return file;
}
return null;
} | java | public static Resource getFile(Config config, Resource directory, String path, short type) {
path = replacePlaceholder(path, config);
if (!StringUtil.isEmpty(path, true)) {
Resource file = getFile(directory.getRealResource(path), type);
if (file != null) return file;
file = getFile(config.getResource(path), type);
if (file != null) return file;
}
return null;
} | [
"public",
"static",
"Resource",
"getFile",
"(",
"Config",
"config",
",",
"Resource",
"directory",
",",
"String",
"path",
",",
"short",
"type",
")",
"{",
"path",
"=",
"replacePlaceholder",
"(",
"path",
",",
"config",
")",
";",
"if",
"(",
"!",
"StringUtil",
".",
"isEmpty",
"(",
"path",
",",
"true",
")",
")",
"{",
"Resource",
"file",
"=",
"getFile",
"(",
"directory",
".",
"getRealResource",
"(",
"path",
")",
",",
"type",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"return",
"file",
";",
"file",
"=",
"getFile",
"(",
"config",
".",
"getResource",
"(",
"path",
")",
",",
"type",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"return",
"file",
";",
"}",
"return",
"null",
";",
"}"
] | touch a file object by the string definition
@param config
@param directory
@param path
@param type
@return matching file | [
"touch",
"a",
"file",
"object",
"by",
"the",
"string",
"definition"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigWebUtil.java#L225-L236 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/SVSConsumerAuditor.java | SVSConsumerAuditor.auditRetrieveValueSetEvent | public void auditRetrieveValueSetEvent(RFC3881EventOutcomeCodes eventOutcome,
String repositoryEndpointUri,
String valueSetUniqueId, String valueSetName,
String valueSetVersion,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles) {
"""
Audits an ITI-48 Retrieve Value Set event for SVS Consumer actors.
@param eventOutcome The event outcome indicator
@param repositoryEndpointUri The Web service endpoint URI for the SVS repository
@param valueSetUniqueId unique id (OID) of the returned value set
@param valueSetName name associated with the unique id (OID) of the returned value set
@param valueSetVersion version of the returned value set
@param purposesOfUse purpose of use codes (may be taken from XUA token)
@param userRoles roles of the human user (may be taken from XUA token)
"""
if (!isAuditorEnabled()) {
return;
}
ImportEvent importEvent = new ImportEvent(false, eventOutcome, new IHETransactionEventTypeCodes.RetrieveValueSet(), purposesOfUse);
importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
importEvent.addSourceActiveParticipant(EventUtils.getAddressForUrl(repositoryEndpointUri, false), null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false);
importEvent.addDestinationActiveParticipant(getSystemUserId(), getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true);
if (!EventUtils.isEmptyOrNull(getHumanRequestor())) {
importEvent.addHumanRequestorActiveParticipant(getHumanRequestor(), null, null, userRoles);
}
importEvent.addValueSetParticipantObject(valueSetUniqueId, valueSetName, valueSetVersion);
audit(importEvent);
} | java | public void auditRetrieveValueSetEvent(RFC3881EventOutcomeCodes eventOutcome,
String repositoryEndpointUri,
String valueSetUniqueId, String valueSetName,
String valueSetVersion,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
ImportEvent importEvent = new ImportEvent(false, eventOutcome, new IHETransactionEventTypeCodes.RetrieveValueSet(), purposesOfUse);
importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
importEvent.addSourceActiveParticipant(EventUtils.getAddressForUrl(repositoryEndpointUri, false), null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false);
importEvent.addDestinationActiveParticipant(getSystemUserId(), getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true);
if (!EventUtils.isEmptyOrNull(getHumanRequestor())) {
importEvent.addHumanRequestorActiveParticipant(getHumanRequestor(), null, null, userRoles);
}
importEvent.addValueSetParticipantObject(valueSetUniqueId, valueSetName, valueSetVersion);
audit(importEvent);
} | [
"public",
"void",
"auditRetrieveValueSetEvent",
"(",
"RFC3881EventOutcomeCodes",
"eventOutcome",
",",
"String",
"repositoryEndpointUri",
",",
"String",
"valueSetUniqueId",
",",
"String",
"valueSetName",
",",
"String",
"valueSetVersion",
",",
"List",
"<",
"CodedValueType",
">",
"purposesOfUse",
",",
"List",
"<",
"CodedValueType",
">",
"userRoles",
")",
"{",
"if",
"(",
"!",
"isAuditorEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"ImportEvent",
"importEvent",
"=",
"new",
"ImportEvent",
"(",
"false",
",",
"eventOutcome",
",",
"new",
"IHETransactionEventTypeCodes",
".",
"RetrieveValueSet",
"(",
")",
",",
"purposesOfUse",
")",
";",
"importEvent",
".",
"setAuditSourceId",
"(",
"getAuditSourceId",
"(",
")",
",",
"getAuditEnterpriseSiteId",
"(",
")",
")",
";",
"importEvent",
".",
"addSourceActiveParticipant",
"(",
"EventUtils",
".",
"getAddressForUrl",
"(",
"repositoryEndpointUri",
",",
"false",
")",
",",
"null",
",",
"null",
",",
"EventUtils",
".",
"getAddressForUrl",
"(",
"repositoryEndpointUri",
",",
"false",
")",
",",
"false",
")",
";",
"importEvent",
".",
"addDestinationActiveParticipant",
"(",
"getSystemUserId",
"(",
")",
",",
"getSystemAltUserId",
"(",
")",
",",
"getSystemUserName",
"(",
")",
",",
"getSystemNetworkId",
"(",
")",
",",
"true",
")",
";",
"if",
"(",
"!",
"EventUtils",
".",
"isEmptyOrNull",
"(",
"getHumanRequestor",
"(",
")",
")",
")",
"{",
"importEvent",
".",
"addHumanRequestorActiveParticipant",
"(",
"getHumanRequestor",
"(",
")",
",",
"null",
",",
"null",
",",
"userRoles",
")",
";",
"}",
"importEvent",
".",
"addValueSetParticipantObject",
"(",
"valueSetUniqueId",
",",
"valueSetName",
",",
"valueSetVersion",
")",
";",
"audit",
"(",
"importEvent",
")",
";",
"}"
] | Audits an ITI-48 Retrieve Value Set event for SVS Consumer actors.
@param eventOutcome The event outcome indicator
@param repositoryEndpointUri The Web service endpoint URI for the SVS repository
@param valueSetUniqueId unique id (OID) of the returned value set
@param valueSetName name associated with the unique id (OID) of the returned value set
@param valueSetVersion version of the returned value set
@param purposesOfUse purpose of use codes (may be taken from XUA token)
@param userRoles roles of the human user (may be taken from XUA token) | [
"Audits",
"an",
"ITI",
"-",
"48",
"Retrieve",
"Value",
"Set",
"event",
"for",
"SVS",
"Consumer",
"actors",
"."
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/SVSConsumerAuditor.java#L59-L78 |
aws/aws-sdk-java | aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/UpdateEventConfigurationsRequest.java | UpdateEventConfigurationsRequest.withEventConfigurations | public UpdateEventConfigurationsRequest withEventConfigurations(java.util.Map<String, Configuration> eventConfigurations) {
"""
<p>
The new event configuration values.
</p>
@param eventConfigurations
The new event configuration values.
@return Returns a reference to this object so that method calls can be chained together.
"""
setEventConfigurations(eventConfigurations);
return this;
} | java | public UpdateEventConfigurationsRequest withEventConfigurations(java.util.Map<String, Configuration> eventConfigurations) {
setEventConfigurations(eventConfigurations);
return this;
} | [
"public",
"UpdateEventConfigurationsRequest",
"withEventConfigurations",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"Configuration",
">",
"eventConfigurations",
")",
"{",
"setEventConfigurations",
"(",
"eventConfigurations",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The new event configuration values.
</p>
@param eventConfigurations
The new event configuration values.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"new",
"event",
"configuration",
"values",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/UpdateEventConfigurationsRequest.java#L65-L68 |
apache/incubator-heron | heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java | SchedulerStateManagerAdaptor.updatePackingPlan | public Boolean updatePackingPlan(PackingPlans.PackingPlan packingPlan, String topologyName) {
"""
Update the packing plan for the given topology. If the packing plan doesn't exist, create it.
If it does, update it.
@param packingPlan the packing plan of the topology
@return Boolean - Success or Failure
"""
if (getPackingPlan(topologyName) != null) {
deletePackingPlan(topologyName);
}
return setPackingPlan(packingPlan, topologyName);
} | java | public Boolean updatePackingPlan(PackingPlans.PackingPlan packingPlan, String topologyName) {
if (getPackingPlan(topologyName) != null) {
deletePackingPlan(topologyName);
}
return setPackingPlan(packingPlan, topologyName);
} | [
"public",
"Boolean",
"updatePackingPlan",
"(",
"PackingPlans",
".",
"PackingPlan",
"packingPlan",
",",
"String",
"topologyName",
")",
"{",
"if",
"(",
"getPackingPlan",
"(",
"topologyName",
")",
"!=",
"null",
")",
"{",
"deletePackingPlan",
"(",
"topologyName",
")",
";",
"}",
"return",
"setPackingPlan",
"(",
"packingPlan",
",",
"topologyName",
")",
";",
"}"
] | Update the packing plan for the given topology. If the packing plan doesn't exist, create it.
If it does, update it.
@param packingPlan the packing plan of the topology
@return Boolean - Success or Failure | [
"Update",
"the",
"packing",
"plan",
"for",
"the",
"given",
"topology",
".",
"If",
"the",
"packing",
"plan",
"doesn",
"t",
"exist",
"create",
"it",
".",
"If",
"it",
"does",
"update",
"it",
"."
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java#L164-L169 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java | AbstractTypeVisitor6.visitIntersection | @Override
public R visitIntersection(IntersectionType t, P p) {
"""
{@inheritDoc}
@implSpec Visits an {@code IntersectionType} element by calling {@code
visitUnknown}.
@param t {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code visitUnknown}
@since 1.8
"""
return visitUnknown(t, p);
} | java | @Override
public R visitIntersection(IntersectionType t, P p) {
return visitUnknown(t, p);
} | [
"@",
"Override",
"public",
"R",
"visitIntersection",
"(",
"IntersectionType",
"t",
",",
"P",
"p",
")",
"{",
"return",
"visitUnknown",
"(",
"t",
",",
"p",
")",
";",
"}"
] | {@inheritDoc}
@implSpec Visits an {@code IntersectionType} element by calling {@code
visitUnknown}.
@param t {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code visitUnknown}
@since 1.8 | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java#L135-L138 |
lessthanoptimal/BoofCV | main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/RefineDualQuadraticAlgebra.java | RefineDualQuadraticAlgebra.encodeK | public int encodeK( DMatrix3x3 K , int which, int offset, double params[] ) {
"""
Encode the calibration as a 3x3 matrix. K is assumed to zero initially or at
least all non-zero elements will align with values that are written to.
"""
if( fixedAspectRatio ) {
K.a11 = params[offset++];
K.a22 = aspect.data[which]*K.a11;
} else {
K.a11 = params[offset++];
K.a22 = params[offset++];
}
if( !zeroSkew ) {
K.a12 = params[offset++];
}
if( !zeroPrinciplePoint ) {
K.a13 = params[offset++];
K.a23 = params[offset++];
}
K.a33 = 1;
return offset;
} | java | public int encodeK( DMatrix3x3 K , int which, int offset, double params[] ) {
if( fixedAspectRatio ) {
K.a11 = params[offset++];
K.a22 = aspect.data[which]*K.a11;
} else {
K.a11 = params[offset++];
K.a22 = params[offset++];
}
if( !zeroSkew ) {
K.a12 = params[offset++];
}
if( !zeroPrinciplePoint ) {
K.a13 = params[offset++];
K.a23 = params[offset++];
}
K.a33 = 1;
return offset;
} | [
"public",
"int",
"encodeK",
"(",
"DMatrix3x3",
"K",
",",
"int",
"which",
",",
"int",
"offset",
",",
"double",
"params",
"[",
"]",
")",
"{",
"if",
"(",
"fixedAspectRatio",
")",
"{",
"K",
".",
"a11",
"=",
"params",
"[",
"offset",
"++",
"]",
";",
"K",
".",
"a22",
"=",
"aspect",
".",
"data",
"[",
"which",
"]",
"*",
"K",
".",
"a11",
";",
"}",
"else",
"{",
"K",
".",
"a11",
"=",
"params",
"[",
"offset",
"++",
"]",
";",
"K",
".",
"a22",
"=",
"params",
"[",
"offset",
"++",
"]",
";",
"}",
"if",
"(",
"!",
"zeroSkew",
")",
"{",
"K",
".",
"a12",
"=",
"params",
"[",
"offset",
"++",
"]",
";",
"}",
"if",
"(",
"!",
"zeroPrinciplePoint",
")",
"{",
"K",
".",
"a13",
"=",
"params",
"[",
"offset",
"++",
"]",
";",
"K",
".",
"a23",
"=",
"params",
"[",
"offset",
"++",
"]",
";",
"}",
"K",
".",
"a33",
"=",
"1",
";",
"return",
"offset",
";",
"}"
] | Encode the calibration as a 3x3 matrix. K is assumed to zero initially or at
least all non-zero elements will align with values that are written to. | [
"Encode",
"the",
"calibration",
"as",
"a",
"3x3",
"matrix",
".",
"K",
"is",
"assumed",
"to",
"zero",
"initially",
"or",
"at",
"least",
"all",
"non",
"-",
"zero",
"elements",
"will",
"align",
"with",
"values",
"that",
"are",
"written",
"to",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/RefineDualQuadraticAlgebra.java#L230-L250 |
respoke/respoke-sdk-android | respokeSDK/src/main/java/com/digium/respokesdk/RespokeGroup.java | RespokeGroup.postGetGroupMembersError | private void postGetGroupMembersError(final GetGroupMembersCompletionListener completionListener, final String errorMessage) {
"""
A convenience method for posting errors to a GetGroupMembersCompletionListener
@param completionListener The listener to notify
@param errorMessage The human-readable error message that occurred
"""
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != completionListener) {
completionListener.onError(errorMessage);
}
}
});
} | java | private void postGetGroupMembersError(final GetGroupMembersCompletionListener completionListener, final String errorMessage) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != completionListener) {
completionListener.onError(errorMessage);
}
}
});
} | [
"private",
"void",
"postGetGroupMembersError",
"(",
"final",
"GetGroupMembersCompletionListener",
"completionListener",
",",
"final",
"String",
"errorMessage",
")",
"{",
"new",
"Handler",
"(",
"Looper",
".",
"getMainLooper",
"(",
")",
")",
".",
"post",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"completionListener",
")",
"{",
"completionListener",
".",
"onError",
"(",
"errorMessage",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] | A convenience method for posting errors to a GetGroupMembersCompletionListener
@param completionListener The listener to notify
@param errorMessage The human-readable error message that occurred | [
"A",
"convenience",
"method",
"for",
"posting",
"errors",
"to",
"a",
"GetGroupMembersCompletionListener"
] | train | https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeGroup.java#L434-L443 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/PolicyLimit.java | PolicyLimit.findPolicyLimitByUserAndCounter | public static PolicyLimit findPolicyLimitByUserAndCounter(EntityManager em, PrincipalUser user, PolicyCounter counter) {
"""
Retrieves the policy limit object for a given user-counter combination.
@param em The EntityManager to use.
@param user The user for which to retrieve the policy limit.
@param counter The counter for which to retrieve the policy limit.
@return The policy limit object for the given user-counter combination. Null if no such record exists.
"""
TypedQuery<PolicyLimit> query = em.createNamedQuery("PolicyLimit.findPolicyLimitByUserAndCounter", PolicyLimit.class);
try {
query.setParameter("user", user);
query.setParameter("counter", counter);
return query.getSingleResult();
} catch (NoResultException ex) {
return null;
}
} | java | public static PolicyLimit findPolicyLimitByUserAndCounter(EntityManager em, PrincipalUser user, PolicyCounter counter) {
TypedQuery<PolicyLimit> query = em.createNamedQuery("PolicyLimit.findPolicyLimitByUserAndCounter", PolicyLimit.class);
try {
query.setParameter("user", user);
query.setParameter("counter", counter);
return query.getSingleResult();
} catch (NoResultException ex) {
return null;
}
} | [
"public",
"static",
"PolicyLimit",
"findPolicyLimitByUserAndCounter",
"(",
"EntityManager",
"em",
",",
"PrincipalUser",
"user",
",",
"PolicyCounter",
"counter",
")",
"{",
"TypedQuery",
"<",
"PolicyLimit",
">",
"query",
"=",
"em",
".",
"createNamedQuery",
"(",
"\"PolicyLimit.findPolicyLimitByUserAndCounter\"",
",",
"PolicyLimit",
".",
"class",
")",
";",
"try",
"{",
"query",
".",
"setParameter",
"(",
"\"user\"",
",",
"user",
")",
";",
"query",
".",
"setParameter",
"(",
"\"counter\"",
",",
"counter",
")",
";",
"return",
"query",
".",
"getSingleResult",
"(",
")",
";",
"}",
"catch",
"(",
"NoResultException",
"ex",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Retrieves the policy limit object for a given user-counter combination.
@param em The EntityManager to use.
@param user The user for which to retrieve the policy limit.
@param counter The counter for which to retrieve the policy limit.
@return The policy limit object for the given user-counter combination. Null if no such record exists. | [
"Retrieves",
"the",
"policy",
"limit",
"object",
"for",
"a",
"given",
"user",
"-",
"counter",
"combination",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/PolicyLimit.java#L129-L139 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.readUtf8Lines | public static void readUtf8Lines(InputStream in, LineHandler lineHandler) throws IORuntimeException {
"""
按行读取UTF-8编码数据,针对每行的数据做处理
@param in {@link InputStream}
@param lineHandler 行处理接口,实现handle方法用于编辑一行的数据后入到指定地方
@throws IORuntimeException IO异常
@since 3.1.1
"""
readLines(in, CharsetUtil.CHARSET_UTF_8, lineHandler);
} | java | public static void readUtf8Lines(InputStream in, LineHandler lineHandler) throws IORuntimeException {
readLines(in, CharsetUtil.CHARSET_UTF_8, lineHandler);
} | [
"public",
"static",
"void",
"readUtf8Lines",
"(",
"InputStream",
"in",
",",
"LineHandler",
"lineHandler",
")",
"throws",
"IORuntimeException",
"{",
"readLines",
"(",
"in",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
",",
"lineHandler",
")",
";",
"}"
] | 按行读取UTF-8编码数据,针对每行的数据做处理
@param in {@link InputStream}
@param lineHandler 行处理接口,实现handle方法用于编辑一行的数据后入到指定地方
@throws IORuntimeException IO异常
@since 3.1.1 | [
"按行读取UTF",
"-",
"8编码数据,针对每行的数据做处理"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L689-L691 |
JOML-CI/JOML | src/org/joml/Intersectiond.java | Intersectiond.intersectLineSegmentTriangle | public static boolean intersectLineSegmentTriangle(Vector3dc p0, Vector3dc p1, Vector3dc v0, Vector3dc v1, Vector3dc v2, double epsilon, Vector3d intersectionPoint) {
"""
Determine whether the line segment with the end points <code>p0</code> and <code>p1</code>
intersects the triangle consisting of the three vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code>,
regardless of the winding order of the triangle or the direction of the line segment between its two end points,
and return the point of intersection.
<p>
Reference: <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf">
Fast, Minimum Storage Ray/Triangle Intersection</a>
@see #intersectLineSegmentTriangle(double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, Vector3d)
@param p0
the line segment's first end point
@param p1
the line segment's second end point
@param v0
the position of the first vertex
@param v1
the position of the second vertex
@param v2
the position of the third vertex
@param epsilon
a small epsilon when testing line segments that are almost parallel to the triangle
@param intersectionPoint
the point of intersection
@return <code>true</code> if the given line segment intersects the triangle; <code>false</code> otherwise
"""
return intersectLineSegmentTriangle(p0.x(), p0.y(), p0.z(), p1.x(), p1.y(), p1.z(), v0.x(), v0.y(), v0.z(), v1.x(), v1.y(), v1.z(), v2.x(), v2.y(), v2.z(), epsilon, intersectionPoint);
} | java | public static boolean intersectLineSegmentTriangle(Vector3dc p0, Vector3dc p1, Vector3dc v0, Vector3dc v1, Vector3dc v2, double epsilon, Vector3d intersectionPoint) {
return intersectLineSegmentTriangle(p0.x(), p0.y(), p0.z(), p1.x(), p1.y(), p1.z(), v0.x(), v0.y(), v0.z(), v1.x(), v1.y(), v1.z(), v2.x(), v2.y(), v2.z(), epsilon, intersectionPoint);
} | [
"public",
"static",
"boolean",
"intersectLineSegmentTriangle",
"(",
"Vector3dc",
"p0",
",",
"Vector3dc",
"p1",
",",
"Vector3dc",
"v0",
",",
"Vector3dc",
"v1",
",",
"Vector3dc",
"v2",
",",
"double",
"epsilon",
",",
"Vector3d",
"intersectionPoint",
")",
"{",
"return",
"intersectLineSegmentTriangle",
"(",
"p0",
".",
"x",
"(",
")",
",",
"p0",
".",
"y",
"(",
")",
",",
"p0",
".",
"z",
"(",
")",
",",
"p1",
".",
"x",
"(",
")",
",",
"p1",
".",
"y",
"(",
")",
",",
"p1",
".",
"z",
"(",
")",
",",
"v0",
".",
"x",
"(",
")",
",",
"v0",
".",
"y",
"(",
")",
",",
"v0",
".",
"z",
"(",
")",
",",
"v1",
".",
"x",
"(",
")",
",",
"v1",
".",
"y",
"(",
")",
",",
"v1",
".",
"z",
"(",
")",
",",
"v2",
".",
"x",
"(",
")",
",",
"v2",
".",
"y",
"(",
")",
",",
"v2",
".",
"z",
"(",
")",
",",
"epsilon",
",",
"intersectionPoint",
")",
";",
"}"
] | Determine whether the line segment with the end points <code>p0</code> and <code>p1</code>
intersects the triangle consisting of the three vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code>,
regardless of the winding order of the triangle or the direction of the line segment between its two end points,
and return the point of intersection.
<p>
Reference: <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf">
Fast, Minimum Storage Ray/Triangle Intersection</a>
@see #intersectLineSegmentTriangle(double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, Vector3d)
@param p0
the line segment's first end point
@param p1
the line segment's second end point
@param v0
the position of the first vertex
@param v1
the position of the second vertex
@param v2
the position of the third vertex
@param epsilon
a small epsilon when testing line segments that are almost parallel to the triangle
@param intersectionPoint
the point of intersection
@return <code>true</code> if the given line segment intersects the triangle; <code>false</code> otherwise | [
"Determine",
"whether",
"the",
"line",
"segment",
"with",
"the",
"end",
"points",
"<code",
">",
"p0<",
"/",
"code",
">",
"and",
"<code",
">",
"p1<",
"/",
"code",
">",
"intersects",
"the",
"triangle",
"consisting",
"of",
"the",
"three",
"vertices",
"<code",
">",
"(",
"v0X",
"v0Y",
"v0Z",
")",
"<",
"/",
"code",
">",
"<code",
">",
"(",
"v1X",
"v1Y",
"v1Z",
")",
"<",
"/",
"code",
">",
"and",
"<code",
">",
"(",
"v2X",
"v2Y",
"v2Z",
")",
"<",
"/",
"code",
">",
"regardless",
"of",
"the",
"winding",
"order",
"of",
"the",
"triangle",
"or",
"the",
"direction",
"of",
"the",
"line",
"segment",
"between",
"its",
"two",
"end",
"points",
"and",
"return",
"the",
"point",
"of",
"intersection",
".",
"<p",
">",
"Reference",
":",
"<a",
"href",
"=",
"http",
":",
"//",
"www",
".",
"graphics",
".",
"cornell",
".",
"edu",
"/",
"pubs",
"/",
"1997",
"/",
"MT97",
".",
"pdf",
">",
"Fast",
"Minimum",
"Storage",
"Ray",
"/",
"Triangle",
"Intersection<",
"/",
"a",
">"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectiond.java#L3335-L3337 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/GitLabApiClient.java | GitLabApiClient.putUpload | protected Response putUpload(String name, File fileToUpload, Object... pathArgs) throws IOException {
"""
Perform a file upload using multipart/form-data using the HTTP PUT method, returning
a ClientResponse instance with the data returned from the endpoint.
@param name the name for the form field that contains the file name
@param fileToUpload a File instance pointing to the file to upload
@param pathArgs variable list of arguments used to build the URI
@return a ClientResponse instance with the data returned from the endpoint
@throws IOException if an error occurs while constructing the URL
"""
URL url = getApiUrl(pathArgs);
return (putUpload(name, fileToUpload, url));
} | java | protected Response putUpload(String name, File fileToUpload, Object... pathArgs) throws IOException {
URL url = getApiUrl(pathArgs);
return (putUpload(name, fileToUpload, url));
} | [
"protected",
"Response",
"putUpload",
"(",
"String",
"name",
",",
"File",
"fileToUpload",
",",
"Object",
"...",
"pathArgs",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"getApiUrl",
"(",
"pathArgs",
")",
";",
"return",
"(",
"putUpload",
"(",
"name",
",",
"fileToUpload",
",",
"url",
")",
")",
";",
"}"
] | Perform a file upload using multipart/form-data using the HTTP PUT method, returning
a ClientResponse instance with the data returned from the endpoint.
@param name the name for the form field that contains the file name
@param fileToUpload a File instance pointing to the file to upload
@param pathArgs variable list of arguments used to build the URI
@return a ClientResponse instance with the data returned from the endpoint
@throws IOException if an error occurs while constructing the URL | [
"Perform",
"a",
"file",
"upload",
"using",
"multipart",
"/",
"form",
"-",
"data",
"using",
"the",
"HTTP",
"PUT",
"method",
"returning",
"a",
"ClientResponse",
"instance",
"with",
"the",
"data",
"returned",
"from",
"the",
"endpoint",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GitLabApiClient.java#L606-L609 |
apache/incubator-gobblin | gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinClusterUtils.java | GobblinClusterUtils.getJobStateFilePath | public static Path getJobStateFilePath(boolean usingStateStore, Path appWorkPath, String jobId) {
"""
Generate the path to the job.state file
@param usingStateStore is a state store being used to store the job.state content
@param appWorkPath work directory
@param jobId job id
@return a {@link Path} referring to the job.state
"""
final Path jobStateFilePath;
// the state store uses a path of the form workdir/_jobstate/job_id/job_id.job.state while old method stores the file
// in the app work dir.
if (usingStateStore) {
jobStateFilePath = new Path(appWorkPath, GobblinClusterConfigurationKeys.JOB_STATE_DIR_NAME
+ Path.SEPARATOR + jobId + Path.SEPARATOR + jobId + "."
+ AbstractJobLauncher.JOB_STATE_FILE_NAME);
} else {
jobStateFilePath = new Path(appWorkPath, jobId + "." + AbstractJobLauncher.JOB_STATE_FILE_NAME);
}
log.info("job state file path: " + jobStateFilePath);
return jobStateFilePath;
} | java | public static Path getJobStateFilePath(boolean usingStateStore, Path appWorkPath, String jobId) {
final Path jobStateFilePath;
// the state store uses a path of the form workdir/_jobstate/job_id/job_id.job.state while old method stores the file
// in the app work dir.
if (usingStateStore) {
jobStateFilePath = new Path(appWorkPath, GobblinClusterConfigurationKeys.JOB_STATE_DIR_NAME
+ Path.SEPARATOR + jobId + Path.SEPARATOR + jobId + "."
+ AbstractJobLauncher.JOB_STATE_FILE_NAME);
} else {
jobStateFilePath = new Path(appWorkPath, jobId + "." + AbstractJobLauncher.JOB_STATE_FILE_NAME);
}
log.info("job state file path: " + jobStateFilePath);
return jobStateFilePath;
} | [
"public",
"static",
"Path",
"getJobStateFilePath",
"(",
"boolean",
"usingStateStore",
",",
"Path",
"appWorkPath",
",",
"String",
"jobId",
")",
"{",
"final",
"Path",
"jobStateFilePath",
";",
"// the state store uses a path of the form workdir/_jobstate/job_id/job_id.job.state while old method stores the file",
"// in the app work dir.",
"if",
"(",
"usingStateStore",
")",
"{",
"jobStateFilePath",
"=",
"new",
"Path",
"(",
"appWorkPath",
",",
"GobblinClusterConfigurationKeys",
".",
"JOB_STATE_DIR_NAME",
"+",
"Path",
".",
"SEPARATOR",
"+",
"jobId",
"+",
"Path",
".",
"SEPARATOR",
"+",
"jobId",
"+",
"\".\"",
"+",
"AbstractJobLauncher",
".",
"JOB_STATE_FILE_NAME",
")",
";",
"}",
"else",
"{",
"jobStateFilePath",
"=",
"new",
"Path",
"(",
"appWorkPath",
",",
"jobId",
"+",
"\".\"",
"+",
"AbstractJobLauncher",
".",
"JOB_STATE_FILE_NAME",
")",
";",
"}",
"log",
".",
"info",
"(",
"\"job state file path: \"",
"+",
"jobStateFilePath",
")",
";",
"return",
"jobStateFilePath",
";",
"}"
] | Generate the path to the job.state file
@param usingStateStore is a state store being used to store the job.state content
@param appWorkPath work directory
@param jobId job id
@return a {@link Path} referring to the job.state | [
"Generate",
"the",
"path",
"to",
"the",
"job",
".",
"state",
"file"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinClusterUtils.java#L90-L107 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/SegmentMetadataUpdateTransaction.java | SegmentMetadataUpdateTransaction.preProcessAsSourceSegment | void preProcessAsSourceSegment(MergeSegmentOperation operation) throws StreamSegmentNotSealedException,
StreamSegmentMergedException, StreamSegmentTruncatedException {
"""
Pre-processes the given operation as a Source Segment.
@param operation The operation.
@throws IllegalArgumentException If the operation is for a different Segment.
@throws StreamSegmentNotSealedException If the Segment is not sealed.
@throws StreamSegmentMergedException If the Segment is already merged.
@throws StreamSegmentTruncatedException If the Segment is truncated.
"""
Exceptions.checkArgument(this.id == operation.getSourceSegmentId(),
"operation", "Invalid Operation Source Segment Id.");
if (this.merged) {
throw new StreamSegmentMergedException(this.name);
}
if (!this.sealed) {
throw new StreamSegmentNotSealedException(this.name);
}
if (this.startOffset > 0) {
throw new StreamSegmentTruncatedException(this.name, "Segment cannot be merged because it is truncated.", null);
}
if (!this.recoveryMode) {
operation.setLength(this.length);
}
} | java | void preProcessAsSourceSegment(MergeSegmentOperation operation) throws StreamSegmentNotSealedException,
StreamSegmentMergedException, StreamSegmentTruncatedException {
Exceptions.checkArgument(this.id == operation.getSourceSegmentId(),
"operation", "Invalid Operation Source Segment Id.");
if (this.merged) {
throw new StreamSegmentMergedException(this.name);
}
if (!this.sealed) {
throw new StreamSegmentNotSealedException(this.name);
}
if (this.startOffset > 0) {
throw new StreamSegmentTruncatedException(this.name, "Segment cannot be merged because it is truncated.", null);
}
if (!this.recoveryMode) {
operation.setLength(this.length);
}
} | [
"void",
"preProcessAsSourceSegment",
"(",
"MergeSegmentOperation",
"operation",
")",
"throws",
"StreamSegmentNotSealedException",
",",
"StreamSegmentMergedException",
",",
"StreamSegmentTruncatedException",
"{",
"Exceptions",
".",
"checkArgument",
"(",
"this",
".",
"id",
"==",
"operation",
".",
"getSourceSegmentId",
"(",
")",
",",
"\"operation\"",
",",
"\"Invalid Operation Source Segment Id.\"",
")",
";",
"if",
"(",
"this",
".",
"merged",
")",
"{",
"throw",
"new",
"StreamSegmentMergedException",
"(",
"this",
".",
"name",
")",
";",
"}",
"if",
"(",
"!",
"this",
".",
"sealed",
")",
"{",
"throw",
"new",
"StreamSegmentNotSealedException",
"(",
"this",
".",
"name",
")",
";",
"}",
"if",
"(",
"this",
".",
"startOffset",
">",
"0",
")",
"{",
"throw",
"new",
"StreamSegmentTruncatedException",
"(",
"this",
".",
"name",
",",
"\"Segment cannot be merged because it is truncated.\"",
",",
"null",
")",
";",
"}",
"if",
"(",
"!",
"this",
".",
"recoveryMode",
")",
"{",
"operation",
".",
"setLength",
"(",
"this",
".",
"length",
")",
";",
"}",
"}"
] | Pre-processes the given operation as a Source Segment.
@param operation The operation.
@throws IllegalArgumentException If the operation is for a different Segment.
@throws StreamSegmentNotSealedException If the Segment is not sealed.
@throws StreamSegmentMergedException If the Segment is already merged.
@throws StreamSegmentTruncatedException If the Segment is truncated. | [
"Pre",
"-",
"processes",
"the",
"given",
"operation",
"as",
"a",
"Source",
"Segment",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/SegmentMetadataUpdateTransaction.java#L401-L421 |
bozaro/git-lfs-java | gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java | Client.putObject | public boolean putObject(@NotNull final StreamProvider streamProvider, @NotNull final Meta meta, @NotNull final Links links) throws IOException {
"""
Upload object by metadata.
@param links Object links.
@param streamProvider Object stream provider.
@param meta Object metadata.
@return Return true is object is uploaded successfully and false if object is already uploaded.
@throws IOException On some errors.
"""
if (links.getLinks().containsKey(LinkType.Download)) {
return false;
}
final Link uploadLink = links.getLinks().get(LinkType.Upload);
if (uploadLink == null) {
throw new IOException("Upload link not found");
}
doRequest(uploadLink, new ObjectPut(streamProvider, meta.getSize()), uploadLink.getHref());
final Link verifyLink = links.getLinks().get(LinkType.Verify);
if (verifyLink != null) {
doRequest(verifyLink, new ObjectVerify(meta), verifyLink.getHref());
}
return true;
} | java | public boolean putObject(@NotNull final StreamProvider streamProvider, @NotNull final Meta meta, @NotNull final Links links) throws IOException {
if (links.getLinks().containsKey(LinkType.Download)) {
return false;
}
final Link uploadLink = links.getLinks().get(LinkType.Upload);
if (uploadLink == null) {
throw new IOException("Upload link not found");
}
doRequest(uploadLink, new ObjectPut(streamProvider, meta.getSize()), uploadLink.getHref());
final Link verifyLink = links.getLinks().get(LinkType.Verify);
if (verifyLink != null) {
doRequest(verifyLink, new ObjectVerify(meta), verifyLink.getHref());
}
return true;
} | [
"public",
"boolean",
"putObject",
"(",
"@",
"NotNull",
"final",
"StreamProvider",
"streamProvider",
",",
"@",
"NotNull",
"final",
"Meta",
"meta",
",",
"@",
"NotNull",
"final",
"Links",
"links",
")",
"throws",
"IOException",
"{",
"if",
"(",
"links",
".",
"getLinks",
"(",
")",
".",
"containsKey",
"(",
"LinkType",
".",
"Download",
")",
")",
"{",
"return",
"false",
";",
"}",
"final",
"Link",
"uploadLink",
"=",
"links",
".",
"getLinks",
"(",
")",
".",
"get",
"(",
"LinkType",
".",
"Upload",
")",
";",
"if",
"(",
"uploadLink",
"==",
"null",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Upload link not found\"",
")",
";",
"}",
"doRequest",
"(",
"uploadLink",
",",
"new",
"ObjectPut",
"(",
"streamProvider",
",",
"meta",
".",
"getSize",
"(",
")",
")",
",",
"uploadLink",
".",
"getHref",
"(",
")",
")",
";",
"final",
"Link",
"verifyLink",
"=",
"links",
".",
"getLinks",
"(",
")",
".",
"get",
"(",
"LinkType",
".",
"Verify",
")",
";",
"if",
"(",
"verifyLink",
"!=",
"null",
")",
"{",
"doRequest",
"(",
"verifyLink",
",",
"new",
"ObjectVerify",
"(",
"meta",
")",
",",
"verifyLink",
".",
"getHref",
"(",
")",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Upload object by metadata.
@param links Object links.
@param streamProvider Object stream provider.
@param meta Object metadata.
@return Return true is object is uploaded successfully and false if object is already uploaded.
@throws IOException On some errors. | [
"Upload",
"object",
"by",
"metadata",
"."
] | train | https://github.com/bozaro/git-lfs-java/blob/ee05bf0472ee61bf362cf93d283e5ee5d44ef685/gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java#L230-L245 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java | RouteTablesInner.beginCreateOrUpdate | public RouteTableInner beginCreateOrUpdate(String resourceGroupName, String routeTableName, RouteTableInner parameters) {
"""
Create or updates a route table in a specified resource group.
@param resourceGroupName The name of the resource group.
@param routeTableName The name of the route table.
@param parameters Parameters supplied to the create or update route table operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RouteTableInner object if successful.
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, parameters).toBlocking().single().body();
} | java | public RouteTableInner beginCreateOrUpdate(String resourceGroupName, String routeTableName, RouteTableInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, parameters).toBlocking().single().body();
} | [
"public",
"RouteTableInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"routeTableName",
",",
"RouteTableInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"routeTableName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Create or updates a route table in a specified resource group.
@param resourceGroupName The name of the resource group.
@param routeTableName The name of the route table.
@param parameters Parameters supplied to the create or update route table operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RouteTableInner object if successful. | [
"Create",
"or",
"updates",
"a",
"route",
"table",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java#L519-L521 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsPublishProject.java | CmsPublishProject.buildLockConfirmationMessageJS | @Override
public String buildLockConfirmationMessageJS() {
"""
Returns the html code to build the confirmation messages.<p>
@return html code
"""
StringBuffer html = new StringBuffer(512);
html.append("<script type='text/javascript'><!--\n");
html.append("function setConfirmationMessage(locks, blockinglocks) {\n");
html.append("\tvar confMsg = document.getElementById('conf-msg');\n");
html.append("\tif (locks > -1) {\n");
html.append("\t\tdocument.getElementById('butClose').className = 'hide';\n");
html.append("\t\tdocument.getElementById('butContinue').className = '';\n");
html.append("\t\tif (locks > 0) {\n");
html.append("\t\t\tshowAjaxReportContent();\n");
html.append("\t\t\tconfMsg.innerHTML = '");
html.append(key(Messages.GUI_PUBLISH_UNLOCK_CONFIRMATION_0));
html.append("';\n");
html.append("\t\t} else {\n");
html.append("\t\tshowAjaxOk();\n");
html.append("\t\t\tconfMsg.innerHTML = '");
html.append(key(Messages.GUI_PUBLISH_NO_LOCKS_CONFIRMATION_0));
html.append("';\n");
html.append("\t\t}\n");
html.append("\t} else {\n");
html.append("\t\tdocument.getElementById('butClose').className = '';\n");
html.append("\t\tdocument.getElementById('butContinue').className = 'hide';\n");
html.append("\t\tconfMsg.innerHTML = '");
html.append(key(org.opencms.workplace.Messages.GUI_AJAX_REPORT_WAIT_0));
html.append("';\n");
html.append("\t}\n");
html.append("}\n");
html.append("// -->\n");
html.append("</script>\n");
return html.toString();
} | java | @Override
public String buildLockConfirmationMessageJS() {
StringBuffer html = new StringBuffer(512);
html.append("<script type='text/javascript'><!--\n");
html.append("function setConfirmationMessage(locks, blockinglocks) {\n");
html.append("\tvar confMsg = document.getElementById('conf-msg');\n");
html.append("\tif (locks > -1) {\n");
html.append("\t\tdocument.getElementById('butClose').className = 'hide';\n");
html.append("\t\tdocument.getElementById('butContinue').className = '';\n");
html.append("\t\tif (locks > 0) {\n");
html.append("\t\t\tshowAjaxReportContent();\n");
html.append("\t\t\tconfMsg.innerHTML = '");
html.append(key(Messages.GUI_PUBLISH_UNLOCK_CONFIRMATION_0));
html.append("';\n");
html.append("\t\t} else {\n");
html.append("\t\tshowAjaxOk();\n");
html.append("\t\t\tconfMsg.innerHTML = '");
html.append(key(Messages.GUI_PUBLISH_NO_LOCKS_CONFIRMATION_0));
html.append("';\n");
html.append("\t\t}\n");
html.append("\t} else {\n");
html.append("\t\tdocument.getElementById('butClose').className = '';\n");
html.append("\t\tdocument.getElementById('butContinue').className = 'hide';\n");
html.append("\t\tconfMsg.innerHTML = '");
html.append(key(org.opencms.workplace.Messages.GUI_AJAX_REPORT_WAIT_0));
html.append("';\n");
html.append("\t}\n");
html.append("}\n");
html.append("// -->\n");
html.append("</script>\n");
return html.toString();
} | [
"@",
"Override",
"public",
"String",
"buildLockConfirmationMessageJS",
"(",
")",
"{",
"StringBuffer",
"html",
"=",
"new",
"StringBuffer",
"(",
"512",
")",
";",
"html",
".",
"append",
"(",
"\"<script type='text/javascript'><!--\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"function setConfirmationMessage(locks, blockinglocks) {\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\tvar confMsg = document.getElementById('conf-msg');\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\tif (locks > -1) {\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t\\tdocument.getElementById('butClose').className = 'hide';\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t\\tdocument.getElementById('butContinue').className = '';\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t\\tif (locks > 0) {\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t\\t\\tshowAjaxReportContent();\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t\\t\\tconfMsg.innerHTML = '\"",
")",
";",
"html",
".",
"append",
"(",
"key",
"(",
"Messages",
".",
"GUI_PUBLISH_UNLOCK_CONFIRMATION_0",
")",
")",
";",
"html",
".",
"append",
"(",
"\"';\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t\\t} else {\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t\\tshowAjaxOk();\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t\\t\\tconfMsg.innerHTML = '\"",
")",
";",
"html",
".",
"append",
"(",
"key",
"(",
"Messages",
".",
"GUI_PUBLISH_NO_LOCKS_CONFIRMATION_0",
")",
")",
";",
"html",
".",
"append",
"(",
"\"';\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t\\t}\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t} else {\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t\\tdocument.getElementById('butClose').className = '';\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t\\tdocument.getElementById('butContinue').className = 'hide';\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t\\tconfMsg.innerHTML = '\"",
")",
";",
"html",
".",
"append",
"(",
"key",
"(",
"org",
".",
"opencms",
".",
"workplace",
".",
"Messages",
".",
"GUI_AJAX_REPORT_WAIT_0",
")",
")",
";",
"html",
".",
"append",
"(",
"\"';\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"\\t}\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"}\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"// -->\\n\"",
")",
";",
"html",
".",
"append",
"(",
"\"</script>\\n\"",
")",
";",
"return",
"html",
".",
"toString",
"(",
")",
";",
"}"
] | Returns the html code to build the confirmation messages.<p>
@return html code | [
"Returns",
"the",
"html",
"code",
"to",
"build",
"the",
"confirmation",
"messages",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPublishProject.java#L237-L269 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java | OdsElements.addChildCellStyle | public void addChildCellStyle(final TableCellStyle style, final TableCell.Type type) {
"""
Create an automatic style for this TableCellStyle and this type of cell.
Do not produce any effect if the type is Type.STRING or Type.VOID
@param style the style of the cell (color, data style, etc.)
@param type the type of the cell
"""
this.contentElement.addChildCellStyle(style, type);
} | java | public void addChildCellStyle(final TableCellStyle style, final TableCell.Type type) {
this.contentElement.addChildCellStyle(style, type);
} | [
"public",
"void",
"addChildCellStyle",
"(",
"final",
"TableCellStyle",
"style",
",",
"final",
"TableCell",
".",
"Type",
"type",
")",
"{",
"this",
".",
"contentElement",
".",
"addChildCellStyle",
"(",
"style",
",",
"type",
")",
";",
"}"
] | Create an automatic style for this TableCellStyle and this type of cell.
Do not produce any effect if the type is Type.STRING or Type.VOID
@param style the style of the cell (color, data style, etc.)
@param type the type of the cell | [
"Create",
"an",
"automatic",
"style",
"for",
"this",
"TableCellStyle",
"and",
"this",
"type",
"of",
"cell",
".",
"Do",
"not",
"produce",
"any",
"effect",
"if",
"the",
"type",
"is",
"Type",
".",
"STRING",
"or",
"Type",
".",
"VOID"
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java#L127-L129 |
JodaOrg/joda-convert | src/main/java/org/joda/convert/Types.java | Types.newParameterizedTypeWithOwner | static ParameterizedType newParameterizedTypeWithOwner(
Type ownerType, Class<?> rawType, Type... arguments) {
"""
Returns a type where {@code rawType} is parameterized by {@code arguments} and is owned by
{@code ownerType}.
"""
if (ownerType == null) {
return newParameterizedType(rawType, arguments);
}
// ParameterizedTypeImpl constructor already checks, but we want to throw NPE before IAE
checkNotNull(arguments);
checkArgument(rawType.getEnclosingClass() != null, "Owner type for unenclosed %s", rawType);
return new ParameterizedTypeImpl(ownerType, rawType, arguments);
} | java | static ParameterizedType newParameterizedTypeWithOwner(
Type ownerType, Class<?> rawType, Type... arguments) {
if (ownerType == null) {
return newParameterizedType(rawType, arguments);
}
// ParameterizedTypeImpl constructor already checks, but we want to throw NPE before IAE
checkNotNull(arguments);
checkArgument(rawType.getEnclosingClass() != null, "Owner type for unenclosed %s", rawType);
return new ParameterizedTypeImpl(ownerType, rawType, arguments);
} | [
"static",
"ParameterizedType",
"newParameterizedTypeWithOwner",
"(",
"Type",
"ownerType",
",",
"Class",
"<",
"?",
">",
"rawType",
",",
"Type",
"...",
"arguments",
")",
"{",
"if",
"(",
"ownerType",
"==",
"null",
")",
"{",
"return",
"newParameterizedType",
"(",
"rawType",
",",
"arguments",
")",
";",
"}",
"// ParameterizedTypeImpl constructor already checks, but we want to throw NPE before IAE",
"checkNotNull",
"(",
"arguments",
")",
";",
"checkArgument",
"(",
"rawType",
".",
"getEnclosingClass",
"(",
")",
"!=",
"null",
",",
"\"Owner type for unenclosed %s\"",
",",
"rawType",
")",
";",
"return",
"new",
"ParameterizedTypeImpl",
"(",
"ownerType",
",",
"rawType",
",",
"arguments",
")",
";",
"}"
] | Returns a type where {@code rawType} is parameterized by {@code arguments} and is owned by
{@code ownerType}. | [
"Returns",
"a",
"type",
"where",
"{"
] | train | https://github.com/JodaOrg/joda-convert/blob/266bd825f4550590d5dafdf4225c548559e0633b/src/main/java/org/joda/convert/Types.java#L83-L92 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/client/gui/element/position/Positions.java | Positions.leftAlignedTo | public static IntSupplier leftAlignedTo(IPositioned other, int offset) {
"""
Left aligns the owner to the other.
@param other the other
@param offset the offset
@return the int supplier
"""
checkNotNull(other);
return () -> {
return other.position().x() + offset;
};
} | java | public static IntSupplier leftAlignedTo(IPositioned other, int offset)
{
checkNotNull(other);
return () -> {
return other.position().x() + offset;
};
} | [
"public",
"static",
"IntSupplier",
"leftAlignedTo",
"(",
"IPositioned",
"other",
",",
"int",
"offset",
")",
"{",
"checkNotNull",
"(",
"other",
")",
";",
"return",
"(",
")",
"->",
"{",
"return",
"other",
".",
"position",
"(",
")",
".",
"x",
"(",
")",
"+",
"offset",
";",
"}",
";",
"}"
] | Left aligns the owner to the other.
@param other the other
@param offset the offset
@return the int supplier | [
"Left",
"aligns",
"the",
"owner",
"to",
"the",
"other",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/element/position/Positions.java#L225-L231 |
abego/treelayout | org.abego.treelayout/src/main/java/org/abego/treelayout/TreeLayout.java | TreeLayout.getDistance | private double getDistance(TreeNode v, TreeNode w) {
"""
The distance of two nodes is the distance of the centers of both noded.
<p>
I.e. the distance includes the gap between the nodes and half of the
sizes of the nodes.
@param v
@param w
@return the distance between node v and w
"""
double sizeOfNodes = getNodeSize(v) + getNodeSize(w);
double distance = sizeOfNodes / 2
+ configuration.getGapBetweenNodes(v, w);
return distance;
} | java | private double getDistance(TreeNode v, TreeNode w) {
double sizeOfNodes = getNodeSize(v) + getNodeSize(w);
double distance = sizeOfNodes / 2
+ configuration.getGapBetweenNodes(v, w);
return distance;
} | [
"private",
"double",
"getDistance",
"(",
"TreeNode",
"v",
",",
"TreeNode",
"w",
")",
"{",
"double",
"sizeOfNodes",
"=",
"getNodeSize",
"(",
"v",
")",
"+",
"getNodeSize",
"(",
"w",
")",
";",
"double",
"distance",
"=",
"sizeOfNodes",
"/",
"2",
"+",
"configuration",
".",
"getGapBetweenNodes",
"(",
"v",
",",
"w",
")",
";",
"return",
"distance",
";",
"}"
] | The distance of two nodes is the distance of the centers of both noded.
<p>
I.e. the distance includes the gap between the nodes and half of the
sizes of the nodes.
@param v
@param w
@return the distance between node v and w | [
"The",
"distance",
"of",
"two",
"nodes",
"is",
"the",
"distance",
"of",
"the",
"centers",
"of",
"both",
"noded",
".",
"<p",
">",
"I",
".",
"e",
".",
"the",
"distance",
"includes",
"the",
"gap",
"between",
"the",
"nodes",
"and",
"half",
"of",
"the",
"sizes",
"of",
"the",
"nodes",
"."
] | train | https://github.com/abego/treelayout/blob/aa73af5803c6ec30db0b4ad192c7cba55d0862d2/org.abego.treelayout/src/main/java/org/abego/treelayout/TreeLayout.java#L393-L399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.