repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java
Channels.writeFullyImpl
private static void writeFullyImpl(WritableByteChannel ch, ByteBuffer bb) throws IOException { while (bb.remaining() > 0) { int n = ch.write(bb); if (n <= 0) throw new RuntimeException("no bytes written"); } }
java
private static void writeFullyImpl(WritableByteChannel ch, ByteBuffer bb) throws IOException { while (bb.remaining() > 0) { int n = ch.write(bb); if (n <= 0) throw new RuntimeException("no bytes written"); } }
[ "private", "static", "void", "writeFullyImpl", "(", "WritableByteChannel", "ch", ",", "ByteBuffer", "bb", ")", "throws", "IOException", "{", "while", "(", "bb", ".", "remaining", "(", ")", ">", "0", ")", "{", "int", "n", "=", "ch", ".", "write", "(", "...
Write all remaining bytes in buffer to the given channel. If the channel is selectable then it must be configured blocking.
[ "Write", "all", "remaining", "bytes", "in", "buffer", "to", "the", "given", "channel", ".", "If", "the", "channel", "is", "selectable", "then", "it", "must", "be", "configured", "blocking", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java#L75-L83
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.writeUtf16Bom
private static void writeUtf16Bom(OutputStream stream, boolean bigEndian) throws IOException { if (bigEndian) { stream.write(-2); stream.write(-1); } else { stream.write(-1); stream.write(-2); } }
java
private static void writeUtf16Bom(OutputStream stream, boolean bigEndian) throws IOException { if (bigEndian) { stream.write(-2); stream.write(-1); } else { stream.write(-1); stream.write(-2); } }
[ "private", "static", "void", "writeUtf16Bom", "(", "OutputStream", "stream", ",", "boolean", "bigEndian", ")", "throws", "IOException", "{", "if", "(", "bigEndian", ")", "{", "stream", ".", "write", "(", "-", "2", ")", ";", "stream", ".", "write", "(", "...
Write a Byte Order Mark at the beginning of the file @param stream the FileOutputStream to write the BOM to @param bigEndian true if UTF 16 Big Endian or false if Low Endian @throws IOException if an IOException occurs. @since 1.0
[ "Write", "a", "Byte", "Order", "Mark", "at", "the", "beginning", "of", "the", "file" ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1825-L1833
navnorth/LRJavaLib
src/com/navnorth/learningregistry/LRActivity.java
LRActivity.addMeasureToVerb
public boolean addMeasureToVerb(Map<String, Object> properties) { String[] pathKeys = {"verb"}; return addChild("measure", properties, pathKeys); }
java
public boolean addMeasureToVerb(Map<String, Object> properties) { String[] pathKeys = {"verb"}; return addChild("measure", properties, pathKeys); }
[ "public", "boolean", "addMeasureToVerb", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "String", "[", "]", "pathKeys", "=", "{", "\"verb\"", "}", ";", "return", "addChild", "(", "\"measure\"", ",", "properties", ",", "pathKeys", ")...
Add an arbitrary map of key-value pairs as a measure to the verb @param properties @return True if added, false if not (due to missing required fields or lack of "verb")
[ "Add", "an", "arbitrary", "map", "of", "key", "-", "value", "pairs", "as", "a", "measure", "to", "the", "verb" ]
train
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L165-L169
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/parser/lexparser/Options.java
Options.setOption
public int setOption(String[] flags, int i) { int j = setOptionFlag(flags, i); if (j == i) { j = tlpParams.setOptionFlag(flags, i); } if (j == i) { throw new IllegalArgumentException("Unknown option: " + flags[i]); } return j; }
java
public int setOption(String[] flags, int i) { int j = setOptionFlag(flags, i); if (j == i) { j = tlpParams.setOptionFlag(flags, i); } if (j == i) { throw new IllegalArgumentException("Unknown option: " + flags[i]); } return j; }
[ "public", "int", "setOption", "(", "String", "[", "]", "flags", ",", "int", "i", ")", "{", "int", "j", "=", "setOptionFlag", "(", "flags", ",", "i", ")", ";", "if", "(", "j", "==", "i", ")", "{", "j", "=", "tlpParams", ".", "setOptionFlag", "(", ...
Set an option based on a String array in the style of commandline flags. The option may be either one known by the Options object, or one recognized by the TreebankLangParserParams which has already been set up inside the Options object, and then the option is set in the language-particular TreebankLangParserParams. Note that despite this method being an instance method, many flags are actually set as static class variables in the Train and Test classes (this should be fixed some day). Some options (there are many others; see the source code): <ul> <li> <code>-maxLength n</code> set the maximum length sentence to parse (inclusively) <li> <code>-printTT</code> print the training trees in raw, annotated, and annotated+binarized form. Useful for debugging and other miscellany. <li> <code>-printAnnotated filename</code> use only in conjunction with -printTT. Redirects printing of annotated training trees to <code>filename</code>. <li> <code>-forceTags</code> when the parser is tested against a set of gold standard trees, use the tagged yield, instead of just the yield, as input. </ul> @param flags An array of options arguments, command-line style. E.g. {"-maxLength", "50"}. @param i The index in flags to start at when processing an option @return The index in flags of the position after the last element used in processing this option. @throws IllegalArgumentException If the current array position cannot be processed as a valid option
[ "Set", "an", "option", "based", "on", "a", "String", "array", "in", "the", "style", "of", "commandline", "flags", ".", "The", "option", "may", "be", "either", "one", "known", "by", "the", "Options", "object", "or", "one", "recognized", "by", "the", "Tree...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/Options.java#L167-L176
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/core/Parser.java
Parser.parseLong
public static long parseLong(String s, int beginIndex, int endIndex) { // Fallback to default implementation in case the string is long if (endIndex - beginIndex > 16) { return Long.parseLong(s.substring(beginIndex, endIndex)); } long res = digitAt(s, beginIndex); for (beginIndex++; beginIndex < endIndex; beginIndex++) { res = res * 10 + digitAt(s, beginIndex); } return res; }
java
public static long parseLong(String s, int beginIndex, int endIndex) { // Fallback to default implementation in case the string is long if (endIndex - beginIndex > 16) { return Long.parseLong(s.substring(beginIndex, endIndex)); } long res = digitAt(s, beginIndex); for (beginIndex++; beginIndex < endIndex; beginIndex++) { res = res * 10 + digitAt(s, beginIndex); } return res; }
[ "public", "static", "long", "parseLong", "(", "String", "s", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "// Fallback to default implementation in case the string is long", "if", "(", "endIndex", "-", "beginIndex", ">", "16", ")", "{", "return", "L...
Faster version of {@link Long#parseLong(String)} when parsing a substring is required @param s string to parse @param beginIndex begin index @param endIndex end index @return long value
[ "Faster", "version", "of", "{", "@link", "Long#parseLong", "(", "String", ")", "}", "when", "parsing", "a", "substring", "is", "required" ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/Parser.java#L704-L714
liferay/com-liferay-commerce
commerce-discount-api/src/main/java/com/liferay/commerce/discount/service/persistence/CommerceDiscountUtil.java
CommerceDiscountUtil.findByUUID_G
public static CommerceDiscount findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.discount.exception.NoSuchDiscountException { return getPersistence().findByUUID_G(uuid, groupId); }
java
public static CommerceDiscount findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.discount.exception.NoSuchDiscountException { return getPersistence().findByUUID_G(uuid, groupId); }
[ "public", "static", "CommerceDiscount", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "discount", ".", "exception", ".", "NoSuchDiscountException", "{", "return", "getPersistence", "(", ...
Returns the commerce discount where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchDiscountException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce discount @throws NoSuchDiscountException if a matching commerce discount could not be found
[ "Returns", "the", "commerce", "discount", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchDiscountException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-api/src/main/java/com/liferay/commerce/discount/service/persistence/CommerceDiscountUtil.java#L280-L283
liyiorg/weixin-popular
src/main/java/weixin/popular/api/QrcodeAPI.java
QrcodeAPI.wxaappCreatewxaqrcode
public static BufferedImage wxaappCreatewxaqrcode(String access_token,Wxaqrcode wxaqrcode){ String json = JsonUtil.toJSONString(wxaqrcode); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/cgi-bin/wxaapp/createwxaqrcode") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(json,Charset.forName("utf-8"))) .build(); CloseableHttpResponse httpResponse = LocalHttpClient.execute(httpUriRequest); return getImage(httpResponse); }
java
public static BufferedImage wxaappCreatewxaqrcode(String access_token,Wxaqrcode wxaqrcode){ String json = JsonUtil.toJSONString(wxaqrcode); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/cgi-bin/wxaapp/createwxaqrcode") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(json,Charset.forName("utf-8"))) .build(); CloseableHttpResponse httpResponse = LocalHttpClient.execute(httpUriRequest); return getImage(httpResponse); }
[ "public", "static", "BufferedImage", "wxaappCreatewxaqrcode", "(", "String", "access_token", ",", "Wxaqrcode", "wxaqrcode", ")", "{", "String", "json", "=", "JsonUtil", ".", "toJSONString", "(", "wxaqrcode", ")", ";", "HttpUriRequest", "httpUriRequest", "=", "Reques...
获取小程序页面二维码 <br> 小程序码使用 使用 WxaAPI.getwxacode 或 WxaAPI.getwxacodeunlimit @since 2.8.8 @param access_token access_token @param wxaqrcode wxaqrcode @return BufferedImage
[ "获取小程序页面二维码", "<br", ">", "小程序码使用", "使用", "WxaAPI", ".", "getwxacode", "或", "WxaAPI", ".", "getwxacodeunlimit" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/QrcodeAPI.java#L117-L127
querydsl/querydsl
querydsl-spatial/src/main/java/com/querydsl/spatial/jts/JTSGeometryExpressions.java
JTSGeometryExpressions.asJTSGeometry
public static <T extends Geometry> JTSGeometryExpression<T> asJTSGeometry( Expression<T> expr) { Expression<T> underlyingMixin = ExpressionUtils.extract(expr); return new JTSGeometryExpression<T>(underlyingMixin) { private static final long serialVersionUID = -6714044005570420009L; @Override public <R, C> R accept(Visitor<R, C> v, C context) { return this.mixin.accept(v, context); } }; }
java
public static <T extends Geometry> JTSGeometryExpression<T> asJTSGeometry( Expression<T> expr) { Expression<T> underlyingMixin = ExpressionUtils.extract(expr); return new JTSGeometryExpression<T>(underlyingMixin) { private static final long serialVersionUID = -6714044005570420009L; @Override public <R, C> R accept(Visitor<R, C> v, C context) { return this.mixin.accept(v, context); } }; }
[ "public", "static", "<", "T", "extends", "Geometry", ">", "JTSGeometryExpression", "<", "T", ">", "asJTSGeometry", "(", "Expression", "<", "T", ">", "expr", ")", "{", "Expression", "<", "T", ">", "underlyingMixin", "=", "ExpressionUtils", ".", "extract", "("...
Create a new JTSGeometryExpression @param expr Expression of type Geometry @return new JTSGeometryExpression
[ "Create", "a", "new", "JTSGeometryExpression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-spatial/src/main/java/com/querydsl/spatial/jts/JTSGeometryExpressions.java#L268-L281
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java
DatabaseBlobAuditingPoliciesInner.createOrUpdateAsync
public Observable<DatabaseBlobAuditingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseBlobAuditingPolicyInner>, DatabaseBlobAuditingPolicyInner>() { @Override public DatabaseBlobAuditingPolicyInner call(ServiceResponse<DatabaseBlobAuditingPolicyInner> response) { return response.body(); } }); }
java
public Observable<DatabaseBlobAuditingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseBlobAuditingPolicyInner>, DatabaseBlobAuditingPolicyInner>() { @Override public DatabaseBlobAuditingPolicyInner call(ServiceResponse<DatabaseBlobAuditingPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DatabaseBlobAuditingPolicyInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "DatabaseBlobAuditingPolicyInner", "parameters", ")", "{", "return", "createOrUpd...
Creates or updates a database's blob auditing policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @param parameters The database blob auditing policy. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DatabaseBlobAuditingPolicyInner object
[ "Creates", "or", "updates", "a", "database", "s", "blob", "auditing", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java#L202-L209
javers/javers
javers-core/src/main/java/org/javers/core/Changes.java
Changes.groupByCommit
public List<ChangesByCommit> groupByCommit() { Map<CommitMetadata, List<Change>> changesByCommit = changes.stream().collect( groupingBy(c -> c.getCommitMetadata().orElseThrow( () -> new IllegalStateException("No CommitMetadata in this Change")), () -> new LinkedHashMap<>(), toList())); List<ChangesByCommit> result = new ArrayList<>(); changesByCommit.forEach((k,v) -> { result.add(new ChangesByCommit(k, v, valuePrinter)); }); return Collections.unmodifiableList(result); }
java
public List<ChangesByCommit> groupByCommit() { Map<CommitMetadata, List<Change>> changesByCommit = changes.stream().collect( groupingBy(c -> c.getCommitMetadata().orElseThrow( () -> new IllegalStateException("No CommitMetadata in this Change")), () -> new LinkedHashMap<>(), toList())); List<ChangesByCommit> result = new ArrayList<>(); changesByCommit.forEach((k,v) -> { result.add(new ChangesByCommit(k, v, valuePrinter)); }); return Collections.unmodifiableList(result); }
[ "public", "List", "<", "ChangesByCommit", ">", "groupByCommit", "(", ")", "{", "Map", "<", "CommitMetadata", ",", "List", "<", "Change", ">", ">", "changesByCommit", "=", "changes", ".", "stream", "(", ")", ".", "collect", "(", "groupingBy", "(", "c", "-...
Changes grouped by commits. <br/> When formatting a changelog, usually you need to group changes by commits and then by objects. <br/><br/> For example, this changelog: <pre> commit 2.0 changes on Employee/Frodo : - ValueChange{ 'salary' changed from '10000' to '11000' } - ListChange{ 'subordinates' collection changes : 0. 'Employee/Sam' added } changes on Employee/Sam : - ValueChange{ 'name' changed from '' to 'Sam' } - ValueChange{ 'salary' changed from '0' to '2000' } - ReferenceChange{ 'boss' changed from '' to 'Employee/Frodo' } - NewObject{ new object: Employee/Sam } commit 1.0 changes on Employee/Frodo : - ValueChange{ 'name' changed from '' to 'Frodo' } - ValueChange{ 'salary' changed from '0' to '10000' } - NewObject{ new object: Employee/Frodo } </pre> is printed by this code: <pre> Changes changes = javers.findChanges(QueryBuilder.byClass(Employee.class) .withNewObjectChanges().build()); changes.groupByCommit().forEach(byCommit -> { System.out.println("commit " + byCommit.getCommit().getId()); byCommit.groupByObject().forEach(byObject -> { System.out.println(" changes on " + byObject.getGlobalId().value() + " : "); byObject.get().forEach(change -> { System.out.println(" - " + change); }); }); }); </pre> @see <a href="https://javers.org/documentation/repository-examples/#change-log">http://javers.org/documentation/repository-examples/#change-log</a> @since 3.9
[ "Changes", "grouped", "by", "commits", ".", "<br", "/", ">" ]
train
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/Changes.java#L84-L95
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/security/LoginForm.java
LoginForm.getAuthentication
public Authentication getAuthentication() { String username = getValueModel(LoginDetails.PROPERTY_USERNAME, String.class).getValue(); String password = getValueModel(LoginDetails.PROPERTY_PASSWORD, String.class).getValue(); return new UsernamePasswordAuthenticationToken( username, password ); }
java
public Authentication getAuthentication() { String username = getValueModel(LoginDetails.PROPERTY_USERNAME, String.class).getValue(); String password = getValueModel(LoginDetails.PROPERTY_PASSWORD, String.class).getValue(); return new UsernamePasswordAuthenticationToken( username, password ); }
[ "public", "Authentication", "getAuthentication", "(", ")", "{", "String", "username", "=", "getValueModel", "(", "LoginDetails", ".", "PROPERTY_USERNAME", ",", "String", ".", "class", ")", ".", "getValue", "(", ")", ";", "String", "password", "=", "getValueModel...
Get an Authentication token that contains the current username and password. @return authentication token
[ "Get", "an", "Authentication", "token", "that", "contains", "the", "current", "username", "and", "password", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/security/LoginForm.java#L58-L62
EXIficient/exificient-core
src/main/java/com/siemens/ct/exi/core/io/channel/BitEncoderChannel.java
BitEncoderChannel.encodeNBitUnsignedInteger
public void encodeNBitUnsignedInteger(int b, int n) throws IOException { if (b < 0 || n < 0) { throw new IllegalArgumentException( "Encode negative value as unsigned integer is invalid!"); } assert (b >= 0); assert (n >= 0); ostream.writeBits(b, n); }
java
public void encodeNBitUnsignedInteger(int b, int n) throws IOException { if (b < 0 || n < 0) { throw new IllegalArgumentException( "Encode negative value as unsigned integer is invalid!"); } assert (b >= 0); assert (n >= 0); ostream.writeBits(b, n); }
[ "public", "void", "encodeNBitUnsignedInteger", "(", "int", "b", ",", "int", "n", ")", "throws", "IOException", "{", "if", "(", "b", "<", "0", "||", "n", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Encode negative value as unsigned i...
Encode n-bit unsigned integer. The n least significant bits of parameter b starting with the most significant, i.e. from left to right.
[ "Encode", "n", "-", "bit", "unsigned", "integer", ".", "The", "n", "least", "significant", "bits", "of", "parameter", "b", "starting", "with", "the", "most", "significant", "i", ".", "e", ".", "from", "left", "to", "right", "." ]
train
https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/io/channel/BitEncoderChannel.java#L90-L99
undertow-io/undertow
core/src/main/java/io/undertow/util/ETagUtils.java
ETagUtils.handleIfMatch
public static boolean handleIfMatch(final HttpServerExchange exchange, final List<ETag> etags, boolean allowWeak) { return handleIfMatch(exchange.getRequestHeaders().getFirst(Headers.IF_MATCH), etags, allowWeak); }
java
public static boolean handleIfMatch(final HttpServerExchange exchange, final List<ETag> etags, boolean allowWeak) { return handleIfMatch(exchange.getRequestHeaders().getFirst(Headers.IF_MATCH), etags, allowWeak); }
[ "public", "static", "boolean", "handleIfMatch", "(", "final", "HttpServerExchange", "exchange", ",", "final", "List", "<", "ETag", ">", "etags", ",", "boolean", "allowWeak", ")", "{", "return", "handleIfMatch", "(", "exchange", ".", "getRequestHeaders", "(", ")"...
Handles the if-match header. returns true if the request should proceed, false otherwise @param exchange the exchange @param etags The etags @return
[ "Handles", "the", "if", "-", "match", "header", ".", "returns", "true", "if", "the", "request", "should", "proceed", "false", "otherwise" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/ETagUtils.java#L55-L57
gocd/gocd
base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java
DirectoryScanner.setBasedir
public DirectoryScanner setBasedir(String basedir) { setBasedir(basedir == null ? null : new File(basedir.replace('/', File.separatorChar).replace( '\\', File.separatorChar))); return this; }
java
public DirectoryScanner setBasedir(String basedir) { setBasedir(basedir == null ? null : new File(basedir.replace('/', File.separatorChar).replace( '\\', File.separatorChar))); return this; }
[ "public", "DirectoryScanner", "setBasedir", "(", "String", "basedir", ")", "{", "setBasedir", "(", "basedir", "==", "null", "?", "null", ":", "new", "File", "(", "basedir", ".", "replace", "(", "'", "'", ",", "File", ".", "separatorChar", ")", ".", "repl...
Set the base directory to be scanned. This is the directory which is scanned recursively. All '/' and '\' characters are replaced by <code>File.separatorChar</code>, so the separator used need not match <code>File.separatorChar</code>. @param basedir The base directory to scan.
[ "Set", "the", "base", "directory", "to", "be", "scanned", ".", "This", "is", "the", "directory", "which", "is", "scanned", "recursively", ".", "All", "/", "and", "\\", "characters", "are", "replaced", "by", "<code", ">", "File", ".", "separatorChar<", "/",...
train
https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java#L557-L562
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/dispatcher/DispatcherBase.java
DispatcherBase.obtainIntConfigParameter
protected static int obtainIntConfigParameter(MessageStoreImpl msi, String parameterName, String defaultValue, int minValue, int maxValue) { int value = Integer.parseInt(defaultValue); if (msi != null) { String strValue = msi.getProperty(parameterName, defaultValue); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, parameterName + "=" + strValue); }; // end if try { value = Integer.parseInt(strValue); if ((value < minValue) || (value > maxValue)) { value = Integer.parseInt(defaultValue); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "OVERRIDE: " + parameterName + "=" + strValue); }; // end if }; // end if } catch (NumberFormatException nfexc) { //No FFDC Code Needed. } }; // end if return value; }
java
protected static int obtainIntConfigParameter(MessageStoreImpl msi, String parameterName, String defaultValue, int minValue, int maxValue) { int value = Integer.parseInt(defaultValue); if (msi != null) { String strValue = msi.getProperty(parameterName, defaultValue); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, parameterName + "=" + strValue); }; // end if try { value = Integer.parseInt(strValue); if ((value < minValue) || (value > maxValue)) { value = Integer.parseInt(defaultValue); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "OVERRIDE: " + parameterName + "=" + strValue); }; // end if }; // end if } catch (NumberFormatException nfexc) { //No FFDC Code Needed. } }; // end if return value; }
[ "protected", "static", "int", "obtainIntConfigParameter", "(", "MessageStoreImpl", "msi", ",", "String", "parameterName", ",", "String", "defaultValue", ",", "int", "minValue", ",", "int", "maxValue", ")", "{", "int", "value", "=", "Integer", ".", "parseInt", "(...
Obtains the value of an integer configuration parameter given its name, the default value and 'reasonable' minimum and maximum values. @param msi The Message Store instance to obtain the parameters (may be null) @param parameterName The parameter's name @param defaultValue The default value @param minValue A reasonable minimum value @param maxValue A reasonable maximum value
[ "Obtains", "the", "value", "of", "an", "integer", "configuration", "parameter", "given", "its", "name", "the", "default", "value", "and", "reasonable", "minimum", "and", "maximum", "values", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/dispatcher/DispatcherBase.java#L38-L70
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.updateProject
public Project updateProject(UUID projectId, Project updatedProject) { return updateProjectWithServiceResponseAsync(projectId, updatedProject).toBlocking().single().body(); }
java
public Project updateProject(UUID projectId, Project updatedProject) { return updateProjectWithServiceResponseAsync(projectId, updatedProject).toBlocking().single().body(); }
[ "public", "Project", "updateProject", "(", "UUID", "projectId", ",", "Project", "updatedProject", ")", "{", "return", "updateProjectWithServiceResponseAsync", "(", "projectId", ",", "updatedProject", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", ...
Update a specific project. @param projectId The id of the project to update @param updatedProject The updated project model @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 Project object if successful.
[ "Update", "a", "specific", "project", "." ]
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#L2123-L2125
VoltDB/voltdb
src/frontend/org/voltdb/compiler/VoltCompiler.java
VoltCompiler.debugVerifyCatalog
private void debugVerifyCatalog(InMemoryJarfile origJarFile, Catalog origCatalog) { final VoltCompiler autoGenCompiler = new VoltCompiler(m_isXDCR); // Make the new compiler use the original jarfile's classloader so it can // pull in the class files for procedures and imports autoGenCompiler.m_classLoader = origJarFile.getLoader(); List<VoltCompilerReader> autogenReaderList = new ArrayList<>(1); autogenReaderList.add(new VoltCompilerJarFileReader(origJarFile, AUTOGEN_DDL_FILE_NAME)); InMemoryJarfile autoGenJarOutput = new InMemoryJarfile(); autoGenCompiler.m_currentFilename = AUTOGEN_DDL_FILE_NAME; // This call is purposely replicated in retryFailedCatalogRebuildUnderDebug, // where it provides an opportunity to set a breakpoint on a do-over when this // mainline call produces a flawed catalog that fails the catalog diff. // Keep the two calls in synch to allow debugging under the same exact conditions. Catalog autoGenCatalog = autoGenCompiler.compileCatalogInternal(null, null, autogenReaderList, autoGenJarOutput); if (autoGenCatalog == null) { Log.info("Did not verify catalog because it could not be compiled."); return; } FilteredCatalogDiffEngine diffEng = new FilteredCatalogDiffEngine(origCatalog, autoGenCatalog, false); String diffCmds = diffEng.commands(); if (diffCmds != null && !diffCmds.equals("")) { // This retry is disabled by default to avoid confusing the unwary developer // with a "pointless" replay of an apparently flawed catalog rebuild. // Enable it via this flag to provide a chance to set an early breakpoint // that is only triggered in hopeless cases. if (RETRY_FAILED_CATALOG_REBUILD_UNDER_DEBUG) { autoGenCatalog = replayFailedCatalogRebuildUnderDebug( autoGenCompiler, autogenReaderList, autoGenJarOutput); } // Re-run a failed diff more verbosely as a pre-crash test diagnostic. diffEng = new FilteredCatalogDiffEngine(origCatalog, autoGenCatalog, true); diffCmds = diffEng.commands(); String crashAdvice = "Catalog Verification from Generated DDL failed! " + "VoltDB dev: Consider" + (RETRY_FAILED_CATALOG_REBUILD_UNDER_DEBUG ? "" : " setting VoltCompiler.RETRY_FAILED_CATALOG_REBUILD_UNDER_DEBUG = true and") + " setting a breakpoint in VoltCompiler.replayFailedCatalogRebuildUnderDebug" + " to debug a replay of the faulty catalog rebuild roundtrip. "; VoltDB.crashLocalVoltDB(crashAdvice + "The offending diffcmds were: " + diffCmds); } else { Log.info("Catalog verification completed successfuly."); } }
java
private void debugVerifyCatalog(InMemoryJarfile origJarFile, Catalog origCatalog) { final VoltCompiler autoGenCompiler = new VoltCompiler(m_isXDCR); // Make the new compiler use the original jarfile's classloader so it can // pull in the class files for procedures and imports autoGenCompiler.m_classLoader = origJarFile.getLoader(); List<VoltCompilerReader> autogenReaderList = new ArrayList<>(1); autogenReaderList.add(new VoltCompilerJarFileReader(origJarFile, AUTOGEN_DDL_FILE_NAME)); InMemoryJarfile autoGenJarOutput = new InMemoryJarfile(); autoGenCompiler.m_currentFilename = AUTOGEN_DDL_FILE_NAME; // This call is purposely replicated in retryFailedCatalogRebuildUnderDebug, // where it provides an opportunity to set a breakpoint on a do-over when this // mainline call produces a flawed catalog that fails the catalog diff. // Keep the two calls in synch to allow debugging under the same exact conditions. Catalog autoGenCatalog = autoGenCompiler.compileCatalogInternal(null, null, autogenReaderList, autoGenJarOutput); if (autoGenCatalog == null) { Log.info("Did not verify catalog because it could not be compiled."); return; } FilteredCatalogDiffEngine diffEng = new FilteredCatalogDiffEngine(origCatalog, autoGenCatalog, false); String diffCmds = diffEng.commands(); if (diffCmds != null && !diffCmds.equals("")) { // This retry is disabled by default to avoid confusing the unwary developer // with a "pointless" replay of an apparently flawed catalog rebuild. // Enable it via this flag to provide a chance to set an early breakpoint // that is only triggered in hopeless cases. if (RETRY_FAILED_CATALOG_REBUILD_UNDER_DEBUG) { autoGenCatalog = replayFailedCatalogRebuildUnderDebug( autoGenCompiler, autogenReaderList, autoGenJarOutput); } // Re-run a failed diff more verbosely as a pre-crash test diagnostic. diffEng = new FilteredCatalogDiffEngine(origCatalog, autoGenCatalog, true); diffCmds = diffEng.commands(); String crashAdvice = "Catalog Verification from Generated DDL failed! " + "VoltDB dev: Consider" + (RETRY_FAILED_CATALOG_REBUILD_UNDER_DEBUG ? "" : " setting VoltCompiler.RETRY_FAILED_CATALOG_REBUILD_UNDER_DEBUG = true and") + " setting a breakpoint in VoltCompiler.replayFailedCatalogRebuildUnderDebug" + " to debug a replay of the faulty catalog rebuild roundtrip. "; VoltDB.crashLocalVoltDB(crashAdvice + "The offending diffcmds were: " + diffCmds); } else { Log.info("Catalog verification completed successfuly."); } }
[ "private", "void", "debugVerifyCatalog", "(", "InMemoryJarfile", "origJarFile", ",", "Catalog", "origCatalog", ")", "{", "final", "VoltCompiler", "autoGenCompiler", "=", "new", "VoltCompiler", "(", "m_isXDCR", ")", ";", "// Make the new compiler use the original jarfile's c...
Internal method that takes the generated DDL from the catalog and builds a new catalog. The generated catalog is diffed with the original catalog to verify compilation and catalog generation consistency.
[ "Internal", "method", "that", "takes", "the", "generated", "DDL", "from", "the", "catalog", "and", "builds", "a", "new", "catalog", ".", "The", "generated", "catalog", "is", "diffed", "with", "the", "original", "catalog", "to", "verify", "compilation", "and", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/VoltCompiler.java#L647-L695
VoltDB/voltdb
src/frontend/org/voltdb/planner/FilterMatcher.java
FilterMatcher.childrenMatch
private static boolean childrenMatch(AbstractExpression e1, AbstractExpression e2) { return new FilterMatcher(e1.getLeft(), e2.getLeft()).match() && new FilterMatcher(e1.getRight(), e2.getRight()).match(); }
java
private static boolean childrenMatch(AbstractExpression e1, AbstractExpression e2) { return new FilterMatcher(e1.getLeft(), e2.getLeft()).match() && new FilterMatcher(e1.getRight(), e2.getRight()).match(); }
[ "private", "static", "boolean", "childrenMatch", "(", "AbstractExpression", "e1", ",", "AbstractExpression", "e2", ")", "{", "return", "new", "FilterMatcher", "(", "e1", ".", "getLeft", "(", ")", ",", "e2", ".", "getLeft", "(", ")", ")", ".", "match", "(",...
Check that getLeft() and getRight() of the two expressions match. @param e1 first expression @param e2 second expression @return whether first's getLeft() matches with second's getLeft(), and first's getRight() matches second's getRight().
[ "Check", "that", "getLeft", "()", "and", "getRight", "()", "of", "the", "two", "expressions", "match", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/FilterMatcher.java#L113-L116
Mangopay/mangopay2-java-sdk
src/main/java/com/mangopay/core/UrlTool.java
UrlTool.getRestUrl
public String getRestUrl(String urlKey, Boolean addClientId) throws UnsupportedEncodingException { return getRestUrl(urlKey, addClientId, null, null); }
java
public String getRestUrl(String urlKey, Boolean addClientId) throws UnsupportedEncodingException { return getRestUrl(urlKey, addClientId, null, null); }
[ "public", "String", "getRestUrl", "(", "String", "urlKey", ",", "Boolean", "addClientId", ")", "throws", "UnsupportedEncodingException", "{", "return", "getRestUrl", "(", "urlKey", ",", "addClientId", ",", "null", ",", "null", ")", ";", "}" ]
Gets REST url. @param urlKey Url key. @param addClientId Denotes whether client identifier should be composed into final url. @return Final REST url. @throws UnsupportedEncodingException
[ "Gets", "REST", "url", "." ]
train
https://github.com/Mangopay/mangopay2-java-sdk/blob/037cecb44ea62def63b507817fd9961649151157/src/main/java/com/mangopay/core/UrlTool.java#L58-L60
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobLauncherFactory.java
JobLauncherFactory.newJobLauncher
public static JobLauncher newJobLauncher(Properties sysProps, Properties jobProps, String launcherTypeValue, SharedResourcesBroker<GobblinScopeTypes> instanceBroker, List<? extends Tag<?>> metadataTags) { Optional<JobLauncherType> launcherType = Enums.getIfPresent(JobLauncherType.class, launcherTypeValue); try { if (launcherType.isPresent()) { switch (launcherType.get()) { case LOCAL: return new LocalJobLauncher(JobConfigurationUtils.combineSysAndJobProperties(sysProps, jobProps), instanceBroker, metadataTags); case MAPREDUCE: return new MRJobLauncher(JobConfigurationUtils.combineSysAndJobProperties(sysProps, jobProps), instanceBroker, metadataTags); default: throw new RuntimeException("Unsupported job launcher type: " + launcherType.get().name()); } } @SuppressWarnings("unchecked") Class<? extends AbstractJobLauncher> launcherClass = (Class<? extends AbstractJobLauncher>) Class.forName(launcherTypeValue); return launcherClass.getDeclaredConstructor(Properties.class) .newInstance(JobConfigurationUtils.combineSysAndJobProperties(sysProps, jobProps)); } catch (Exception e) { throw new RuntimeException("Failed to create job launcher: " + e, e); } }
java
public static JobLauncher newJobLauncher(Properties sysProps, Properties jobProps, String launcherTypeValue, SharedResourcesBroker<GobblinScopeTypes> instanceBroker, List<? extends Tag<?>> metadataTags) { Optional<JobLauncherType> launcherType = Enums.getIfPresent(JobLauncherType.class, launcherTypeValue); try { if (launcherType.isPresent()) { switch (launcherType.get()) { case LOCAL: return new LocalJobLauncher(JobConfigurationUtils.combineSysAndJobProperties(sysProps, jobProps), instanceBroker, metadataTags); case MAPREDUCE: return new MRJobLauncher(JobConfigurationUtils.combineSysAndJobProperties(sysProps, jobProps), instanceBroker, metadataTags); default: throw new RuntimeException("Unsupported job launcher type: " + launcherType.get().name()); } } @SuppressWarnings("unchecked") Class<? extends AbstractJobLauncher> launcherClass = (Class<? extends AbstractJobLauncher>) Class.forName(launcherTypeValue); return launcherClass.getDeclaredConstructor(Properties.class) .newInstance(JobConfigurationUtils.combineSysAndJobProperties(sysProps, jobProps)); } catch (Exception e) { throw new RuntimeException("Failed to create job launcher: " + e, e); } }
[ "public", "static", "JobLauncher", "newJobLauncher", "(", "Properties", "sysProps", ",", "Properties", "jobProps", ",", "String", "launcherTypeValue", ",", "SharedResourcesBroker", "<", "GobblinScopeTypes", ">", "instanceBroker", ",", "List", "<", "?", "extends", "Tag...
Creates a new instance for a JobLauncher with a given type @param sysProps the system/environment properties @param jobProps the job properties @param launcherTypeValue the type of the launcher; either a {@link JobLauncherType} value or the name of the class that extends {@link AbstractJobLauncher} and has a constructor that has a single Properties parameter.. @param metadataTags additional metadata to be added to timing events @return the JobLauncher instance @throws RuntimeException if the instantiation fails
[ "Creates", "a", "new", "instance", "for", "a", "JobLauncher", "with", "a", "given", "type" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobLauncherFactory.java#L136-L160
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.parseNewExpression
private Expr parseNewExpression(EnclosingScope scope, boolean terminated) { int start = index; // try to match a lifetime Identifier lifetime = parseOptionalLifetimeIdentifier(scope, terminated); if (lifetime != null) { scope.mustBeLifetime(lifetime); match(Colon); } else { // FIXME: this should really be null lifetime = new Identifier("*"); } match(New); Expr e = parseExpression(scope, terminated); return annotateSourceLocation(new Expr.New(Type.Void, e, lifetime), start); }
java
private Expr parseNewExpression(EnclosingScope scope, boolean terminated) { int start = index; // try to match a lifetime Identifier lifetime = parseOptionalLifetimeIdentifier(scope, terminated); if (lifetime != null) { scope.mustBeLifetime(lifetime); match(Colon); } else { // FIXME: this should really be null lifetime = new Identifier("*"); } match(New); Expr e = parseExpression(scope, terminated); return annotateSourceLocation(new Expr.New(Type.Void, e, lifetime), start); }
[ "private", "Expr", "parseNewExpression", "(", "EnclosingScope", "scope", ",", "boolean", "terminated", ")", "{", "int", "start", "=", "index", ";", "// try to match a lifetime", "Identifier", "lifetime", "=", "parseOptionalLifetimeIdentifier", "(", "scope", ",", "term...
Parse a new expression, which is of the form: <pre> TermExpr::= ... | "new" Expr | Lifetime ":" "new" Identifier Expr </pre> @param scope The enclosing scope for this statement, which determines the set of visible (i.e. declared) variables and also the current indentation level. @param terminated This indicates that the expression is known to be terminated (or not). An expression that's known to be terminated is one which is guaranteed to be followed by something. This is important because it means that we can ignore any newline characters encountered in parsing this expression, and that we'll never overrun the end of the expression (i.e. because there's guaranteed to be something which terminates this expression). A classic situation where terminated is true is when parsing an expression surrounded in braces. In such case, we know the right-brace will always terminate this expression. @return
[ "Parse", "a", "new", "expression", "which", "is", "of", "the", "form", ":" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L2844-L2858
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/BitFieldReader.java
BitFieldReader.loadIndeces
public int loadIndeces(List<RowIndexEntry> rowIndexEntries, int startIndex) { int updatedStartIndex = input.loadIndeces(rowIndexEntries, startIndex); int numIndeces = rowIndexEntries.size(); indeces = new int[numIndeces + 1]; int i = 0; for (RowIndexEntry rowIndexEntry : rowIndexEntries) { indeces[i] = (int) rowIndexEntry.getPositions(updatedStartIndex); i++; } return updatedStartIndex + 1; }
java
public int loadIndeces(List<RowIndexEntry> rowIndexEntries, int startIndex) { int updatedStartIndex = input.loadIndeces(rowIndexEntries, startIndex); int numIndeces = rowIndexEntries.size(); indeces = new int[numIndeces + 1]; int i = 0; for (RowIndexEntry rowIndexEntry : rowIndexEntries) { indeces[i] = (int) rowIndexEntry.getPositions(updatedStartIndex); i++; } return updatedStartIndex + 1; }
[ "public", "int", "loadIndeces", "(", "List", "<", "RowIndexEntry", ">", "rowIndexEntries", ",", "int", "startIndex", ")", "{", "int", "updatedStartIndex", "=", "input", ".", "loadIndeces", "(", "rowIndexEntries", ",", "startIndex", ")", ";", "int", "numIndeces",...
Read in the number of bytes consumed at each index entry and store it, also call loadIndeces on child stream and return the index of the next streams indexes.
[ "Read", "in", "the", "number", "of", "bytes", "consumed", "at", "each", "index", "entry", "and", "store", "it", "also", "call", "loadIndeces", "on", "child", "stream", "and", "return", "the", "index", "of", "the", "next", "streams", "indexes", "." ]
train
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/BitFieldReader.java#L80-L91
BoltsFramework/Bolts-Android
bolts-applinks/src/main/java/bolts/AppLinks.java
AppLinks.getTargetUrlFromInboundIntent
public static Uri getTargetUrlFromInboundIntent(Context context, Intent intent) { Bundle appLinkData = getAppLinkData(intent); if (appLinkData != null) { String targetString = appLinkData.getString(KEY_NAME_TARGET); if (targetString != null) { MeasurementEvent.sendBroadcastEvent(context, MeasurementEvent.APP_LINK_NAVIGATE_IN_EVENT_NAME, intent, null); return Uri.parse(targetString); } } return null; }
java
public static Uri getTargetUrlFromInboundIntent(Context context, Intent intent) { Bundle appLinkData = getAppLinkData(intent); if (appLinkData != null) { String targetString = appLinkData.getString(KEY_NAME_TARGET); if (targetString != null) { MeasurementEvent.sendBroadcastEvent(context, MeasurementEvent.APP_LINK_NAVIGATE_IN_EVENT_NAME, intent, null); return Uri.parse(targetString); } } return null; }
[ "public", "static", "Uri", "getTargetUrlFromInboundIntent", "(", "Context", "context", ",", "Intent", "intent", ")", "{", "Bundle", "appLinkData", "=", "getAppLinkData", "(", "intent", ")", ";", "if", "(", "appLinkData", "!=", "null", ")", "{", "String", "targ...
Gets the target URL for an intent. If the intent is from an App Link, this will be the App Link target. Otherwise, it return null; For app link intent, this function will broadcast APP_LINK_NAVIGATE_IN_EVENT_NAME event. @param context the context this function is called within. @param intent the incoming intent. @return the target URL for the intent if applink intent; null otherwise.
[ "Gets", "the", "target", "URL", "for", "an", "intent", ".", "If", "the", "intent", "is", "from", "an", "App", "Link", "this", "will", "be", "the", "App", "Link", "target", ".", "Otherwise", "it", "return", "null", ";", "For", "app", "link", "intent", ...
train
https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-applinks/src/main/java/bolts/AppLinks.java#L78-L88
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readResourceAssignment
private void readResourceAssignment(Task task, Document.Projects.Project.Task.ResourceAssignments.ResourceAssignment assignment) { Resource resource = m_projectFile.getResourceByUniqueID(assignment.getResourceID()); if (resource != null) { ResourceAssignment mpxjAssignment = task.addResourceAssignment(resource); mpxjAssignment.setUniqueID(assignment.getID()); mpxjAssignment.setWork(Duration.getInstance(assignment.getManHour().doubleValue() * m_workHoursPerDay, TimeUnit.HOURS)); mpxjAssignment.setUnits(assignment.getUse()); } }
java
private void readResourceAssignment(Task task, Document.Projects.Project.Task.ResourceAssignments.ResourceAssignment assignment) { Resource resource = m_projectFile.getResourceByUniqueID(assignment.getResourceID()); if (resource != null) { ResourceAssignment mpxjAssignment = task.addResourceAssignment(resource); mpxjAssignment.setUniqueID(assignment.getID()); mpxjAssignment.setWork(Duration.getInstance(assignment.getManHour().doubleValue() * m_workHoursPerDay, TimeUnit.HOURS)); mpxjAssignment.setUnits(assignment.getUse()); } }
[ "private", "void", "readResourceAssignment", "(", "Task", "task", ",", "Document", ".", "Projects", ".", "Project", ".", "Task", ".", "ResourceAssignments", ".", "ResourceAssignment", "assignment", ")", "{", "Resource", "resource", "=", "m_projectFile", ".", "getR...
Read resource assignments. @param task Parent task @param assignment ConceptDraw PROJECT resource assignment
[ "Read", "resource", "assignments", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L466-L476
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/FileIoUtil.java
FileIoUtil.readPropertiesBoolean
public static boolean readPropertiesBoolean(Properties _props, String _property) { if (_props.containsKey(_property)) { if (_props.getProperty(_property).matches("(?i)(1|yes|true|enabled|on|y)")) { return true; } } return false; }
java
public static boolean readPropertiesBoolean(Properties _props, String _property) { if (_props.containsKey(_property)) { if (_props.getProperty(_property).matches("(?i)(1|yes|true|enabled|on|y)")) { return true; } } return false; }
[ "public", "static", "boolean", "readPropertiesBoolean", "(", "Properties", "_props", ",", "String", "_property", ")", "{", "if", "(", "_props", ".", "containsKey", "(", "_property", ")", ")", "{", "if", "(", "_props", ".", "getProperty", "(", "_property", ")...
Reads a property as boolean from an properties object. Returns true if read property matches 1, yes, true, enabled, on, y @param _props @param _property @return
[ "Reads", "a", "property", "as", "boolean", "from", "an", "properties", "object", ".", "Returns", "true", "if", "read", "property", "matches", "1", "yes", "true", "enabled", "on", "y" ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/FileIoUtil.java#L129-L136
meltmedia/cadmium
servlets/src/main/java/com/meltmedia/cadmium/servlets/AbstractSecureRedirectStrategy.java
AbstractSecureRedirectStrategy.makeInsecure
@Override public void makeInsecure(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); response.setHeader("Location", insecureUrl(request, response)); response.getOutputStream().flush(); response.getOutputStream().close(); }
java
@Override public void makeInsecure(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); response.setHeader("Location", insecureUrl(request, response)); response.getOutputStream().flush(); response.getOutputStream().close(); }
[ "@", "Override", "public", "void", "makeInsecure", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", "{", "response", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_MOVED_PERMANENTLY", ")", ";", "respon...
Sends a moved perminately redirect to the insecure form of the request URL. @request the request to make secure. @response the response for the request.
[ "Sends", "a", "moved", "perminately", "redirect", "to", "the", "insecure", "form", "of", "the", "request", "URL", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/AbstractSecureRedirectStrategy.java#L170-L176
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java
GeneratorNodeExtensions.appendTemplate
public CompositeGeneratorNode appendTemplate(final CompositeGeneratorNode parent, final StringConcatenationClient templateString) { final TemplateNode proc = new TemplateNode(templateString, this); List<IGeneratorNode> _children = parent.getChildren(); _children.add(proc); return parent; }
java
public CompositeGeneratorNode appendTemplate(final CompositeGeneratorNode parent, final StringConcatenationClient templateString) { final TemplateNode proc = new TemplateNode(templateString, this); List<IGeneratorNode> _children = parent.getChildren(); _children.add(proc); return parent; }
[ "public", "CompositeGeneratorNode", "appendTemplate", "(", "final", "CompositeGeneratorNode", "parent", ",", "final", "StringConcatenationClient", "templateString", ")", "{", "final", "TemplateNode", "proc", "=", "new", "TemplateNode", "(", "templateString", ",", "this", ...
Creates a template node for the given templateString and appends it to the given parent node. Templates are translated to generator node trees and expressions in templates can be of type IGeneratorNode. @return the given parent node
[ "Creates", "a", "template", "node", "for", "the", "given", "templateString", "and", "appends", "it", "to", "the", "given", "parent", "node", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java#L161-L166
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/provisioning/OptionsApi.java
OptionsApi.getOptions
public Options getOptions(String personDBID, String agentGroupDBID) throws ProvisioningApiException { try { OptionsGetResponseSuccess resp = optionsApi.optionsGet( personDBID, agentGroupDBID ); if (!resp.getStatus().getCode().equals(0)) { throw new ProvisioningApiException("Error getting options. Code: " + resp.getStatus().getCode()); } Options out = new Options(); out.setOptions((Map<String, Object>) resp.getData().getOptions()); out.setCmeAppName(resp.getData().getCmeAppName()); out.setCmeAppDBID(resp.getData().getCmeAppDBID()); return out; } catch (ApiException e) { throw new ProvisioningApiException("Error getting options", e); } }
java
public Options getOptions(String personDBID, String agentGroupDBID) throws ProvisioningApiException { try { OptionsGetResponseSuccess resp = optionsApi.optionsGet( personDBID, agentGroupDBID ); if (!resp.getStatus().getCode().equals(0)) { throw new ProvisioningApiException("Error getting options. Code: " + resp.getStatus().getCode()); } Options out = new Options(); out.setOptions((Map<String, Object>) resp.getData().getOptions()); out.setCmeAppName(resp.getData().getCmeAppName()); out.setCmeAppDBID(resp.getData().getCmeAppDBID()); return out; } catch (ApiException e) { throw new ProvisioningApiException("Error getting options", e); } }
[ "public", "Options", "getOptions", "(", "String", "personDBID", ",", "String", "agentGroupDBID", ")", "throws", "ProvisioningApiException", "{", "try", "{", "OptionsGetResponseSuccess", "resp", "=", "optionsApi", ".", "optionsGet", "(", "personDBID", ",", "agentGroupD...
Get options. Get options for a specified application and merge them with the person and agent group annexes. @param personDBID The DBID of a person. Options are merged with the person&#39;s annex and the annexes of the person&#39;s agent groups. Mutual with agent_group_dbid. (optional) @param agentGroupDBID The DBID of an agent group. Options are merged with the agent group&#39;s annex. Mutual with person_dbid. (optional) @return Options object containing list of Options as well as cmeAppName and cmeAppDBID. @throws ProvisioningApiException if the call is unsuccessful.
[ "Get", "options", ".", "Get", "options", "for", "a", "specified", "application", "and", "merge", "them", "with", "the", "person", "and", "agent", "group", "annexes", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/provisioning/OptionsApi.java#L31-L52
Azure/azure-sdk-for-java
containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/AgentPoolsInner.java
AgentPoolsInner.listAsync
public Observable<Page<AgentPoolInner>> listAsync(final String resourceGroupName, final String managedClusterName) { return listWithServiceResponseAsync(resourceGroupName, managedClusterName) .map(new Func1<ServiceResponse<Page<AgentPoolInner>>, Page<AgentPoolInner>>() { @Override public Page<AgentPoolInner> call(ServiceResponse<Page<AgentPoolInner>> response) { return response.body(); } }); }
java
public Observable<Page<AgentPoolInner>> listAsync(final String resourceGroupName, final String managedClusterName) { return listWithServiceResponseAsync(resourceGroupName, managedClusterName) .map(new Func1<ServiceResponse<Page<AgentPoolInner>>, Page<AgentPoolInner>>() { @Override public Page<AgentPoolInner> call(ServiceResponse<Page<AgentPoolInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "AgentPoolInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "managedClusterName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "managedClu...
Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. @param resourceGroupName The name of the resource group. @param managedClusterName The name of the managed cluster resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;AgentPoolInner&gt; object
[ "Gets", "a", "list", "of", "agent", "pools", "in", "the", "specified", "managed", "cluster", ".", "Gets", "a", "list", "of", "agent", "pools", "in", "the", "specified", "managed", "cluster", ".", "The", "operation", "returns", "properties", "of", "each", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/AgentPoolsInner.java#L146-L154
Bedework/bw-util
bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java
XmlUtil.getAttrVal
public static String getAttrVal(final NamedNodeMap nnm, final String name) { Node nmAttr = nnm.getNamedItem(name); if ((nmAttr == null) || (absent(nmAttr.getNodeValue()))) { return null; } return nmAttr.getNodeValue(); }
java
public static String getAttrVal(final NamedNodeMap nnm, final String name) { Node nmAttr = nnm.getNamedItem(name); if ((nmAttr == null) || (absent(nmAttr.getNodeValue()))) { return null; } return nmAttr.getNodeValue(); }
[ "public", "static", "String", "getAttrVal", "(", "final", "NamedNodeMap", "nnm", ",", "final", "String", "name", ")", "{", "Node", "nmAttr", "=", "nnm", ".", "getNamedItem", "(", "name", ")", ";", "if", "(", "(", "nmAttr", "==", "null", ")", "||", "(",...
Return the attribute value of the named attribute from the given map. @param nnm NamedNodeMap @param name String name of desired attribute @return String attribute value or null
[ "Return", "the", "attribute", "value", "of", "the", "named", "attribute", "from", "the", "given", "map", "." ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L252-L260
Stratio/deep-spark
deep-cassandra/src/main/java/com/stratio/deep/cassandra/entity/CassandraCell.java
CassandraCell.create
public static Cell create(String cellName, Object cellValue) { return create(cellName, cellValue, Boolean.FALSE, Boolean.FALSE); }
java
public static Cell create(String cellName, Object cellValue) { return create(cellName, cellValue, Boolean.FALSE, Boolean.FALSE); }
[ "public", "static", "Cell", "create", "(", "String", "cellName", ",", "Object", "cellValue", ")", "{", "return", "create", "(", "cellName", ",", "cellValue", ",", "Boolean", ".", "FALSE", ",", "Boolean", ".", "FALSE", ")", ";", "}" ]
Factory method, builds a new CassandraCell (isPartitionKey = false and isClusterKey = false). The validator will be automatically calculated using the value object type. @param cellName the cell name @param cellValue the cell value, provided as a ByteBuffer. @return an instance of a Cell object for the provided parameters.
[ "Factory", "method", "builds", "a", "new", "CassandraCell", "(", "isPartitionKey", "=", "false", "and", "isClusterKey", "=", "false", ")", ".", "The", "validator", "will", "be", "automatically", "calculated", "using", "the", "value", "object", "type", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/entity/CassandraCell.java#L72-L74
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.deleteTag
public void deleteTag(Serializable projectId, String tagName) throws IOException { String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabTag.URL + "/" + tagName; retrieve().method(DELETE).to(tailUrl, Void.class); }
java
public void deleteTag(Serializable projectId, String tagName) throws IOException { String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabTag.URL + "/" + tagName; retrieve().method(DELETE).to(tailUrl, Void.class); }
[ "public", "void", "deleteTag", "(", "Serializable", "projectId", ",", "String", "tagName", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabProject", ".", "URL", "+", "\"/\"", "+", "sanitizeProjectId", "(", "projectId", ")", "+", "GitlabTag", ...
Delete tag in specific project @param projectId @param tagName @throws IOException on gitlab api call error
[ "Delete", "tag", "in", "specific", "project" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3427-L3430
gallandarakhneorg/afc
core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java
MathUtil.isEpsilonEqual
@Pure public static boolean isEpsilonEqual(double v1, double v2, double epsilon) { if (Double.isInfinite(v1)) { return Double.isInfinite(v2) && Math.signum(v1) == Math.signum(v2); } else if (Double.isNaN(v1)) { return false; } final double value = Math.abs(v1 - v2); final double eps = Double.isNaN(epsilon) ? Math.ulp(value) : epsilon; return value <= eps; }
java
@Pure public static boolean isEpsilonEqual(double v1, double v2, double epsilon) { if (Double.isInfinite(v1)) { return Double.isInfinite(v2) && Math.signum(v1) == Math.signum(v2); } else if (Double.isNaN(v1)) { return false; } final double value = Math.abs(v1 - v2); final double eps = Double.isNaN(epsilon) ? Math.ulp(value) : epsilon; return value <= eps; }
[ "@", "Pure", "public", "static", "boolean", "isEpsilonEqual", "(", "double", "v1", ",", "double", "v2", ",", "double", "epsilon", ")", "{", "if", "(", "Double", ".", "isInfinite", "(", "v1", ")", ")", "{", "return", "Double", ".", "isInfinite", "(", "v...
Replies if the given values are near. @param v1 first value. @param v2 second value. @param epsilon the approximation epsilon. If {@link Double#NaN}, the function {@link Math#ulp(double)} is used for evaluating the epsilon. @return <code>true</code> if the given {@code v1} is near {@code v2}, otherwise <code>false</code>.
[ "Replies", "if", "the", "given", "values", "are", "near", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L166-L176
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/util/EntityUtils.java
EntityUtils.isNullValue
public static boolean isNullValue(Entity entity, Attribute attribute) { boolean isNullValue; String attributeName = attribute.getName(); AttributeType attributeType = attribute.getDataType(); switch (attributeType) { case BOOL: isNullValue = entity.getBoolean(attributeName) == null; break; case CATEGORICAL: case FILE: case XREF: isNullValue = entity.getEntity(attributeName) == null; break; case CATEGORICAL_MREF: case MREF: case ONE_TO_MANY: Iterable<Entity> refEntities = entity.getEntities(attributeName); isNullValue = Iterables.isEmpty(refEntities); break; case COMPOUND: throw new RuntimeException(format("Invalid data type [%s]", attribute.getDataType())); case DATE: isNullValue = entity.getLocalDate(attributeName) == null; break; case DATE_TIME: isNullValue = entity.getInstant(attributeName) == null; break; case DECIMAL: isNullValue = entity.getDouble(attributeName) == null; break; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: isNullValue = entity.getString(attributeName) == null; break; case INT: isNullValue = entity.getInt(attributeName) == null; break; case LONG: isNullValue = entity.getLong(attributeName) == null; break; default: throw new UnexpectedEnumException(attributeType); } return isNullValue; }
java
public static boolean isNullValue(Entity entity, Attribute attribute) { boolean isNullValue; String attributeName = attribute.getName(); AttributeType attributeType = attribute.getDataType(); switch (attributeType) { case BOOL: isNullValue = entity.getBoolean(attributeName) == null; break; case CATEGORICAL: case FILE: case XREF: isNullValue = entity.getEntity(attributeName) == null; break; case CATEGORICAL_MREF: case MREF: case ONE_TO_MANY: Iterable<Entity> refEntities = entity.getEntities(attributeName); isNullValue = Iterables.isEmpty(refEntities); break; case COMPOUND: throw new RuntimeException(format("Invalid data type [%s]", attribute.getDataType())); case DATE: isNullValue = entity.getLocalDate(attributeName) == null; break; case DATE_TIME: isNullValue = entity.getInstant(attributeName) == null; break; case DECIMAL: isNullValue = entity.getDouble(attributeName) == null; break; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: isNullValue = entity.getString(attributeName) == null; break; case INT: isNullValue = entity.getInt(attributeName) == null; break; case LONG: isNullValue = entity.getLong(attributeName) == null; break; default: throw new UnexpectedEnumException(attributeType); } return isNullValue; }
[ "public", "static", "boolean", "isNullValue", "(", "Entity", "entity", ",", "Attribute", "attribute", ")", "{", "boolean", "isNullValue", ";", "String", "attributeName", "=", "attribute", ".", "getName", "(", ")", ";", "AttributeType", "attributeType", "=", "att...
Returns whether an entity attribute value is <tt>null</tt> or empty for attributes referencing multiple entities.
[ "Returns", "whether", "an", "entity", "attribute", "value", "is", "<tt", ">", "null<", "/", "tt", ">", "or", "empty", "for", "attributes", "referencing", "multiple", "entities", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/util/EntityUtils.java#L553-L602
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/util/DockerPathUtil.java
DockerPathUtil.resolveAbsolutely
public static File resolveAbsolutely(String pathToResolve, String baseDir) { // TODO: handle the case where pathToResolve specifies a non-existent path, for example, a base directory equal to "/" and a relative path of "../../foo". File fileToResolve = new File(pathToResolve); if (fileToResolve.isAbsolute()) { return fileToResolve; } if (baseDir == null) { throw new IllegalArgumentException("Cannot resolve relative path '" + pathToResolve + "' with a " + "null base directory."); } File baseDirAsFile = new File(baseDir); if (!baseDirAsFile.isAbsolute()) { throw new IllegalArgumentException("Base directory '" + baseDirAsFile + "' must be absolute"); } final File toCanonicalize = new File(baseDirAsFile, pathToResolve); try { return toCanonicalize.getCanonicalFile(); } catch (IOException e) { throw new RuntimeException("Unable to canonicalize the file path '" + toCanonicalize + "'"); } }
java
public static File resolveAbsolutely(String pathToResolve, String baseDir) { // TODO: handle the case where pathToResolve specifies a non-existent path, for example, a base directory equal to "/" and a relative path of "../../foo". File fileToResolve = new File(pathToResolve); if (fileToResolve.isAbsolute()) { return fileToResolve; } if (baseDir == null) { throw new IllegalArgumentException("Cannot resolve relative path '" + pathToResolve + "' with a " + "null base directory."); } File baseDirAsFile = new File(baseDir); if (!baseDirAsFile.isAbsolute()) { throw new IllegalArgumentException("Base directory '" + baseDirAsFile + "' must be absolute"); } final File toCanonicalize = new File(baseDirAsFile, pathToResolve); try { return toCanonicalize.getCanonicalFile(); } catch (IOException e) { throw new RuntimeException("Unable to canonicalize the file path '" + toCanonicalize + "'"); } }
[ "public", "static", "File", "resolveAbsolutely", "(", "String", "pathToResolve", ",", "String", "baseDir", ")", "{", "// TODO: handle the case where pathToResolve specifies a non-existent path, for example, a base directory equal to \"/\" and a relative path of \"../../foo\".", "File", "...
Resolves the supplied resource (a path or directory on the filesystem) relative the supplied {@code baseDir}. The returned {@code File} is guaranteed to be {@link File#isAbsolute() absolute}. The returned file is <em>not</em> guaranteed to exist. <p> If the supplied {@code pathToResolve} is already {@link File#isAbsolute() absolute}, then it is returned <em>unmodified</em>. Otherwise, the {@code pathToResolve} is returned as an absolute {@code File} using the supplied {@code baseDir} as its parent. </p> @param pathToResolve represents a filesystem resource, which may be an absolute path @param baseDir the absolute path used to resolve non-absolute path resources; <em>must</em> be absolute @return an absolute {@code File} reference to {@code pathToResolve}; <em>not</em> guaranteed to exist @throws IllegalArgumentException if the supplied {@code baseDir} does not represent an absolute path
[ "Resolves", "the", "supplied", "resource", "(", "a", "path", "or", "directory", "on", "the", "filesystem", ")", "relative", "the", "supplied", "{", "@code", "baseDir", "}", ".", "The", "returned", "{", "@code", "File", "}", "is", "guaranteed", "to", "be", ...
train
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/util/DockerPathUtil.java#L32-L56
denisneuling/cctrl.jar
cctrl-api-client/src/main/java/com/cloudcontrolled/api/client/util/ClassUtil.java
ClassUtil.getValueOfField
public static Object getValueOfField(Field field, Object ref) { field.setAccessible(true); Object value = null; try { value = field.get(ref); } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } return value; }
java
public static Object getValueOfField(Field field, Object ref) { field.setAccessible(true); Object value = null; try { value = field.get(ref); } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } return value; }
[ "public", "static", "Object", "getValueOfField", "(", "Field", "field", ",", "Object", "ref", ")", "{", "field", ".", "setAccessible", "(", "true", ")", ";", "Object", "value", "=", "null", ";", "try", "{", "value", "=", "field", ".", "get", "(", "ref"...
<p> getValueOfField. </p> @param field a {@link java.lang.reflect.Field} object. @param ref a {@link java.lang.Object} object. @return a {@link java.lang.Object} object.
[ "<p", ">", "getValueOfField", ".", "<", "/", "p", ">" ]
train
https://github.com/denisneuling/cctrl.jar/blob/37450d824f4dc5ecbcc81c61e48f1ec876ca2de8/cctrl-api-client/src/main/java/com/cloudcontrolled/api/client/util/ClassUtil.java#L189-L198
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/index/service/RowMapper.java
RowMapper.build
public static RowMapper build(CFMetaData metadata, ColumnDefinition columnDefinition, Schema schema) { if (metadata.clusteringColumns().size() > 0) { return new RowMapperWide(metadata, columnDefinition, schema); } else { return new RowMapperSkinny(metadata, columnDefinition, schema); } }
java
public static RowMapper build(CFMetaData metadata, ColumnDefinition columnDefinition, Schema schema) { if (metadata.clusteringColumns().size() > 0) { return new RowMapperWide(metadata, columnDefinition, schema); } else { return new RowMapperSkinny(metadata, columnDefinition, schema); } }
[ "public", "static", "RowMapper", "build", "(", "CFMetaData", "metadata", ",", "ColumnDefinition", "columnDefinition", ",", "Schema", "schema", ")", "{", "if", "(", "metadata", ".", "clusteringColumns", "(", ")", ".", "size", "(", ")", ">", "0", ")", "{", "...
Returns a new {@link RowMapper} for the specified column family metadata, indexed column definition and {@link Schema}. @param metadata The indexed column family metadata. @param columnDefinition The indexed column definition. @param schema The mapping {@link Schema}. @return A new {@link RowMapper} for the specified column family metadata, indexed column definition and {@link Schema}.
[ "Returns", "a", "new", "{", "@link", "RowMapper", "}", "for", "the", "specified", "column", "family", "metadata", "indexed", "column", "definition", "and", "{", "@link", "Schema", "}", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/service/RowMapper.java#L76-L82
symphonyoss/messageml-utils
src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java
XmlPrintStream.printElement
public void printElement(String elementName, Object value) { println("<" + elementName + ">" + (value == null ? "" : escape(value.toString())) + "</" + elementName + ">"); }
java
public void printElement(String elementName, Object value) { println("<" + elementName + ">" + (value == null ? "" : escape(value.toString())) + "</" + elementName + ">"); }
[ "public", "void", "printElement", "(", "String", "elementName", ",", "Object", "value", ")", "{", "println", "(", "\"<\"", "+", "elementName", "+", "\">\"", "+", "(", "value", "==", "null", "?", "\"\"", ":", "escape", "(", "value", ".", "toString", "(", ...
Output a complete element with the given content. @param elementName Name of element. @param value Content of element.
[ "Output", "a", "complete", "element", "with", "the", "given", "content", "." ]
train
https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java#L109-L111
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTabSetRenderer.java
WTabSetRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WTabSet tabSet = (WTabSet) component; XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("ui:tabset"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendAttribute("type", getTypeAsString(tabSet.getType())); xml.appendOptionalAttribute("disabled", tabSet.isDisabled(), "true"); xml.appendOptionalAttribute("hidden", tabSet.isHidden(), "true"); xml.appendOptionalAttribute("contentHeight", tabSet.getContentHeight()); xml.appendOptionalAttribute("showHeadOnly", tabSet.isShowHeadOnly(), "true"); xml.appendOptionalAttribute("single", TabSetType.ACCORDION.equals(tabSet.getType()) && tabSet.isSingle(), "true"); if (WTabSet.TabSetType.ACCORDION.equals(tabSet.getType())) { xml.appendOptionalAttribute("groupName", tabSet.getGroupName()); } xml.appendClose(); // Render margin MarginRendererUtil.renderMargin(tabSet, renderContext); paintChildren(tabSet, renderContext); xml.appendEndTag("ui:tabset"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WTabSet tabSet = (WTabSet) component; XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("ui:tabset"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendAttribute("type", getTypeAsString(tabSet.getType())); xml.appendOptionalAttribute("disabled", tabSet.isDisabled(), "true"); xml.appendOptionalAttribute("hidden", tabSet.isHidden(), "true"); xml.appendOptionalAttribute("contentHeight", tabSet.getContentHeight()); xml.appendOptionalAttribute("showHeadOnly", tabSet.isShowHeadOnly(), "true"); xml.appendOptionalAttribute("single", TabSetType.ACCORDION.equals(tabSet.getType()) && tabSet.isSingle(), "true"); if (WTabSet.TabSetType.ACCORDION.equals(tabSet.getType())) { xml.appendOptionalAttribute("groupName", tabSet.getGroupName()); } xml.appendClose(); // Render margin MarginRendererUtil.renderMargin(tabSet, renderContext); paintChildren(tabSet, renderContext); xml.appendEndTag("ui:tabset"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WTabSet", "tabSet", "=", "(", "WTabSet", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext"...
Paints the given WTabSet. @param component the WTabSet to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WTabSet", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTabSetRenderer.java#L24-L52
threerings/nenya
core/src/main/java/com/threerings/util/KeyboardManager.java
KeyboardManager.notifyObservers
protected synchronized void notifyObservers (int id, int keyCode, long timestamp) { _keyOp.init(id, keyCode, timestamp); _observers.apply(_keyOp); }
java
protected synchronized void notifyObservers (int id, int keyCode, long timestamp) { _keyOp.init(id, keyCode, timestamp); _observers.apply(_keyOp); }
[ "protected", "synchronized", "void", "notifyObservers", "(", "int", "id", ",", "int", "keyCode", ",", "long", "timestamp", ")", "{", "_keyOp", ".", "init", "(", "id", ",", "keyCode", ",", "timestamp", ")", ";", "_observers", ".", "apply", "(", "_keyOp", ...
Notifies all registered key observers of the supplied key event. This method provides a thread-safe manner in which to notify the observers, which is necessary since the {@link KeyInfo} objects do various antics from the interval manager thread whilst we may do other notification from the AWT thread when normal key events are handled.
[ "Notifies", "all", "registered", "key", "observers", "of", "the", "supplied", "key", "event", ".", "This", "method", "provides", "a", "thread", "-", "safe", "manner", "in", "which", "to", "notify", "the", "observers", "which", "is", "necessary", "since", "th...
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyboardManager.java#L384-L388
cycorp/api-suite
core-api/src/main/java/com/cyc/kb/exception/KbObjectNotFoundException.java
KbObjectNotFoundException.fromThrowable
public static KbObjectNotFoundException fromThrowable(String message, Throwable cause) { return (cause instanceof KbObjectNotFoundException && Objects.equals(message, cause.getMessage())) ? (KbObjectNotFoundException) cause : new KbObjectNotFoundException(message, cause); }
java
public static KbObjectNotFoundException fromThrowable(String message, Throwable cause) { return (cause instanceof KbObjectNotFoundException && Objects.equals(message, cause.getMessage())) ? (KbObjectNotFoundException) cause : new KbObjectNotFoundException(message, cause); }
[ "public", "static", "KbObjectNotFoundException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "KbObjectNotFoundException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", "...
Converts a Throwable to a KbObjectNotFoundException with the specified detail message. If the Throwable is a KbObjectNotFoundException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new KbObjectNotFoundException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a KbObjectNotFoundException
[ "Converts", "a", "Throwable", "to", "a", "KbObjectNotFoundException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "KbObjectNotFoundException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", ...
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbObjectNotFoundException.java#L65-L69
cqframework/clinical_quality_language
Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/Cql2ElmVisitor.java
Cql2ElmVisitor.getPropertyPath
private String getPropertyPath(Expression reference, String alias) { if (reference instanceof Property) { Property property = (Property)reference; if (alias.equals(property.getScope())) { return property.getPath(); } else if (property.getSource() != null) { String subPath = getPropertyPath(property.getSource(), alias); if (subPath != null) { return String.format("%s.%s", subPath, property.getPath()); } } } return null; }
java
private String getPropertyPath(Expression reference, String alias) { if (reference instanceof Property) { Property property = (Property)reference; if (alias.equals(property.getScope())) { return property.getPath(); } else if (property.getSource() != null) { String subPath = getPropertyPath(property.getSource(), alias); if (subPath != null) { return String.format("%s.%s", subPath, property.getPath()); } } } return null; }
[ "private", "String", "getPropertyPath", "(", "Expression", "reference", ",", "String", "alias", ")", "{", "if", "(", "reference", "instanceof", "Property", ")", "{", "Property", "property", "=", "(", "Property", ")", "reference", ";", "if", "(", "alias", "."...
Collapse a property path expression back to it's qualified form for use as the path attribute of the retrieve. @param reference the <code>Expression</code> to collapse @param alias the alias of the <code>Retrieve</code> in the query. @return The collapsed path operands (or sub-operands) were modified; <code>false</code> otherwise.
[ "Collapse", "a", "property", "path", "expression", "back", "to", "it", "s", "qualified", "form", "for", "use", "as", "the", "path", "attribute", "of", "the", "retrieve", "." ]
train
https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/Cql2ElmVisitor.java#L3058-L3073
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java
DifferentialFunctionFactory.maxPooling2d
public SDVariable maxPooling2d(SDVariable input, Pooling2DConfig pooling2DConfig) { MaxPooling2D maxPooling2D = MaxPooling2D.builder() .input(input) .sameDiff(sameDiff()) .config(pooling2DConfig) .build(); return maxPooling2D.outputVariable(); }
java
public SDVariable maxPooling2d(SDVariable input, Pooling2DConfig pooling2DConfig) { MaxPooling2D maxPooling2D = MaxPooling2D.builder() .input(input) .sameDiff(sameDiff()) .config(pooling2DConfig) .build(); return maxPooling2D.outputVariable(); }
[ "public", "SDVariable", "maxPooling2d", "(", "SDVariable", "input", ",", "Pooling2DConfig", "pooling2DConfig", ")", "{", "MaxPooling2D", "maxPooling2D", "=", "MaxPooling2D", ".", "builder", "(", ")", ".", "input", "(", "input", ")", ".", "sameDiff", "(", "sameDi...
Max pooling 2d operation. @param input the inputs to pooling @param pooling2DConfig the configuration @return
[ "Max", "pooling", "2d", "operation", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L334-L342
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
PdfContentByte.createPattern
public PdfPatternPainter createPattern(float width, float height, float xstep, float ystep, Color color) { checkWriter(); if ( xstep == 0.0f || ystep == 0.0f ) throw new RuntimeException("XStep or YStep can not be ZERO."); PdfPatternPainter painter = new PdfPatternPainter(writer, color); painter.setWidth(width); painter.setHeight(height); painter.setXStep(xstep); painter.setYStep(ystep); writer.addSimplePattern(painter); return painter; }
java
public PdfPatternPainter createPattern(float width, float height, float xstep, float ystep, Color color) { checkWriter(); if ( xstep == 0.0f || ystep == 0.0f ) throw new RuntimeException("XStep or YStep can not be ZERO."); PdfPatternPainter painter = new PdfPatternPainter(writer, color); painter.setWidth(width); painter.setHeight(height); painter.setXStep(xstep); painter.setYStep(ystep); writer.addSimplePattern(painter); return painter; }
[ "public", "PdfPatternPainter", "createPattern", "(", "float", "width", ",", "float", "height", ",", "float", "xstep", ",", "float", "ystep", ",", "Color", "color", ")", "{", "checkWriter", "(", ")", ";", "if", "(", "xstep", "==", "0.0f", "||", "ystep", "...
Create a new uncolored tiling pattern. @param width the width of the pattern @param height the height of the pattern @param xstep the desired horizontal spacing between pattern cells. May be either positive or negative, but not zero. @param ystep the desired vertical spacing between pattern cells. May be either positive or negative, but not zero. @param color the default color. Can be <CODE>null</CODE> @return the <CODE>PdfPatternPainter</CODE> where the pattern will be created
[ "Create", "a", "new", "uncolored", "tiling", "pattern", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L1954-L1965
ecclesia/kipeto
kipeto-core/src/main/java/de/ecclesia/kipeto/repository/WritingRepositoryStrategy.java
WritingRepositoryStrategy.storeStream
public void storeStream(String id, InputStream inputStream, ByteTransferListener listener) throws IOException { Assert.isNotNull(id); Assert.isNotNull(inputStream); CountingInputStream countingInputStream = new CountingInputStream(inputStream); countingInputStream.addByteTransferListener(new ByteTransferListener() { public void handleByteTransfer(ByteTransferEvent event) { bytesWritten += event.getBytesSinceLastEvent(); } }); if (listener != null) { countingInputStream.addByteTransferListener(listener); } store(id, countingInputStream); }
java
public void storeStream(String id, InputStream inputStream, ByteTransferListener listener) throws IOException { Assert.isNotNull(id); Assert.isNotNull(inputStream); CountingInputStream countingInputStream = new CountingInputStream(inputStream); countingInputStream.addByteTransferListener(new ByteTransferListener() { public void handleByteTransfer(ByteTransferEvent event) { bytesWritten += event.getBytesSinceLastEvent(); } }); if (listener != null) { countingInputStream.addByteTransferListener(listener); } store(id, countingInputStream); }
[ "public", "void", "storeStream", "(", "String", "id", ",", "InputStream", "inputStream", ",", "ByteTransferListener", "listener", ")", "throws", "IOException", "{", "Assert", ".", "isNotNull", "(", "id", ")", ";", "Assert", ".", "isNotNull", "(", "inputStream", ...
Speichert den übergebenen InputStream unter der angegebenen Id. Per Definition ist die Id der Hash des InputStreams. Falls unter der angegebenen Id also bereits ein Objekt anderer Länge gepeichert ist, schlägt das Speichern fehl. @param id Id des Objektes, unter der es abgelegt wird @param inputStream des zu speichernden Objektes @throws IOException
[ "Speichert", "den", "übergebenen", "InputStream", "unter", "der", "angegebenen", "Id", ".", "Per", "Definition", "ist", "die", "Id", "der", "Hash", "des", "InputStreams", ".", "Falls", "unter", "der", "angegebenen", "Id", "also", "bereits", "ein", "Objekt", "a...
train
https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto-core/src/main/java/de/ecclesia/kipeto/repository/WritingRepositoryStrategy.java#L51-L68
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EventsRequest.java
EventsRequest.withBatchItem
public EventsRequest withBatchItem(java.util.Map<String, EventsBatch> batchItem) { setBatchItem(batchItem); return this; }
java
public EventsRequest withBatchItem(java.util.Map<String, EventsBatch> batchItem) { setBatchItem(batchItem); return this; }
[ "public", "EventsRequest", "withBatchItem", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "EventsBatch", ">", "batchItem", ")", "{", "setBatchItem", "(", "batchItem", ")", ";", "return", "this", ";", "}" ]
A batch of events to process. Each BatchItem consists of an endpoint ID as the key, and an EventsBatch object as the value. @param batchItem A batch of events to process. Each BatchItem consists of an endpoint ID as the key, and an EventsBatch object as the value. @return Returns a reference to this object so that method calls can be chained together.
[ "A", "batch", "of", "events", "to", "process", ".", "Each", "BatchItem", "consists", "of", "an", "endpoint", "ID", "as", "the", "key", "and", "an", "EventsBatch", "object", "as", "the", "value", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EventsRequest.java#L70-L73
micronaut-projects/micronaut-core
cli/src/main/groovy/io/micronaut/cli/io/support/ResourceUtils.java
ResourceUtils.getFile
public static File getFile(URL resourceUrl, String description) throws FileNotFoundException { if (!URL_PROTOCOL_FILE.equals(resourceUrl.getProtocol())) { throw new FileNotFoundException( description + " cannot be resolved to absolute file path " + "because it does not reside in the file system: " + resourceUrl); } try { return new File(toURI(resourceUrl).getSchemeSpecificPart()); } catch (URISyntaxException ex) { // Fallback for URLs that are not valid URIs (should hardly ever happen). return new File(resourceUrl.getFile()); } }
java
public static File getFile(URL resourceUrl, String description) throws FileNotFoundException { if (!URL_PROTOCOL_FILE.equals(resourceUrl.getProtocol())) { throw new FileNotFoundException( description + " cannot be resolved to absolute file path " + "because it does not reside in the file system: " + resourceUrl); } try { return new File(toURI(resourceUrl).getSchemeSpecificPart()); } catch (URISyntaxException ex) { // Fallback for URLs that are not valid URIs (should hardly ever happen). return new File(resourceUrl.getFile()); } }
[ "public", "static", "File", "getFile", "(", "URL", "resourceUrl", ",", "String", "description", ")", "throws", "FileNotFoundException", "{", "if", "(", "!", "URL_PROTOCOL_FILE", ".", "equals", "(", "resourceUrl", ".", "getProtocol", "(", ")", ")", ")", "{", ...
Resolve the given resource URL to a <code>java.io.File</code>, i.e. to a file in the file system. @param resourceUrl the resource URL to resolve @param description a description of the original resource that the URL was created for (for example, a class path location) @return a corresponding File object @throws java.io.FileNotFoundException if the URL cannot be resolved to a file in the file system
[ "Resolve", "the", "given", "resource", "URL", "to", "a", "<code", ">", "java", ".", "io", ".", "File<", "/", "code", ">", "i", ".", "e", ".", "to", "a", "file", "in", "the", "file", "system", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/cli/src/main/groovy/io/micronaut/cli/io/support/ResourceUtils.java#L208-L220
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/asm/SearchUtils.java
SearchUtils.findLineNumberForInstruction
public static LineNumberNode findLineNumberForInstruction(InsnList insnList, AbstractInsnNode insnNode) { Validate.notNull(insnList); Validate.notNull(insnNode); int idx = insnList.indexOf(insnNode); Validate.isTrue(idx != -1); // Get index of labels and insnNode within method ListIterator<AbstractInsnNode> insnIt = insnList.iterator(idx); while (insnIt.hasPrevious()) { AbstractInsnNode node = insnIt.previous(); if (node instanceof LineNumberNode) { return (LineNumberNode) node; } } return null; }
java
public static LineNumberNode findLineNumberForInstruction(InsnList insnList, AbstractInsnNode insnNode) { Validate.notNull(insnList); Validate.notNull(insnNode); int idx = insnList.indexOf(insnNode); Validate.isTrue(idx != -1); // Get index of labels and insnNode within method ListIterator<AbstractInsnNode> insnIt = insnList.iterator(idx); while (insnIt.hasPrevious()) { AbstractInsnNode node = insnIt.previous(); if (node instanceof LineNumberNode) { return (LineNumberNode) node; } } return null; }
[ "public", "static", "LineNumberNode", "findLineNumberForInstruction", "(", "InsnList", "insnList", ",", "AbstractInsnNode", "insnNode", ")", "{", "Validate", ".", "notNull", "(", "insnList", ")", ";", "Validate", ".", "notNull", "(", "insnNode", ")", ";", "int", ...
Find line number associated with an instruction. @param insnList instruction list for method @param insnNode instruction within method being searched against @throws NullPointerException if any argument is {@code null} or contains {@code null} @throws IllegalArgumentException if arguments aren't all from the same method @return line number node associated with the instruction, or {@code null} if no line number exists
[ "Find", "line", "number", "associated", "with", "an", "instruction", "." ]
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/asm/SearchUtils.java#L394-L412
pravega/pravega
common/src/main/java/io/pravega/common/function/Callbacks.java
Callbacks.invokeSafely
public static <T> void invokeSafely(Consumer<T> consumer, T argument, Consumer<Throwable> failureHandler) { Preconditions.checkNotNull(consumer, "consumer"); try { consumer.accept(argument); } catch (Exception ex) { if (failureHandler != null) { invokeSafely(failureHandler, ex, null); } } }
java
public static <T> void invokeSafely(Consumer<T> consumer, T argument, Consumer<Throwable> failureHandler) { Preconditions.checkNotNull(consumer, "consumer"); try { consumer.accept(argument); } catch (Exception ex) { if (failureHandler != null) { invokeSafely(failureHandler, ex, null); } } }
[ "public", "static", "<", "T", ">", "void", "invokeSafely", "(", "Consumer", "<", "T", ">", "consumer", ",", "T", "argument", ",", "Consumer", "<", "Throwable", ">", "failureHandler", ")", "{", "Preconditions", ".", "checkNotNull", "(", "consumer", ",", "\"...
Invokes the given Consumer with the given argument, and catches any exceptions that it may throw. @param consumer The consumer to invoke. @param argument The argument to pass to the consumer. @param failureHandler An optional callback to invoke if the consumer threw any exceptions. @param <T> The type of the argument. @throws NullPointerException If the consumer is null.
[ "Invokes", "the", "given", "Consumer", "with", "the", "given", "argument", "and", "catches", "any", "exceptions", "that", "it", "may", "throw", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/function/Callbacks.java#L50-L60
deeplearning4j/deeplearning4j
datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/CropImageTransform.java
CropImageTransform.doTransform
@Override protected ImageWritable doTransform(ImageWritable image, Random random) { if (image == null) { return null; } Mat mat = converter.convert(image.getFrame()); int top = random != null ? random.nextInt(cropTop + 1) : cropTop; int left = random != null ? random.nextInt(cropLeft + 1) : cropLeft; int bottom = random != null ? random.nextInt(cropBottom + 1) : cropBottom; int right = random != null ? random.nextInt(cropRight + 1) : cropRight; y = Math.min(top, mat.rows() - 1); x = Math.min(left, mat.cols() - 1); int h = Math.max(1, mat.rows() - bottom - y); int w = Math.max(1, mat.cols() - right - x); Mat result = mat.apply(new Rect(x, y, w, h)); return new ImageWritable(converter.convert(result)); }
java
@Override protected ImageWritable doTransform(ImageWritable image, Random random) { if (image == null) { return null; } Mat mat = converter.convert(image.getFrame()); int top = random != null ? random.nextInt(cropTop + 1) : cropTop; int left = random != null ? random.nextInt(cropLeft + 1) : cropLeft; int bottom = random != null ? random.nextInt(cropBottom + 1) : cropBottom; int right = random != null ? random.nextInt(cropRight + 1) : cropRight; y = Math.min(top, mat.rows() - 1); x = Math.min(left, mat.cols() - 1); int h = Math.max(1, mat.rows() - bottom - y); int w = Math.max(1, mat.cols() - right - x); Mat result = mat.apply(new Rect(x, y, w, h)); return new ImageWritable(converter.convert(result)); }
[ "@", "Override", "protected", "ImageWritable", "doTransform", "(", "ImageWritable", "image", ",", "Random", "random", ")", "{", "if", "(", "image", "==", "null", ")", "{", "return", "null", ";", "}", "Mat", "mat", "=", "converter", ".", "convert", "(", "...
Takes an image and returns a transformed image. Uses the random object in the case of random transformations. @param image to transform, null == end of stream @param random object to use (or null for deterministic) @return transformed image
[ "Takes", "an", "image", "and", "returns", "a", "transformed", "image", ".", "Uses", "the", "random", "object", "in", "the", "case", "of", "random", "transformations", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/CropImageTransform.java#L89-L107
undertow-io/undertow
core/src/main/java/io/undertow/server/Connectors.java
Connectors.ungetRequestBytes
public static void ungetRequestBytes(final HttpServerExchange exchange, PooledByteBuffer... buffers) { PooledByteBuffer[] existing = exchange.getAttachment(HttpServerExchange.BUFFERED_REQUEST_DATA); PooledByteBuffer[] newArray; if (existing == null) { newArray = new PooledByteBuffer[buffers.length]; System.arraycopy(buffers, 0, newArray, 0, buffers.length); } else { newArray = new PooledByteBuffer[existing.length + buffers.length]; System.arraycopy(existing, 0, newArray, 0, existing.length); System.arraycopy(buffers, 0, newArray, existing.length, buffers.length); } exchange.putAttachment(HttpServerExchange.BUFFERED_REQUEST_DATA, newArray); //todo: force some kind of wakeup? exchange.addExchangeCompleteListener(BufferedRequestDataCleanupListener.INSTANCE); }
java
public static void ungetRequestBytes(final HttpServerExchange exchange, PooledByteBuffer... buffers) { PooledByteBuffer[] existing = exchange.getAttachment(HttpServerExchange.BUFFERED_REQUEST_DATA); PooledByteBuffer[] newArray; if (existing == null) { newArray = new PooledByteBuffer[buffers.length]; System.arraycopy(buffers, 0, newArray, 0, buffers.length); } else { newArray = new PooledByteBuffer[existing.length + buffers.length]; System.arraycopy(existing, 0, newArray, 0, existing.length); System.arraycopy(buffers, 0, newArray, existing.length, buffers.length); } exchange.putAttachment(HttpServerExchange.BUFFERED_REQUEST_DATA, newArray); //todo: force some kind of wakeup? exchange.addExchangeCompleteListener(BufferedRequestDataCleanupListener.INSTANCE); }
[ "public", "static", "void", "ungetRequestBytes", "(", "final", "HttpServerExchange", "exchange", ",", "PooledByteBuffer", "...", "buffers", ")", "{", "PooledByteBuffer", "[", "]", "existing", "=", "exchange", ".", "getAttachment", "(", "HttpServerExchange", ".", "BU...
Attached buffered data to the exchange. The will generally be used to allow data to be re-read. @param exchange The HTTP server exchange @param buffers The buffers to attach
[ "Attached", "buffered", "data", "to", "the", "exchange", ".", "The", "will", "generally", "be", "used", "to", "allow", "data", "to", "be", "re", "-", "read", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/Connectors.java#L110-L123
alibaba/ARouter
arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/TypeUtils.java
TypeUtils.typeExchange
public int typeExchange(Element element) { TypeMirror typeMirror = element.asType(); // Primitive if (typeMirror.getKind().isPrimitive()) { return element.asType().getKind().ordinal(); } switch (typeMirror.toString()) { case BYTE: return TypeKind.BYTE.ordinal(); case SHORT: return TypeKind.SHORT.ordinal(); case INTEGER: return TypeKind.INT.ordinal(); case LONG: return TypeKind.LONG.ordinal(); case FLOAT: return TypeKind.FLOAT.ordinal(); case DOUBEL: return TypeKind.DOUBLE.ordinal(); case BOOLEAN: return TypeKind.BOOLEAN.ordinal(); case CHAR: return TypeKind.CHAR.ordinal(); case STRING: return TypeKind.STRING.ordinal(); default: // Other side, maybe the PARCELABLE or SERIALIZABLE or OBJECT. if (types.isSubtype(typeMirror, parcelableType)) { // PARCELABLE return TypeKind.PARCELABLE.ordinal(); } else if (types.isSubtype(typeMirror, serializableType)) { // SERIALIZABLE return TypeKind.SERIALIZABLE.ordinal(); } else { return TypeKind.OBJECT.ordinal(); } } }
java
public int typeExchange(Element element) { TypeMirror typeMirror = element.asType(); // Primitive if (typeMirror.getKind().isPrimitive()) { return element.asType().getKind().ordinal(); } switch (typeMirror.toString()) { case BYTE: return TypeKind.BYTE.ordinal(); case SHORT: return TypeKind.SHORT.ordinal(); case INTEGER: return TypeKind.INT.ordinal(); case LONG: return TypeKind.LONG.ordinal(); case FLOAT: return TypeKind.FLOAT.ordinal(); case DOUBEL: return TypeKind.DOUBLE.ordinal(); case BOOLEAN: return TypeKind.BOOLEAN.ordinal(); case CHAR: return TypeKind.CHAR.ordinal(); case STRING: return TypeKind.STRING.ordinal(); default: // Other side, maybe the PARCELABLE or SERIALIZABLE or OBJECT. if (types.isSubtype(typeMirror, parcelableType)) { // PARCELABLE return TypeKind.PARCELABLE.ordinal(); } else if (types.isSubtype(typeMirror, serializableType)) { // SERIALIZABLE return TypeKind.SERIALIZABLE.ordinal(); } else { return TypeKind.OBJECT.ordinal(); } } }
[ "public", "int", "typeExchange", "(", "Element", "element", ")", "{", "TypeMirror", "typeMirror", "=", "element", ".", "asType", "(", ")", ";", "// Primitive", "if", "(", "typeMirror", ".", "getKind", "(", ")", ".", "isPrimitive", "(", ")", ")", "{", "re...
Diagnostics out the true java type @param element Raw type @return Type class of java
[ "Diagnostics", "out", "the", "true", "java", "type" ]
train
https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/TypeUtils.java#L48-L87
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java
LabAccountsInner.getRegionalAvailability
public GetRegionalAvailabilityResponseInner getRegionalAvailability(String resourceGroupName, String labAccountName) { return getRegionalAvailabilityWithServiceResponseAsync(resourceGroupName, labAccountName).toBlocking().single().body(); }
java
public GetRegionalAvailabilityResponseInner getRegionalAvailability(String resourceGroupName, String labAccountName) { return getRegionalAvailabilityWithServiceResponseAsync(resourceGroupName, labAccountName).toBlocking().single().body(); }
[ "public", "GetRegionalAvailabilityResponseInner", "getRegionalAvailability", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ")", "{", "return", "getRegionalAvailabilityWithServiceResponseAsync", "(", "resourceGroupName", ",", "labAccountName", ")", ".", "t...
Get regional availability information for each size category configured under a lab account. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the GetRegionalAvailabilityResponseInner object if successful.
[ "Get", "regional", "availability", "information", "for", "each", "size", "category", "configured", "under", "a", "lab", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java#L1211-L1213
aws/aws-sdk-java
aws-java-sdk-logs/src/main/java/com/amazonaws/services/logs/model/TagLogGroupRequest.java
TagLogGroupRequest.withTags
public TagLogGroupRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public TagLogGroupRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "TagLogGroupRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The key-value pairs to use for the tags. </p> @param tags The key-value pairs to use for the tags. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "key", "-", "value", "pairs", "to", "use", "for", "the", "tags", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-logs/src/main/java/com/amazonaws/services/logs/model/TagLogGroupRequest.java#L119-L122
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java
TypeAnnotationPosition.constructorInvocationTypeArg
public static TypeAnnotationPosition constructorInvocationTypeArg(final List<TypePathEntry> location, final int type_index) { return constructorInvocationTypeArg(location, null, type_index, -1); }
java
public static TypeAnnotationPosition constructorInvocationTypeArg(final List<TypePathEntry> location, final int type_index) { return constructorInvocationTypeArg(location, null, type_index, -1); }
[ "public", "static", "TypeAnnotationPosition", "constructorInvocationTypeArg", "(", "final", "List", "<", "TypePathEntry", ">", "location", ",", "final", "int", "type_index", ")", "{", "return", "constructorInvocationTypeArg", "(", "location", ",", "null", ",", "type_i...
Create a {@code TypeAnnotationPosition} for a constructor invocation type argument. @param location The type path. @param type_index The index of the type argument.
[ "Create", "a", "{", "@code", "TypeAnnotationPosition", "}", "for", "a", "constructor", "invocation", "type", "argument", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java#L944-L948
EdwardRaff/JSAT
JSAT/src/jsat/distributions/discrete/Zipf.java
Zipf.setSkew
public void setSkew(double skew) { if(skew <= 0 || Double.isNaN(skew) || Double.isInfinite(skew)) throw new IllegalArgumentException("Skew must be a positive value, not " + skew); this.skew = skew; fixCache(); }
java
public void setSkew(double skew) { if(skew <= 0 || Double.isNaN(skew) || Double.isInfinite(skew)) throw new IllegalArgumentException("Skew must be a positive value, not " + skew); this.skew = skew; fixCache(); }
[ "public", "void", "setSkew", "(", "double", "skew", ")", "{", "if", "(", "skew", "<=", "0", "||", "Double", ".", "isNaN", "(", "skew", ")", "||", "Double", ".", "isInfinite", "(", "skew", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Sk...
Sets the skewness of the distribution. Lower values spread out the probability distribution, while higher values concentrate on the lowest ranks. @param skew the positive value for the distribution's skew
[ "Sets", "the", "skewness", "of", "the", "distribution", ".", "Lower", "values", "spread", "out", "the", "probability", "distribution", "while", "higher", "values", "concentrate", "on", "the", "lowest", "ranks", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/discrete/Zipf.java#L111-L117
UrielCh/ovh-java-sdk
ovh-java-sdk-saascsp2/src/main/java/net/minidev/ovh/api/ApiOvhSaascsp2.java
ApiOvhSaascsp2.serviceName_changeAdministratorPassword_POST
public OvhOfficeTask serviceName_changeAdministratorPassword_POST(String serviceName, String newPassword) throws IOException { String qPath = "/saas/csp2/{serviceName}/changeAdministratorPassword"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "newPassword", newPassword); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOfficeTask.class); }
java
public OvhOfficeTask serviceName_changeAdministratorPassword_POST(String serviceName, String newPassword) throws IOException { String qPath = "/saas/csp2/{serviceName}/changeAdministratorPassword"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "newPassword", newPassword); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOfficeTask.class); }
[ "public", "OvhOfficeTask", "serviceName_changeAdministratorPassword_POST", "(", "String", "serviceName", ",", "String", "newPassword", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/saas/csp2/{serviceName}/changeAdministratorPassword\"", ";", "StringBuilder", "s...
Changes the tenant administrator's password REST: POST /saas/csp2/{serviceName}/changeAdministratorPassword @param newPassword [required] New password for the tenant administrator @param serviceName [required] The unique identifier of your Office service API beta
[ "Changes", "the", "tenant", "administrator", "s", "password" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-saascsp2/src/main/java/net/minidev/ovh/api/ApiOvhSaascsp2.java#L254-L261
rhuss/jolokia
agent/core/src/main/java/org/jolokia/util/IoUtil.java
IoUtil.streamResponseAndClose
public static void streamResponseAndClose(Writer pWriter, JSONStreamAware pJson, String callback) throws IOException { try { if (callback == null) { pJson.writeJSONString(pWriter); } else { pWriter.write(callback); pWriter.write("("); pJson.writeJSONString(pWriter); pWriter.write(");"); } // Writer end marker for chunked responses pWriter.write(STREAM_END_MARKER); } finally { // Flush and close, even on an exception to avoid locks in the thread pWriter.flush(); pWriter.close(); } }
java
public static void streamResponseAndClose(Writer pWriter, JSONStreamAware pJson, String callback) throws IOException { try { if (callback == null) { pJson.writeJSONString(pWriter); } else { pWriter.write(callback); pWriter.write("("); pJson.writeJSONString(pWriter); pWriter.write(");"); } // Writer end marker for chunked responses pWriter.write(STREAM_END_MARKER); } finally { // Flush and close, even on an exception to avoid locks in the thread pWriter.flush(); pWriter.close(); } }
[ "public", "static", "void", "streamResponseAndClose", "(", "Writer", "pWriter", ",", "JSONStreamAware", "pJson", ",", "String", "callback", ")", "throws", "IOException", "{", "try", "{", "if", "(", "callback", "==", "null", ")", "{", "pJson", ".", "writeJSONSt...
Stream a JSON stream to a given writer, potentiall wrap it in a callback for a JSONP response and then flush & close the writer. The writer is closed in any case, also when an exception occurs @param pWriter writer to write to. Must be not null. @param pJson JSON response to stream @param callback the name of the callback function if JSONP should be used or <code>null</code> if the answer should be streamed directly @throws IOException if the streaming fails
[ "Stream", "a", "JSON", "stream", "to", "a", "given", "writer", "potentiall", "wrap", "it", "in", "a", "callback", "for", "a", "JSONP", "response", "and", "then", "flush", "&", "close", "the", "writer", ".", "The", "writer", "is", "closed", "in", "any", ...
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/util/IoUtil.java#L30-L48
azkaban/azkaban
azkaban-common/src/main/java/azkaban/executor/ExecutorManager.java
ExecutorManager.cancelFlow
@Override public void cancelFlow(final ExecutableFlow exFlow, final String userId) throws ExecutorManagerException { synchronized (exFlow) { if (this.runningExecutions.get().containsKey(exFlow.getExecutionId())) { final Pair<ExecutionReference, ExecutableFlow> pair = this.runningExecutions.get().get(exFlow.getExecutionId()); this.apiGateway.callWithReferenceByUser(pair.getFirst(), ConnectorParams.CANCEL_ACTION, userId); } else if (this.queuedFlows.hasExecution(exFlow.getExecutionId())) { this.queuedFlows.dequeue(exFlow.getExecutionId()); this.executionFinalizer .finalizeFlow(exFlow, "Cancelled before dispatching to executor", null); } else { throw new ExecutorManagerException("Execution " + exFlow.getExecutionId() + " of flow " + exFlow.getFlowId() + " isn't running."); } } }
java
@Override public void cancelFlow(final ExecutableFlow exFlow, final String userId) throws ExecutorManagerException { synchronized (exFlow) { if (this.runningExecutions.get().containsKey(exFlow.getExecutionId())) { final Pair<ExecutionReference, ExecutableFlow> pair = this.runningExecutions.get().get(exFlow.getExecutionId()); this.apiGateway.callWithReferenceByUser(pair.getFirst(), ConnectorParams.CANCEL_ACTION, userId); } else if (this.queuedFlows.hasExecution(exFlow.getExecutionId())) { this.queuedFlows.dequeue(exFlow.getExecutionId()); this.executionFinalizer .finalizeFlow(exFlow, "Cancelled before dispatching to executor", null); } else { throw new ExecutorManagerException("Execution " + exFlow.getExecutionId() + " of flow " + exFlow.getFlowId() + " isn't running."); } } }
[ "@", "Override", "public", "void", "cancelFlow", "(", "final", "ExecutableFlow", "exFlow", ",", "final", "String", "userId", ")", "throws", "ExecutorManagerException", "{", "synchronized", "(", "exFlow", ")", "{", "if", "(", "this", ".", "runningExecutions", "."...
if flows was dispatched to an executor, cancel by calling Executor else if flow is still in queue, remove from queue and finalize {@inheritDoc} @see azkaban.executor.ExecutorManagerAdapter#cancelFlow(azkaban.executor.ExecutableFlow, java.lang.String)
[ "if", "flows", "was", "dispatched", "to", "an", "executor", "cancel", "by", "calling", "Executor", "else", "if", "flow", "is", "still", "in", "queue", "remove", "from", "queue", "and", "finalize", "{", "@inheritDoc", "}" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/executor/ExecutorManager.java#L825-L844
line/centraldogma
client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java
CentralDogmaEndpointGroup.of
public static <T> CentralDogmaEndpointGroup<T> of(CentralDogma centralDogma, String projectName, String repositoryName, Query<T> query, EndpointListDecoder<T> endpointListDecoder) { return ofWatcher(centralDogma.fileWatcher(projectName, repositoryName, query), endpointListDecoder); }
java
public static <T> CentralDogmaEndpointGroup<T> of(CentralDogma centralDogma, String projectName, String repositoryName, Query<T> query, EndpointListDecoder<T> endpointListDecoder) { return ofWatcher(centralDogma.fileWatcher(projectName, repositoryName, query), endpointListDecoder); }
[ "public", "static", "<", "T", ">", "CentralDogmaEndpointGroup", "<", "T", ">", "of", "(", "CentralDogma", "centralDogma", ",", "String", "projectName", ",", "String", "repositoryName", ",", "Query", "<", "T", ">", "query", ",", "EndpointListDecoder", "<", "T",...
Creates a new {@link CentralDogmaEndpointGroup}. @param centralDogma a {@link CentralDogma} @param projectName a Central Dogma project name @param repositoryName a Central Dogma repository name @param query a {@link Query} to route file @param endpointListDecoder an {@link EndpointListDecoder}
[ "Creates", "a", "new", "{", "@link", "CentralDogmaEndpointGroup", "}", "." ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java#L84-L89
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaInvocationHandler.java
AkkaInvocationHandler.invokeRpc
private Object invokeRpc(Method method, Object[] args) throws Exception { String methodName = method.getName(); Class<?>[] parameterTypes = method.getParameterTypes(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); Time futureTimeout = extractRpcTimeout(parameterAnnotations, args, timeout); final RpcInvocation rpcInvocation = createRpcInvocationMessage(methodName, parameterTypes, args); Class<?> returnType = method.getReturnType(); final Object result; if (Objects.equals(returnType, Void.TYPE)) { tell(rpcInvocation); result = null; } else { // execute an asynchronous call CompletableFuture<?> resultFuture = ask(rpcInvocation, futureTimeout); CompletableFuture<?> completableFuture = resultFuture.thenApply((Object o) -> { if (o instanceof SerializedValue) { try { return ((SerializedValue<?>) o).deserializeValue(getClass().getClassLoader()); } catch (IOException | ClassNotFoundException e) { throw new CompletionException( new RpcException("Could not deserialize the serialized payload of RPC method : " + methodName, e)); } } else { return o; } }); if (Objects.equals(returnType, CompletableFuture.class)) { result = completableFuture; } else { try { result = completableFuture.get(futureTimeout.getSize(), futureTimeout.getUnit()); } catch (ExecutionException ee) { throw new RpcException("Failure while obtaining synchronous RPC result.", ExceptionUtils.stripExecutionException(ee)); } } } return result; }
java
private Object invokeRpc(Method method, Object[] args) throws Exception { String methodName = method.getName(); Class<?>[] parameterTypes = method.getParameterTypes(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); Time futureTimeout = extractRpcTimeout(parameterAnnotations, args, timeout); final RpcInvocation rpcInvocation = createRpcInvocationMessage(methodName, parameterTypes, args); Class<?> returnType = method.getReturnType(); final Object result; if (Objects.equals(returnType, Void.TYPE)) { tell(rpcInvocation); result = null; } else { // execute an asynchronous call CompletableFuture<?> resultFuture = ask(rpcInvocation, futureTimeout); CompletableFuture<?> completableFuture = resultFuture.thenApply((Object o) -> { if (o instanceof SerializedValue) { try { return ((SerializedValue<?>) o).deserializeValue(getClass().getClassLoader()); } catch (IOException | ClassNotFoundException e) { throw new CompletionException( new RpcException("Could not deserialize the serialized payload of RPC method : " + methodName, e)); } } else { return o; } }); if (Objects.equals(returnType, CompletableFuture.class)) { result = completableFuture; } else { try { result = completableFuture.get(futureTimeout.getSize(), futureTimeout.getUnit()); } catch (ExecutionException ee) { throw new RpcException("Failure while obtaining synchronous RPC result.", ExceptionUtils.stripExecutionException(ee)); } } } return result; }
[ "private", "Object", "invokeRpc", "(", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "Exception", "{", "String", "methodName", "=", "method", ".", "getName", "(", ")", ";", "Class", "<", "?", ">", "[", "]", "parameterTypes", "=", ...
Invokes a RPC method by sending the RPC invocation details to the rpc endpoint. @param method to call @param args of the method call @return result of the RPC @throws Exception if the RPC invocation fails
[ "Invokes", "a", "RPC", "method", "by", "sending", "the", "RPC", "invocation", "details", "to", "the", "rpc", "endpoint", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaInvocationHandler.java#L194-L240
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.setDateExpired
public void setDateExpired(CmsResource resource, long dateExpired, boolean recursive) throws CmsException { getResourceType(resource).setDateExpired(this, m_securityManager, resource, dateExpired, recursive); }
java
public void setDateExpired(CmsResource resource, long dateExpired, boolean recursive) throws CmsException { getResourceType(resource).setDateExpired(this, m_securityManager, resource, dateExpired, recursive); }
[ "public", "void", "setDateExpired", "(", "CmsResource", "resource", ",", "long", "dateExpired", ",", "boolean", "recursive", ")", "throws", "CmsException", "{", "getResourceType", "(", "resource", ")", ".", "setDateExpired", "(", "this", ",", "m_securityManager", ...
Changes the "expire" date of a resource.<p> @param resource the resource to change @param dateExpired the new expire date of the changed resource @param recursive if this operation is to be applied recursively to all resources in a folder @throws CmsException if something goes wrong
[ "Changes", "the", "expire", "date", "of", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3753-L3756
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/File.java
File.setReadable
public boolean setReadable(boolean readable, boolean ownerOnly) { return doChmod(ownerOnly ? S_IRUSR : (S_IRUSR | S_IRGRP | S_IROTH), readable); }
java
public boolean setReadable(boolean readable, boolean ownerOnly) { return doChmod(ownerOnly ? S_IRUSR : (S_IRUSR | S_IRGRP | S_IROTH), readable); }
[ "public", "boolean", "setReadable", "(", "boolean", "readable", ",", "boolean", "ownerOnly", ")", "{", "return", "doChmod", "(", "ownerOnly", "?", "S_IRUSR", ":", "(", "S_IRUSR", "|", "S_IRGRP", "|", "S_IROTH", ")", ",", "readable", ")", ";", "}" ]
Manipulates the read permissions for the abstract path designated by this file. @param readable To allow read permission if true, otherwise disallow @param ownerOnly To manipulate read permission only for owner if true, otherwise for everyone. The manipulation will apply to everyone regardless of this value if the underlying system does not distinguish owner and other users. @return true if and only if the operation succeeded. If the user does not have permission to change the access permissions of this abstract pathname the operation will fail. If the underlying file system does not support read permission and the value of readable is false, this operation will fail. @since 1.6
[ "Manipulates", "the", "read", "permissions", "for", "the", "abstract", "path", "designated", "by", "this", "file", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/File.java#L726-L728
HeidelTime/heideltime
src/de/unihd/dbs/uima/annotator/heideltime/utilities/DateCalculator.java
DateCalculator.getXNextDay
public static String getXNextDay(String date, Integer x) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); String newDate = ""; Calendar c = Calendar.getInstance(); try { c.setTime(formatter.parse(date)); c.add(Calendar.DAY_OF_MONTH, x); c.getTime(); newDate = formatter.format(c.getTime()); } catch (ParseException e) { e.printStackTrace(); } return newDate; }
java
public static String getXNextDay(String date, Integer x) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); String newDate = ""; Calendar c = Calendar.getInstance(); try { c.setTime(formatter.parse(date)); c.add(Calendar.DAY_OF_MONTH, x); c.getTime(); newDate = formatter.format(c.getTime()); } catch (ParseException e) { e.printStackTrace(); } return newDate; }
[ "public", "static", "String", "getXNextDay", "(", "String", "date", ",", "Integer", "x", ")", "{", "SimpleDateFormat", "formatter", "=", "new", "SimpleDateFormat", "(", "\"yyyy-MM-dd\"", ")", ";", "String", "newDate", "=", "\"\"", ";", "Calendar", "c", "=", ...
get the x-next day of date. @param date given date to get new date from @param x type of temporal event to search for @return
[ "get", "the", "x", "-", "next", "day", "of", "date", "." ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/de/unihd/dbs/uima/annotator/heideltime/utilities/DateCalculator.java#L149-L162
m-m-m/util
scanner/src/main/java/net/sf/mmm/util/scanner/base/CharSequenceScanner.java
CharSequenceScanner.getOriginalString
public String getOriginalString() { if (this.string != null) { this.string = new String(this.buffer, this.initialOffset, getLength()); } return this.string; }
java
public String getOriginalString() { if (this.string != null) { this.string = new String(this.buffer, this.initialOffset, getLength()); } return this.string; }
[ "public", "String", "getOriginalString", "(", ")", "{", "if", "(", "this", ".", "string", "!=", "null", ")", "{", "this", ".", "string", "=", "new", "String", "(", "this", ".", "buffer", ",", "this", ".", "initialOffset", ",", "getLength", "(", ")", ...
This method gets the original string to parse. @see CharSequenceScanner#CharSequenceScanner(String) @return the original string.
[ "This", "method", "gets", "the", "original", "string", "to", "parse", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/scanner/src/main/java/net/sf/mmm/util/scanner/base/CharSequenceScanner.java#L391-L397
threerings/nenya
core/src/main/java/com/threerings/media/sprite/Sprite.java
Sprite.cancelMove
public void cancelMove () { if (_path != null) { Path oldpath = _path; _path = null; oldpath.wasRemoved(this); if (_observers != null) { _observers.apply(new CancelledOp(this, oldpath)); } } }
java
public void cancelMove () { if (_path != null) { Path oldpath = _path; _path = null; oldpath.wasRemoved(this); if (_observers != null) { _observers.apply(new CancelledOp(this, oldpath)); } } }
[ "public", "void", "cancelMove", "(", ")", "{", "if", "(", "_path", "!=", "null", ")", "{", "Path", "oldpath", "=", "_path", ";", "_path", "=", "null", ";", "oldpath", ".", "wasRemoved", "(", "this", ")", ";", "if", "(", "_observers", "!=", "null", ...
Cancels any path that the sprite may currently be moving along.
[ "Cancels", "any", "path", "that", "the", "sprite", "may", "currently", "be", "moving", "along", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sprite/Sprite.java#L240-L250
vinta/pangu.java
src/main/java/ws/vinta/pangu/Pangu.java
Pangu.spacingFile
public void spacingFile(File inputFile, File outputFile) throws IOException { // TODO: support charset FileReader fr = new FileReader(inputFile); BufferedReader br = new BufferedReader(fr); outputFile.getParentFile().mkdirs(); FileWriter fw = new FileWriter(outputFile, false); BufferedWriter bw = new BufferedWriter(fw); try { String line = br.readLine(); // readLine() do not contain newline char while (line != null) { line = spacingText(line); // TODO: keep file's raw newline char from difference OS platform bw.write(line); bw.newLine(); line = br.readLine(); } } finally { br.close(); // 避免 writer 沒有實際操作就 close(),產生一個空檔案 if (bw != null) { bw.close(); } } }
java
public void spacingFile(File inputFile, File outputFile) throws IOException { // TODO: support charset FileReader fr = new FileReader(inputFile); BufferedReader br = new BufferedReader(fr); outputFile.getParentFile().mkdirs(); FileWriter fw = new FileWriter(outputFile, false); BufferedWriter bw = new BufferedWriter(fw); try { String line = br.readLine(); // readLine() do not contain newline char while (line != null) { line = spacingText(line); // TODO: keep file's raw newline char from difference OS platform bw.write(line); bw.newLine(); line = br.readLine(); } } finally { br.close(); // 避免 writer 沒有實際操作就 close(),產生一個空檔案 if (bw != null) { bw.close(); } } }
[ "public", "void", "spacingFile", "(", "File", "inputFile", ",", "File", "outputFile", ")", "throws", "IOException", "{", "// TODO: support charset", "FileReader", "fr", "=", "new", "FileReader", "(", "inputFile", ")", ";", "BufferedReader", "br", "=", "new", "Bu...
Performs a paranoid text spacing on {@code inputFile} and generate a new file {@code outputFile}. @param inputFile an existing file to process, must not be {@code null}. @param outputFile the processed file, must not be {@code null}. @throws IOException if an error occurs. @since 1.1.0
[ "Performs", "a", "paranoid", "text", "spacing", "on", "{", "@code", "inputFile", "}", "and", "generate", "a", "new", "file", "{", "@code", "outputFile", "}", "." ]
train
https://github.com/vinta/pangu.java/blob/a81ce9c0cfd5122a3d4234b95c250fd57afd7f34/src/main/java/ws/vinta/pangu/Pangu.java#L143-L174
vsima/uber-java-client
src/main/java/com/victorsima/uber/Utils.java
Utils.generateAuthorizeUrl
public static String generateAuthorizeUrl(String oAuthUri, String clientId, String[] scope){ StringBuilder sb = new StringBuilder(oAuthUri); sb.append("/oauth/authorize?response_type=code"); sb.append("&client_id=" + clientId); if (scope != null) { sb.append("&scope="); for (int i = 0; i < scope.length; i++) { if (i > 0) { sb.append("%20"); } sb.append(scope[i]); } } return sb.toString(); }
java
public static String generateAuthorizeUrl(String oAuthUri, String clientId, String[] scope){ StringBuilder sb = new StringBuilder(oAuthUri); sb.append("/oauth/authorize?response_type=code"); sb.append("&client_id=" + clientId); if (scope != null) { sb.append("&scope="); for (int i = 0; i < scope.length; i++) { if (i > 0) { sb.append("%20"); } sb.append(scope[i]); } } return sb.toString(); }
[ "public", "static", "String", "generateAuthorizeUrl", "(", "String", "oAuthUri", ",", "String", "clientId", ",", "String", "[", "]", "scope", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "oAuthUri", ")", ";", "sb", ".", "append", "(", ...
Generates the initial url for the OAuth authorization flow @return oauth authorize url
[ "Generates", "the", "initial", "url", "for", "the", "OAuth", "authorization", "flow" ]
train
https://github.com/vsima/uber-java-client/blob/7cb081728db6286d949024c1b4c85dd74d275472/src/main/java/com/victorsima/uber/Utils.java#L40-L54
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java
ReviewsImpl.addVideoTranscriptModerationResultAsync
public Observable<Void> addVideoTranscriptModerationResultAsync(String teamName, String reviewId, String contentType, List<TranscriptModerationBodyItem> transcriptModerationBody) { return addVideoTranscriptModerationResultWithServiceResponseAsync(teamName, reviewId, contentType, transcriptModerationBody).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> addVideoTranscriptModerationResultAsync(String teamName, String reviewId, String contentType, List<TranscriptModerationBodyItem> transcriptModerationBody) { return addVideoTranscriptModerationResultWithServiceResponseAsync(teamName, reviewId, contentType, transcriptModerationBody).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "addVideoTranscriptModerationResultAsync", "(", "String", "teamName", ",", "String", "reviewId", ",", "String", "contentType", ",", "List", "<", "TranscriptModerationBodyItem", ">", "transcriptModerationBody", ")", "{", "return"...
This API adds a transcript screen text result file for a video review. Transcript screen text result file is a result of Screen Text API . In order to generate transcript screen text result file , a transcript file has to be screened for profanity using Screen Text API. @param teamName Your team name. @param reviewId Id of the review. @param contentType The content type. @param transcriptModerationBody Body for add video transcript moderation result API @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "This", "API", "adds", "a", "transcript", "screen", "text", "result", "file", "for", "a", "video", "review", ".", "Transcript", "screen", "text", "result", "file", "is", "a", "result", "of", "Screen", "Text", "API", ".", "In", "order", "to", "generate", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L1724-L1731
dvasilen/Hive-XML-SerDe
src/main/java/com/ibm/spss/hive/serde2/xml/processor/XmlUtils.java
XmlUtils.getPrimitiveValue
public static Object getPrimitiveValue(String value, PrimitiveCategory primitiveCategory) { if (value != null) { try { switch (primitiveCategory) { case BOOLEAN: return Boolean.valueOf(value); case BYTE: return Byte.valueOf(value); case DOUBLE: return Double.valueOf(value); case FLOAT: return Float.valueOf(value); case INT: return Integer.valueOf(value); case LONG: return Long.valueOf(value); case SHORT: return Short.valueOf(value); case STRING: return value; default: throw new IllegalStateException(primitiveCategory.toString()); } } catch (Exception ignored) { } } return null; }
java
public static Object getPrimitiveValue(String value, PrimitiveCategory primitiveCategory) { if (value != null) { try { switch (primitiveCategory) { case BOOLEAN: return Boolean.valueOf(value); case BYTE: return Byte.valueOf(value); case DOUBLE: return Double.valueOf(value); case FLOAT: return Float.valueOf(value); case INT: return Integer.valueOf(value); case LONG: return Long.valueOf(value); case SHORT: return Short.valueOf(value); case STRING: return value; default: throw new IllegalStateException(primitiveCategory.toString()); } } catch (Exception ignored) { } } return null; }
[ "public", "static", "Object", "getPrimitiveValue", "(", "String", "value", ",", "PrimitiveCategory", "primitiveCategory", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "try", "{", "switch", "(", "primitiveCategory", ")", "{", "case", "BOOLEAN", ":", ...
Converts the string value to the java object for the given primitive category @param value the value @param primitiveCategory the primitive category @return the java object
[ "Converts", "the", "string", "value", "to", "the", "java", "object", "for", "the", "given", "primitive", "category" ]
train
https://github.com/dvasilen/Hive-XML-SerDe/blob/2a7a184b2cfaeb63008529a9851cd72edb8025d9/src/main/java/com/ibm/spss/hive/serde2/xml/processor/XmlUtils.java#L41-L68
Ordinastie/MalisisCore
src/main/java/net/malisis/core/inventory/MalisisInventoryContainer.java
MalisisInventoryContainer.handleShiftClick
private ItemStack handleShiftClick(MalisisInventory inventory, MalisisSlot slot) { ItemStack itemStack = transferSlotOutOfInventory(inventory, slot); //replace what's left of the item back into the slot slot.setItemStack(itemStack); slot.onSlotChanged(); return itemStack; }
java
private ItemStack handleShiftClick(MalisisInventory inventory, MalisisSlot slot) { ItemStack itemStack = transferSlotOutOfInventory(inventory, slot); //replace what's left of the item back into the slot slot.setItemStack(itemStack); slot.onSlotChanged(); return itemStack; }
[ "private", "ItemStack", "handleShiftClick", "(", "MalisisInventory", "inventory", ",", "MalisisSlot", "slot", ")", "{", "ItemStack", "itemStack", "=", "transferSlotOutOfInventory", "(", "inventory", ",", "slot", ")", ";", "//replace what's left of the item back into the slo...
Handles shift clicking a slot. @param inventoryId the inventory id @param slot the slot @return the item stack
[ "Handles", "shift", "clicking", "a", "slot", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/inventory/MalisisInventoryContainer.java#L484-L492
aerogear/aerogear-crypto-java
src/main/java/org/jboss/aerogear/crypto/Util.java
Util.formatter
public static String formatter(Mode mode, Padding padding) { return String.format("%s/%s", mode, padding); }
java
public static String formatter(Mode mode, Padding padding) { return String.format("%s/%s", mode, padding); }
[ "public", "static", "String", "formatter", "(", "Mode", "mode", ",", "Padding", "padding", ")", "{", "return", "String", ".", "format", "(", "\"%s/%s\"", ",", "mode", ",", "padding", ")", ";", "}" ]
Utility method to format algorithms name in Java like way @param mode @param padding @return string name with the formatted algorithm
[ "Utility", "method", "to", "format", "algorithms", "name", "in", "Java", "like", "way" ]
train
https://github.com/aerogear/aerogear-crypto-java/blob/3a371780f7deff603f5a7a1dd3de1eeb5e147202/src/main/java/org/jboss/aerogear/crypto/Util.java#L91-L93
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java
ParameterTool.getByte
public byte getByte(String key, byte defaultValue) { addToDefaults(key, Byte.toString(defaultValue)); String value = get(key); if (value == null) { return defaultValue; } else { return Byte.valueOf(value); } }
java
public byte getByte(String key, byte defaultValue) { addToDefaults(key, Byte.toString(defaultValue)); String value = get(key); if (value == null) { return defaultValue; } else { return Byte.valueOf(value); } }
[ "public", "byte", "getByte", "(", "String", "key", ",", "byte", "defaultValue", ")", "{", "addToDefaults", "(", "key", ",", "Byte", ".", "toString", "(", "defaultValue", ")", ")", ";", "String", "value", "=", "get", "(", "key", ")", ";", "if", "(", "...
Returns the Byte value for the given key. If the key does not exists it will return the default value given. The method fails if the value is not a Byte.
[ "Returns", "the", "Byte", "value", "for", "the", "given", "key", ".", "If", "the", "key", "does", "not", "exists", "it", "will", "return", "the", "default", "value", "given", ".", "The", "method", "fails", "if", "the", "value", "is", "not", "a", "Byte"...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L449-L457
samskivert/pythagoras
src/main/java/pythagoras/d/Matrix4.java
Matrix4.setToPerspective
public Matrix4 setToPerspective (double fovy, double aspect, double near, double far) { double f = 1f / Math.tan(fovy / 2f), dscale = 1f / (near - far); return set(f/aspect, 0f, 0f, 0f, 0f, f, 0f, 0f, 0f, 0f, (far+near) * dscale, 2f * far * near * dscale, 0f, 0f, -1f, 0f); }
java
public Matrix4 setToPerspective (double fovy, double aspect, double near, double far) { double f = 1f / Math.tan(fovy / 2f), dscale = 1f / (near - far); return set(f/aspect, 0f, 0f, 0f, 0f, f, 0f, 0f, 0f, 0f, (far+near) * dscale, 2f * far * near * dscale, 0f, 0f, -1f, 0f); }
[ "public", "Matrix4", "setToPerspective", "(", "double", "fovy", ",", "double", "aspect", ",", "double", "near", ",", "double", "far", ")", "{", "double", "f", "=", "1f", "/", "Math", ".", "tan", "(", "fovy", "/", "2f", ")", ",", "dscale", "=", "1f", ...
Sets this to a perspective projection matrix. The formula comes from the OpenGL documentation for the gluPerspective function. @return a reference to this matrix, for chaining.
[ "Sets", "this", "to", "a", "perspective", "projection", "matrix", ".", "The", "formula", "comes", "from", "the", "OpenGL", "documentation", "for", "the", "gluPerspective", "function", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix4.java#L373-L379
finmath/finmath-lib
src/main/java/net/finmath/time/ScheduleGenerator.java
ScheduleGenerator.createScheduleFromConventions
public static Schedule createScheduleFromConventions( LocalDate referenceDate, int spotOffsetDays, String startOffsetString, String maturityString, String frequency, String daycountConvention, String shortPeriodConvention, String dateRollConvention, BusinessdayCalendar businessdayCalendar, int fixingOffsetDays, int paymentOffsetDays ) { // tradeDate=referenceDate return createScheduleFromConventions(referenceDate, referenceDate, spotOffsetDays, startOffsetString, maturityString, frequency, daycountConvention, shortPeriodConvention, dateRollConvention, businessdayCalendar, fixingOffsetDays, paymentOffsetDays); }
java
public static Schedule createScheduleFromConventions( LocalDate referenceDate, int spotOffsetDays, String startOffsetString, String maturityString, String frequency, String daycountConvention, String shortPeriodConvention, String dateRollConvention, BusinessdayCalendar businessdayCalendar, int fixingOffsetDays, int paymentOffsetDays ) { // tradeDate=referenceDate return createScheduleFromConventions(referenceDate, referenceDate, spotOffsetDays, startOffsetString, maturityString, frequency, daycountConvention, shortPeriodConvention, dateRollConvention, businessdayCalendar, fixingOffsetDays, paymentOffsetDays); }
[ "public", "static", "Schedule", "createScheduleFromConventions", "(", "LocalDate", "referenceDate", ",", "int", "spotOffsetDays", ",", "String", "startOffsetString", ",", "String", "maturityString", ",", "String", "frequency", ",", "String", "daycountConvention", ",", "...
Simple schedule generation where startDate and maturityDate are calculated based on referenceDate, spotOffsetDays, startOffsetString and maturityString. The schedule generation considers short periods. Date rolling is ignored. @param referenceDate The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0. @param spotOffsetDays Number of business days to be added to the trade date to obtain the spot date. @param startOffsetString The start date as an offset from the spotDate (build from tradeDate and spotOffsetDays) entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc. @param maturityString The end date of the last period entered as a code like 1D, 1W, 1M, 2M, 3M, 1Y, etc. @param frequency The frequency (as String). @param daycountConvention The daycount convention (as String). @param shortPeriodConvention If short period exists, have it first or last (as String). @param dateRollConvention Adjustment to be applied to the all dates (as String). @param businessdayCalendar Business day calendar (holiday calendar) to be used for date roll adjustment. @param fixingOffsetDays Number of business days to be added to period start to get the fixing date. @param paymentOffsetDays Number of business days to be added to period end to get the payment date. @return The corresponding schedule
[ "Simple", "schedule", "generation", "where", "startDate", "and", "maturityDate", "are", "calculated", "based", "on", "referenceDate", "spotOffsetDays", "startOffsetString", "and", "maturityString", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/ScheduleGenerator.java#L613-L629
wildfly-swarm-archive/ARCHIVE-wildfly-swarm
container/runtime/src/main/java/org/wildfly/swarm/container/runtime/StandaloneXmlParser.java
StandaloneXmlParser.addDelegate
public StandaloneXmlParser addDelegate(QName elementName, XMLElementReader<List<ModelNode>> parser) { xmlMapper.registerRootElement(elementName, parser); return this; }
java
public StandaloneXmlParser addDelegate(QName elementName, XMLElementReader<List<ModelNode>> parser) { xmlMapper.registerRootElement(elementName, parser); return this; }
[ "public", "StandaloneXmlParser", "addDelegate", "(", "QName", "elementName", ",", "XMLElementReader", "<", "List", "<", "ModelNode", ">", ">", "parser", ")", "{", "xmlMapper", ".", "registerRootElement", "(", "elementName", ",", "parser", ")", ";", "return", "th...
Add a parser for a subpart of the XML model. @param elementName the FQ element name (i.e. subsystem name) @param parser creates ModelNode's from XML input @return
[ "Add", "a", "parser", "for", "a", "subpart", "of", "the", "XML", "model", "." ]
train
https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/container/runtime/src/main/java/org/wildfly/swarm/container/runtime/StandaloneXmlParser.java#L83-L86
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_renewSSL_POST
public OvhTask organizationName_service_exchangeService_renewSSL_POST(String organizationName, String exchangeService, String dcv) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/renewSSL"; StringBuilder sb = path(qPath, organizationName, exchangeService); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "dcv", dcv); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask organizationName_service_exchangeService_renewSSL_POST(String organizationName, String exchangeService, String dcv) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/renewSSL"; StringBuilder sb = path(qPath, organizationName, exchangeService); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "dcv", dcv); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "organizationName_service_exchangeService_renewSSL_POST", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "dcv", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/exchange/{organizationName}/service/{ex...
Renew SSL if it will expire in next 30 days REST: POST /email/exchange/{organizationName}/service/{exchangeService}/renewSSL @param dcv [required] DCV email require for order ssl varification process @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service
[ "Renew", "SSL", "if", "it", "will", "expire", "in", "next", "30", "days" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L1010-L1017
gwtplus/google-gin
src/main/java/com/google/gwt/inject/rebind/resolution/BindingInstaller.java
BindingInstaller.installBinding
private void installBinding(DependencyGraph graph, Key<?> key, Binding binding) { // Figure out where we're putting the implicit entry GinjectorBindings implicitEntryPosition = positions.getInstallPosition(key); // Ensure that the dependencies are available to the ginjector inheritBindingsForDeps(implicitEntryPosition, graph.getDependenciesOf(key)); // Now add the implicit binding to the ginjector implicitEntryPosition.addBinding(key, binding); }
java
private void installBinding(DependencyGraph graph, Key<?> key, Binding binding) { // Figure out where we're putting the implicit entry GinjectorBindings implicitEntryPosition = positions.getInstallPosition(key); // Ensure that the dependencies are available to the ginjector inheritBindingsForDeps(implicitEntryPosition, graph.getDependenciesOf(key)); // Now add the implicit binding to the ginjector implicitEntryPosition.addBinding(key, binding); }
[ "private", "void", "installBinding", "(", "DependencyGraph", "graph", ",", "Key", "<", "?", ">", "key", ",", "Binding", "binding", ")", "{", "// Figure out where we're putting the implicit entry", "GinjectorBindings", "implicitEntryPosition", "=", "positions", ".", "get...
Adds the given implicit binding in the graph to the injector hierarchy in the position specified by the {@link BindingPositioner}. Also ensures that the dependencies of the implicit binding are available at the chosen position.
[ "Adds", "the", "given", "implicit", "binding", "in", "the", "graph", "to", "the", "injector", "hierarchy", "in", "the", "position", "specified", "by", "the", "{" ]
train
https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/resolution/BindingInstaller.java#L91-L100
google/j2objc
jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java
MutableBigInteger.addDisjoint
void addDisjoint(MutableBigInteger addend, int n) { if (addend.isZero()) return; int x = intLen; int y = addend.intLen + n; int resultLen = (intLen > y ? intLen : y); int[] result; if (value.length < resultLen) result = new int[resultLen]; else { result = value; Arrays.fill(value, offset+intLen, value.length, 0); } int rstart = result.length-1; // copy from this if needed System.arraycopy(value, offset, result, rstart+1-x, x); y -= x; rstart -= x; int len = Math.min(y, addend.value.length-addend.offset); System.arraycopy(addend.value, addend.offset, result, rstart+1-y, len); // zero the gap for (int i=rstart+1-y+len; i < rstart+1; i++) result[i] = 0; value = result; intLen = resultLen; offset = result.length - resultLen; }
java
void addDisjoint(MutableBigInteger addend, int n) { if (addend.isZero()) return; int x = intLen; int y = addend.intLen + n; int resultLen = (intLen > y ? intLen : y); int[] result; if (value.length < resultLen) result = new int[resultLen]; else { result = value; Arrays.fill(value, offset+intLen, value.length, 0); } int rstart = result.length-1; // copy from this if needed System.arraycopy(value, offset, result, rstart+1-x, x); y -= x; rstart -= x; int len = Math.min(y, addend.value.length-addend.offset); System.arraycopy(addend.value, addend.offset, result, rstart+1-y, len); // zero the gap for (int i=rstart+1-y+len; i < rstart+1; i++) result[i] = 0; value = result; intLen = resultLen; offset = result.length - resultLen; }
[ "void", "addDisjoint", "(", "MutableBigInteger", "addend", ",", "int", "n", ")", "{", "if", "(", "addend", ".", "isZero", "(", ")", ")", "return", ";", "int", "x", "=", "intLen", ";", "int", "y", "=", "addend", ".", "intLen", "+", "n", ";", "int", ...
Like {@link #addShifted(MutableBigInteger, int)} but {@code this.intLen} must not be greater than {@code n}. In other words, concatenates {@code this} and {@code addend}.
[ "Like", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L862-L894
bignerdranch/expandable-recycler-view
expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java
ExpandableRecyclerAdapter.notifyParentRangeChanged
@UiThread public void notifyParentRangeChanged(int parentPositionStart, int itemCount) { int flatParentPositionStart = getFlatParentPosition(parentPositionStart); int flatParentPosition = flatParentPositionStart; int sizeChanged = 0; int changed; P parent; for (int j = 0; j < itemCount; j++) { parent = mParentList.get(parentPositionStart); changed = changeParentWrapper(flatParentPosition, parent); sizeChanged += changed; flatParentPosition += changed; parentPositionStart++; } notifyItemRangeChanged(flatParentPositionStart, sizeChanged); }
java
@UiThread public void notifyParentRangeChanged(int parentPositionStart, int itemCount) { int flatParentPositionStart = getFlatParentPosition(parentPositionStart); int flatParentPosition = flatParentPositionStart; int sizeChanged = 0; int changed; P parent; for (int j = 0; j < itemCount; j++) { parent = mParentList.get(parentPositionStart); changed = changeParentWrapper(flatParentPosition, parent); sizeChanged += changed; flatParentPosition += changed; parentPositionStart++; } notifyItemRangeChanged(flatParentPositionStart, sizeChanged); }
[ "@", "UiThread", "public", "void", "notifyParentRangeChanged", "(", "int", "parentPositionStart", ",", "int", "itemCount", ")", "{", "int", "flatParentPositionStart", "=", "getFlatParentPosition", "(", "parentPositionStart", ")", ";", "int", "flatParentPosition", "=", ...
Notify any registered observers that the {@code itemCount} parents starting at {@code parentPositionStart} have changed. This will also trigger an item changed for children of the parent list specified. <p> This is an item change event, not a structural change event. It indicates that any reflection of the data in the given position range is out of date and should be updated. The parents in the given range retain the same identity. This means that the number of children must stay the same. @param parentPositionStart Position of the item that has changed @param itemCount Number of parents changed in the data set
[ "Notify", "any", "registered", "observers", "that", "the", "{", "@code", "itemCount", "}", "parents", "starting", "at", "{", "@code", "parentPositionStart", "}", "have", "changed", ".", "This", "will", "also", "trigger", "an", "item", "changed", "for", "childr...
train
https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L1011-L1027
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/Client/ClientStateMachine.java
ClientStateMachine.getStateEpisodeForState
@Override protected StateEpisode getStateEpisodeForState(IState state) { if (!(state instanceof ClientState)) return null; ClientState cs = (ClientState) state; switch (cs) { case WAITING_FOR_MOD_READY: return new InitialiseClientModEpisode(this); case DORMANT: return new DormantEpisode(this); case CREATING_HANDLERS: return new CreateHandlersEpisode(this); case EVALUATING_WORLD_REQUIREMENTS: return new EvaluateWorldRequirementsEpisode(this); case PAUSING_OLD_SERVER: return new PauseOldServerEpisode(this); case CLOSING_OLD_SERVER: return new CloseOldServerEpisode(this); case CREATING_NEW_WORLD: return new CreateWorldEpisode(this); case WAITING_FOR_SERVER_READY: return new WaitingForServerEpisode(this); case RUNNING: return new MissionRunningEpisode(this); case IDLING: return new MissionIdlingEpisode(this); case MISSION_ENDED: return new MissionEndedEpisode(this, MissionResult.ENDED, false, false, true); case ERROR_DUFF_HANDLERS: return new MissionEndedEpisode(this, MissionResult.MOD_FAILED_TO_INSTANTIATE_HANDLERS, true, true, true); case ERROR_INTEGRATED_SERVER_UNREACHABLE: return new MissionEndedEpisode(this, MissionResult.MOD_SERVER_UNREACHABLE, true, true, true); case ERROR_NO_WORLD: return new MissionEndedEpisode(this, MissionResult.MOD_HAS_NO_WORLD_LOADED, true, true, true); case ERROR_CANNOT_CREATE_WORLD: return new MissionEndedEpisode(this, MissionResult.MOD_FAILED_TO_CREATE_WORLD, true, true, true); case ERROR_CANNOT_START_AGENT: // run-ons deliberate case ERROR_LOST_AGENT: case ERROR_LOST_VIDEO: return new MissionEndedEpisode(this, MissionResult.MOD_HAS_NO_AGENT_AVAILABLE, true, true, false); case ERROR_LOST_NETWORK_CONNECTION: // run-on deliberate case ERROR_CANNOT_CONNECT_TO_SERVER: return new MissionEndedEpisode(this, MissionResult.MOD_CONNECTION_FAILED, true, false, true); // No point trying to inform the server - we can't reach it anyway! case ERROR_TIMED_OUT_WAITING_FOR_EPISODE_START: // run-ons deliberate case ERROR_TIMED_OUT_WAITING_FOR_EPISODE_PAUSE: case ERROR_TIMED_OUT_WAITING_FOR_EPISODE_CLOSE: case ERROR_TIMED_OUT_WAITING_FOR_MISSION_END: case ERROR_TIMED_OUT_WAITING_FOR_WORLD_CREATE: return new MissionEndedEpisode(this, MissionResult.MOD_CONNECTION_FAILED, true, true, true); case MISSION_ABORTED: return new MissionEndedEpisode(this, MissionResult.MOD_SERVER_ABORTED_MISSION, true, false, true); // Don't inform the server - it already knows (we're acting on its notification) case WAITING_FOR_SERVER_MISSION_END: return new WaitingForServerMissionEndEpisode(this); default: break; } return null; }
java
@Override protected StateEpisode getStateEpisodeForState(IState state) { if (!(state instanceof ClientState)) return null; ClientState cs = (ClientState) state; switch (cs) { case WAITING_FOR_MOD_READY: return new InitialiseClientModEpisode(this); case DORMANT: return new DormantEpisode(this); case CREATING_HANDLERS: return new CreateHandlersEpisode(this); case EVALUATING_WORLD_REQUIREMENTS: return new EvaluateWorldRequirementsEpisode(this); case PAUSING_OLD_SERVER: return new PauseOldServerEpisode(this); case CLOSING_OLD_SERVER: return new CloseOldServerEpisode(this); case CREATING_NEW_WORLD: return new CreateWorldEpisode(this); case WAITING_FOR_SERVER_READY: return new WaitingForServerEpisode(this); case RUNNING: return new MissionRunningEpisode(this); case IDLING: return new MissionIdlingEpisode(this); case MISSION_ENDED: return new MissionEndedEpisode(this, MissionResult.ENDED, false, false, true); case ERROR_DUFF_HANDLERS: return new MissionEndedEpisode(this, MissionResult.MOD_FAILED_TO_INSTANTIATE_HANDLERS, true, true, true); case ERROR_INTEGRATED_SERVER_UNREACHABLE: return new MissionEndedEpisode(this, MissionResult.MOD_SERVER_UNREACHABLE, true, true, true); case ERROR_NO_WORLD: return new MissionEndedEpisode(this, MissionResult.MOD_HAS_NO_WORLD_LOADED, true, true, true); case ERROR_CANNOT_CREATE_WORLD: return new MissionEndedEpisode(this, MissionResult.MOD_FAILED_TO_CREATE_WORLD, true, true, true); case ERROR_CANNOT_START_AGENT: // run-ons deliberate case ERROR_LOST_AGENT: case ERROR_LOST_VIDEO: return new MissionEndedEpisode(this, MissionResult.MOD_HAS_NO_AGENT_AVAILABLE, true, true, false); case ERROR_LOST_NETWORK_CONNECTION: // run-on deliberate case ERROR_CANNOT_CONNECT_TO_SERVER: return new MissionEndedEpisode(this, MissionResult.MOD_CONNECTION_FAILED, true, false, true); // No point trying to inform the server - we can't reach it anyway! case ERROR_TIMED_OUT_WAITING_FOR_EPISODE_START: // run-ons deliberate case ERROR_TIMED_OUT_WAITING_FOR_EPISODE_PAUSE: case ERROR_TIMED_OUT_WAITING_FOR_EPISODE_CLOSE: case ERROR_TIMED_OUT_WAITING_FOR_MISSION_END: case ERROR_TIMED_OUT_WAITING_FOR_WORLD_CREATE: return new MissionEndedEpisode(this, MissionResult.MOD_CONNECTION_FAILED, true, true, true); case MISSION_ABORTED: return new MissionEndedEpisode(this, MissionResult.MOD_SERVER_ABORTED_MISSION, true, false, true); // Don't inform the server - it already knows (we're acting on its notification) case WAITING_FOR_SERVER_MISSION_END: return new WaitingForServerMissionEndEpisode(this); default: break; } return null; }
[ "@", "Override", "protected", "StateEpisode", "getStateEpisodeForState", "(", "IState", "state", ")", "{", "if", "(", "!", "(", "state", "instanceof", "ClientState", ")", ")", "return", "null", ";", "ClientState", "cs", "=", "(", "ClientState", ")", "state", ...
Create the episode object for the requested state. @param state the state the mod is entering @return a MissionStateEpisode that localises all the logic required to run this state
[ "Create", "the", "episode", "object", "for", "the", "requested", "state", "." ]
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Client/ClientStateMachine.java#L282-L341
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabasesInner.java
RestorableDroppedDatabasesInner.getAsync
public Observable<RestorableDroppedDatabaseInner> getAsync(String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { return getWithServiceResponseAsync(resourceGroupName, serverName, restorableDroppededDatabaseId).map(new Func1<ServiceResponse<RestorableDroppedDatabaseInner>, RestorableDroppedDatabaseInner>() { @Override public RestorableDroppedDatabaseInner call(ServiceResponse<RestorableDroppedDatabaseInner> response) { return response.body(); } }); }
java
public Observable<RestorableDroppedDatabaseInner> getAsync(String resourceGroupName, String serverName, String restorableDroppededDatabaseId) { return getWithServiceResponseAsync(resourceGroupName, serverName, restorableDroppededDatabaseId).map(new Func1<ServiceResponse<RestorableDroppedDatabaseInner>, RestorableDroppedDatabaseInner>() { @Override public RestorableDroppedDatabaseInner call(ServiceResponse<RestorableDroppedDatabaseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RestorableDroppedDatabaseInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "restorableDroppededDatabaseId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",",...
Gets a deleted database that can be restored. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param restorableDroppededDatabaseId The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RestorableDroppedDatabaseInner object
[ "Gets", "a", "deleted", "database", "that", "can", "be", "restored", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabasesInner.java#L103-L110
codeprimate-software/cp-elements
src/main/java/org/cp/elements/tools/net/support/AbstractClientServerSupport.java
AbstractClientServerSupport.newServerSocket
public ServerSocket newServerSocket(int port) { try { ServerSocket serverSocket = newServerSocket(); serverSocket.setReuseAddress(DEFAULT_REUSE_ADDRESS); serverSocket.bind(newSocketAddress(port)); return serverSocket; } catch (IOException cause) { throw newRuntimeException(cause, "Failed to create a ServerSocket on port [%d]", port); } }
java
public ServerSocket newServerSocket(int port) { try { ServerSocket serverSocket = newServerSocket(); serverSocket.setReuseAddress(DEFAULT_REUSE_ADDRESS); serverSocket.bind(newSocketAddress(port)); return serverSocket; } catch (IOException cause) { throw newRuntimeException(cause, "Failed to create a ServerSocket on port [%d]", port); } }
[ "public", "ServerSocket", "newServerSocket", "(", "int", "port", ")", "{", "try", "{", "ServerSocket", "serverSocket", "=", "newServerSocket", "(", ")", ";", "serverSocket", ".", "setReuseAddress", "(", "DEFAULT_REUSE_ADDRESS", ")", ";", "serverSocket", ".", "bind...
Constructs and configures a new {@link ServerSocket}. @param port {@link Integer} value indicating the port number to which the {@link ServerSocket} is bound listening for client connections. @return a new {@link ServerSocket}. @throws RuntimeException if the {@link ServerSocket} could not be created. @see java.net.ServerSocket
[ "Constructs", "and", "configures", "a", "new", "{", "@link", "ServerSocket", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/tools/net/support/AbstractClientServerSupport.java#L119-L129
soi-toolkit/soi-toolkit-mule
commons/components/module-logger/src/main/java/org/soitoolkit/commons/module/logger/SoitoolkitLoggerModule.java
SoitoolkitLoggerModule.logInfo
@Processor public Object logInfo( String message, @Optional String integrationScenario, @Optional String contractId, @Optional String correlationId, @Optional Map<String, String> extra) { return doLog(LogLevelType.INFO, message, integrationScenario, contractId, correlationId, extra); }
java
@Processor public Object logInfo( String message, @Optional String integrationScenario, @Optional String contractId, @Optional String correlationId, @Optional Map<String, String> extra) { return doLog(LogLevelType.INFO, message, integrationScenario, contractId, correlationId, extra); }
[ "@", "Processor", "public", "Object", "logInfo", "(", "String", "message", ",", "@", "Optional", "String", "integrationScenario", ",", "@", "Optional", "String", "contractId", ",", "@", "Optional", "String", "correlationId", ",", "@", "Optional", "Map", "<", "...
Log processor for level INFO {@sample.xml ../../../doc/SoitoolkitLogger-connector.xml.sample soitoolkitlogger:log} @param message Log-message to be processed @param integrationScenario Optional name of the integration scenario or business process @param contractId Optional name of the contract in use @param correlationId Optional correlation identity of the message @param extra Optional extra info @return The incoming payload
[ "Log", "processor", "for", "level", "INFO" ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/module-logger/src/main/java/org/soitoolkit/commons/module/logger/SoitoolkitLoggerModule.java#L144-L153
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getNumArguments
public int getNumArguments(InvokeInstruction ins, ConstantPoolGen cpg) { SignatureParser parser = new SignatureParser(ins.getSignature(cpg)); return parser.getNumParameters(); }
java
public int getNumArguments(InvokeInstruction ins, ConstantPoolGen cpg) { SignatureParser parser = new SignatureParser(ins.getSignature(cpg)); return parser.getNumParameters(); }
[ "public", "int", "getNumArguments", "(", "InvokeInstruction", "ins", ",", "ConstantPoolGen", "cpg", ")", "{", "SignatureParser", "parser", "=", "new", "SignatureParser", "(", "ins", ".", "getSignature", "(", "cpg", ")", ")", ";", "return", "parser", ".", "getN...
Get the number of arguments passed to given method invocation. @param ins the method invocation instruction @param cpg the ConstantPoolGen for the class containing the method @return number of arguments; note that this excludes the object instance for instance methods
[ "Get", "the", "number", "of", "arguments", "passed", "to", "given", "method", "invocation", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L348-L351
fommil/matrix-toolkits-java
src/main/java/no/uib/cipr/matrix/PermutationMatrix.java
PermutationMatrix.fromPartialPivots
public static PermutationMatrix fromPartialPivots(int[] pivots) { int[] permutations = new int[pivots.length]; for (int i = 0; i < pivots.length; i++) { permutations[i] = i; } for (int i = 0; i < pivots.length; i++) { int j = pivots[i] - 1; if (j == i) continue; int tmp = permutations[i]; permutations[i] = permutations[j]; permutations[j] = tmp; } return new PermutationMatrix(permutations, pivots); }
java
public static PermutationMatrix fromPartialPivots(int[] pivots) { int[] permutations = new int[pivots.length]; for (int i = 0; i < pivots.length; i++) { permutations[i] = i; } for (int i = 0; i < pivots.length; i++) { int j = pivots[i] - 1; if (j == i) continue; int tmp = permutations[i]; permutations[i] = permutations[j]; permutations[j] = tmp; } return new PermutationMatrix(permutations, pivots); }
[ "public", "static", "PermutationMatrix", "fromPartialPivots", "(", "int", "[", "]", "pivots", ")", "{", "int", "[", "]", "permutations", "=", "new", "int", "[", "pivots", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pivo...
The sequential row permutations to perform, e.g. (2, 3, 3) means: permute row 1 with row 2, then permute row 2 with row 3, then permute row 3 with row 3 (i.e. do nothing). <p> Using this factory will ensure that LAPACK optimisations are available for multiplication operations. @param pivots using fortran (1-indexed) notation.
[ "The", "sequential", "row", "permutations", "to", "perform", "e", ".", "g", ".", "(", "2", "3", "3", ")", "means", ":", "permute", "row", "1", "with", "row", "2", "then", "permute", "row", "2", "with", "row", "3", "then", "permute", "row", "3", "wi...
train
https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/PermutationMatrix.java#L51-L67
raydac/java-comment-preprocessor
jcp/src/main/java/com/igormaznitsa/meta/common/utils/TimeGuard.java
TimeGuard.addPoint
@Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth") // WARNING! Don't make a call from methods of the class to not break stack depth! public static void addPoint(@Nonnull final String timePointName, @Nonnull final TimeAlertListener listener) { final List<TimeData> list = REGISTRY.get(); list.add(new TimeData(ThreadUtils.stackDepth(), timePointName, -1L, assertNotNull(listener))); }
java
@Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth") // WARNING! Don't make a call from methods of the class to not break stack depth! public static void addPoint(@Nonnull final String timePointName, @Nonnull final TimeAlertListener listener) { final List<TimeData> list = REGISTRY.get(); list.add(new TimeData(ThreadUtils.stackDepth(), timePointName, -1L, assertNotNull(listener))); }
[ "@", "Weight", "(", "value", "=", "Weight", ".", "Unit", ".", "VARIABLE", ",", "comment", "=", "\"Depends on the current call stack depth\"", ")", "// WARNING! Don't make a call from methods of the class to not break stack depth!", "public", "static", "void", "addPoint", "(",...
Add a named time point. @param timePointName name for the time point @param listener listener to be notified @see #checkPoint(java.lang.String) @since 1.0
[ "Add", "a", "named", "time", "point", "." ]
train
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/meta/common/utils/TimeGuard.java#L105-L110
google/closure-compiler
src/com/google/javascript/jscomp/TypeValidator.java
TypeValidator.expectAllInterfaceProperties
void expectAllInterfaceProperties(Node n, FunctionType type) { ObjectType instance = type.getInstanceType(); for (ObjectType implemented : type.getAllImplementedInterfaces()) { if (implemented.getImplicitPrototype() != null) { for (String prop : implemented.getImplicitPrototype().getOwnPropertyNames()) { expectInterfaceProperty(n, instance, implemented, prop); } } } }
java
void expectAllInterfaceProperties(Node n, FunctionType type) { ObjectType instance = type.getInstanceType(); for (ObjectType implemented : type.getAllImplementedInterfaces()) { if (implemented.getImplicitPrototype() != null) { for (String prop : implemented.getImplicitPrototype().getOwnPropertyNames()) { expectInterfaceProperty(n, instance, implemented, prop); } } } }
[ "void", "expectAllInterfaceProperties", "(", "Node", "n", ",", "FunctionType", "type", ")", "{", "ObjectType", "instance", "=", "type", ".", "getInstanceType", "(", ")", ";", "for", "(", "ObjectType", "implemented", ":", "type", ".", "getAllImplementedInterfaces",...
Expect that all properties on interfaces that this type implements are implemented and correctly typed.
[ "Expect", "that", "all", "properties", "on", "interfaces", "that", "this", "type", "implements", "are", "implemented", "and", "correctly", "typed", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L877-L887
Impetus/Kundera
src/kundera-elastic-search/src/main/java/com/impetus/client/es/utils/ESResponseWrapper.java
ESResponseWrapper.onEnum
private Object onEnum(Attribute attribute, Object fieldValue) { if (((Field) attribute.getJavaMember()).getType().isEnum()) { EnumAccessor accessor = new EnumAccessor(); fieldValue = accessor.fromString(((AbstractAttribute) attribute).getBindableJavaType(), fieldValue.toString()); } return fieldValue; }
java
private Object onEnum(Attribute attribute, Object fieldValue) { if (((Field) attribute.getJavaMember()).getType().isEnum()) { EnumAccessor accessor = new EnumAccessor(); fieldValue = accessor.fromString(((AbstractAttribute) attribute).getBindableJavaType(), fieldValue.toString()); } return fieldValue; }
[ "private", "Object", "onEnum", "(", "Attribute", "attribute", ",", "Object", "fieldValue", ")", "{", "if", "(", "(", "(", "Field", ")", "attribute", ".", "getJavaMember", "(", ")", ")", ".", "getType", "(", ")", ".", "isEnum", "(", ")", ")", "{", "En...
On enum. @param attribute the attribute @param fieldValue the field value @return the object
[ "On", "enum", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/utils/ESResponseWrapper.java#L662-L671
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/GridTable.java
GridTable.setHandle
public FieldList setHandle(Object bookmark, int iHandleType) throws DBException { m_objectID = null; // No current record m_dataSource = null; FieldList fieldList = this.getNextTable().setHandle(bookmark, iHandleType); if (fieldList != null) m_iRecordStatus = DBConstants.RECORD_NORMAL; else m_iRecordStatus = DBConstants.RECORD_INVALID | DBConstants.RECORD_AT_BOF | DBConstants.RECORD_AT_EOF; return fieldList; }
java
public FieldList setHandle(Object bookmark, int iHandleType) throws DBException { m_objectID = null; // No current record m_dataSource = null; FieldList fieldList = this.getNextTable().setHandle(bookmark, iHandleType); if (fieldList != null) m_iRecordStatus = DBConstants.RECORD_NORMAL; else m_iRecordStatus = DBConstants.RECORD_INVALID | DBConstants.RECORD_AT_BOF | DBConstants.RECORD_AT_EOF; return fieldList; }
[ "public", "FieldList", "setHandle", "(", "Object", "bookmark", ",", "int", "iHandleType", ")", "throws", "DBException", "{", "m_objectID", "=", "null", ";", "// No current record", "m_dataSource", "=", "null", ";", "FieldList", "fieldList", "=", "this", ".", "ge...
Reposition to this record Using this bookmark. @param Object bookmark Bookmark. @param int iHandleType Type of handle (see getHandle). @exception FILE_NOT_OPEN. @return record if found/null - record not found.
[ "Reposition", "to", "this", "record", "Using", "this", "bookmark", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/GridTable.java#L571-L581
datumbox/datumbox-framework
datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/TransposeDataList.java
TransposeDataList.put
public final FlatDataList put(Object key, FlatDataList value) { return internalData.put(key, value); }
java
public final FlatDataList put(Object key, FlatDataList value) { return internalData.put(key, value); }
[ "public", "final", "FlatDataList", "put", "(", "Object", "key", ",", "FlatDataList", "value", ")", "{", "return", "internalData", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Adds a particular key-value into the internal map. It returns the previous value which was associated with that key. @param key @param value @return
[ "Adds", "a", "particular", "key", "-", "value", "into", "the", "internal", "map", ".", "It", "returns", "the", "previous", "value", "which", "was", "associated", "with", "that", "key", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/TransposeDataList.java#L79-L81
konvergeio/cofoja
src/main/java/com/google/java/contract/util/Predicates.java
Predicates.forEntries
public static <K, V> Predicate<Map<K, V>> forEntries( final Predicate<? super Set<Map.Entry<K, V>>> p) { return new Predicate<Map<K, V>>() { @Override public boolean apply(Map<K, V> obj) { return p.apply(obj.entrySet()); } }; }
java
public static <K, V> Predicate<Map<K, V>> forEntries( final Predicate<? super Set<Map.Entry<K, V>>> p) { return new Predicate<Map<K, V>>() { @Override public boolean apply(Map<K, V> obj) { return p.apply(obj.entrySet()); } }; }
[ "public", "static", "<", "K", ",", "V", ">", "Predicate", "<", "Map", "<", "K", ",", "V", ">", ">", "forEntries", "(", "final", "Predicate", "<", "?", "super", "Set", "<", "Map", ".", "Entry", "<", "K", ",", "V", ">", ">", ">", "p", ")", "{",...
Returns a predicate that evaluates to {@code true} if the entry set of its argument satisfies {@code p}.
[ "Returns", "a", "predicate", "that", "evaluates", "to", "{" ]
train
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/util/Predicates.java#L240-L248
zandero/rest.vertx
src/main/java/com/zandero/rest/reader/ReaderFactory.java
ReaderFactory.get
public ValueReader get(MethodParameter parameter, Class<? extends ValueReader> byMethodDefinition, InjectionProvider provider, RoutingContext context, MediaType... mediaTypes) { // by type Class<?> readerType = null; try { // reader parameter as given Assert.notNull(parameter, "Missing parameter!"); Class<? extends ValueReader> reader = parameter.getReader(); if (reader != null) { return getClassInstance(reader, provider, context); } // by value type, if body also by method/class definition or consumes media type readerType = parameter.getDataType(); ValueReader valueReader = get(readerType, byMethodDefinition, provider, context, mediaTypes); return valueReader != null ? valueReader : new GenericValueReader(); } catch (ClassFactoryException e) { log.error("Failed to provide value reader: " + readerType + ", for: " + parameter + ", falling back to GenericBodyReader() instead!"); return new GenericValueReader(); } catch (ContextException e) { log.error( "Failed inject context into value reader: " + readerType + ", for: " + parameter + ", falling back to GenericBodyReader() instead!"); return new GenericValueReader(); } }
java
public ValueReader get(MethodParameter parameter, Class<? extends ValueReader> byMethodDefinition, InjectionProvider provider, RoutingContext context, MediaType... mediaTypes) { // by type Class<?> readerType = null; try { // reader parameter as given Assert.notNull(parameter, "Missing parameter!"); Class<? extends ValueReader> reader = parameter.getReader(); if (reader != null) { return getClassInstance(reader, provider, context); } // by value type, if body also by method/class definition or consumes media type readerType = parameter.getDataType(); ValueReader valueReader = get(readerType, byMethodDefinition, provider, context, mediaTypes); return valueReader != null ? valueReader : new GenericValueReader(); } catch (ClassFactoryException e) { log.error("Failed to provide value reader: " + readerType + ", for: " + parameter + ", falling back to GenericBodyReader() instead!"); return new GenericValueReader(); } catch (ContextException e) { log.error( "Failed inject context into value reader: " + readerType + ", for: " + parameter + ", falling back to GenericBodyReader() instead!"); return new GenericValueReader(); } }
[ "public", "ValueReader", "get", "(", "MethodParameter", "parameter", ",", "Class", "<", "?", "extends", "ValueReader", ">", "byMethodDefinition", ",", "InjectionProvider", "provider", ",", "RoutingContext", "context", ",", "MediaType", "...", "mediaTypes", ")", "{",...
Step over all possibilities to provide desired reader @param parameter check parameter if reader is set or we have a type reader present @param byMethodDefinition check default definition @param provider injection provider if any @param context routing context @param mediaTypes check by consumes annotation @return found reader or GenericBodyReader
[ "Step", "over", "all", "possibilities", "to", "provide", "desired", "reader" ]
train
https://github.com/zandero/rest.vertx/blob/ba458720cf59e076953eab9dac7227eeaf9e58ce/src/main/java/com/zandero/rest/reader/ReaderFactory.java#L49-L83
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Grego.java
Grego.getDayOfWeekInMonth
public static int getDayOfWeekInMonth(int year, int month, int dayOfMonth) { int weekInMonth = (dayOfMonth + 6)/7; if (weekInMonth == 4) { if (dayOfMonth + 7 > monthLength(year, month)) { weekInMonth = -1; } } else if (weekInMonth == 5) { weekInMonth = -1; } return weekInMonth; }
java
public static int getDayOfWeekInMonth(int year, int month, int dayOfMonth) { int weekInMonth = (dayOfMonth + 6)/7; if (weekInMonth == 4) { if (dayOfMonth + 7 > monthLength(year, month)) { weekInMonth = -1; } } else if (weekInMonth == 5) { weekInMonth = -1; } return weekInMonth; }
[ "public", "static", "int", "getDayOfWeekInMonth", "(", "int", "year", ",", "int", "month", ",", "int", "dayOfMonth", ")", "{", "int", "weekInMonth", "=", "(", "dayOfMonth", "+", "6", ")", "/", "7", ";", "if", "(", "weekInMonth", "==", "4", ")", "{", ...
/* Returns the ordinal number for the specified day of week in the month. The valid return value is 1, 2, 3, 4 or -1.
[ "/", "*", "Returns", "the", "ordinal", "number", "for", "the", "specified", "day", "of", "week", "in", "the", "month", ".", "The", "valid", "return", "value", "is", "1", "2", "3", "4", "or", "-", "1", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Grego.java#L207-L217
kubernetes-client/java
util/src/main/java/io/kubernetes/client/informer/impl/DefaultSharedIndexInformer.java
DefaultSharedIndexInformer.handleDeltas
private void handleDeltas(Deque<MutablePair<DeltaFIFO.DeltaType, Object>> deltas) { if (Collections.isEmptyCollection(deltas)) { return; } // from oldest to newest for (MutablePair<DeltaFIFO.DeltaType, Object> delta : deltas) { DeltaFIFO.DeltaType deltaType = delta.getLeft(); switch (deltaType) { case Sync: case Added: case Updated: boolean isSync = deltaType == DeltaFIFO.DeltaType.Sync; Object oldObj = this.indexer.get((ApiType) delta.getRight()); if (oldObj != null) { this.indexer.update((ApiType) delta.getRight()); this.processor.distribute( new ProcessorListener.UpdateNotification(oldObj, delta.getRight()), isSync); } else { this.indexer.add((ApiType) delta.getRight()); this.processor.distribute( new ProcessorListener.AddNotification(delta.getRight()), isSync); } break; case Deleted: this.indexer.delete((ApiType) delta.getRight()); this.processor.distribute( new ProcessorListener.DeleteNotification(delta.getRight()), false); break; } } }
java
private void handleDeltas(Deque<MutablePair<DeltaFIFO.DeltaType, Object>> deltas) { if (Collections.isEmptyCollection(deltas)) { return; } // from oldest to newest for (MutablePair<DeltaFIFO.DeltaType, Object> delta : deltas) { DeltaFIFO.DeltaType deltaType = delta.getLeft(); switch (deltaType) { case Sync: case Added: case Updated: boolean isSync = deltaType == DeltaFIFO.DeltaType.Sync; Object oldObj = this.indexer.get((ApiType) delta.getRight()); if (oldObj != null) { this.indexer.update((ApiType) delta.getRight()); this.processor.distribute( new ProcessorListener.UpdateNotification(oldObj, delta.getRight()), isSync); } else { this.indexer.add((ApiType) delta.getRight()); this.processor.distribute( new ProcessorListener.AddNotification(delta.getRight()), isSync); } break; case Deleted: this.indexer.delete((ApiType) delta.getRight()); this.processor.distribute( new ProcessorListener.DeleteNotification(delta.getRight()), false); break; } } }
[ "private", "void", "handleDeltas", "(", "Deque", "<", "MutablePair", "<", "DeltaFIFO", ".", "DeltaType", ",", "Object", ">", ">", "deltas", ")", "{", "if", "(", "Collections", ".", "isEmptyCollection", "(", "deltas", ")", ")", "{", "return", ";", "}", "/...
handleDeltas handles deltas and call processor distribute. @param deltas deltas
[ "handleDeltas", "handles", "deltas", "and", "call", "processor", "distribute", "." ]
train
https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/util/src/main/java/io/kubernetes/client/informer/impl/DefaultSharedIndexInformer.java#L167-L198
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java
MarkdownParser.setOutlineEntryFormat
public void setOutlineEntryFormat(String formatWithoutNumbers, String formatWithNumbers) { if (!Strings.isEmpty(formatWithoutNumbers)) { this.outlineEntryWithoutNumberFormat = formatWithoutNumbers; } if (!Strings.isEmpty(formatWithNumbers)) { this.outlineEntryWithNumberFormat = formatWithNumbers; } }
java
public void setOutlineEntryFormat(String formatWithoutNumbers, String formatWithNumbers) { if (!Strings.isEmpty(formatWithoutNumbers)) { this.outlineEntryWithoutNumberFormat = formatWithoutNumbers; } if (!Strings.isEmpty(formatWithNumbers)) { this.outlineEntryWithNumberFormat = formatWithNumbers; } }
[ "public", "void", "setOutlineEntryFormat", "(", "String", "formatWithoutNumbers", ",", "String", "formatWithNumbers", ")", "{", "if", "(", "!", "Strings", ".", "isEmpty", "(", "formatWithoutNumbers", ")", ")", "{", "this", ".", "outlineEntryWithoutNumberFormat", "="...
Change the formats to be applied to the outline entries. <p>The format must be compatible with {@link MessageFormat}. <p>If section auto-numbering is on, the first parameter <code>{0}</code> equals to the prefix, the second parameter <code>{1}</code> equals to the string representation of the section number, the third parameter <code>{2}</code> equals to the title text, and the fourth parameter <code>{3}</code> is the reference id of the section. <p>If section auto-numbering is off, the first parameter <code>{0}</code> equals to the prefix, the second parameter <code>{1}</code> equals to the title text, and the third parameter <code>{2}</code> is the reference id of the section. @param formatWithoutNumbers the format for the outline entries without section numbers. @param formatWithNumbers the format for the outline entries with section numbers.
[ "Change", "the", "formats", "to", "be", "applied", "to", "the", "outline", "entries", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L330-L337
glyptodon/guacamole-client
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
ModeledUser.putUnrestrictedAttributes
private void putUnrestrictedAttributes(Map<String, String> attributes) { // Set full name attribute attributes.put(User.Attribute.FULL_NAME, getModel().getFullName()); // Set email address attribute attributes.put(User.Attribute.EMAIL_ADDRESS, getModel().getEmailAddress()); // Set organization attribute attributes.put(User.Attribute.ORGANIZATION, getModel().getOrganization()); // Set role attribute attributes.put(User.Attribute.ORGANIZATIONAL_ROLE, getModel().getOrganizationalRole()); }
java
private void putUnrestrictedAttributes(Map<String, String> attributes) { // Set full name attribute attributes.put(User.Attribute.FULL_NAME, getModel().getFullName()); // Set email address attribute attributes.put(User.Attribute.EMAIL_ADDRESS, getModel().getEmailAddress()); // Set organization attribute attributes.put(User.Attribute.ORGANIZATION, getModel().getOrganization()); // Set role attribute attributes.put(User.Attribute.ORGANIZATIONAL_ROLE, getModel().getOrganizationalRole()); }
[ "private", "void", "putUnrestrictedAttributes", "(", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "// Set full name attribute", "attributes", ".", "put", "(", "User", ".", "Attribute", ".", "FULL_NAME", ",", "getModel", "(", ")", ".", "get...
Stores all unrestricted (unprivileged) attributes within the given Map, pulling the values of those attributes from the underlying user model. If no value is yet defined for an attribute, that attribute will be set to null. @param attributes The Map to store all unrestricted attributes within.
[ "Stores", "all", "unrestricted", "(", "unprivileged", ")", "attributes", "within", "the", "given", "Map", "pulling", "the", "values", "of", "those", "attributes", "from", "the", "underlying", "user", "model", ".", "If", "no", "value", "is", "yet", "defined", ...
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java#L338-L352
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java
PersonGroupPersonsImpl.updateFaceWithServiceResponseAsync
public Observable<ServiceResponse<Void>> updateFaceWithServiceResponseAsync(String personGroupId, UUID personId, UUID persistedFaceId, UpdateFaceOptionalParameter updateFaceOptionalParameter) { if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (personGroupId == null) { throw new IllegalArgumentException("Parameter personGroupId is required and cannot be null."); } if (personId == null) { throw new IllegalArgumentException("Parameter personId is required and cannot be null."); } if (persistedFaceId == null) { throw new IllegalArgumentException("Parameter persistedFaceId is required and cannot be null."); } final String userData = updateFaceOptionalParameter != null ? updateFaceOptionalParameter.userData() : null; return updateFaceWithServiceResponseAsync(personGroupId, personId, persistedFaceId, userData); }
java
public Observable<ServiceResponse<Void>> updateFaceWithServiceResponseAsync(String personGroupId, UUID personId, UUID persistedFaceId, UpdateFaceOptionalParameter updateFaceOptionalParameter) { if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (personGroupId == null) { throw new IllegalArgumentException("Parameter personGroupId is required and cannot be null."); } if (personId == null) { throw new IllegalArgumentException("Parameter personId is required and cannot be null."); } if (persistedFaceId == null) { throw new IllegalArgumentException("Parameter persistedFaceId is required and cannot be null."); } final String userData = updateFaceOptionalParameter != null ? updateFaceOptionalParameter.userData() : null; return updateFaceWithServiceResponseAsync(personGroupId, personId, persistedFaceId, userData); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Void", ">", ">", "updateFaceWithServiceResponseAsync", "(", "String", "personGroupId", ",", "UUID", "personId", ",", "UUID", "persistedFaceId", ",", "UpdateFaceOptionalParameter", "updateFaceOptionalParameter", ")", "{...
Update a person persisted face's userData field. @param personGroupId Id referencing a particular person group. @param personId Id referencing a particular person. @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. @param updateFaceOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Update", "a", "person", "persisted", "face", "s", "userData", "field", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java#L1030-L1046
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/KeyVisualization.java
KeyVisualization.getPreferredColumns
protected static int getPreferredColumns(double width, double height, int numc, double maxwidth) { // Maximum width (compared to height) of labels - guess. // FIXME: do we really need to do this three-step computation? // Number of rows we'd use in a squared layout: final double rows = Math.ceil(FastMath.pow(numc * maxwidth, height / (width + height))); // Given this number of rows (plus one for header), use this many columns: return (int) Math.ceil(numc / (rows + 1)); }
java
protected static int getPreferredColumns(double width, double height, int numc, double maxwidth) { // Maximum width (compared to height) of labels - guess. // FIXME: do we really need to do this three-step computation? // Number of rows we'd use in a squared layout: final double rows = Math.ceil(FastMath.pow(numc * maxwidth, height / (width + height))); // Given this number of rows (plus one for header), use this many columns: return (int) Math.ceil(numc / (rows + 1)); }
[ "protected", "static", "int", "getPreferredColumns", "(", "double", "width", ",", "double", "height", ",", "int", "numc", ",", "double", "maxwidth", ")", "{", "// Maximum width (compared to height) of labels - guess.", "// FIXME: do we really need to do this three-step computat...
Compute the preferred number of columns. @param width Target width @param height Target height @param numc Number of clusters @param maxwidth Max width of entries @return Preferred number of columns
[ "Compute", "the", "preferred", "number", "of", "columns", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/visunproj/KeyVisualization.java#L130-L137
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java
ApplicationGatewaysInner.getByResourceGroup
public ApplicationGatewayInner getByResourceGroup(String resourceGroupName, String applicationGatewayName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().single().body(); }
java
public ApplicationGatewayInner getByResourceGroup(String resourceGroupName, String applicationGatewayName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().single().body(); }
[ "public", "ApplicationGatewayInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "applicationGatewayName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "applicationGatewayName", ")", ".", "toBlocki...
Gets the specified application gateway. @param resourceGroupName The name of the resource group. @param applicationGatewayName The name of the application gateway. @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 ApplicationGatewayInner object if successful.
[ "Gets", "the", "specified", "application", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L321-L323