repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/HttpCookie.java
HttpCookie.parseInternal
private static HttpCookie parseInternal(String header, boolean retainHeader) { HttpCookie cookie = null; String namevaluePair = null; StringTokenizer tokenizer = new StringTokenizer(header, ";"); // there should always have at least on name-value pair; // it's cookie's name try { namevaluePair = tokenizer.nextToken(); int index = namevaluePair.indexOf('='); if (index != -1) { String name = namevaluePair.substring(0, index).trim(); String value = namevaluePair.substring(index + 1).trim(); if (retainHeader) cookie = new HttpCookie(name, stripOffSurroundingQuote(value), header); else cookie = new HttpCookie(name, stripOffSurroundingQuote(value)); } else { // no "=" in name-value pair; it's an error throw new IllegalArgumentException("Invalid cookie name-value pair"); } } catch (NoSuchElementException ignored) { throw new IllegalArgumentException("Empty cookie header string"); } // remaining name-value pairs are cookie's attributes while (tokenizer.hasMoreTokens()) { namevaluePair = tokenizer.nextToken(); int index = namevaluePair.indexOf('='); String name, value; if (index != -1) { name = namevaluePair.substring(0, index).trim(); value = namevaluePair.substring(index + 1).trim(); } else { name = namevaluePair.trim(); value = null; } // assign attribute to cookie assignAttribute(cookie, name, value); } return cookie; }
java
private static HttpCookie parseInternal(String header, boolean retainHeader) { HttpCookie cookie = null; String namevaluePair = null; StringTokenizer tokenizer = new StringTokenizer(header, ";"); // there should always have at least on name-value pair; // it's cookie's name try { namevaluePair = tokenizer.nextToken(); int index = namevaluePair.indexOf('='); if (index != -1) { String name = namevaluePair.substring(0, index).trim(); String value = namevaluePair.substring(index + 1).trim(); if (retainHeader) cookie = new HttpCookie(name, stripOffSurroundingQuote(value), header); else cookie = new HttpCookie(name, stripOffSurroundingQuote(value)); } else { // no "=" in name-value pair; it's an error throw new IllegalArgumentException("Invalid cookie name-value pair"); } } catch (NoSuchElementException ignored) { throw new IllegalArgumentException("Empty cookie header string"); } // remaining name-value pairs are cookie's attributes while (tokenizer.hasMoreTokens()) { namevaluePair = tokenizer.nextToken(); int index = namevaluePair.indexOf('='); String name, value; if (index != -1) { name = namevaluePair.substring(0, index).trim(); value = namevaluePair.substring(index + 1).trim(); } else { name = namevaluePair.trim(); value = null; } // assign attribute to cookie assignAttribute(cookie, name, value); } return cookie; }
[ "private", "static", "HttpCookie", "parseInternal", "(", "String", "header", ",", "boolean", "retainHeader", ")", "{", "HttpCookie", "cookie", "=", "null", ";", "String", "namevaluePair", "=", "null", ";", "StringTokenizer", "tokenizer", "=", "new", "StringTokeniz...
/* Parse header string to cookie object. @param header header string; should contain only one NAME=VALUE pair @return an HttpCookie being extracted @throws IllegalArgumentException if header string violates the cookie specification
[ "/", "*", "Parse", "header", "string", "to", "cookie", "object", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/HttpCookie.java#L975-L1024
knowm/XChange
xchange-mercadobitcoin/src/main/java/org/knowm/xchange/mercadobitcoin/service/MercadoBitcoinTradeService.java
MercadoBitcoinTradeService.placeLimitOrder
@Override public String placeLimitOrder(LimitOrder limitOrder) throws IOException { String pair; if (limitOrder.getCurrencyPair().equals(CurrencyPair.BTC_BRL)) { pair = "btc_brl"; } else if (limitOrder.getCurrencyPair().equals(new CurrencyPair(Currency.LTC, Currency.BRL))) { pair = "ltc_brl"; } else { throw new NotAvailableFromExchangeException(); } String type; if (limitOrder.getType() == Order.OrderType.BID) { type = "buy"; } else { type = "sell"; } MercadoBitcoinBaseTradeApiResult<MercadoBitcoinPlaceLimitOrderResult> newOrderResult = mercadoBitcoinPlaceLimitOrder( pair, type, limitOrder.getOriginalAmount(), limitOrder.getLimitPrice()); return MercadoBitcoinUtils.makeMercadoBitcoinOrderId( limitOrder.getCurrencyPair(), newOrderResult.getTheReturn().keySet().iterator().next()); }
java
@Override public String placeLimitOrder(LimitOrder limitOrder) throws IOException { String pair; if (limitOrder.getCurrencyPair().equals(CurrencyPair.BTC_BRL)) { pair = "btc_brl"; } else if (limitOrder.getCurrencyPair().equals(new CurrencyPair(Currency.LTC, Currency.BRL))) { pair = "ltc_brl"; } else { throw new NotAvailableFromExchangeException(); } String type; if (limitOrder.getType() == Order.OrderType.BID) { type = "buy"; } else { type = "sell"; } MercadoBitcoinBaseTradeApiResult<MercadoBitcoinPlaceLimitOrderResult> newOrderResult = mercadoBitcoinPlaceLimitOrder( pair, type, limitOrder.getOriginalAmount(), limitOrder.getLimitPrice()); return MercadoBitcoinUtils.makeMercadoBitcoinOrderId( limitOrder.getCurrencyPair(), newOrderResult.getTheReturn().keySet().iterator().next()); }
[ "@", "Override", "public", "String", "placeLimitOrder", "(", "LimitOrder", "limitOrder", ")", "throws", "IOException", "{", "String", "pair", ";", "if", "(", "limitOrder", ".", "getCurrencyPair", "(", ")", ".", "equals", "(", "CurrencyPair", ".", "BTC_BRL", ")...
The result is not the pure order id. It is a composition with the currency pair and the order id (the same format used as parameter of {@link #cancelOrder}). Please see {@link org.knowm.xchange.mercadobitcoin.MercadoBitcoinUtils#makeMercadoBitcoinOrderId} .
[ "The", "result", "is", "not", "the", "pure", "order", "id", ".", "It", "is", "a", "composition", "with", "the", "currency", "pair", "and", "the", "order", "id", "(", "the", "same", "format", "used", "as", "parameter", "of", "{" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-mercadobitcoin/src/main/java/org/knowm/xchange/mercadobitcoin/service/MercadoBitcoinTradeService.java#L82-L109
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/las/index/strtree/STRtreeJGT.java
STRtreeJGT.nearestNeighbour
public Object nearestNeighbour( Envelope env, Object item, ItemDistance itemDist ) { Boundable bnd = new ItemBoundable(env, item); BoundablePair bp = new BoundablePair(this.getRoot(), bnd, itemDist); return nearestNeighbour(bp)[0]; }
java
public Object nearestNeighbour( Envelope env, Object item, ItemDistance itemDist ) { Boundable bnd = new ItemBoundable(env, item); BoundablePair bp = new BoundablePair(this.getRoot(), bnd, itemDist); return nearestNeighbour(bp)[0]; }
[ "public", "Object", "nearestNeighbour", "(", "Envelope", "env", ",", "Object", "item", ",", "ItemDistance", "itemDist", ")", "{", "Boundable", "bnd", "=", "new", "ItemBoundable", "(", "env", ",", "item", ")", ";", "BoundablePair", "bp", "=", "new", "Boundabl...
Finds the item in this tree which is nearest to the given {@link Object}, using {@link org.locationtech.jts.index.strtree.ItemDistance} as the distance metric. A Branch-and-Bound tree traversal algorithm is used to provide an efficient search. <p> The query <tt>object</tt> does <b>not</b> have to be contained in the tree, but it does have to be compatible with the <tt>itemDist</tt> distance metric. @param env the envelope of the query item @param item the item to find the nearest neighbour of @param itemDist a distance metric applicable to the items in this tree and the query item @return the nearest item in this tree
[ "Finds", "the", "item", "in", "this", "tree", "which", "is", "nearest", "to", "the", "given", "{", "@link", "Object", "}", "using", "{", "@link", "org", ".", "locationtech", ".", "jts", ".", "index", ".", "strtree", ".", "ItemDistance", "}", "as", "the...
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/las/index/strtree/STRtreeJGT.java#L306-L310
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java
DocTreeScanner.visitHidden
@Override public R visitHidden(HiddenTree node, P p) { return scan(node.getBody(), p); }
java
@Override public R visitHidden(HiddenTree node, P p) { return scan(node.getBody(), p); }
[ "@", "Override", "public", "R", "visitHidden", "(", "HiddenTree", "node", ",", "P", "p", ")", "{", "return", "scan", "(", "node", ".", "getBody", "(", ")", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L244-L247
Alluxio/alluxio
core/server/common/src/main/java/alluxio/master/journal/MasterJournalContext.java
MasterJournalContext.waitForJournalFlush
private void waitForJournalFlush() throws UnavailableException { if (mFlushCounter == INVALID_FLUSH_COUNTER) { // Check this before the precondition. return; } RetryPolicy retry = new TimeoutRetry(FLUSH_RETRY_TIMEOUT_MS, FLUSH_RETRY_INTERVAL_MS); while (retry.attempt()) { try { mAsyncJournalWriter.flush(mFlushCounter); return; } catch (IOException e) { LOG.warn("Journal flush failed. retrying...", e); } catch (JournalClosedException e) { throw new UnavailableException(String.format("Failed to complete request: %s", e.getMessage()), e); } catch (Throwable e) { ProcessUtils.fatalError(LOG, e, "Journal flush failed"); } } ProcessUtils.fatalError(LOG, "Journal flush failed after %d attempts", retry.getAttemptCount()); }
java
private void waitForJournalFlush() throws UnavailableException { if (mFlushCounter == INVALID_FLUSH_COUNTER) { // Check this before the precondition. return; } RetryPolicy retry = new TimeoutRetry(FLUSH_RETRY_TIMEOUT_MS, FLUSH_RETRY_INTERVAL_MS); while (retry.attempt()) { try { mAsyncJournalWriter.flush(mFlushCounter); return; } catch (IOException e) { LOG.warn("Journal flush failed. retrying...", e); } catch (JournalClosedException e) { throw new UnavailableException(String.format("Failed to complete request: %s", e.getMessage()), e); } catch (Throwable e) { ProcessUtils.fatalError(LOG, e, "Journal flush failed"); } } ProcessUtils.fatalError(LOG, "Journal flush failed after %d attempts", retry.getAttemptCount()); }
[ "private", "void", "waitForJournalFlush", "(", ")", "throws", "UnavailableException", "{", "if", "(", "mFlushCounter", "==", "INVALID_FLUSH_COUNTER", ")", "{", "// Check this before the precondition.", "return", ";", "}", "RetryPolicy", "retry", "=", "new", "TimeoutRetr...
Waits for the flush counter to be flushed to the journal. If the counter is {@link #INVALID_FLUSH_COUNTER}, this is a noop.
[ "Waits", "for", "the", "flush", "counter", "to", "be", "flushed", "to", "the", "journal", ".", "If", "the", "counter", "is", "{" ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/MasterJournalContext.java#L66-L87
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/misc/ImplCommonOps_DSCC.java
ImplCommonOps_DSCC.addColAppend
public static void addColAppend(double alpha, DMatrixSparseCSC A, int colA, double beta, DMatrixSparseCSC B, int colB, DMatrixSparseCSC C, @Nullable IGrowArray gw) { if( A.numRows != B.numRows || A.numRows != C.numRows) throw new IllegalArgumentException("Number of rows in A, B, and C do not match"); int idxA0 = A.col_idx[colA]; int idxA1 = A.col_idx[colA+1]; int idxB0 = B.col_idx[colB]; int idxB1 = B.col_idx[colB+1]; C.growMaxColumns(++C.numCols,true); C.growMaxLength(C.nz_length+idxA1-idxA0+idxB1-idxB0,true); int []w = adjust(gw,A.numRows); Arrays.fill(w,0,A.numRows,-1); for (int i = idxA0; i < idxA1; i++) { int row = A.nz_rows[i]; C.nz_rows[C.nz_length] = row; C.nz_values[C.nz_length] = alpha*A.nz_values[i]; w[row] = C.nz_length++; } for (int i = idxB0; i < idxB1; i++) { int row = B.nz_rows[i]; if( w[row] != -1 ) { C.nz_values[w[row]] += beta*B.nz_values[i]; } else { C.nz_values[C.nz_length] = beta*B.nz_values[i]; C.nz_rows[C.nz_length++] = row; } } C.col_idx[C.numCols] = C.nz_length; }
java
public static void addColAppend(double alpha, DMatrixSparseCSC A, int colA, double beta, DMatrixSparseCSC B, int colB, DMatrixSparseCSC C, @Nullable IGrowArray gw) { if( A.numRows != B.numRows || A.numRows != C.numRows) throw new IllegalArgumentException("Number of rows in A, B, and C do not match"); int idxA0 = A.col_idx[colA]; int idxA1 = A.col_idx[colA+1]; int idxB0 = B.col_idx[colB]; int idxB1 = B.col_idx[colB+1]; C.growMaxColumns(++C.numCols,true); C.growMaxLength(C.nz_length+idxA1-idxA0+idxB1-idxB0,true); int []w = adjust(gw,A.numRows); Arrays.fill(w,0,A.numRows,-1); for (int i = idxA0; i < idxA1; i++) { int row = A.nz_rows[i]; C.nz_rows[C.nz_length] = row; C.nz_values[C.nz_length] = alpha*A.nz_values[i]; w[row] = C.nz_length++; } for (int i = idxB0; i < idxB1; i++) { int row = B.nz_rows[i]; if( w[row] != -1 ) { C.nz_values[w[row]] += beta*B.nz_values[i]; } else { C.nz_values[C.nz_length] = beta*B.nz_values[i]; C.nz_rows[C.nz_length++] = row; } } C.col_idx[C.numCols] = C.nz_length; }
[ "public", "static", "void", "addColAppend", "(", "double", "alpha", ",", "DMatrixSparseCSC", "A", ",", "int", "colA", ",", "double", "beta", ",", "DMatrixSparseCSC", "B", ",", "int", "colB", ",", "DMatrixSparseCSC", "C", ",", "@", "Nullable", "IGrowArray", "...
Adds the results of adding a column in A and B as a new column in C.<br> C(:,end+1) = &alpha;*A(:,colA) + &beta;*B(:,colB) @param alpha scalar @param A matrix @param colA column in A @param beta scalar @param B matrix @param colB column in B @param C Column in C @param gw workspace
[ "Adds", "the", "results", "of", "adding", "a", "column", "in", "A", "and", "B", "as", "a", "new", "column", "in", "C", ".", "<br", ">", "C", "(", ":", "end", "+", "1", ")", "=", "&alpha", ";", "*", "A", "(", ":", "colA", ")", "+", "&beta", ...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/misc/ImplCommonOps_DSCC.java#L132-L166
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.putRatingProviderArg
public static void putRatingProviderArg(String key, String value) { try { if (ApptentiveInternal.isApptentiveRegistered()) { ApptentiveInternal.getInstance().putRatingProviderArg(key, value); } } catch (Exception e) { ApptentiveLog.e(CONVERSATION, e, "Exception while putting rating provider arg"); logException(e); } }
java
public static void putRatingProviderArg(String key, String value) { try { if (ApptentiveInternal.isApptentiveRegistered()) { ApptentiveInternal.getInstance().putRatingProviderArg(key, value); } } catch (Exception e) { ApptentiveLog.e(CONVERSATION, e, "Exception while putting rating provider arg"); logException(e); } }
[ "public", "static", "void", "putRatingProviderArg", "(", "String", "key", ",", "String", "value", ")", "{", "try", "{", "if", "(", "ApptentiveInternal", ".", "isApptentiveRegistered", "(", ")", ")", "{", "ApptentiveInternal", ".", "getInstance", "(", ")", ".",...
If there are any properties that your {@link IRatingProvider} implementation requires, populate them here. This is not currently needed with the Google Play and Amazon Appstore IRatingProviders. @param key A String @param value A String
[ "If", "there", "are", "any", "properties", "that", "your", "{", "@link", "IRatingProvider", "}", "implementation", "requires", "populate", "them", "here", ".", "This", "is", "not", "currently", "needed", "with", "the", "Google", "Play", "and", "Amazon", "Appst...
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L875-L884
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java
DefaultRedirectResolver.redirectMatches
protected boolean redirectMatches(String requestedRedirect, String redirectUri) { UriComponents requestedRedirectUri = UriComponentsBuilder.fromUriString(requestedRedirect).build(); UriComponents registeredRedirectUri = UriComponentsBuilder.fromUriString(redirectUri).build(); boolean schemeMatch = isEqual(registeredRedirectUri.getScheme(), requestedRedirectUri.getScheme()); boolean userInfoMatch = isEqual(registeredRedirectUri.getUserInfo(), requestedRedirectUri.getUserInfo()); boolean hostMatch = hostMatches(registeredRedirectUri.getHost(), requestedRedirectUri.getHost()); boolean portMatch = matchPorts ? registeredRedirectUri.getPort() == requestedRedirectUri.getPort() : true; boolean pathMatch = isEqual(registeredRedirectUri.getPath(), StringUtils.cleanPath(requestedRedirectUri.getPath())); boolean queryParamMatch = matchQueryParams(registeredRedirectUri.getQueryParams(), requestedRedirectUri.getQueryParams()); return schemeMatch && userInfoMatch && hostMatch && portMatch && pathMatch && queryParamMatch; }
java
protected boolean redirectMatches(String requestedRedirect, String redirectUri) { UriComponents requestedRedirectUri = UriComponentsBuilder.fromUriString(requestedRedirect).build(); UriComponents registeredRedirectUri = UriComponentsBuilder.fromUriString(redirectUri).build(); boolean schemeMatch = isEqual(registeredRedirectUri.getScheme(), requestedRedirectUri.getScheme()); boolean userInfoMatch = isEqual(registeredRedirectUri.getUserInfo(), requestedRedirectUri.getUserInfo()); boolean hostMatch = hostMatches(registeredRedirectUri.getHost(), requestedRedirectUri.getHost()); boolean portMatch = matchPorts ? registeredRedirectUri.getPort() == requestedRedirectUri.getPort() : true; boolean pathMatch = isEqual(registeredRedirectUri.getPath(), StringUtils.cleanPath(requestedRedirectUri.getPath())); boolean queryParamMatch = matchQueryParams(registeredRedirectUri.getQueryParams(), requestedRedirectUri.getQueryParams()); return schemeMatch && userInfoMatch && hostMatch && portMatch && pathMatch && queryParamMatch; }
[ "protected", "boolean", "redirectMatches", "(", "String", "requestedRedirect", ",", "String", "redirectUri", ")", "{", "UriComponents", "requestedRedirectUri", "=", "UriComponentsBuilder", ".", "fromUriString", "(", "requestedRedirect", ")", ".", "build", "(", ")", ";...
Whether the requested redirect URI "matches" the specified redirect URI. For a URL, this implementation tests if the user requested redirect starts with the registered redirect, so it would have the same host and root path if it is an HTTP URL. The port, userinfo, query params also matched. Request redirect uri path can include additional parameters which are ignored for the match <p> For other (non-URL) cases, such as for some implicit clients, the redirect_uri must be an exact match. @param requestedRedirect The requested redirect URI. @param redirectUri The registered redirect URI. @return Whether the requested redirect URI "matches" the specified redirect URI.
[ "Whether", "the", "requested", "redirect", "URI", "matches", "the", "specified", "redirect", "URI", ".", "For", "a", "URL", "this", "implementation", "tests", "if", "the", "user", "requested", "redirect", "starts", "with", "the", "registered", "redirect", "so", ...
train
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java#L120-L134
jmeetsma/Iglu-Http
src/main/java/org/ijsberg/iglu/server/http/filter/WebAppEntryPoint.java
WebAppEntryPoint.storeSessionDataInCookie
public static void storeSessionDataInCookie(String key, String value, ServletResponse response) { Cookie cookie = new Cookie(key, value); cookie.setPath("/"); cookie.setMaxAge(-1);//expire when browser closes ((HttpServletResponse) response).addCookie(cookie); }
java
public static void storeSessionDataInCookie(String key, String value, ServletResponse response) { Cookie cookie = new Cookie(key, value); cookie.setPath("/"); cookie.setMaxAge(-1);//expire when browser closes ((HttpServletResponse) response).addCookie(cookie); }
[ "public", "static", "void", "storeSessionDataInCookie", "(", "String", "key", ",", "String", "value", ",", "ServletResponse", "response", ")", "{", "Cookie", "cookie", "=", "new", "Cookie", "(", "key", ",", "value", ")", ";", "cookie", ".", "setPath", "(", ...
Stores session id in the root of a cookie The cookie will expire as soon as the browser closes @param key @param value @param response
[ "Stores", "session", "id", "in", "the", "root", "of", "a", "cookie", "The", "cookie", "will", "expire", "as", "soon", "as", "the", "browser", "closes" ]
train
https://github.com/jmeetsma/Iglu-Http/blob/5b5ed3b417285dc79b7aa013bf2340bb5ba1ffbe/src/main/java/org/ijsberg/iglu/server/http/filter/WebAppEntryPoint.java#L162-L168
eBay/xcelite
src/main/java/com/ebay/xcelite/Xcelite.java
Xcelite.getSheet
public XceliteSheet getSheet(String sheetName) { Sheet sheet = workbook.getSheet(sheetName); if (sheet == null) { throw new XceliteException(String.format("Could not find sheet named \"%s\"", sheetName)); } return new XceliteSheetImpl(sheet, file); }
java
public XceliteSheet getSheet(String sheetName) { Sheet sheet = workbook.getSheet(sheetName); if (sheet == null) { throw new XceliteException(String.format("Could not find sheet named \"%s\"", sheetName)); } return new XceliteSheetImpl(sheet, file); }
[ "public", "XceliteSheet", "getSheet", "(", "String", "sheetName", ")", "{", "Sheet", "sheet", "=", "workbook", ".", "getSheet", "(", "sheetName", ")", ";", "if", "(", "sheet", "==", "null", ")", "{", "throw", "new", "XceliteException", "(", "String", ".", ...
Gets the sheet with the specified index. @param sheetIndex the sheet name @return XceliteSheet object
[ "Gets", "the", "sheet", "with", "the", "specified", "index", "." ]
train
https://github.com/eBay/xcelite/blob/0362f4cf9c5b8dee73e8ec00a860f0fef0f0c2e1/src/main/java/com/ebay/xcelite/Xcelite.java#L99-L105
epam/parso
src/main/java/com/epam/parso/impl/SasFileParser.java
SasFileParser.bytesToString
private String bytesToString(byte[] bytes, int offset, int length) throws UnsupportedEncodingException, StringIndexOutOfBoundsException { return new String(bytes, offset, length, encoding); }
java
private String bytesToString(byte[] bytes, int offset, int length) throws UnsupportedEncodingException, StringIndexOutOfBoundsException { return new String(bytes, offset, length, encoding); }
[ "private", "String", "bytesToString", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "length", ")", "throws", "UnsupportedEncodingException", ",", "StringIndexOutOfBoundsException", "{", "return", "new", "String", "(", "bytes", ",", "offset", ...
The function to convert a sub-range of an array of bytes into a string. @param bytes a string represented by an array of bytes. @param offset the initial offset @param length the length @return the conversion result string. @throws UnsupportedEncodingException when unknown encoding. @throws StringIndexOutOfBoundsException when invalid offset and/or length.
[ "The", "function", "to", "convert", "a", "sub", "-", "range", "of", "an", "array", "of", "bytes", "into", "a", "string", "." ]
train
https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L886-L889
casmi/casmi
src/main/java/casmi/image/Image.java
Image.setColor
public final void setColor(Color color, int x, int y) { int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); int red = (int)(color.getRed() * 255.0); int green = (int)(color.getGreen() * 255.0); int blue = (int)(color.getBlue() * 255.0); int alpha = (int)(color.getAlpha() * 255.0); pixels[x + y * width] = alpha << 24 | red << 16 | green << 8 | blue; }
java
public final void setColor(Color color, int x, int y) { int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); int red = (int)(color.getRed() * 255.0); int green = (int)(color.getGreen() * 255.0); int blue = (int)(color.getBlue() * 255.0); int alpha = (int)(color.getAlpha() * 255.0); pixels[x + y * width] = alpha << 24 | red << 16 | green << 8 | blue; }
[ "public", "final", "void", "setColor", "(", "Color", "color", ",", "int", "x", ",", "int", "y", ")", "{", "int", "[", "]", "pixels", "=", "(", "(", "DataBufferInt", ")", "img", ".", "getRaster", "(", ")", ".", "getDataBuffer", "(", ")", ")", ".", ...
Sets the color value of the pixel data in this Image. @param color <<<<<<< HEAD The color value of the pixel. ======= The color value of the pixel. >>>>>>> 16121fd9fe4eeaef3cb56619769a3119a9e6531a @param x The x-coordinate of the pixel. @param y The y-coordinate of the pixel.
[ "Sets", "the", "color", "value", "of", "the", "pixel", "data", "in", "this", "Image", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/image/Image.java#L360-L370
alkacon/opencms-core
src/org/opencms/importexport/CmsImportVersion5.java
CmsImportVersion5.importRelations
protected void importRelations(CmsResource resource, Element parentElement) { // Get the nodes for the relations @SuppressWarnings("unchecked") List<Node> relationElements = parentElement.selectNodes( "./" + A_CmsImport.N_RELATIONS + "/" + A_CmsImport.N_RELATION); List<CmsRelation> relations = new ArrayList<CmsRelation>(); // iterate over the nodes Iterator<Node> itRelations = relationElements.iterator(); while (itRelations.hasNext()) { Element relationElement = (Element)itRelations.next(); String structureID = getChildElementTextValue(relationElement, A_CmsImport.N_RELATION_ATTRIBUTE_ID); String targetPath = getChildElementTextValue(relationElement, A_CmsImport.N_RELATION_ATTRIBUTE_PATH); String relationType = getChildElementTextValue(relationElement, A_CmsImport.N_RELATION_ATTRIBUTE_TYPE); CmsUUID targetId = new CmsUUID(structureID); CmsRelationType type = CmsRelationType.valueOf(relationType); CmsRelation relation = new CmsRelation( resource.getStructureId(), resource.getRootPath(), targetId, targetPath, type); relations.add(relation); } if (!relations.isEmpty()) { m_importedRelations.put(resource.getRootPath(), relations); } }
java
protected void importRelations(CmsResource resource, Element parentElement) { // Get the nodes for the relations @SuppressWarnings("unchecked") List<Node> relationElements = parentElement.selectNodes( "./" + A_CmsImport.N_RELATIONS + "/" + A_CmsImport.N_RELATION); List<CmsRelation> relations = new ArrayList<CmsRelation>(); // iterate over the nodes Iterator<Node> itRelations = relationElements.iterator(); while (itRelations.hasNext()) { Element relationElement = (Element)itRelations.next(); String structureID = getChildElementTextValue(relationElement, A_CmsImport.N_RELATION_ATTRIBUTE_ID); String targetPath = getChildElementTextValue(relationElement, A_CmsImport.N_RELATION_ATTRIBUTE_PATH); String relationType = getChildElementTextValue(relationElement, A_CmsImport.N_RELATION_ATTRIBUTE_TYPE); CmsUUID targetId = new CmsUUID(structureID); CmsRelationType type = CmsRelationType.valueOf(relationType); CmsRelation relation = new CmsRelation( resource.getStructureId(), resource.getRootPath(), targetId, targetPath, type); relations.add(relation); } if (!relations.isEmpty()) { m_importedRelations.put(resource.getRootPath(), relations); } }
[ "protected", "void", "importRelations", "(", "CmsResource", "resource", ",", "Element", "parentElement", ")", "{", "// Get the nodes for the relations", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "List", "<", "Node", ">", "relationElements", "=", "parentElement...
Reads all the relations of the resource from the <code>manifest.xml</code> file and adds them to the according resource.<p> @param resource the resource to import the relations for @param parentElement the current element
[ "Reads", "all", "the", "relations", "of", "the", "resource", "from", "the", "<code", ">", "manifest", ".", "xml<", "/", "code", ">", "file", "and", "adds", "them", "to", "the", "according", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportVersion5.java#L300-L331
jpelzer/pelzer-spring
src/main/java/com/pelzer/util/spring/SpringUtil.java
SpringUtil.getSpringBean
public static <T> T getSpringBean(final Class<T> beanClass){ return getSpringBean(SpringUtilConstants.CONTEXT_DEFINITION, beanClass); }
java
public static <T> T getSpringBean(final Class<T> beanClass){ return getSpringBean(SpringUtilConstants.CONTEXT_DEFINITION, beanClass); }
[ "public", "static", "<", "T", ">", "T", "getSpringBean", "(", "final", "Class", "<", "T", ">", "beanClass", ")", "{", "return", "getSpringBean", "(", "SpringUtilConstants", ".", "CONTEXT_DEFINITION", ",", "beanClass", ")", ";", "}" ]
Takes the given beanClass (which is probably an interface) and requests that Spring instantiate a bean for that class. The underlying mechanism is specific to us, in that we expect the beanClass to have a static String 'BEAN_NAME', which we will then pass to Spring to get our bean. <p> <b>WARNING</b> YOU MAY ONLY CALL THIS METHOD ONCE!<br> The reason for this is that you should only be entering Spring from one direction, so if you call this twice, you're not following that advice. Instead, you should call SpringUtil.{@link #getInstance()}. {@link #getBean(Class)} @throws org.springframework.beans.BeansException If there is a problem loading the bean, if it does not have a 'BEAN_NAME' property, or if you call this method a second time.
[ "Takes", "the", "given", "beanClass", "(", "which", "is", "probably", "an", "interface", ")", "and", "requests", "that", "Spring", "instantiate", "a", "bean", "for", "that", "class", ".", "The", "underlying", "mechanism", "is", "specific", "to", "us", "in", ...
train
https://github.com/jpelzer/pelzer-spring/blob/b5bd9877df244d9092df01c12d81e7b35d438c57/src/main/java/com/pelzer/util/spring/SpringUtil.java#L54-L56
alkacon/opencms-core
src/org/opencms/publish/CmsPublishManager.java
CmsPublishManager.publishResource
public CmsUUID publishResource(CmsObject cms, String resourcename) throws Exception { return publishResource(cms, resourcename, false, new CmsShellReport(cms.getRequestContext().getLocale())); }
java
public CmsUUID publishResource(CmsObject cms, String resourcename) throws Exception { return publishResource(cms, resourcename, false, new CmsShellReport(cms.getRequestContext().getLocale())); }
[ "public", "CmsUUID", "publishResource", "(", "CmsObject", "cms", ",", "String", "resourcename", ")", "throws", "Exception", "{", "return", "publishResource", "(", "cms", ",", "resourcename", ",", "false", ",", "new", "CmsShellReport", "(", "cms", ".", "getReques...
Publishes a single resource, printing messages to a shell report.<p> The siblings of the resource will not be published.<p> @param cms the cms request context @param resourcename the name of the resource to be published @return the publish history id of the published project @throws Exception if something goes wrong @see CmsShellReport
[ "Publishes", "a", "single", "resource", "printing", "messages", "to", "a", "shell", "report", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/publish/CmsPublishManager.java#L603-L606
googlegenomics/dataflow-java
src/main/java/com/google/cloud/genomics/dataflow/functions/ibs/SharedAllelesRatioCalculator.java
SharedAllelesRatioCalculator.similarity
@Override public double similarity(VariantCall call1, VariantCall call2) { int minNumberOfGenotypes = Math.min(call1.getGenotypeCount(), call2.getGenotypeCount()); int numberOfSharedAlleles = 0; for (int i = 0; i < minNumberOfGenotypes; ++i) { if (call1.getGenotype(i) == call2.getGenotype(i)) { ++numberOfSharedAlleles; } } int maxNumberOfGenotypes = Math.max(call1.getGenotypeCount(), call2.getGenotypeCount()); return (double) numberOfSharedAlleles / maxNumberOfGenotypes; }
java
@Override public double similarity(VariantCall call1, VariantCall call2) { int minNumberOfGenotypes = Math.min(call1.getGenotypeCount(), call2.getGenotypeCount()); int numberOfSharedAlleles = 0; for (int i = 0; i < minNumberOfGenotypes; ++i) { if (call1.getGenotype(i) == call2.getGenotype(i)) { ++numberOfSharedAlleles; } } int maxNumberOfGenotypes = Math.max(call1.getGenotypeCount(), call2.getGenotypeCount()); return (double) numberOfSharedAlleles / maxNumberOfGenotypes; }
[ "@", "Override", "public", "double", "similarity", "(", "VariantCall", "call1", ",", "VariantCall", "call2", ")", "{", "int", "minNumberOfGenotypes", "=", "Math", ".", "min", "(", "call1", ".", "getGenotypeCount", "(", ")", ",", "call2", ".", "getGenotypeCount...
scores when the number of alleles is different than 2 and when the genotypes are unphased.
[ "scores", "when", "the", "number", "of", "alleles", "is", "different", "than", "2", "and", "when", "the", "genotypes", "are", "unphased", "." ]
train
https://github.com/googlegenomics/dataflow-java/blob/ef2c56ed1a6397843c55102748b8c2b12aaa4772/src/main/java/com/google/cloud/genomics/dataflow/functions/ibs/SharedAllelesRatioCalculator.java#L29-L40
h2oai/h2o-2
src/main/java/hex/deeplearning/DeepLearning.java
DeepLearning.reBalance
private Frame reBalance(final Frame fr, boolean local) { int chunks = (int)Math.min( 4 * H2O.NUMCPUS * (local ? 1 : H2O.CLOUD.size()), fr.numRows()); if (fr.anyVec().nChunks() > chunks && !reproducible) { Log.info("Dataset already contains " + fr.anyVec().nChunks() + " chunks. No need to rebalance."); return fr; } else if (reproducible) { Log.warn("Reproducibility enforced - using only 1 thread - can be slow."); chunks = 1; } if (!quiet_mode) Log.info("ReBalancing dataset into (at least) " + chunks + " chunks."); // return MRUtils.shuffleAndBalance(fr, chunks, seed, local, shuffle_training_data); String snewKey = fr._key != null ? (fr._key.toString() + ".balanced") : Key.rand(); Key newKey = Key.makeSystem(snewKey); RebalanceDataSet rb = new RebalanceDataSet(fr, newKey, chunks); H2O.submitTask(rb); rb.join(); return UKV.get(newKey); }
java
private Frame reBalance(final Frame fr, boolean local) { int chunks = (int)Math.min( 4 * H2O.NUMCPUS * (local ? 1 : H2O.CLOUD.size()), fr.numRows()); if (fr.anyVec().nChunks() > chunks && !reproducible) { Log.info("Dataset already contains " + fr.anyVec().nChunks() + " chunks. No need to rebalance."); return fr; } else if (reproducible) { Log.warn("Reproducibility enforced - using only 1 thread - can be slow."); chunks = 1; } if (!quiet_mode) Log.info("ReBalancing dataset into (at least) " + chunks + " chunks."); // return MRUtils.shuffleAndBalance(fr, chunks, seed, local, shuffle_training_data); String snewKey = fr._key != null ? (fr._key.toString() + ".balanced") : Key.rand(); Key newKey = Key.makeSystem(snewKey); RebalanceDataSet rb = new RebalanceDataSet(fr, newKey, chunks); H2O.submitTask(rb); rb.join(); return UKV.get(newKey); }
[ "private", "Frame", "reBalance", "(", "final", "Frame", "fr", ",", "boolean", "local", ")", "{", "int", "chunks", "=", "(", "int", ")", "Math", ".", "min", "(", "4", "*", "H2O", ".", "NUMCPUS", "*", "(", "local", "?", "1", ":", "H2O", ".", "CLOUD...
Rebalance a frame for load balancing @param fr Input frame @param local whether to only create enough chunks to max out all cores on one node only @return Frame that has potentially more chunks
[ "Rebalance", "a", "frame", "for", "load", "balancing" ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/deeplearning/DeepLearning.java#L1179-L1196
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/util/ShareSheetStyle.java
ShareSheetStyle.setCopyUrlStyle
public ShareSheetStyle setCopyUrlStyle(Drawable icon, String label, String message) { copyUrlIcon_ = icon; copyURlText_ = label; urlCopiedMessage_ = message; return this; }
java
public ShareSheetStyle setCopyUrlStyle(Drawable icon, String label, String message) { copyUrlIcon_ = icon; copyURlText_ = label; urlCopiedMessage_ = message; return this; }
[ "public", "ShareSheetStyle", "setCopyUrlStyle", "(", "Drawable", "icon", ",", "String", "label", ",", "String", "message", ")", "{", "copyUrlIcon_", "=", "icon", ";", "copyURlText_", "=", "label", ";", "urlCopiedMessage_", "=", "message", ";", "return", "this", ...
<p> Set the icon, label and success message for copy url option. Default label is "Copy link".</p> @param icon Drawable to set as the icon for copy url option. Default icon is system menu_save icon @param label A {@link String} with value for the copy url option label. Default label is "Copy link" @param message A {@link String} with value for a toast message displayed on copying a url. Default message is "Copied link to clipboard!" @return This object to allow method chaining
[ "<p", ">", "Set", "the", "icon", "label", "and", "success", "message", "for", "copy", "url", "option", ".", "Default", "label", "is", "Copy", "link", ".", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/util/ShareSheetStyle.java#L120-L125
alkacon/opencms-core
src/org/opencms/main/CmsShellCommands.java
CmsShellCommands.setIndexRebuildMode
public void setIndexRebuildMode(String searchIndex, String mode) { I_CmsSearchIndex index = OpenCms.getSearchManager().getIndex(searchIndex); if (index != null) { index.setRebuildMode(mode); // required for this setting to take effect OpenCms.getSearchManager().initOfflineIndexes(); } }
java
public void setIndexRebuildMode(String searchIndex, String mode) { I_CmsSearchIndex index = OpenCms.getSearchManager().getIndex(searchIndex); if (index != null) { index.setRebuildMode(mode); // required for this setting to take effect OpenCms.getSearchManager().initOfflineIndexes(); } }
[ "public", "void", "setIndexRebuildMode", "(", "String", "searchIndex", ",", "String", "mode", ")", "{", "I_CmsSearchIndex", "index", "=", "OpenCms", ".", "getSearchManager", "(", ")", ".", "getIndex", "(", "searchIndex", ")", ";", "if", "(", "index", "!=", "...
Sets the rebuild mode for the requested index. Allowing to disable indexing during module import.<p> This setting will not be written to the XML configuration file and will only take effect within the current shell instance.<p> @param searchIndex the search index @param mode the rebuild mode to set
[ "Sets", "the", "rebuild", "mode", "for", "the", "requested", "index", ".", "Allowing", "to", "disable", "indexing", "during", "module", "import", ".", "<p", ">", "This", "setting", "will", "not", "be", "written", "to", "the", "XML", "configuration", "file", ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L1505-L1513
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_OffSetCurve.java
ST_OffSetCurve.geometryOffSetCurve
public static void geometryOffSetCurve(ArrayList<LineString> list, Geometry geometry, double offset, BufferParameters bufferParameters) { final List curves = new OffsetCurveSetBuilder(geometry, offset, new OffsetCurveBuilder(geometry.getFactory().getPrecisionModel(), bufferParameters)).getCurves(); final Iterator<SegmentString> iterator = curves.iterator(); while (iterator.hasNext()) { list.add(geometry.getFactory().createLineString(iterator.next().getCoordinates())); } }
java
public static void geometryOffSetCurve(ArrayList<LineString> list, Geometry geometry, double offset, BufferParameters bufferParameters) { final List curves = new OffsetCurveSetBuilder(geometry, offset, new OffsetCurveBuilder(geometry.getFactory().getPrecisionModel(), bufferParameters)).getCurves(); final Iterator<SegmentString> iterator = curves.iterator(); while (iterator.hasNext()) { list.add(geometry.getFactory().createLineString(iterator.next().getCoordinates())); } }
[ "public", "static", "void", "geometryOffSetCurve", "(", "ArrayList", "<", "LineString", ">", "list", ",", "Geometry", "geometry", ",", "double", "offset", ",", "BufferParameters", "bufferParameters", ")", "{", "final", "List", "curves", "=", "new", "OffsetCurveSet...
Compute the offset curve for a polygon, a point or a collection of geometries @param list @param geometry @param offset @param bufferParameters
[ "Compute", "the", "offset", "curve", "for", "a", "polygon", "a", "point", "or", "a", "collection", "of", "geometries" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_OffSetCurve.java#L160-L166
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/ConnectApi.java
ConnectApi.listUsers
public IntegratedUserInfoList listUsers(String accountId, String connectId, ConnectApi.ListUsersOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling listUsers"); } // verify the required parameter 'connectId' is set if (connectId == null) { throw new ApiException(400, "Missing the required parameter 'connectId' when calling listUsers"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/connect/{connectId}/users".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "connectId" + "\\}", apiClient.escapeString(connectId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "count", options.count)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "email_substring", options.emailSubstring)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "list_included_users", options.listIncludedUsers)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", options.status)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "user_name_substring", options.userNameSubstring)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<IntegratedUserInfoList> localVarReturnType = new GenericType<IntegratedUserInfoList>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
java
public IntegratedUserInfoList listUsers(String accountId, String connectId, ConnectApi.ListUsersOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling listUsers"); } // verify the required parameter 'connectId' is set if (connectId == null) { throw new ApiException(400, "Missing the required parameter 'connectId' when calling listUsers"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/connect/{connectId}/users".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "connectId" + "\\}", apiClient.escapeString(connectId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "count", options.count)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "email_substring", options.emailSubstring)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "list_included_users", options.listIncludedUsers)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", options.status)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "user_name_substring", options.userNameSubstring)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<IntegratedUserInfoList> localVarReturnType = new GenericType<IntegratedUserInfoList>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
[ "public", "IntegratedUserInfoList", "listUsers", "(", "String", "accountId", ",", "String", "connectId", ",", "ConnectApi", ".", "ListUsersOptions", "options", ")", "throws", "ApiException", "{", "Object", "localVarPostBody", "=", "\"{}\"", ";", "// verify the required ...
Returns users from the configured Connect service. Returns users from the configured Connect service. @param accountId The external account number (int) or account ID Guid. (required) @param connectId The ID of the custom Connect configuration being accessed. (required) @param options for modifying the method behavior. @return IntegratedUserInfoList @throws ApiException if fails to make API call
[ "Returns", "users", "from", "the", "configured", "Connect", "service", ".", "Returns", "users", "from", "the", "configured", "Connect", "service", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/ConnectApi.java#L711-L758
sockeqwe/sqlbrite-dao
dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java
Dao.rawQuery
protected QueryBuilder rawQuery(@Nullable final String table, @NonNull String sql) { return rawQueryOnManyTables(table == null ? null : Collections.singleton(table), sql); }
java
protected QueryBuilder rawQuery(@Nullable final String table, @NonNull String sql) { return rawQueryOnManyTables(table == null ? null : Collections.singleton(table), sql); }
[ "protected", "QueryBuilder", "rawQuery", "(", "@", "Nullable", "final", "String", "table", ",", "@", "NonNull", "String", "sql", ")", "{", "return", "rawQueryOnManyTables", "(", "table", "==", "null", "?", "null", ":", "Collections", ".", "singleton", "(", "...
Creates a raw query and enables auto updates for the given single table @param table the affected table. updates get triggered if the observed tables changes. Use {@code null} or {@link #rawQuery(String)} if you don't want to register for automatic updates @param sql The sql query statement
[ "Creates", "a", "raw", "query", "and", "enables", "auto", "updates", "for", "the", "given", "single", "table" ]
train
https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/dao/src/main/java/com/hannesdorfmann/sqlbrite/dao/Dao.java#L182-L184
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java
XSLTAttributeDef.processQNAMESRNU
final Vector processQNAMESRNU(StylesheetHandler handler, String uri, String name, String rawName, String value) throws org.xml.sax.SAXException { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nQNames = tokenizer.countTokens(); Vector qnames = new Vector(nQNames); String defaultURI = handler.getNamespaceForPrefix(""); for (int i = 0; i < nQNames; i++) { String tok = tokenizer.nextToken(); if (tok.indexOf(':') == -1) { qnames.addElement(new QName(defaultURI,tok)); } else { qnames.addElement(new QName(tok, handler)); } } return qnames; }
java
final Vector processQNAMESRNU(StylesheetHandler handler, String uri, String name, String rawName, String value) throws org.xml.sax.SAXException { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nQNames = tokenizer.countTokens(); Vector qnames = new Vector(nQNames); String defaultURI = handler.getNamespaceForPrefix(""); for (int i = 0; i < nQNames; i++) { String tok = tokenizer.nextToken(); if (tok.indexOf(':') == -1) { qnames.addElement(new QName(defaultURI,tok)); } else { qnames.addElement(new QName(tok, handler)); } } return qnames; }
[ "final", "Vector", "processQNAMESRNU", "(", "StylesheetHandler", "handler", ",", "String", "uri", ",", "String", "name", ",", "String", "rawName", ",", "String", "value", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXException", "{", "StringTokenizer"...
Process an attribute string of type T_QNAMES_RESOLVE_NULL into a vector of QNames where the specification requires non-prefixed elements to be placed in the default namespace. (See section 16 of XSLT 1.0; the <em>only</em> time that this will get called is for the <code>cdata-section-elements</code> attribute on <code>xsl:output</code>. @param handler non-null reference to current StylesheetHandler that is constructing the Templates. @param uri The Namespace URI, or an empty string. @param name The local name (without prefix), or empty string if not namespace processing. @param rawName The qualified name (with prefix). @param value A whitespace delimited list of qualified names. @return a Vector of QName objects. @throws org.xml.sax.SAXException if the one of the qualified name strings contains a prefix that can not be resolved, or a qualified name contains syntax that is invalid for a qualified name.
[ "Process", "an", "attribute", "string", "of", "type", "T_QNAMES_RESOLVE_NULL", "into", "a", "vector", "of", "QNames", "where", "the", "specification", "requires", "non", "-", "prefixed", "elements", "to", "be", "placed", "in", "the", "default", "namespace", ".",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1120-L1140
Jasig/uPortal
uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java
UpdatePreferencesServlet.chooseSkin
@RequestMapping(method = RequestMethod.POST, params = "action=chooseSkin") public ModelAndView chooseSkin(HttpServletRequest request, @RequestParam String skinName) throws IOException { this.stylesheetUserPreferencesService.setStylesheetParameter( request, PreferencesScope.THEME, "skin", skinName); return new ModelAndView("jsonView", Collections.emptyMap()); }
java
@RequestMapping(method = RequestMethod.POST, params = "action=chooseSkin") public ModelAndView chooseSkin(HttpServletRequest request, @RequestParam String skinName) throws IOException { this.stylesheetUserPreferencesService.setStylesheetParameter( request, PreferencesScope.THEME, "skin", skinName); return new ModelAndView("jsonView", Collections.emptyMap()); }
[ "@", "RequestMapping", "(", "method", "=", "RequestMethod", ".", "POST", ",", "params", "=", "\"action=chooseSkin\"", ")", "public", "ModelAndView", "chooseSkin", "(", "HttpServletRequest", "request", ",", "@", "RequestParam", "String", "skinName", ")", "throws", ...
Update the user's preferred skin. @param request HTTP Request @param skinName name of the Skin @throws IOException @throws PortalException
[ "Update", "the", "user", "s", "preferred", "skin", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java#L854-L862
trello/RxLifecycle
rxlifecycle-android-lifecycle/src/main/java/com/trello/lifecycle2/android/lifecycle/RxLifecycleAndroidLifecycle.java
RxLifecycleAndroidLifecycle.bindLifecycle
@NonNull @CheckResult public static <T> LifecycleTransformer<T> bindLifecycle(@NonNull Observable<Lifecycle.Event> lifecycle) { return bind(lifecycle, LIFECYCLE); }
java
@NonNull @CheckResult public static <T> LifecycleTransformer<T> bindLifecycle(@NonNull Observable<Lifecycle.Event> lifecycle) { return bind(lifecycle, LIFECYCLE); }
[ "@", "NonNull", "@", "CheckResult", "public", "static", "<", "T", ">", "LifecycleTransformer", "<", "T", ">", "bindLifecycle", "(", "@", "NonNull", "Observable", "<", "Lifecycle", ".", "Event", ">", "lifecycle", ")", "{", "return", "bind", "(", "lifecycle", ...
Binds the given source to an Android lifecycle. <p> This helper automatically determines (based on the lifecycle sequence itself) when the source should stop emitting items. In the case that the lifecycle sequence is in the creation phase (ON_CREATE, ON_START, etc) it will choose the equivalent destructive phase (ON_DESTROY, ON_STOP, etc). If used in the destructive phase, the notifications will cease at the next event; for example, if used in ON_PAUSE, it will unsubscribe in ON_STOP. @param lifecycle the lifecycle sequence of an Activity @return a reusable {@link LifecycleTransformer} that unsubscribes the source during the Activity lifecycle
[ "Binds", "the", "given", "source", "to", "an", "Android", "lifecycle", ".", "<p", ">", "This", "helper", "automatically", "determines", "(", "based", "on", "the", "lifecycle", "sequence", "itself", ")", "when", "the", "source", "should", "stop", "emitting", ...
train
https://github.com/trello/RxLifecycle/blob/b0a9eb54867f0d72b9614d24091c59dfd4b2d5c1/rxlifecycle-android-lifecycle/src/main/java/com/trello/lifecycle2/android/lifecycle/RxLifecycleAndroidLifecycle.java#L32-L36
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/producttypes/ProductTypeOptionUrl.java
ProductTypeOptionUrl.deleteOptionUrl
public static MozuUrl deleteOptionUrl(String attributeFQN, Integer productTypeId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/producttypes/{productTypeId}/Options/{attributeFQN}"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("productTypeId", productTypeId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl deleteOptionUrl(String attributeFQN, Integer productTypeId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/producttypes/{productTypeId}/Options/{attributeFQN}"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("productTypeId", productTypeId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "deleteOptionUrl", "(", "String", "attributeFQN", ",", "Integer", "productTypeId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/attributedefinition/producttypes/{productTypeId}/Options/{attri...
Get Resource Url for DeleteOption @param attributeFQN Fully qualified name for an attribute. @param productTypeId Identifier of the product type. @return String Resource Url
[ "Get", "Resource", "Url", "for", "DeleteOption" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/producttypes/ProductTypeOptionUrl.java#L80-L86
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bcc/BccClient.java
BccClient.createImageFromInstance
public CreateImageResponse createImageFromInstance(String imageName, String instanceId) { return createImage(new CreateImageRequest() .withImageName(imageName).withInstanceId(instanceId)); }
java
public CreateImageResponse createImageFromInstance(String imageName, String instanceId) { return createImage(new CreateImageRequest() .withImageName(imageName).withInstanceId(instanceId)); }
[ "public", "CreateImageResponse", "createImageFromInstance", "(", "String", "imageName", ",", "String", "instanceId", ")", "{", "return", "createImage", "(", "new", "CreateImageRequest", "(", ")", ".", "withImageName", "(", "imageName", ")", ".", "withInstanceId", "(...
Creating a customized image from the instance.. <p> While creating an image from an instance,the instance must be Running or Stopped, otherwise,it's will get <code>409</code> errorCode. This is an asynchronous interface, you can get the latest status by invoke {@link #getImage(GetImageRequest)} @param imageName The name of image that will be created. @param instanceId The id of instance which will be used to create image. @return The response with id of image newly created.
[ "Creating", "a", "customized", "image", "from", "the", "instance", ".." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1206-L1209
rhuss/jolokia
agent/core/src/main/java/org/jolokia/handler/JsonRequestHandler.java
JsonRequestHandler.doHandleRequest
public Object doHandleRequest(MBeanServerExecutor serverManager, R request) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException { return null; }
java
public Object doHandleRequest(MBeanServerExecutor serverManager, R request) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException { return null; }
[ "public", "Object", "doHandleRequest", "(", "MBeanServerExecutor", "serverManager", ",", "R", "request", ")", "throws", "InstanceNotFoundException", ",", "AttributeNotFoundException", ",", "ReflectionException", ",", "MBeanException", ",", "IOException", ",", "NotChangedExc...
Default implementation fo handling a request for multiple servers at once. A subclass, which returns, <code>true</code> on {@link #handleAllServersAtOnce(JmxRequest)}, needs to override this method. @param serverManager all MBean servers found in this JVM @param request the original request @return the result of the the request. @throws IOException @throws AttributeNotFoundException @throws InstanceNotFoundException @throws MBeanException @throws ReflectionException
[ "Default", "implementation", "fo", "handling", "a", "request", "for", "multiple", "servers", "at", "once", ".", "A", "subclass", "which", "returns", "<code", ">", "true<", "/", "code", ">", "on", "{", "@link", "#handleAllServersAtOnce", "(", "JmxRequest", ")",...
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/handler/JsonRequestHandler.java#L178-L181
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/Exceptions.java
Exceptions.addSuppressed
public static void addSuppressed(Throwable owner, Throwable add) { try { Method method = owner.getClass().getMethod("addSuppressed", Throwable.class); method.invoke(owner, add); } catch (NoSuchMethodException e) { // ignore, will happen for JRE < 1.7 } catch (SecurityException e) { throwUncheckedException(e); } catch (IllegalAccessException e) { throwUncheckedException(e); } catch (IllegalArgumentException e) { throwUncheckedException(e); } catch (InvocationTargetException e) { throwUncheckedException(e); } }
java
public static void addSuppressed(Throwable owner, Throwable add) { try { Method method = owner.getClass().getMethod("addSuppressed", Throwable.class); method.invoke(owner, add); } catch (NoSuchMethodException e) { // ignore, will happen for JRE < 1.7 } catch (SecurityException e) { throwUncheckedException(e); } catch (IllegalAccessException e) { throwUncheckedException(e); } catch (IllegalArgumentException e) { throwUncheckedException(e); } catch (InvocationTargetException e) { throwUncheckedException(e); } }
[ "public", "static", "void", "addSuppressed", "(", "Throwable", "owner", ",", "Throwable", "add", ")", "{", "try", "{", "Method", "method", "=", "owner", ".", "getClass", "(", ")", ".", "getMethod", "(", "\"addSuppressed\"", ",", "Throwable", ".", "class", ...
Invoke {@code Throwable#addSuppressed(Throwable)} reflectively if it is available. It is not available on JRE &lt; 1.7 @since 2.8
[ "Invoke", "{", "@code", "Throwable#addSuppressed", "(", "Throwable", ")", "}", "reflectively", "if", "it", "is", "available", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/Exceptions.java#L37-L52
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/query/MongoDBQuery.java
MongoDBQuery.getColumnName
private String getColumnName(EntityMetadata metadata, EntityType entityType, String property) { String columnName = null; if (property.indexOf(".") > 0) { property = property.substring((kunderaQuery.getEntityAlias() + ".").length()); } try { columnName = ((AbstractAttribute) entityType.getAttribute(property)).getJPAColumnName(); } catch (IllegalArgumentException iaex) { log.warn("No column found by this name : " + property + " checking for embeddedfield"); } // where condition may be for search within embedded object if (columnName == null && property.indexOf(".") > 0) { String enclosingEmbeddedField = MetadataUtils.getEnclosingEmbeddedFieldName(metadata, property, true, kunderaMetadata); if (enclosingEmbeddedField != null) { columnName = property; } } if (columnName == null) { log.error("No column found by this name : " + property); throw new JPQLParseException("No column found by this name : " + property + ". Check your query."); } return columnName; }
java
private String getColumnName(EntityMetadata metadata, EntityType entityType, String property) { String columnName = null; if (property.indexOf(".") > 0) { property = property.substring((kunderaQuery.getEntityAlias() + ".").length()); } try { columnName = ((AbstractAttribute) entityType.getAttribute(property)).getJPAColumnName(); } catch (IllegalArgumentException iaex) { log.warn("No column found by this name : " + property + " checking for embeddedfield"); } // where condition may be for search within embedded object if (columnName == null && property.indexOf(".") > 0) { String enclosingEmbeddedField = MetadataUtils.getEnclosingEmbeddedFieldName(metadata, property, true, kunderaMetadata); if (enclosingEmbeddedField != null) { columnName = property; } } if (columnName == null) { log.error("No column found by this name : " + property); throw new JPQLParseException("No column found by this name : " + property + ". Check your query."); } return columnName; }
[ "private", "String", "getColumnName", "(", "EntityMetadata", "metadata", ",", "EntityType", "entityType", ",", "String", "property", ")", "{", "String", "columnName", "=", "null", ";", "if", "(", "property", ".", "indexOf", "(", "\".\"", ")", ">", "0", ")", ...
Gets the column name. @param metadata the metadata @param entityType the entity type @param property the property @return the column name
[ "Gets", "the", "column", "name", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/query/MongoDBQuery.java#L1233-L1266
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/spider/ShardCache.java
ShardCache.verifyShard
public synchronized void verifyShard(TableDefinition tableDef, int shardNumber) { assert tableDef != null; assert tableDef.isSharded(); assert shardNumber > 0; Map<String, Map<Integer, Date>> tableMap = m_appShardMap.get(tableDef.getAppDef().getAppName()); if (tableMap != null) { Map<Integer, Date> shardMap = tableMap.get(tableDef.getTableName()); if (shardMap != null) { if (shardMap.containsKey(shardNumber)) { return; } } } // Unknown app/table/shard number, so start it. Date shardDate = tableDef.computeShardStart(shardNumber); addShardStart(tableDef, shardNumber, shardDate); }
java
public synchronized void verifyShard(TableDefinition tableDef, int shardNumber) { assert tableDef != null; assert tableDef.isSharded(); assert shardNumber > 0; Map<String, Map<Integer, Date>> tableMap = m_appShardMap.get(tableDef.getAppDef().getAppName()); if (tableMap != null) { Map<Integer, Date> shardMap = tableMap.get(tableDef.getTableName()); if (shardMap != null) { if (shardMap.containsKey(shardNumber)) { return; } } } // Unknown app/table/shard number, so start it. Date shardDate = tableDef.computeShardStart(shardNumber); addShardStart(tableDef, shardNumber, shardDate); }
[ "public", "synchronized", "void", "verifyShard", "(", "TableDefinition", "tableDef", ",", "int", "shardNumber", ")", "{", "assert", "tableDef", "!=", "null", ";", "assert", "tableDef", ".", "isSharded", "(", ")", ";", "assert", "shardNumber", ">", "0", ";", ...
Verify that the shard with the given number has been registered for the given table. If it hasn't, the shard's starting date is computed, the shard is registered in the _shards row, and the start date is cached. @param tableDef TableDefinition of a sharded table. @param shardNumber Shard number (must be > 0).
[ "Verify", "that", "the", "shard", "with", "the", "given", "number", "has", "been", "registered", "for", "the", "given", "table", ".", "If", "it", "hasn", "t", "the", "shard", "s", "starting", "date", "is", "computed", "the", "shard", "is", "registered", ...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/ShardCache.java#L119-L137
minio/minio-java
api/src/main/java/io/minio/MinioClient.java
MinioClient.getPresignedObjectUrl
public String getPresignedObjectUrl(Method method, String bucketName, String objectName, Integer expires, Map<String, String> reqParams) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidExpiresRangeException { // Validate input. if (expires < 1 || expires > DEFAULT_EXPIRY_TIME) { throw new InvalidExpiresRangeException(expires, "expires must be in range of 1 to " + DEFAULT_EXPIRY_TIME); } byte[] body = null; if (method == Method.PUT || method == Method.POST) { body = new byte[0]; } Multimap<String, String> queryParamMap = null; if (reqParams != null) { queryParamMap = HashMultimap.create(); for (Map.Entry<String, String> m: reqParams.entrySet()) { queryParamMap.put(m.getKey(), m.getValue()); } } String region = getRegion(bucketName); Request request = createRequest(method, bucketName, objectName, region, null, queryParamMap, null, body, 0); HttpUrl url = Signer.presignV4(request, region, accessKey, secretKey, expires); return url.toString(); }
java
public String getPresignedObjectUrl(Method method, String bucketName, String objectName, Integer expires, Map<String, String> reqParams) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidExpiresRangeException { // Validate input. if (expires < 1 || expires > DEFAULT_EXPIRY_TIME) { throw new InvalidExpiresRangeException(expires, "expires must be in range of 1 to " + DEFAULT_EXPIRY_TIME); } byte[] body = null; if (method == Method.PUT || method == Method.POST) { body = new byte[0]; } Multimap<String, String> queryParamMap = null; if (reqParams != null) { queryParamMap = HashMultimap.create(); for (Map.Entry<String, String> m: reqParams.entrySet()) { queryParamMap.put(m.getKey(), m.getValue()); } } String region = getRegion(bucketName); Request request = createRequest(method, bucketName, objectName, region, null, queryParamMap, null, body, 0); HttpUrl url = Signer.presignV4(request, region, accessKey, secretKey, expires); return url.toString(); }
[ "public", "String", "getPresignedObjectUrl", "(", "Method", "method", ",", "String", "bucketName", ",", "String", "objectName", ",", "Integer", "expires", ",", "Map", "<", "String", ",", "String", ">", "reqParams", ")", "throws", "InvalidBucketNameException", ",",...
Returns a presigned URL string with given HTTP method, expiry time and custom request params for a specific object in the bucket. </p><b>Example:</b><br> <pre>{@code String url = minioClient.getPresignedObjectUrl(Method.DELETE, "my-bucketname", "my-objectname", 60 * 60 * 24, reqParams); System.out.println(url); }</pre> @param method HTTP {@link Method}. @param bucketName Bucket name. @param objectName Object name in the bucket. @param expires Expiration time in seconds of presigned URL. @param reqParams Override values for set of response headers. Currently supported request parameters are [response-expires, response-content-type, response-cache-control, response-content-disposition] @return string contains URL to download the object. @throws InvalidBucketNameException upon invalid bucket name is given @throws NoSuchAlgorithmException upon requested algorithm was not found during signature calculation @throws InsufficientDataException upon getting EOFException while reading given InputStream even before reading given length @throws IOException upon connection error @throws InvalidKeyException upon an invalid access key or secret key @throws NoResponseException upon no response from server @throws XmlPullParserException upon parsing response xml @throws ErrorResponseException upon unsuccessful execution @throws InternalException upon internal library error @throws InvalidExpiresRangeException upon input expires is out of range
[ "Returns", "a", "presigned", "URL", "string", "with", "given", "HTTP", "method", "expiry", "time", "and", "custom", "request", "params", "for", "a", "specific", "object", "in", "the", "bucket", "." ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L2343-L2370
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/util/Constants.java
Constants.decode
public static Object decode(Object value, Type type) { if (value instanceof Integer) { int i = (Integer) value; switch (type.getTag()) { case BOOLEAN: return i != 0; case CHAR: return (char) i; case BYTE: return (byte) i; case SHORT: return (short) i; } } return value; }
java
public static Object decode(Object value, Type type) { if (value instanceof Integer) { int i = (Integer) value; switch (type.getTag()) { case BOOLEAN: return i != 0; case CHAR: return (char) i; case BYTE: return (byte) i; case SHORT: return (short) i; } } return value; }
[ "public", "static", "Object", "decode", "(", "Object", "value", ",", "Type", "type", ")", "{", "if", "(", "value", "instanceof", "Integer", ")", "{", "int", "i", "=", "(", "Integer", ")", "value", ";", "switch", "(", "type", ".", "getTag", "(", ")", ...
Converts a constant in internal representation (in which boolean, char, byte, short, and int are each represented by an Integer) into standard representation. Other values (including null) are returned unchanged.
[ "Converts", "a", "constant", "in", "internal", "representation", "(", "in", "which", "boolean", "char", "byte", "short", "and", "int", "are", "each", "represented", "by", "an", "Integer", ")", "into", "standard", "representation", ".", "Other", "values", "(", ...
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/util/Constants.java#L46-L57
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/ObjectGraphUtils.java
ObjectGraphUtils.onAutoGenerateId
public static boolean onAutoGenerateId(Field idField, Object idValue) { if (idField.isAnnotationPresent(GeneratedValue.class)) { return !isIdSet(idValue, idField); } return false; }
java
public static boolean onAutoGenerateId(Field idField, Object idValue) { if (idField.isAnnotationPresent(GeneratedValue.class)) { return !isIdSet(idValue, idField); } return false; }
[ "public", "static", "boolean", "onAutoGenerateId", "(", "Field", "idField", ",", "Object", "idValue", ")", "{", "if", "(", "idField", ".", "isAnnotationPresent", "(", "GeneratedValue", ".", "class", ")", ")", "{", "return", "!", "isIdSet", "(", "idValue", ",...
Validates and set id, in case not set and intended for auto generation. @param idField id field @param idValue value of id attribute. @return returns true if id is not set and @GeneratedValue annotation is present. Else false.
[ "Validates", "and", "set", "id", "in", "case", "not", "set", "and", "intended", "for", "auto", "generation", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/ObjectGraphUtils.java#L69-L77
devnied/EMV-NFC-Paycard-Enrollment
library/src/main/java/com/github/devnied/emvnfccard/parser/impl/GeldKarteParser.java
GeldKarteParser.extractEF_ID
protected void extractEF_ID(final Application pApplication) throws CommunicationException { // 00B201BC00 byte[] data = template.get().getProvider().transceive(new CommandApdu(CommandEnum.READ_RECORD, 0x01, 0xBC, 0).toBytes()); if (ResponseUtils.isSucceed(data)) { pApplication.setReadingStep(ApplicationStepEnum.READ); // Date SimpleDateFormat format = new SimpleDateFormat("MM/yy",Locale.getDefault()); // Track 2 EmvTrack2 track2 = new EmvTrack2(); track2.setCardNumber(BytesUtils.bytesToStringNoSpace(Arrays.copyOfRange(data, 4, 9))); try { track2.setExpireDate(format.parse(String.format("%02x/%02x", data[11], data[10]))); } catch (ParseException e) { LOGGER.error(e.getMessage(),e); } template.get().getCard().setTrack2(track2); } }
java
protected void extractEF_ID(final Application pApplication) throws CommunicationException { // 00B201BC00 byte[] data = template.get().getProvider().transceive(new CommandApdu(CommandEnum.READ_RECORD, 0x01, 0xBC, 0).toBytes()); if (ResponseUtils.isSucceed(data)) { pApplication.setReadingStep(ApplicationStepEnum.READ); // Date SimpleDateFormat format = new SimpleDateFormat("MM/yy",Locale.getDefault()); // Track 2 EmvTrack2 track2 = new EmvTrack2(); track2.setCardNumber(BytesUtils.bytesToStringNoSpace(Arrays.copyOfRange(data, 4, 9))); try { track2.setExpireDate(format.parse(String.format("%02x/%02x", data[11], data[10]))); } catch (ParseException e) { LOGGER.error(e.getMessage(),e); } template.get().getCard().setTrack2(track2); } }
[ "protected", "void", "extractEF_ID", "(", "final", "Application", "pApplication", ")", "throws", "CommunicationException", "{", "// 00B201BC00", "byte", "[", "]", "data", "=", "template", ".", "get", "(", ")", ".", "getProvider", "(", ")", ".", "transceive", "...
Method used to extract Ef_iD record @param pApplication EMV application @throws CommunicationException communication error
[ "Method", "used", "to", "extract", "Ef_iD", "record" ]
train
https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/parser/impl/GeldKarteParser.java#L195-L213
mgm-tp/jfunk
jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/ExtendedProperties.java
ExtendedProperties.put
@Override public String put(final String key, final String value) { return propsMap.put(key, value); }
java
@Override public String put(final String key, final String value) { return propsMap.put(key, value); }
[ "@", "Override", "public", "String", "put", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "return", "propsMap", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Sets the property with the specified key. @param key The key (may not be {@code null}) @param value The value (may not be {@code null}) @return The previous value of the property, or {@code null} if it did not have one
[ "Sets", "the", "property", "with", "the", "specified", "key", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/ExtendedProperties.java#L213-L216
jglobus/JGlobus
gss/src/main/java/org/globus/net/ServerSocketFactory.java
ServerSocketFactory.createServerSocket
private ServerSocket createServerSocket(int backlog, InetAddress binAddr) throws IOException { ServerSocket server = null ; int port = 0; while(true) { port = this.portRange.getFreePort(port); try { server = new PrServerSocket(port, backlog, binAddr); this.portRange.setUsed(port); return server; } catch(IOException e) { // continue on port++; } } }
java
private ServerSocket createServerSocket(int backlog, InetAddress binAddr) throws IOException { ServerSocket server = null ; int port = 0; while(true) { port = this.portRange.getFreePort(port); try { server = new PrServerSocket(port, backlog, binAddr); this.portRange.setUsed(port); return server; } catch(IOException e) { // continue on port++; } } }
[ "private", "ServerSocket", "createServerSocket", "(", "int", "backlog", ",", "InetAddress", "binAddr", ")", "throws", "IOException", "{", "ServerSocket", "server", "=", "null", ";", "int", "port", "=", "0", ";", "while", "(", "true", ")", "{", "port", "=", ...
Tries to find first available port within the port range specified. If it finds a free port, it first checks if the port is not used by any other server. If it is, it keeps looking for a next available port. If none found, it throws an exception. If the port is available the server instance is returned.
[ "Tries", "to", "find", "first", "available", "port", "within", "the", "port", "range", "specified", ".", "If", "it", "finds", "a", "free", "port", "it", "first", "checks", "if", "the", "port", "is", "not", "used", "by", "any", "other", "server", ".", "...
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gss/src/main/java/org/globus/net/ServerSocketFactory.java#L124-L142
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/jboss/logging/Logger.java
Logger.tracef
public void tracef(Throwable t, String format, Object... params) { doLogf(Level.TRACE, FQCN, format, params, t); }
java
public void tracef(Throwable t, String format, Object... params) { doLogf(Level.TRACE, FQCN, format, params, t); }
[ "public", "void", "tracef", "(", "Throwable", "t", ",", "String", "format", ",", "Object", "...", "params", ")", "{", "doLogf", "(", "Level", ".", "TRACE", ",", "FQCN", ",", "format", ",", "params", ",", "t", ")", ";", "}" ]
Issue a formatted log message with a level of TRACE. @param t the throwable @param format the format string, as per {@link String#format(String, Object...)} @param params the parameters
[ "Issue", "a", "formatted", "log", "message", "with", "a", "level", "of", "TRACE", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L326-L328
EdwardRaff/JSAT
JSAT/src/jsat/math/integration/Romberg.java
Romberg.romb
public static double romb(Function1D f, double a, double b, int max) { // see http://en.wikipedia.org/wiki/Romberg's_method max+=1; double[] s = new double[max];//first index will not be used double var = 0;//var is used to hold the value R(n-1,m-1), from the previous row so that 2 arrays are not needed double lastVal = Double.NEGATIVE_INFINITY; for(int k = 1; k < max; k++) { for(int i = 1; i <= k; i++) { if(i == 1) { var = s[i]; s[i] = Trapezoidal.trapz(f, a, b, (int)pow(2, k-1)); } else { s[k]= ( pow(4 , i-1)*s[i-1]-var )/(pow(4, i-1) - 1); var = s[i]; s[i]= s[k]; } } if( abs(lastVal - s[k]) < 1e-15 )//there is only approximatly 15.955 accurate decimal digits in a double, this is as close as we will get return s[k]; else lastVal = s[k]; } return s[max-1]; }
java
public static double romb(Function1D f, double a, double b, int max) { // see http://en.wikipedia.org/wiki/Romberg's_method max+=1; double[] s = new double[max];//first index will not be used double var = 0;//var is used to hold the value R(n-1,m-1), from the previous row so that 2 arrays are not needed double lastVal = Double.NEGATIVE_INFINITY; for(int k = 1; k < max; k++) { for(int i = 1; i <= k; i++) { if(i == 1) { var = s[i]; s[i] = Trapezoidal.trapz(f, a, b, (int)pow(2, k-1)); } else { s[k]= ( pow(4 , i-1)*s[i-1]-var )/(pow(4, i-1) - 1); var = s[i]; s[i]= s[k]; } } if( abs(lastVal - s[k]) < 1e-15 )//there is only approximatly 15.955 accurate decimal digits in a double, this is as close as we will get return s[k]; else lastVal = s[k]; } return s[max-1]; }
[ "public", "static", "double", "romb", "(", "Function1D", "f", ",", "double", "a", ",", "double", "b", ",", "int", "max", ")", "{", "// see http://en.wikipedia.org/wiki/Romberg's_method\r", "max", "+=", "1", ";", "double", "[", "]", "s", "=", "new", "double",...
Numerically computes the integral of the given function @param f the function to integrate @param a the lower limit of the integral @param b the upper limit of the integral @param max the maximum number of extrapolation steps to perform. &int;<sub>a</sub><sup>b</sup>f(x) , dx
[ "Numerically", "computes", "the", "integral", "of", "the", "given", "function" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/integration/Romberg.java#L38-L71
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/media/MediaClient.java
MediaClient.createJob
@Deprecated public CreateJobResponse createJob(CreateJobRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPipelineName(), "The parameter pipelineName should NOT be null or empty string."); checkNotNull(request.getSource(), "The parameter source should NOT be null."); checkStringNotEmpty(request.getSource().getSourceKey(), "The parameter sourceKey should NOT be null or empty string."); checkNotNull(request.getTarget(), "The parameter target should NOT be null."); checkStringNotEmpty(request.getTarget().getTargetKey(), "The parameter targetKey should NOT be null or empty string."); checkStringNotEmpty(request.getTarget().getPresetName(), "The parameter presetName should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, TRANSCODE_JOB); return invokeHttpClient(internalRequest, CreateJobResponse.class); }
java
@Deprecated public CreateJobResponse createJob(CreateJobRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPipelineName(), "The parameter pipelineName should NOT be null or empty string."); checkNotNull(request.getSource(), "The parameter source should NOT be null."); checkStringNotEmpty(request.getSource().getSourceKey(), "The parameter sourceKey should NOT be null or empty string."); checkNotNull(request.getTarget(), "The parameter target should NOT be null."); checkStringNotEmpty(request.getTarget().getTargetKey(), "The parameter targetKey should NOT be null or empty string."); checkStringNotEmpty(request.getTarget().getPresetName(), "The parameter presetName should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, TRANSCODE_JOB); return invokeHttpClient(internalRequest, CreateJobResponse.class); }
[ "@", "Deprecated", "public", "CreateJobResponse", "createJob", "(", "CreateJobRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getPipelineName", "(",...
Creates a new transcoder job which converts media files in BOS buckets with specified preset. @param request The request object containing all options for creating a job. @return The newly created job ID. @deprecated As of release 0.8.5, replaced by {@link #createTranscodingJob(CreateTranscodingJobRequest)}}
[ "Creates", "a", "new", "transcoder", "job", "which", "converts", "media", "files", "in", "BOS", "buckets", "with", "specified", "preset", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L205-L223
BrunoEberhard/minimal-j
src/main/java/org/minimalj/util/IdUtils.java
IdUtils.getId
public static Object getId(Object object) { Objects.nonNull(object); try { Field idField = getIdField(object.getClass()); if (idField == null) throw new IllegalArgumentException(object.getClass().getName() + " has no id field to get"); Object id = idField.get(object); return id; } catch (SecurityException | IllegalAccessException e) { throw new LoggingRuntimeException(e, logger, "getting Id failed"); } }
java
public static Object getId(Object object) { Objects.nonNull(object); try { Field idField = getIdField(object.getClass()); if (idField == null) throw new IllegalArgumentException(object.getClass().getName() + " has no id field to get"); Object id = idField.get(object); return id; } catch (SecurityException | IllegalAccessException e) { throw new LoggingRuntimeException(e, logger, "getting Id failed"); } }
[ "public", "static", "Object", "getId", "(", "Object", "object", ")", "{", "Objects", ".", "nonNull", "(", "object", ")", ";", "try", "{", "Field", "idField", "=", "getIdField", "(", "object", ".", "getClass", "(", ")", ")", ";", "if", "(", "idField", ...
Get the value of the <code>id</code> field. The id is converted to 'plain' if it is a ReadOnly id @param object object containing the id. Must not be <code>null</code> @return the value of the <code>id</code> field
[ "Get", "the", "value", "of", "the", "<code", ">", "id<", "/", "code", ">", "field", ".", "The", "id", "is", "converted", "to", "plain", "if", "it", "is", "a", "ReadOnly", "id" ]
train
https://github.com/BrunoEberhard/minimal-j/blob/f7c5461b2b47a10b383aee1e2f1f150f6773703b/src/main/java/org/minimalj/util/IdUtils.java#L53-L63
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/io/FileOutputFormat.java
FileOutputFormat.initializeGlobal
@Override public void initializeGlobal(int parallelism) throws IOException { final Path path = getOutputFilePath(); final FileSystem fs = path.getFileSystem(); // only distributed file systems can be initialized at start-up time. if (fs.isDistributedFS()) { final WriteMode writeMode = getWriteMode(); final OutputDirectoryMode outDirMode = getOutputDirectoryMode(); if (parallelism == 1 && outDirMode == OutputDirectoryMode.PARONLY) { // output is not written in parallel and should be written to a single file. // prepare distributed output path if(!fs.initOutPathDistFS(path, writeMode, false)) { // output preparation failed! Cancel task. throw new IOException("Output path could not be initialized."); } } else { // output should be written to a directory // only distributed file systems can be initialized at start-up time. if(!fs.initOutPathDistFS(path, writeMode, true)) { throw new IOException("Output directory could not be created."); } } } }
java
@Override public void initializeGlobal(int parallelism) throws IOException { final Path path = getOutputFilePath(); final FileSystem fs = path.getFileSystem(); // only distributed file systems can be initialized at start-up time. if (fs.isDistributedFS()) { final WriteMode writeMode = getWriteMode(); final OutputDirectoryMode outDirMode = getOutputDirectoryMode(); if (parallelism == 1 && outDirMode == OutputDirectoryMode.PARONLY) { // output is not written in parallel and should be written to a single file. // prepare distributed output path if(!fs.initOutPathDistFS(path, writeMode, false)) { // output preparation failed! Cancel task. throw new IOException("Output path could not be initialized."); } } else { // output should be written to a directory // only distributed file systems can be initialized at start-up time. if(!fs.initOutPathDistFS(path, writeMode, true)) { throw new IOException("Output directory could not be created."); } } } }
[ "@", "Override", "public", "void", "initializeGlobal", "(", "int", "parallelism", ")", "throws", "IOException", "{", "final", "Path", "path", "=", "getOutputFilePath", "(", ")", ";", "final", "FileSystem", "fs", "=", "path", ".", "getFileSystem", "(", ")", "...
Initialization of the distributed file system if it is used. @param parallelism The task parallelism.
[ "Initialization", "of", "the", "distributed", "file", "system", "if", "it", "is", "used", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/FileOutputFormat.java#L272-L300
ixa-ehu/ixa-pipe-nerc
src/main/java/eus/ixa/ixa/pipe/nerc/CLI.java
CLI.annotate
public final void annotate(final InputStream inputStream, final OutputStream outputStream) throws IOException, JDOMException { BufferedReader breader = new BufferedReader( new InputStreamReader(inputStream, UTF_8)); BufferedWriter bwriter = new BufferedWriter( new OutputStreamWriter(outputStream, UTF_8)); // read KAF document from inputstream KAFDocument kaf = KAFDocument.createFromStream(breader); // load parameters into a properties String model = parsedArguments.getString(MODEL); String outputFormat = parsedArguments.getString("outputFormat"); String lexer = parsedArguments.getString("lexer"); String dictTag = parsedArguments.getString("dictTag"); String dictPath = parsedArguments.getString("dictPath"); String clearFeatures = parsedArguments.getString("clearFeatures"); // language parameter String lang = null; if (parsedArguments.getString("language") != null) { lang = parsedArguments.getString("language"); if (!kaf.getLang().equalsIgnoreCase(lang)) { System.err.println("Language parameter in NAF and CLI do not match!!"); } } else { lang = kaf.getLang(); } Properties properties = setAnnotateProperties(model, lang, lexer, dictTag, dictPath, clearFeatures); KAFDocument.LinguisticProcessor newLp = kaf.addLinguisticProcessor( "entities", IXA_PIPE_NERC + Files.getNameWithoutExtension(model), version + "-" + commit); newLp.setBeginTimestamp(); Annotate annotator = new Annotate(properties); annotator.annotateNEsToKAF(kaf); newLp.setEndTimestamp(); String kafToString = null; if (outputFormat.equalsIgnoreCase("conll03")) { kafToString = annotator.annotateNEsToCoNLL2003(kaf); } else if (outputFormat.equalsIgnoreCase("conll02")) { kafToString = annotator.annotateNEsToCoNLL2002(kaf); } else if (outputFormat.equalsIgnoreCase("opennlp")) { kafToString = annotator.annotateNEsToOpenNLP(kaf); } else { kafToString = kaf.toString(); } bwriter.write(kafToString); bwriter.close(); breader.close(); }
java
public final void annotate(final InputStream inputStream, final OutputStream outputStream) throws IOException, JDOMException { BufferedReader breader = new BufferedReader( new InputStreamReader(inputStream, UTF_8)); BufferedWriter bwriter = new BufferedWriter( new OutputStreamWriter(outputStream, UTF_8)); // read KAF document from inputstream KAFDocument kaf = KAFDocument.createFromStream(breader); // load parameters into a properties String model = parsedArguments.getString(MODEL); String outputFormat = parsedArguments.getString("outputFormat"); String lexer = parsedArguments.getString("lexer"); String dictTag = parsedArguments.getString("dictTag"); String dictPath = parsedArguments.getString("dictPath"); String clearFeatures = parsedArguments.getString("clearFeatures"); // language parameter String lang = null; if (parsedArguments.getString("language") != null) { lang = parsedArguments.getString("language"); if (!kaf.getLang().equalsIgnoreCase(lang)) { System.err.println("Language parameter in NAF and CLI do not match!!"); } } else { lang = kaf.getLang(); } Properties properties = setAnnotateProperties(model, lang, lexer, dictTag, dictPath, clearFeatures); KAFDocument.LinguisticProcessor newLp = kaf.addLinguisticProcessor( "entities", IXA_PIPE_NERC + Files.getNameWithoutExtension(model), version + "-" + commit); newLp.setBeginTimestamp(); Annotate annotator = new Annotate(properties); annotator.annotateNEsToKAF(kaf); newLp.setEndTimestamp(); String kafToString = null; if (outputFormat.equalsIgnoreCase("conll03")) { kafToString = annotator.annotateNEsToCoNLL2003(kaf); } else if (outputFormat.equalsIgnoreCase("conll02")) { kafToString = annotator.annotateNEsToCoNLL2002(kaf); } else if (outputFormat.equalsIgnoreCase("opennlp")) { kafToString = annotator.annotateNEsToOpenNLP(kaf); } else { kafToString = kaf.toString(); } bwriter.write(kafToString); bwriter.close(); breader.close(); }
[ "public", "final", "void", "annotate", "(", "final", "InputStream", "inputStream", ",", "final", "OutputStream", "outputStream", ")", "throws", "IOException", ",", "JDOMException", "{", "BufferedReader", "breader", "=", "new", "BufferedReader", "(", "new", "InputStr...
Main method to do Named Entity tagging. @param inputStream the input stream containing the content to tag @param outputStream the output stream providing the named entities @throws IOException exception if problems in input or output streams @throws JDOMException if xml formatting problems
[ "Main", "method", "to", "do", "Named", "Entity", "tagging", "." ]
train
https://github.com/ixa-ehu/ixa-pipe-nerc/blob/299cb49348eb7650fef2ae47c73f6d3384b43c34/src/main/java/eus/ixa/ixa/pipe/nerc/CLI.java#L180-L228
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionUtils.java
ExtensionUtils.importProperty
public static String importProperty(MutableExtension extension, String propertySuffix, String def) { return StringUtils.defaultString(importProperty(extension, propertySuffix), def); }
java
public static String importProperty(MutableExtension extension, String propertySuffix, String def) { return StringUtils.defaultString(importProperty(extension, propertySuffix), def); }
[ "public", "static", "String", "importProperty", "(", "MutableExtension", "extension", ",", "String", "propertySuffix", ",", "String", "def", ")", "{", "return", "StringUtils", ".", "defaultString", "(", "importProperty", "(", "extension", ",", "propertySuffix", ")",...
Delete and return the value of the passed special property. @param extension the extension from which to extract custom property @param propertySuffix the property suffix @param def the default value @return the value or {@code def} if none was found @since 8.3M1
[ "Delete", "and", "return", "the", "value", "of", "the", "passed", "special", "property", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionUtils.java#L176-L179
eBay/xcelite
src/main/java/com/ebay/xcelite/Xcelite.java
Xcelite.write
public void write(File file) { FileOutputStream out = null; try { out = new FileOutputStream(file, false); workbook.write(out); } catch (FileNotFoundException e) { throw new RuntimeException(e); } catch (IOException e) { new RuntimeException(e); } finally { if (out != null) try { out.close(); } catch (IOException e) { new RuntimeException(e); } } }
java
public void write(File file) { FileOutputStream out = null; try { out = new FileOutputStream(file, false); workbook.write(out); } catch (FileNotFoundException e) { throw new RuntimeException(e); } catch (IOException e) { new RuntimeException(e); } finally { if (out != null) try { out.close(); } catch (IOException e) { new RuntimeException(e); } } }
[ "public", "void", "write", "(", "File", "file", ")", "{", "FileOutputStream", "out", "=", "null", ";", "try", "{", "out", "=", "new", "FileOutputStream", "(", "file", ",", "false", ")", ";", "workbook", ".", "write", "(", "out", ")", ";", "}", "catch...
Saves data to a new file. @param file the file to save the data into
[ "Saves", "data", "to", "a", "new", "file", "." ]
train
https://github.com/eBay/xcelite/blob/0362f4cf9c5b8dee73e8ec00a860f0fef0f0c2e1/src/main/java/com/ebay/xcelite/Xcelite.java#L123-L140
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/cluster/Common.java
Common.acker_inputs
public static Map<GlobalStreamId, Grouping> acker_inputs(StormTopology topology) { Map<GlobalStreamId, Grouping> spout_inputs = new HashMap<>(); Map<String, SpoutSpec> spout_ids = topology.get_spouts(); for (Entry<String, SpoutSpec> spout : spout_ids.entrySet()) { String id = spout.getKey(); GlobalStreamId stream = new GlobalStreamId(id, ACKER_INIT_STREAM_ID); Grouping group = Thrift.mkFieldsGrouping(JStormUtils.mk_list("id")); spout_inputs.put(stream, group); } Map<String, Bolt> bolt_ids = topology.get_bolts(); Map<GlobalStreamId, Grouping> bolt_inputs = new HashMap<>(); for (Entry<String, Bolt> bolt : bolt_ids.entrySet()) { String id = bolt.getKey(); GlobalStreamId streamAck = new GlobalStreamId(id, ACKER_ACK_STREAM_ID); Grouping groupAck = Thrift.mkFieldsGrouping(JStormUtils.mk_list("id")); GlobalStreamId streamFail = new GlobalStreamId(id, ACKER_FAIL_STREAM_ID); Grouping groupFail = Thrift.mkFieldsGrouping(JStormUtils.mk_list("id")); bolt_inputs.put(streamAck, groupAck); bolt_inputs.put(streamFail, groupFail); } Map<GlobalStreamId, Grouping> allInputs = new HashMap<>(); allInputs.putAll(bolt_inputs); allInputs.putAll(spout_inputs); return allInputs; }
java
public static Map<GlobalStreamId, Grouping> acker_inputs(StormTopology topology) { Map<GlobalStreamId, Grouping> spout_inputs = new HashMap<>(); Map<String, SpoutSpec> spout_ids = topology.get_spouts(); for (Entry<String, SpoutSpec> spout : spout_ids.entrySet()) { String id = spout.getKey(); GlobalStreamId stream = new GlobalStreamId(id, ACKER_INIT_STREAM_ID); Grouping group = Thrift.mkFieldsGrouping(JStormUtils.mk_list("id")); spout_inputs.put(stream, group); } Map<String, Bolt> bolt_ids = topology.get_bolts(); Map<GlobalStreamId, Grouping> bolt_inputs = new HashMap<>(); for (Entry<String, Bolt> bolt : bolt_ids.entrySet()) { String id = bolt.getKey(); GlobalStreamId streamAck = new GlobalStreamId(id, ACKER_ACK_STREAM_ID); Grouping groupAck = Thrift.mkFieldsGrouping(JStormUtils.mk_list("id")); GlobalStreamId streamFail = new GlobalStreamId(id, ACKER_FAIL_STREAM_ID); Grouping groupFail = Thrift.mkFieldsGrouping(JStormUtils.mk_list("id")); bolt_inputs.put(streamAck, groupAck); bolt_inputs.put(streamFail, groupFail); } Map<GlobalStreamId, Grouping> allInputs = new HashMap<>(); allInputs.putAll(bolt_inputs); allInputs.putAll(spout_inputs); return allInputs; }
[ "public", "static", "Map", "<", "GlobalStreamId", ",", "Grouping", ">", "acker_inputs", "(", "StormTopology", "topology", ")", "{", "Map", "<", "GlobalStreamId", ",", "Grouping", ">", "spout_inputs", "=", "new", "HashMap", "<>", "(", ")", ";", "Map", "<", ...
Generate acker's input Map<GlobalStreamId, Grouping> for spout <GlobalStreamId(spoutId, ACKER_INIT_STREAM_ID), ...> for bolt <GlobalStreamId(boltId, ACKER_ACK_STREAM_ID), ...> <GlobalStreamId(boltId, ACKER_FAIL_STREAM_ID), ...>
[ "Generate", "acker", "s", "input", "Map<GlobalStreamId", "Grouping", ">" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/cluster/Common.java#L427-L459
RestComm/media-core
sdp/src/main/java/org/restcomm/media/core/sdp/SdpParserPipeline.java
SdpParserPipeline.addAttributeParser
public void addAttributeParser(String type, SdpParser<? extends AttributeField> parser) { synchronized (this.attributeParsers) { this.attributeParsers.put(type, parser); } }
java
public void addAttributeParser(String type, SdpParser<? extends AttributeField> parser) { synchronized (this.attributeParsers) { this.attributeParsers.put(type, parser); } }
[ "public", "void", "addAttributeParser", "(", "String", "type", ",", "SdpParser", "<", "?", "extends", "AttributeField", ">", "parser", ")", "{", "synchronized", "(", "this", ".", "attributeParsers", ")", "{", "this", ".", "attributeParsers", ".", "put", "(", ...
Adds an attribute parser to the pipeline. @param parser The parser to be registered
[ "Adds", "an", "attribute", "parser", "to", "the", "pipeline", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/sdp/src/main/java/org/restcomm/media/core/sdp/SdpParserPipeline.java#L168-L172
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/AbstractSessionBasedExecutableScope.java
AbstractSessionBasedExecutableScope.processFeatureNames
@Override protected void processFeatureNames(QualifiedName name, NameAcceptor acceptor) { QualifiedName methodName = operatorMapping == null? null : operatorMapping.getMethodName(name); if (methodName != null) { acceptor.accept(methodName.toString(), 2); QualifiedName simpleOperator = operatorMapping.getSimpleOperator(name); if (simpleOperator != null) { QualifiedName simpleMethodName = operatorMapping.getMethodName(simpleOperator); if (simpleMethodName != null) { acceptor.accept(simpleMethodName.toString(), 3); } } } else { acceptor.accept(name.toString(), 1); processAsPropertyNames(name, acceptor); } }
java
@Override protected void processFeatureNames(QualifiedName name, NameAcceptor acceptor) { QualifiedName methodName = operatorMapping == null? null : operatorMapping.getMethodName(name); if (methodName != null) { acceptor.accept(methodName.toString(), 2); QualifiedName simpleOperator = operatorMapping.getSimpleOperator(name); if (simpleOperator != null) { QualifiedName simpleMethodName = operatorMapping.getMethodName(simpleOperator); if (simpleMethodName != null) { acceptor.accept(simpleMethodName.toString(), 3); } } } else { acceptor.accept(name.toString(), 1); processAsPropertyNames(name, acceptor); } }
[ "@", "Override", "protected", "void", "processFeatureNames", "(", "QualifiedName", "name", ",", "NameAcceptor", "acceptor", ")", "{", "QualifiedName", "methodName", "=", "operatorMapping", "==", "null", "?", "null", ":", "operatorMapping", ".", "getMethodName", "(",...
From a given name, other variants are computed, e.g. the name may be a property name such as a prefix may be added to the name. Or it may be an operator such as the original method name should be used, too, to find a declaration.
[ "From", "a", "given", "name", "other", "variants", "are", "computed", "e", ".", "g", ".", "the", "name", "may", "be", "a", "property", "name", "such", "as", "a", "prefix", "may", "be", "added", "to", "the", "name", ".", "Or", "it", "may", "be", "an...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/AbstractSessionBasedExecutableScope.java#L36-L52
forge/javaee-descriptors
impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/persistence20/PersistenceDescriptorImpl.java
PersistenceDescriptorImpl.addNamespace
public PersistenceDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
java
public PersistenceDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
[ "public", "PersistenceDescriptor", "addNamespace", "(", "String", "name", ",", "String", "value", ")", "{", "model", ".", "attribute", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a new namespace @return the current instance of <code>PersistenceDescriptor</code>
[ "Adds", "a", "new", "namespace" ]
train
https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/persistence20/PersistenceDescriptorImpl.java#L83-L87
Netflix/conductor
core/src/main/java/com/netflix/conductor/core/execution/WorkflowExecutor.java
WorkflowExecutor.getActiveDomain
@VisibleForTesting String getActiveDomain(String taskType, String[] domains) { if (domains == null || domains.length == 0) { return null; } return Arrays.stream(domains) .filter(domain -> !domain.equalsIgnoreCase("NO_DOMAIN")) .map(domain -> executionDAOFacade.getTaskPollDataByDomain(taskType, domain.trim())) .filter(Objects::nonNull) .filter(validateLastPolledTime) .findFirst() .map(PollData::getDomain) .orElse(domains[domains.length - 1].trim().equalsIgnoreCase("NO_DOMAIN") ? null : domains[domains.length - 1].trim()); }
java
@VisibleForTesting String getActiveDomain(String taskType, String[] domains) { if (domains == null || domains.length == 0) { return null; } return Arrays.stream(domains) .filter(domain -> !domain.equalsIgnoreCase("NO_DOMAIN")) .map(domain -> executionDAOFacade.getTaskPollDataByDomain(taskType, domain.trim())) .filter(Objects::nonNull) .filter(validateLastPolledTime) .findFirst() .map(PollData::getDomain) .orElse(domains[domains.length - 1].trim().equalsIgnoreCase("NO_DOMAIN") ? null : domains[domains.length - 1].trim()); }
[ "@", "VisibleForTesting", "String", "getActiveDomain", "(", "String", "taskType", ",", "String", "[", "]", "domains", ")", "{", "if", "(", "domains", "==", "null", "||", "domains", ".", "length", "==", "0", ")", "{", "return", "null", ";", "}", "return",...
Gets the active domain from the list of domains where the task is to be queued. The domain list must be ordered. In sequence, check if any worker has polled for last `activeWorkerLastPollInSecs` seconds, if so that is the Active domain. When no active domains are found: <li> If NO_DOMAIN token is provided, return null. <li> Else, return last domain from list. @param taskType the taskType of the task for which active domain is to be found @param domains the array of domains for the task. (Must contain atleast one element). @return the active domain where the task will be queued
[ "Gets", "the", "active", "domain", "from", "the", "list", "of", "domains", "where", "the", "task", "is", "to", "be", "queued", ".", "The", "domain", "list", "must", "be", "ordered", ".", "In", "sequence", "check", "if", "any", "worker", "has", "polled", ...
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/core/execution/WorkflowExecutor.java#L1099-L1113
amplexus/java-flac-encoder
src/main/java/net/sourceforge/javaflacencoder/Subframe_LPC.java
Subframe_LPC.getData
public EncodedElement getData() { EncodedElement result = new EncodedElement(_totalBits/8+1,_offset); //result.clear((int)_totalBits+1, _offset); writeLPC(_samples, _lastCount, _start, _increment, result, _frameSampleSize, _lowOrderBits, _precision, _shift, _quantizedCoeffs, _errors, _lpcOrder,rice); int totalBits = result.getTotalBits(); this.lastEncodedSize = (int)totalBits; if(DEBUG_LEV > 0) { System.err.println("lastencodedSize set: "+this.lastEncodedSize); System.err.println("Subframe_LPC::getData(...): End"); } return result; }
java
public EncodedElement getData() { EncodedElement result = new EncodedElement(_totalBits/8+1,_offset); //result.clear((int)_totalBits+1, _offset); writeLPC(_samples, _lastCount, _start, _increment, result, _frameSampleSize, _lowOrderBits, _precision, _shift, _quantizedCoeffs, _errors, _lpcOrder,rice); int totalBits = result.getTotalBits(); this.lastEncodedSize = (int)totalBits; if(DEBUG_LEV > 0) { System.err.println("lastencodedSize set: "+this.lastEncodedSize); System.err.println("Subframe_LPC::getData(...): End"); } return result; }
[ "public", "EncodedElement", "getData", "(", ")", "{", "EncodedElement", "result", "=", "new", "EncodedElement", "(", "_totalBits", "/", "8", "+", "1", ",", "_offset", ")", ";", "//result.clear((int)_totalBits+1, _offset);", "writeLPC", "(", "_samples", ",", "_last...
Get the data from the last encode attempt. Data is returned in an EncodedElement, properly packed at the bit-level to be added directly to a FLAC stream. @return EncodedElement containing encoded subframe
[ "Get", "the", "data", "from", "the", "last", "encode", "attempt", ".", "Data", "is", "returned", "in", "an", "EncodedElement", "properly", "packed", "at", "the", "bit", "-", "level", "to", "be", "added", "directly", "to", "a", "FLAC", "stream", "." ]
train
https://github.com/amplexus/java-flac-encoder/blob/3d536b877dee2a3fd4ab2e0d9569e292cae93bc9/src/main/java/net/sourceforge/javaflacencoder/Subframe_LPC.java#L198-L212
spring-projects/spring-security-oauth
spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/client/CoreOAuthConsumerSupport.java
CoreOAuthConsumerSupport.openConnection
protected HttpURLConnection openConnection(URL requestTokenURL) { try { HttpURLConnection connection = (HttpURLConnection) requestTokenURL.openConnection(selectProxy(requestTokenURL)); connection.setConnectTimeout(getConnectionTimeout()); connection.setReadTimeout(getReadTimeout()); return connection; } catch (IOException e) { throw new OAuthRequestFailedException("Failed to open an OAuth connection.", e); } }
java
protected HttpURLConnection openConnection(URL requestTokenURL) { try { HttpURLConnection connection = (HttpURLConnection) requestTokenURL.openConnection(selectProxy(requestTokenURL)); connection.setConnectTimeout(getConnectionTimeout()); connection.setReadTimeout(getReadTimeout()); return connection; } catch (IOException e) { throw new OAuthRequestFailedException("Failed to open an OAuth connection.", e); } }
[ "protected", "HttpURLConnection", "openConnection", "(", "URL", "requestTokenURL", ")", "{", "try", "{", "HttpURLConnection", "connection", "=", "(", "HttpURLConnection", ")", "requestTokenURL", ".", "openConnection", "(", "selectProxy", "(", "requestTokenURL", ")", "...
Open a connection to the given URL. @param requestTokenURL The request token URL. @return The HTTP URL connection.
[ "Open", "a", "connection", "to", "the", "given", "URL", "." ]
train
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/client/CoreOAuthConsumerSupport.java#L590-L600
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByBirthInfo
public Iterable<DUser> queryByBirthInfo(java.lang.String birthInfo) { return queryByField(null, DUserMapper.Field.BIRTHINFO.getFieldName(), birthInfo); }
java
public Iterable<DUser> queryByBirthInfo(java.lang.String birthInfo) { return queryByField(null, DUserMapper.Field.BIRTHINFO.getFieldName(), birthInfo); }
[ "public", "Iterable", "<", "DUser", ">", "queryByBirthInfo", "(", "java", ".", "lang", ".", "String", "birthInfo", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "BIRTHINFO", ".", "getFieldName", "(", ")", ",", "bir...
query-by method for field birthInfo @param birthInfo the specified attribute @return an Iterable of DUsers for the specified birthInfo
[ "query", "-", "by", "method", "for", "field", "birthInfo" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L88-L90
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.L2_L1
@Pure public static Point2d L2_L1(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_2_N, LAMBERT_2_C, LAMBERT_2_XS, LAMBERT_2_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_1_N, LAMBERT_1_C, LAMBERT_1_XS, LAMBERT_1_YS); }
java
@Pure public static Point2d L2_L1(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_2_N, LAMBERT_2_C, LAMBERT_2_XS, LAMBERT_2_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_1_N, LAMBERT_1_C, LAMBERT_1_XS, LAMBERT_1_YS); }
[ "@", "Pure", "public", "static", "Point2d", "L2_L1", "(", "double", "x", ",", "double", "y", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "NTFLambert_NTFLambdaPhi", "(", "x", ",", "y", ",", "LAMBERT_2_N", ",", "LAMBERT_2_C", ",", "LAMBERT_2_XS", ",", ...
This function convert France Lambert II coordinate to France Lambert I coordinate. @param x is the coordinate in France Lambert II @param y is the coordinate in France Lambert II @return the France Lambert I coordinate.
[ "This", "function", "convert", "France", "Lambert", "II", "coordinate", "to", "France", "Lambert", "I", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L450-L463
apache/groovy
src/main/java/org/codehaus/groovy/ast/tools/GeneralUtils.java
GeneralUtils.getterX
public static Expression getterX(ClassNode annotatedNode, Expression receiver, PropertyNode pNode) { ClassNode owner = pNode.getDeclaringClass(); if (annotatedNode.equals(owner)) { return callX(receiver, getterName(annotatedNode, pNode)); } return propX(receiver, pNode.getName()); }
java
public static Expression getterX(ClassNode annotatedNode, Expression receiver, PropertyNode pNode) { ClassNode owner = pNode.getDeclaringClass(); if (annotatedNode.equals(owner)) { return callX(receiver, getterName(annotatedNode, pNode)); } return propX(receiver, pNode.getName()); }
[ "public", "static", "Expression", "getterX", "(", "ClassNode", "annotatedNode", ",", "Expression", "receiver", ",", "PropertyNode", "pNode", ")", "{", "ClassNode", "owner", "=", "pNode", ".", "getDeclaringClass", "(", ")", ";", "if", "(", "annotatedNode", ".", ...
This method is similar to {@link #propX(Expression, Expression)} but will make sure that if the property being accessed is defined inside the classnode provided as a parameter, then a getter call is generated instead of a field access. @param annotatedNode the class node where the property node is accessed from @param receiver the object having the property @param pNode the property being accessed @return a method call expression or a property expression
[ "This", "method", "is", "similar", "to", "{" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/tools/GeneralUtils.java#L816-L822
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/view/CShareableResource.java
CShareableResource.capHosting
private boolean capHosting(int nIdx, int min, int nbZeroes) { Node n = rp.getNode(nIdx); double capa = getSourceResource().getCapacity(n) * getOverbookRatio(nIdx)/*.getLB()*/; int card = (int) (capa / min) + nbZeroes + 1; if (card < source.getMapping().getRunningVMs(n).size()) { // This shortcut is required to prevent a filtering issue in the scheduling phase: // At time 0, LocalTaskScheduler will complain and start to backtrack. // TODO: revise the notion of continuous constraint for the cardinality issue. return true; } try { //Restrict the hosting capacity. rp.getNbRunningVMs().get(nIdx).updateUpperBound(card, Cause.Null); } catch (ContradictionException ex) { rp.getLogger().error("Unable to cap the hosting capacity of '" + n + " ' to " + card, ex); return false; } return true; }
java
private boolean capHosting(int nIdx, int min, int nbZeroes) { Node n = rp.getNode(nIdx); double capa = getSourceResource().getCapacity(n) * getOverbookRatio(nIdx)/*.getLB()*/; int card = (int) (capa / min) + nbZeroes + 1; if (card < source.getMapping().getRunningVMs(n).size()) { // This shortcut is required to prevent a filtering issue in the scheduling phase: // At time 0, LocalTaskScheduler will complain and start to backtrack. // TODO: revise the notion of continuous constraint for the cardinality issue. return true; } try { //Restrict the hosting capacity. rp.getNbRunningVMs().get(nIdx).updateUpperBound(card, Cause.Null); } catch (ContradictionException ex) { rp.getLogger().error("Unable to cap the hosting capacity of '" + n + " ' to " + card, ex); return false; } return true; }
[ "private", "boolean", "capHosting", "(", "int", "nIdx", ",", "int", "min", ",", "int", "nbZeroes", ")", "{", "Node", "n", "=", "rp", ".", "getNode", "(", "nIdx", ")", ";", "double", "capa", "=", "getSourceResource", "(", ")", ".", "getCapacity", "(", ...
Reduce the cardinality wrt. the worst case scenario. @param nIdx the node index @param min the min (but > 0 ) consumption for a VM @param nbZeroes the number of VMs consuming 0 @return {@code false} if the problem no longer has a solution
[ "Reduce", "the", "cardinality", "wrt", ".", "the", "worst", "case", "scenario", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/view/CShareableResource.java#L372-L390
apache/groovy
src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
InvokerHelper.setGroovyObjectProperty
public static void setGroovyObjectProperty(Object newValue, GroovyObject object, String property) { object.setProperty(property, newValue); }
java
public static void setGroovyObjectProperty(Object newValue, GroovyObject object, String property) { object.setProperty(property, newValue); }
[ "public", "static", "void", "setGroovyObjectProperty", "(", "Object", "newValue", ",", "GroovyObject", "object", ",", "String", "property", ")", "{", "object", ".", "setProperty", "(", "property", ",", "newValue", ")", ";", "}" ]
This is so we don't have to reorder the stack when we call this method. At some point a better name might be in order.
[ "This", "is", "so", "we", "don", "t", "have", "to", "reorder", "the", "stack", "when", "we", "call", "this", "method", ".", "At", "some", "point", "a", "better", "name", "might", "be", "in", "order", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java#L236-L238
eserating/siren4j
src/main/java/com/google/code/siren4j/util/ReflectionUtils.java
ReflectionUtils.getMethodValue
public static Object getMethodValue(Method method, Object obj) { if (method == null) { throw new IllegalArgumentException("method cannot be null."); } try { return method.invoke(obj); } catch (IllegalArgumentException e) { throw new Siren4JRuntimeException(e); } catch (IllegalAccessException e) { throw new Siren4JRuntimeException(e); } catch (InvocationTargetException e) { throw new Siren4JRuntimeException(e); } }
java
public static Object getMethodValue(Method method, Object obj) { if (method == null) { throw new IllegalArgumentException("method cannot be null."); } try { return method.invoke(obj); } catch (IllegalArgumentException e) { throw new Siren4JRuntimeException(e); } catch (IllegalAccessException e) { throw new Siren4JRuntimeException(e); } catch (InvocationTargetException e) { throw new Siren4JRuntimeException(e); } }
[ "public", "static", "Object", "getMethodValue", "(", "Method", "method", ",", "Object", "obj", ")", "{", "if", "(", "method", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"method cannot be null.\"", ")", ";", "}", "try", "{", "r...
Convenience method to retrieve the method value for the specified object wrapped to catch exceptions and re throw as <code>Siren4JRuntimeException</code>. @param method cannot be <code>null</code>. @param obj may be <code>null</code>. @return the value, may be <code>null</code>.
[ "Convenience", "method", "to", "retrieve", "the", "method", "value", "for", "the", "specified", "object", "wrapped", "to", "catch", "exceptions", "and", "re", "throw", "as", "<code", ">", "Siren4JRuntimeException<", "/", "code", ">", "." ]
train
https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ReflectionUtils.java#L365-L378
alkacon/opencms-core
src/org/opencms/ui/apps/cacheadmin/CmsImageCacheTable.java
CmsImageCacheTable.openExplorerForParent
void openExplorerForParent(String rootPath, String uuid) { String parentPath = CmsResource.getParentFolder(rootPath); CmsAppWorkplaceUi.get().getNavigator().navigateTo( CmsFileExplorerConfiguration.APP_ID + "/" + A_CmsUI.getCmsObject().getRequestContext().getCurrentProject().getUuid() + "!!" + A_CmsUI.getCmsObject().getRequestContext().getSiteRoot() + "!!" + parentPath.substring(A_CmsUI.getCmsObject().getRequestContext().getSiteRoot().length()) + "!!" + uuid + "!!"); }
java
void openExplorerForParent(String rootPath, String uuid) { String parentPath = CmsResource.getParentFolder(rootPath); CmsAppWorkplaceUi.get().getNavigator().navigateTo( CmsFileExplorerConfiguration.APP_ID + "/" + A_CmsUI.getCmsObject().getRequestContext().getCurrentProject().getUuid() + "!!" + A_CmsUI.getCmsObject().getRequestContext().getSiteRoot() + "!!" + parentPath.substring(A_CmsUI.getCmsObject().getRequestContext().getSiteRoot().length()) + "!!" + uuid + "!!"); }
[ "void", "openExplorerForParent", "(", "String", "rootPath", ",", "String", "uuid", ")", "{", "String", "parentPath", "=", "CmsResource", ".", "getParentFolder", "(", "rootPath", ")", ";", "CmsAppWorkplaceUi", ".", "get", "(", ")", ".", "getNavigator", "(", ")"...
Opens the explorer for given path and selected resource.<p> @param rootPath to be opened @param uuid to be selected
[ "Opens", "the", "explorer", "for", "given", "path", "and", "selected", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/cacheadmin/CmsImageCacheTable.java#L389-L404
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java
QrCodeEncoder.getLengthBits
private static int getLengthBits(int version, int bitsA, int bitsB, int bitsC) { int lengthBits; if (version < 10) lengthBits = bitsA; else if (version < 27) lengthBits = bitsB; else lengthBits = bitsC; return lengthBits; }
java
private static int getLengthBits(int version, int bitsA, int bitsB, int bitsC) { int lengthBits; if (version < 10) lengthBits = bitsA; else if (version < 27) lengthBits = bitsB; else lengthBits = bitsC; return lengthBits; }
[ "private", "static", "int", "getLengthBits", "(", "int", "version", ",", "int", "bitsA", ",", "int", "bitsB", ",", "int", "bitsC", ")", "{", "int", "lengthBits", ";", "if", "(", "version", "<", "10", ")", "lengthBits", "=", "bitsA", ";", "else", "if", ...
Returns the length of the message length variable in bits. Dependent on version
[ "Returns", "the", "length", "of", "the", "message", "length", "variable", "in", "bits", ".", "Dependent", "on", "version" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java#L459-L469
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
PippoSettings.addInterpolationValue
protected void addInterpolationValue(String name, String value) { interpolationValues.put(String.format("${%s}", name), value); interpolationValues.put(String.format("@{%s}", name), value); }
java
protected void addInterpolationValue(String name, String value) { interpolationValues.put(String.format("${%s}", name), value); interpolationValues.put(String.format("@{%s}", name), value); }
[ "protected", "void", "addInterpolationValue", "(", "String", "name", ",", "String", "value", ")", "{", "interpolationValues", ".", "put", "(", "String", ".", "format", "(", "\"${%s}\"", ",", "name", ")", ",", "value", ")", ";", "interpolationValues", ".", "p...
Add a value that may be interpolated. @param name @param value
[ "Add", "a", "value", "that", "may", "be", "interpolated", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L385-L388
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/parsing/ParseUtils.java
ParseUtils.unexpectedAttribute
public static XMLStreamException unexpectedAttribute(final XMLStreamReader reader, final int index) { return new XMLStreamException("Unexpected attribute '" + reader.getAttributeName(index) + "' encountered", reader.getLocation()); }
java
public static XMLStreamException unexpectedAttribute(final XMLStreamReader reader, final int index) { return new XMLStreamException("Unexpected attribute '" + reader.getAttributeName(index) + "' encountered", reader.getLocation()); }
[ "public", "static", "XMLStreamException", "unexpectedAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "int", "index", ")", "{", "return", "new", "XMLStreamException", "(", "\"Unexpected attribute '\"", "+", "reader", ".", "getAttributeName", "(", "...
Get an exception reporting an unexpected XML attribute. @param reader the stream reader @param index the attribute index @return the exception
[ "Get", "an", "exception", "reporting", "an", "unexpected", "XML", "attribute", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/parsing/ParseUtils.java#L55-L58
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java
JvmTypesBuilder.setInitializer
public void setInitializer(/* @Nullable */ JvmField field, /* @Nullable */ Procedures.Procedure1<ITreeAppendable> strategy) { if (field == null || strategy == null) return; removeExistingBody(field); setCompilationStrategy(field, strategy); }
java
public void setInitializer(/* @Nullable */ JvmField field, /* @Nullable */ Procedures.Procedure1<ITreeAppendable> strategy) { if (field == null || strategy == null) return; removeExistingBody(field); setCompilationStrategy(field, strategy); }
[ "public", "void", "setInitializer", "(", "/* @Nullable */", "JvmField", "field", ",", "/* @Nullable */", "Procedures", ".", "Procedure1", "<", "ITreeAppendable", ">", "strategy", ")", "{", "if", "(", "field", "==", "null", "||", "strategy", "==", "null", ")", ...
Attaches the given compile strategy to the given {@link JvmField} such that the compiler knows how to initialize the {@link JvmField} when it is translated to Java source code. @param field the field to add the initializer to. If <code>null</code> this method does nothing. @param strategy the compilation strategy. If <code>null</code> this method does nothing.
[ "Attaches", "the", "given", "compile", "strategy", "to", "the", "given", "{", "@link", "JvmField", "}", "such", "that", "the", "compiler", "knows", "how", "to", "initialize", "the", "{", "@link", "JvmField", "}", "when", "it", "is", "translated", "to", "Ja...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L1230-L1235
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java
JQLChecker.extractPlaceHolders
private <L extends Collection<JQLPlaceHolder>> L extractPlaceHolders(final JQLContext jqlContext, String jql, final L result) { final One<Boolean> valid = new One<>(); valid.value0 = false; analyzeInternal(jqlContext, jql, new JqlBaseListener() { @Override public void enterBind_parameter(Bind_parameterContext ctx) { String value; if (ctx.bind_parameter_name() != null) { value = ctx.bind_parameter_name().getText(); } else { value = ctx.getText(); } result.add(new JQLPlaceHolder(JQLPlaceHolderType.PARAMETER, value)); } @Override public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) { result.add(new JQLPlaceHolder(JQLPlaceHolderType.DYNAMIC_SQL, ctx.bind_parameter_name().getText())); } }); return result; }
java
private <L extends Collection<JQLPlaceHolder>> L extractPlaceHolders(final JQLContext jqlContext, String jql, final L result) { final One<Boolean> valid = new One<>(); valid.value0 = false; analyzeInternal(jqlContext, jql, new JqlBaseListener() { @Override public void enterBind_parameter(Bind_parameterContext ctx) { String value; if (ctx.bind_parameter_name() != null) { value = ctx.bind_parameter_name().getText(); } else { value = ctx.getText(); } result.add(new JQLPlaceHolder(JQLPlaceHolderType.PARAMETER, value)); } @Override public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) { result.add(new JQLPlaceHolder(JQLPlaceHolderType.DYNAMIC_SQL, ctx.bind_parameter_name().getText())); } }); return result; }
[ "private", "<", "L", "extends", "Collection", "<", "JQLPlaceHolder", ">", ">", "L", "extractPlaceHolders", "(", "final", "JQLContext", "jqlContext", ",", "String", "jql", ",", "final", "L", "result", ")", "{", "final", "One", "<", "Boolean", ">", "valid", ...
Extract place holders. @param <L> the generic type @param jqlContext the jql context @param jql the jql @param result the result @return the l
[ "Extract", "place", "holders", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java#L876-L900
WolfgangFahl/Mediawiki-Japi
src/main/java/com/bitplan/mediawiki/japi/SiteInfoImpl.java
SiteInfoImpl.initNameSpaces
protected void initNameSpaces(General general, List<Ns> namespaceList) { namespaces = new LinkedHashMap<String, Ns>(); namespacesById = new LinkedHashMap<Integer, Ns>(); namespacesByCanonicalName = new LinkedHashMap<String, Ns>(); for (Ns namespace : namespaceList) { String namespacename = namespace.getValue(); namespaces.put(namespacename, namespace); namespacesById.put(namespace.getId(), namespace); String canonical = namespace.getCanonical(); // this is a BUG in 2015-07-02 - some canonical names are not correct // FIXME - when Bug has been fixed in SMW String bugs[] = { "Attribut", "Property", "Konzept", "Concept","Kategorie","Category" }; for (int i = 0; i < bugs.length; i += 2) { if (bugs[i].equals(canonical) && bugs[i].equals(namespacename)) { canonical = bugs[i + 1]; namespace.setCanonical(bugs[i + 1]); } } namespacesByCanonicalName.put(canonical, namespace); } }
java
protected void initNameSpaces(General general, List<Ns> namespaceList) { namespaces = new LinkedHashMap<String, Ns>(); namespacesById = new LinkedHashMap<Integer, Ns>(); namespacesByCanonicalName = new LinkedHashMap<String, Ns>(); for (Ns namespace : namespaceList) { String namespacename = namespace.getValue(); namespaces.put(namespacename, namespace); namespacesById.put(namespace.getId(), namespace); String canonical = namespace.getCanonical(); // this is a BUG in 2015-07-02 - some canonical names are not correct // FIXME - when Bug has been fixed in SMW String bugs[] = { "Attribut", "Property", "Konzept", "Concept","Kategorie","Category" }; for (int i = 0; i < bugs.length; i += 2) { if (bugs[i].equals(canonical) && bugs[i].equals(namespacename)) { canonical = bugs[i + 1]; namespace.setCanonical(bugs[i + 1]); } } namespacesByCanonicalName.put(canonical, namespace); } }
[ "protected", "void", "initNameSpaces", "(", "General", "general", ",", "List", "<", "Ns", ">", "namespaceList", ")", "{", "namespaces", "=", "new", "LinkedHashMap", "<", "String", ",", "Ns", ">", "(", ")", ";", "namespacesById", "=", "new", "LinkedHashMap", ...
initialize the NameSpaces from the given namespaceList @param general @param namespaceList
[ "initialize", "the", "NameSpaces", "from", "the", "given", "namespaceList" ]
train
https://github.com/WolfgangFahl/Mediawiki-Japi/blob/78d0177ebfe02eb05da5550839727861f1e888a5/src/main/java/com/bitplan/mediawiki/japi/SiteInfoImpl.java#L69-L89
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/UtilColor.java
UtilColor.isOpaqueTransparentExclusive
public static boolean isOpaqueTransparentExclusive(int colorA, int colorB) { return colorA == ColorRgba.TRANSPARENT.getRgba() && colorB == ColorRgba.OPAQUE.getRgba() || colorA == ColorRgba.OPAQUE.getRgba() && colorB == ColorRgba.TRANSPARENT.getRgba(); }
java
public static boolean isOpaqueTransparentExclusive(int colorA, int colorB) { return colorA == ColorRgba.TRANSPARENT.getRgba() && colorB == ColorRgba.OPAQUE.getRgba() || colorA == ColorRgba.OPAQUE.getRgba() && colorB == ColorRgba.TRANSPARENT.getRgba(); }
[ "public", "static", "boolean", "isOpaqueTransparentExclusive", "(", "int", "colorA", ",", "int", "colorB", ")", "{", "return", "colorA", "==", "ColorRgba", ".", "TRANSPARENT", ".", "getRgba", "(", ")", "&&", "colorB", "==", "ColorRgba", ".", "OPAQUE", ".", "...
Check if colors transparency type are exclusive (one is {@link ColorRgba#OPAQUE} and the other {@link ColorRgba#TRANSPARENT}). @param colorA The first color. @param colorB The second color. @return <code>true</code> if exclusive, <code>false</code> else.
[ "Check", "if", "colors", "transparency", "type", "are", "exclusive", "(", "one", "is", "{", "@link", "ColorRgba#OPAQUE", "}", "and", "the", "other", "{", "@link", "ColorRgba#TRANSPARENT", "}", ")", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/UtilColor.java#L175-L179
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java
ExcelWriter.setColumnWidth
public ExcelWriter setColumnWidth(int columnIndex, int width) { if (columnIndex < 0) { this.sheet.setDefaultColumnWidth(width); } else { this.sheet.setColumnWidth(columnIndex, width * 256); } return this; }
java
public ExcelWriter setColumnWidth(int columnIndex, int width) { if (columnIndex < 0) { this.sheet.setDefaultColumnWidth(width); } else { this.sheet.setColumnWidth(columnIndex, width * 256); } return this; }
[ "public", "ExcelWriter", "setColumnWidth", "(", "int", "columnIndex", ",", "int", "width", ")", "{", "if", "(", "columnIndex", "<", "0", ")", "{", "this", ".", "sheet", ".", "setDefaultColumnWidth", "(", "width", ")", ";", "}", "else", "{", "this", ".", ...
设置列宽(单位为一个字符的宽度,例如传入width为10,表示10个字符的宽度) @param columnIndex 列号(从0开始计数,-1表示所有列的默认宽度) @param width 宽度(单位1~256个字符宽度) @return this @since 4.0.8
[ "设置列宽(单位为一个字符的宽度,例如传入width为10,表示10个字符的宽度)" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L430-L437
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/ConnectionRepository.java
ConnectionRepository.addDescriptor
public JdbcConnectionDescriptor addDescriptor(String jcdAlias, DataSource dataSource, String username, String password) { JdbcConnectionDescriptor jcd = new JdbcConnectionDescriptor(); jcd.setJcdAlias(jcdAlias); jcd.setDataSource(dataSource); if (username != null) { jcd.setUserName(username); jcd.setPassWord(password); } utils.fillJCDFromDataSource(jcd, dataSource, username, password); if ("default".equals(jcdAlias)) { jcd.setDefaultConnection(true); // arminw: MM will search for the default key // MetadataManager.getInstance().setDefaultPBKey(jcd.getPBKey()); } addDescriptor(jcd); return jcd; }
java
public JdbcConnectionDescriptor addDescriptor(String jcdAlias, DataSource dataSource, String username, String password) { JdbcConnectionDescriptor jcd = new JdbcConnectionDescriptor(); jcd.setJcdAlias(jcdAlias); jcd.setDataSource(dataSource); if (username != null) { jcd.setUserName(username); jcd.setPassWord(password); } utils.fillJCDFromDataSource(jcd, dataSource, username, password); if ("default".equals(jcdAlias)) { jcd.setDefaultConnection(true); // arminw: MM will search for the default key // MetadataManager.getInstance().setDefaultPBKey(jcd.getPBKey()); } addDescriptor(jcd); return jcd; }
[ "public", "JdbcConnectionDescriptor", "addDescriptor", "(", "String", "jcdAlias", ",", "DataSource", "dataSource", ",", "String", "username", ",", "String", "password", ")", "{", "JdbcConnectionDescriptor", "jcd", "=", "new", "JdbcConnectionDescriptor", "(", ")", ";",...
Creates and adds a new connection descriptor for the given JDBC data source. This method tries to guess the platform to be used, but it should be checked afterwards nonetheless using the {@link JdbcConnectionDescriptor#getDbms()} method. Note that the descriptor won't have a value for the driver because it is not possible to retrieve the driver classname from the data source. @param jcdAlias The connection alias for the created connection; if 'default' is used, then the new descriptor will become the default connection descriptor @param dataSource The data source @param username The user name (can be <code>null</code>) @param password The password (can be <code>null</code>) @return The created connection descriptor @see JdbcConnectionDescriptor#getDbms()
[ "Creates", "and", "adds", "a", "new", "connection", "descriptor", "for", "the", "given", "JDBC", "data", "source", ".", "This", "method", "tries", "to", "guess", "the", "platform", "to", "be", "used", "but", "it", "should", "be", "checked", "afterwards", "...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ConnectionRepository.java#L199-L219
evsinev/ber-tlv
src/main/java/com/payneteasy/tlv/BerTlvBuilder.java
BerTlvBuilder.addText
public BerTlvBuilder addText(BerTag aTag, String aText, Charset aCharset) { byte[] buffer = aText.getBytes(aCharset); return addBytes(aTag, buffer, 0, buffer.length); }
java
public BerTlvBuilder addText(BerTag aTag, String aText, Charset aCharset) { byte[] buffer = aText.getBytes(aCharset); return addBytes(aTag, buffer, 0, buffer.length); }
[ "public", "BerTlvBuilder", "addText", "(", "BerTag", "aTag", ",", "String", "aText", ",", "Charset", "aCharset", ")", "{", "byte", "[", "]", "buffer", "=", "aText", ".", "getBytes", "(", "aCharset", ")", ";", "return", "addBytes", "(", "aTag", ",", "buff...
Add ASCII text @param aTag tag @param aText text @return builder
[ "Add", "ASCII", "text" ]
train
https://github.com/evsinev/ber-tlv/blob/82f980c7a8c1938c890a1e1b320ba383eac343f8/src/main/java/com/payneteasy/tlv/BerTlvBuilder.java#L218-L221
google/closure-compiler
src/com/google/javascript/jscomp/PeepholeMinimizeConditions.java
PeepholeMinimizeConditions.areMatchingExits
boolean areMatchingExits(Node nodeThis, Node nodeThat) { return nodeThis.isEquivalentTo(nodeThat) && (!isExceptionPossible(nodeThis) || getExceptionHandler(nodeThis) == getExceptionHandler(nodeThat)); }
java
boolean areMatchingExits(Node nodeThis, Node nodeThat) { return nodeThis.isEquivalentTo(nodeThat) && (!isExceptionPossible(nodeThis) || getExceptionHandler(nodeThis) == getExceptionHandler(nodeThat)); }
[ "boolean", "areMatchingExits", "(", "Node", "nodeThis", ",", "Node", "nodeThat", ")", "{", "return", "nodeThis", ".", "isEquivalentTo", "(", "nodeThat", ")", "&&", "(", "!", "isExceptionPossible", "(", "nodeThis", ")", "||", "getExceptionHandler", "(", "nodeThis...
Check whether one exit can be replaced with another. Verify: 1) They are identical expressions 2) If an exception is possible that the statements, the original and the potential replacement are in the same exception handler.
[ "Check", "whether", "one", "exit", "can", "be", "replaced", "with", "another", ".", "Verify", ":", "1", ")", "They", "are", "identical", "expressions", "2", ")", "If", "an", "exception", "is", "possible", "that", "the", "statements", "the", "original", "an...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PeepholeMinimizeConditions.java#L383-L387
primefaces-extensions/core
src/main/java/org/primefaces/extensions/component/sheet/Sheet.java
Sheet.setLocalValue
public void setLocalValue(final String rowKey, final int col, final Object value) { localValues.put(new SheetRowColIndex(rowKey, col), value); }
java
public void setLocalValue(final String rowKey, final int col, final Object value) { localValues.put(new SheetRowColIndex(rowKey, col), value); }
[ "public", "void", "setLocalValue", "(", "final", "String", "rowKey", ",", "final", "int", "col", ",", "final", "Object", "value", ")", "{", "localValues", ".", "put", "(", "new", "SheetRowColIndex", "(", "rowKey", ",", "col", ")", ",", "value", ")", ";",...
Updates a local value. @param rowKey @param col @param value
[ "Updates", "a", "local", "value", "." ]
train
https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/Sheet.java#L291-L293
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/resources/HostsResource.java
HostsResource.put
@PUT @Path("{host}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public Response.Status put(@PathParam("host") final String host, @QueryParam("id") @DefaultValue("") final String id) { if (isNullOrEmpty(id)) { throw badRequest(new HostRegisterResponse(HostRegisterResponse.Status.INVALID_ID, host)); } model.registerHost(host, id); log.info("added host {}", host); return Response.Status.OK; }
java
@PUT @Path("{host}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public Response.Status put(@PathParam("host") final String host, @QueryParam("id") @DefaultValue("") final String id) { if (isNullOrEmpty(id)) { throw badRequest(new HostRegisterResponse(HostRegisterResponse.Status.INVALID_ID, host)); } model.registerHost(host, id); log.info("added host {}", host); return Response.Status.OK; }
[ "@", "PUT", "@", "Path", "(", "\"{host}\"", ")", "@", "Produces", "(", "APPLICATION_JSON", ")", "@", "Timed", "@", "ExceptionMetered", "public", "Response", ".", "Status", "put", "(", "@", "PathParam", "(", "\"host\"", ")", "final", "String", "host", ",", ...
Registers a host with the cluster. The {@code host} is the name of the host. It SHOULD be the hostname of the machine. The {@code id} should be a persistent value for the host, but initially randomly generated. This way we don't have two machines claiming to be the same host: at least by accident. @param host The host to register. @param id The randomly generated ID for the host. @return The response.
[ "Registers", "a", "host", "with", "the", "cluster", ".", "The", "{", "@code", "host", "}", "is", "the", "name", "of", "the", "host", ".", "It", "SHOULD", "be", "the", "hostname", "of", "the", "machine", ".", "The", "{", "@code", "id", "}", "should", ...
train
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/resources/HostsResource.java#L137-L151
UrielCh/ovh-java-sdk
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
ApiOvhPackxdsl.packName_migration_servicesToDelete_POST
public ArrayList<OvhSubServiceToDelete> packName_migration_servicesToDelete_POST(String packName, String offerName, OvhOfferOption[] options) throws IOException { String qPath = "/pack/xdsl/{packName}/migration/servicesToDelete"; StringBuilder sb = path(qPath, packName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "offerName", offerName); addBody(o, "options", options); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t10); }
java
public ArrayList<OvhSubServiceToDelete> packName_migration_servicesToDelete_POST(String packName, String offerName, OvhOfferOption[] options) throws IOException { String qPath = "/pack/xdsl/{packName}/migration/servicesToDelete"; StringBuilder sb = path(qPath, packName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "offerName", offerName); addBody(o, "options", options); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t10); }
[ "public", "ArrayList", "<", "OvhSubServiceToDelete", ">", "packName_migration_servicesToDelete_POST", "(", "String", "packName", ",", "String", "offerName", ",", "OvhOfferOption", "[", "]", "options", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/pack...
Calculate services to delete with new offer and options REST: POST /pack/xdsl/{packName}/migration/servicesToDelete @param options [required] Options wanted in the new offer @param offerName [required] Reference of the new offer @param packName [required] The internal name of your pack
[ "Calculate", "services", "to", "delete", "with", "new", "offer", "and", "options" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L940-L948
xwiki/xwiki-rendering
xwiki-rendering-macros/xwiki-rendering-macro-html/src/main/java/org/xwiki/rendering/internal/macro/html/HTMLMacro.java
HTMLMacro.cleanHTML
private String cleanHTML(String content, MacroTransformationContext context) throws MacroExecutionException { String cleanedContent = content; HTMLCleanerConfiguration cleanerConfiguration = getCleanerConfiguration(context); // Note that we trim the content since we want to be lenient with the user in case he has entered // some spaces/newlines before a XML declaration (prolog). Otherwise the XML parser would fail to parse. Document document = this.htmlCleaner.clean(new StringReader(cleanedContent), cleanerConfiguration); // Since XML can only have a single root node and since we want to allow users to put // content such as the following, we need to wrap the content in a root node: // <tag1> // .. // </tag1> // <tag2> // </tag2> // In addition we also need to ensure the XHTML DTD is defined so that valid XHTML entities can be // specified. // Remove the HTML envelope since this macro is only a fragment of a page which will already have an // HTML envelope when rendered. We remove it so that the HTML <head> tag isn't output. HTMLUtils.stripHTMLEnvelope(document); // If in inline mode verify we have inline HTML content and remove the top level paragraph if there's one if (context.isInline()) { // TODO: Improve this since when're inside a table cell or a list item we can allow non inline items too Element root = document.getDocumentElement(); if (root.getChildNodes().getLength() == 1 && root.getFirstChild().getNodeType() == Node.ELEMENT_NODE && root.getFirstChild().getNodeName().equalsIgnoreCase("p")) { HTMLUtils.stripFirstElementInside(document, HTMLConstants.TAG_HTML, HTMLConstants.TAG_P); } else { throw new MacroExecutionException( "When using the HTML macro inline, you can only use inline HTML content." + " Block HTML content (such as tables) cannot be displayed." + " Try leaving an empty line before and after the HTML macro."); } } // Don't print the XML declaration nor the XHTML DocType. cleanedContent = HTMLUtils.toString(document, true, true); // Don't print the top level html element (which is always present and at the same location // since it's been normalized by the HTML cleaner) // Note: we trim the first 7 characters since they correspond to a leading new line (generated by // XMLUtils.toString() since the doctype is printed on a line by itself followed by a new line) + // the 6 chars from "<html>". cleanedContent = cleanedContent.substring(7, cleanedContent.length() - 8); return cleanedContent; }
java
private String cleanHTML(String content, MacroTransformationContext context) throws MacroExecutionException { String cleanedContent = content; HTMLCleanerConfiguration cleanerConfiguration = getCleanerConfiguration(context); // Note that we trim the content since we want to be lenient with the user in case he has entered // some spaces/newlines before a XML declaration (prolog). Otherwise the XML parser would fail to parse. Document document = this.htmlCleaner.clean(new StringReader(cleanedContent), cleanerConfiguration); // Since XML can only have a single root node and since we want to allow users to put // content such as the following, we need to wrap the content in a root node: // <tag1> // .. // </tag1> // <tag2> // </tag2> // In addition we also need to ensure the XHTML DTD is defined so that valid XHTML entities can be // specified. // Remove the HTML envelope since this macro is only a fragment of a page which will already have an // HTML envelope when rendered. We remove it so that the HTML <head> tag isn't output. HTMLUtils.stripHTMLEnvelope(document); // If in inline mode verify we have inline HTML content and remove the top level paragraph if there's one if (context.isInline()) { // TODO: Improve this since when're inside a table cell or a list item we can allow non inline items too Element root = document.getDocumentElement(); if (root.getChildNodes().getLength() == 1 && root.getFirstChild().getNodeType() == Node.ELEMENT_NODE && root.getFirstChild().getNodeName().equalsIgnoreCase("p")) { HTMLUtils.stripFirstElementInside(document, HTMLConstants.TAG_HTML, HTMLConstants.TAG_P); } else { throw new MacroExecutionException( "When using the HTML macro inline, you can only use inline HTML content." + " Block HTML content (such as tables) cannot be displayed." + " Try leaving an empty line before and after the HTML macro."); } } // Don't print the XML declaration nor the XHTML DocType. cleanedContent = HTMLUtils.toString(document, true, true); // Don't print the top level html element (which is always present and at the same location // since it's been normalized by the HTML cleaner) // Note: we trim the first 7 characters since they correspond to a leading new line (generated by // XMLUtils.toString() since the doctype is printed on a line by itself followed by a new line) + // the 6 chars from "<html>". cleanedContent = cleanedContent.substring(7, cleanedContent.length() - 8); return cleanedContent; }
[ "private", "String", "cleanHTML", "(", "String", "content", ",", "MacroTransformationContext", "context", ")", "throws", "MacroExecutionException", "{", "String", "cleanedContent", "=", "content", ";", "HTMLCleanerConfiguration", "cleanerConfiguration", "=", "getCleanerConf...
Clean the HTML entered by the user, transforming it into valid XHTML. @param content the content to clean @param context the macro transformation context @return the cleaned HTML as a string representing valid XHTML @throws MacroExecutionException if the macro is inline and the content is not inline HTML
[ "Clean", "the", "HTML", "entered", "by", "the", "user", "transforming", "it", "into", "valid", "XHTML", "." ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-macros/xwiki-rendering-macro-html/src/main/java/org/xwiki/rendering/internal/macro/html/HTMLMacro.java#L181-L231
lecho/hellocharts-android
hellocharts-library/src/lecho/lib/hellocharts/computator/ChartComputator.java
ChartComputator.setMaxViewport
public void setMaxViewport(float left, float top, float right, float bottom) { this.maxViewport.set(left, top, right, bottom); computeMinimumWidthAndHeight(); }
java
public void setMaxViewport(float left, float top, float right, float bottom) { this.maxViewport.set(left, top, right, bottom); computeMinimumWidthAndHeight(); }
[ "public", "void", "setMaxViewport", "(", "float", "left", ",", "float", "top", ",", "float", "right", ",", "float", "bottom", ")", "{", "this", ".", "maxViewport", ".", "set", "(", "left", ",", "top", ",", "right", ",", "bottom", ")", ";", "computeMini...
Set new values for maximum viewport, that will change what part of chart is visible.
[ "Set", "new", "values", "for", "maximum", "viewport", "that", "will", "change", "what", "part", "of", "chart", "is", "visible", "." ]
train
https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/computator/ChartComputator.java#L280-L283
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.notNaN
@Throws(IllegalNaNArgumentException.class) public static double notNaN(final double value, @Nullable final String name) { // most efficient check for NaN, see Double.isNaN(value)) if (value != value) { throw new IllegalNaNArgumentException(name); } return value; }
java
@Throws(IllegalNaNArgumentException.class) public static double notNaN(final double value, @Nullable final String name) { // most efficient check for NaN, see Double.isNaN(value)) if (value != value) { throw new IllegalNaNArgumentException(name); } return value; }
[ "@", "Throws", "(", "IllegalNaNArgumentException", ".", "class", ")", "public", "static", "double", "notNaN", "(", "final", "double", "value", ",", "@", "Nullable", "final", "String", "name", ")", "{", "// most efficient check for NaN, see Double.isNaN(value))", "if",...
Ensures that a double argument is not NaN (not a number). @see java.lang.Double#NaN @param value value which should not be NaN @param name name of object reference (in source code) @return the given double value @throws IllegalNaNArgumentException if the given argument {@code value} is NaN
[ "Ensures", "that", "a", "double", "argument", "is", "not", "NaN", "(", "not", "a", "number", ")", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L2696-L2703
davidcarboni/restolino
src/main/java/com/github/davidcarboni/restolino/Configuration.java
Configuration.configureFilesReloadable
void configureFilesReloadable(String path) { try { // Running with reloading: Path filesPath = FileSystems.getDefault().getPath(path); filesUrl = filesPath.toUri().toURL(); } catch (IOException e) { throw new RuntimeException("Error determining files path/url for: " + path, e); } }
java
void configureFilesReloadable(String path) { try { // Running with reloading: Path filesPath = FileSystems.getDefault().getPath(path); filesUrl = filesPath.toUri().toURL(); } catch (IOException e) { throw new RuntimeException("Error determining files path/url for: " + path, e); } }
[ "void", "configureFilesReloadable", "(", "String", "path", ")", "{", "try", "{", "// Running with reloading:", "Path", "filesPath", "=", "FileSystems", ".", "getDefault", "(", ")", ".", "getPath", "(", "path", ")", ";", "filesUrl", "=", "filesPath", ".", "toUr...
Configures static file serving from a directory. This will be reloadable, so is most useful for development (rather than deployment). This typically serves files from the <code>src/main/resources/files/...</code> directory of your development project. <p> NB This provides an efficient development workflow, allowing you to see static file changes without having to rebuild.
[ "Configures", "static", "file", "serving", "from", "a", "directory", ".", "This", "will", "be", "reloadable", "so", "is", "most", "useful", "for", "development", "(", "rather", "than", "deployment", ")", ".", "This", "typically", "serves", "files", "from", "...
train
https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/Configuration.java#L251-L260
flow/commons
src/main/java/com/flowpowered/commons/queue/SubscribableQueue.java
SubscribableQueue.addAll
public boolean addAll(Collection<? extends T> c, Object identifier) { checkNotNullArgument(c); if (isPublisherThread()) { boolean changed = false; if (identifier != null) { final Long id = subscriberIdentifiers.get(identifier); checkNotNullIdentifier(id); changed = queues.get(id).addAll(c); } else { for (Queue<T> queue : queues.values()) { if (queue.addAll(c)) { changed = true; } } } return changed; } return getCurrentThreadQueue().addAll(c); }
java
public boolean addAll(Collection<? extends T> c, Object identifier) { checkNotNullArgument(c); if (isPublisherThread()) { boolean changed = false; if (identifier != null) { final Long id = subscriberIdentifiers.get(identifier); checkNotNullIdentifier(id); changed = queues.get(id).addAll(c); } else { for (Queue<T> queue : queues.values()) { if (queue.addAll(c)) { changed = true; } } } return changed; } return getCurrentThreadQueue().addAll(c); }
[ "public", "boolean", "addAll", "(", "Collection", "<", "?", "extends", "T", ">", "c", ",", "Object", "identifier", ")", "{", "checkNotNullArgument", "(", "c", ")", ";", "if", "(", "isPublisherThread", "(", ")", ")", "{", "boolean", "changed", "=", "false...
Adds a collection of objects to the queue, targeting only the subscriber identified by the provided identifier object, unless said object is null. The added objects will only be visible to the subscriber. @param c The collection of objects to add @param identifier The identifier object, can be null @return True if this queue changed as a result of the call @see #addAll(java.util.Collection)
[ "Adds", "a", "collection", "of", "objects", "to", "the", "queue", "targeting", "only", "the", "subscriber", "identified", "by", "the", "provided", "identifier", "object", "unless", "said", "object", "is", "null", ".", "The", "added", "objects", "will", "only",...
train
https://github.com/flow/commons/blob/0690efdac06fd728fcd7e9cf10f2b1319379c45b/src/main/java/com/flowpowered/commons/queue/SubscribableQueue.java#L195-L213
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/Constraint.java
Constraint.checkHasMainRef
boolean checkHasMainRef(Session session, Object[] row) { if (ArrayUtil.hasNull(row, core.refCols)) { return false; } PersistentStore store = session.sessionData.getRowStore(core.mainTable); boolean exists = core.mainIndex.exists(session, store, row, core.refCols); if (!exists) { String[] info = new String[] { core.refName.name, core.mainTable.getName().name }; throw Error.error(ErrorCode.X_23502, ErrorCode.CONSTRAINT, info); } return exists; }
java
boolean checkHasMainRef(Session session, Object[] row) { if (ArrayUtil.hasNull(row, core.refCols)) { return false; } PersistentStore store = session.sessionData.getRowStore(core.mainTable); boolean exists = core.mainIndex.exists(session, store, row, core.refCols); if (!exists) { String[] info = new String[] { core.refName.name, core.mainTable.getName().name }; throw Error.error(ErrorCode.X_23502, ErrorCode.CONSTRAINT, info); } return exists; }
[ "boolean", "checkHasMainRef", "(", "Session", "session", ",", "Object", "[", "]", "row", ")", "{", "if", "(", "ArrayUtil", ".", "hasNull", "(", "row", ",", "core", ".", "refCols", ")", ")", "{", "return", "false", ";", "}", "PersistentStore", "store", ...
For the candidate table row, finds any referring node in the main table. This is used to check referential integrity when updating a node. We have to make sure that the main table still holds a valid main record. returns true If a valid row is found, false if there are null in the data Otherwise a 'INTEGRITY VIOLATION' Exception gets thrown.
[ "For", "the", "candidate", "table", "row", "finds", "any", "referring", "node", "in", "the", "main", "table", ".", "This", "is", "used", "to", "check", "referential", "integrity", "when", "updating", "a", "node", ".", "We", "have", "to", "make", "sure", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Constraint.java#L923-L943
Teddy-Zhu/SilentGo
utils/src/main/java/com/silentgo/utils/asm/ClassUtils.java
ClassUtils.matchesTypeName
public static boolean matchesTypeName(Class<?> clazz, String typeName) { return (typeName != null && (typeName.equals(clazz.getTypeName()) || typeName.equals(clazz.getSimpleName()))); }
java
public static boolean matchesTypeName(Class<?> clazz, String typeName) { return (typeName != null && (typeName.equals(clazz.getTypeName()) || typeName.equals(clazz.getSimpleName()))); }
[ "public", "static", "boolean", "matchesTypeName", "(", "Class", "<", "?", ">", "clazz", ",", "String", "typeName", ")", "{", "return", "(", "typeName", "!=", "null", "&&", "(", "typeName", ".", "equals", "(", "clazz", ".", "getTypeName", "(", ")", ")", ...
Check whether the given class matches the user-specified type name. @param clazz the class to check @param typeName the type name to match
[ "Check", "whether", "the", "given", "class", "matches", "the", "user", "-", "specified", "type", "name", "." ]
train
https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/utils/src/main/java/com/silentgo/utils/asm/ClassUtils.java#L537-L540
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/util/ExtraUtil.java
ExtraUtil.getExtra
public static <T> T getExtra(Bundle extras, String name, boolean nullable) { T value = null; if (extras != null && extras.containsKey(name)) { value = (T)extras.get(name); } if (!nullable && value == null) { throw new TransfuseInjectionException("Unable to access Extra " + name); } return value; }
java
public static <T> T getExtra(Bundle extras, String name, boolean nullable) { T value = null; if (extras != null && extras.containsKey(name)) { value = (T)extras.get(name); } if (!nullable && value == null) { throw new TransfuseInjectionException("Unable to access Extra " + name); } return value; }
[ "public", "static", "<", "T", ">", "T", "getExtra", "(", "Bundle", "extras", ",", "String", "name", ",", "boolean", "nullable", ")", "{", "T", "value", "=", "null", ";", "if", "(", "extras", "!=", "null", "&&", "extras", ".", "containsKey", "(", "nam...
Returns the extras in the given bundle by name. If no extra is found and the extra is considered not nullable, this method will throw a TransfuseInjectionException. If no extra is found and the extra is considered nullable, this method will, of course, return null. @throws TransfuseInjectionException @param extras bundle @param name name of the extra to access @param nullable nullability of the extra @return extra value
[ "Returns", "the", "extras", "in", "the", "given", "bundle", "by", "name", ".", "If", "no", "extra", "is", "found", "and", "the", "extra", "is", "considered", "not", "nullable", "this", "method", "will", "throw", "a", "TransfuseInjectionException", ".", "If",...
train
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/util/ExtraUtil.java#L44-L53
apache/incubator-gobblin
gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStoreFactory.java
SimpleHadoopFilesystemConfigStoreFactory.createFileSystem
private FileSystem createFileSystem(URI configKey) throws ConfigStoreCreationException { try { return FileSystem.get(createFileSystemURI(configKey), new Configuration()); } catch (IOException | URISyntaxException e) { throw new ConfigStoreCreationException(configKey, e); } }
java
private FileSystem createFileSystem(URI configKey) throws ConfigStoreCreationException { try { return FileSystem.get(createFileSystemURI(configKey), new Configuration()); } catch (IOException | URISyntaxException e) { throw new ConfigStoreCreationException(configKey, e); } }
[ "private", "FileSystem", "createFileSystem", "(", "URI", "configKey", ")", "throws", "ConfigStoreCreationException", "{", "try", "{", "return", "FileSystem", ".", "get", "(", "createFileSystemURI", "(", "configKey", ")", ",", "new", "Configuration", "(", ")", ")",...
Creates a {@link FileSystem} given a user specified configKey.
[ "Creates", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStoreFactory.java#L196-L202
haraldk/TwelveMonkeys
servlet/src/main/java/com/twelvemonkeys/servlet/fileupload/FileUploadFilter.java
FileUploadFilter.doFilterImpl
public void doFilterImpl(ServletRequest pRequest, ServletResponse pResponse, FilterChain pChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) pRequest; // Get the content type from the request String contentType = request.getContentType(); // If the content type is multipart, wrap if (isMultipartFileUpload(contentType)) { pRequest = new HttpFileUploadRequestWrapper(request, uploadDir, maxFileSize); } pChain.doFilter(pRequest, pResponse); }
java
public void doFilterImpl(ServletRequest pRequest, ServletResponse pResponse, FilterChain pChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) pRequest; // Get the content type from the request String contentType = request.getContentType(); // If the content type is multipart, wrap if (isMultipartFileUpload(contentType)) { pRequest = new HttpFileUploadRequestWrapper(request, uploadDir, maxFileSize); } pChain.doFilter(pRequest, pResponse); }
[ "public", "void", "doFilterImpl", "(", "ServletRequest", "pRequest", ",", "ServletResponse", "pResponse", ",", "FilterChain", "pChain", ")", "throws", "IOException", ",", "ServletException", "{", "HttpServletRequest", "request", "=", "(", "HttpServletRequest", ")", "p...
Examines the request content type, and if it is a {@code multipart/*} request, wraps the request with a {@code HttpFileUploadRequest}. @param pRequest The servlet request @param pResponse The servlet response @param pChain The filter chain @throws ServletException @throws IOException
[ "Examines", "the", "request", "content", "type", "and", "if", "it", "is", "a", "{", "@code", "multipart", "/", "*", "}", "request", "wraps", "the", "request", "with", "a", "{", "@code", "HttpFileUploadRequest", "}", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/fileupload/FileUploadFilter.java#L110-L122
neo4j/neo4j-java-driver
driver/src/main/java/org/neo4j/driver/internal/security/TrustOnFirstUseTrustManager.java
TrustOnFirstUseTrustManager.saveTrustedHost
private void saveTrustedHost( String fingerprint ) throws IOException { this.fingerprint = fingerprint; logger.info( "Adding %s as known and trusted certificate for %s.", fingerprint, serverId ); createKnownCertFileIfNotExists(); assertKnownHostFileWritable(); try ( BufferedWriter writer = new BufferedWriter( new FileWriter( knownHosts, true ) ) ) { writer.write( serverId + " " + this.fingerprint ); writer.newLine(); } }
java
private void saveTrustedHost( String fingerprint ) throws IOException { this.fingerprint = fingerprint; logger.info( "Adding %s as known and trusted certificate for %s.", fingerprint, serverId ); createKnownCertFileIfNotExists(); assertKnownHostFileWritable(); try ( BufferedWriter writer = new BufferedWriter( new FileWriter( knownHosts, true ) ) ) { writer.write( serverId + " " + this.fingerprint ); writer.newLine(); } }
[ "private", "void", "saveTrustedHost", "(", "String", "fingerprint", ")", "throws", "IOException", "{", "this", ".", "fingerprint", "=", "fingerprint", ";", "logger", ".", "info", "(", "\"Adding %s as known and trusted certificate for %s.\"", ",", "fingerprint", ",", "...
Save a new (server_ip, cert) pair into knownHosts file @param fingerprint the SHA-512 fingerprint of the host certificate
[ "Save", "a", "new", "(", "server_ip", "cert", ")", "pair", "into", "knownHosts", "file" ]
train
https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/internal/security/TrustOnFirstUseTrustManager.java#L109-L122
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/Utils.java
Utils.loadFromStream
public static byte[] loadFromStream(InputStream stream) { try { BufferedInputStream bis = new BufferedInputStream(stream); int size = 2048; byte[] theData = new byte[size]; int dataReadSoFar = 0; byte[] buffer = new byte[size / 2]; int read = 0; while ((read = bis.read(buffer)) != -1) { if ((read + dataReadSoFar) > theData.length) { // need to make more room byte[] newTheData = new byte[theData.length * 2]; // System.out.println("doubled to " + newTheData.length); System.arraycopy(theData, 0, newTheData, 0, dataReadSoFar); theData = newTheData; } System.arraycopy(buffer, 0, theData, dataReadSoFar, read); dataReadSoFar += read; } bis.close(); // Resize to actual data read byte[] returnData = new byte[dataReadSoFar]; System.arraycopy(theData, 0, returnData, 0, dataReadSoFar); return returnData; } catch (IOException e) { throw new ReloadException("Unexpectedly unable to load bytedata from input stream", e); } }
java
public static byte[] loadFromStream(InputStream stream) { try { BufferedInputStream bis = new BufferedInputStream(stream); int size = 2048; byte[] theData = new byte[size]; int dataReadSoFar = 0; byte[] buffer = new byte[size / 2]; int read = 0; while ((read = bis.read(buffer)) != -1) { if ((read + dataReadSoFar) > theData.length) { // need to make more room byte[] newTheData = new byte[theData.length * 2]; // System.out.println("doubled to " + newTheData.length); System.arraycopy(theData, 0, newTheData, 0, dataReadSoFar); theData = newTheData; } System.arraycopy(buffer, 0, theData, dataReadSoFar, read); dataReadSoFar += read; } bis.close(); // Resize to actual data read byte[] returnData = new byte[dataReadSoFar]; System.arraycopy(theData, 0, returnData, 0, dataReadSoFar); return returnData; } catch (IOException e) { throw new ReloadException("Unexpectedly unable to load bytedata from input stream", e); } }
[ "public", "static", "byte", "[", "]", "loadFromStream", "(", "InputStream", "stream", ")", "{", "try", "{", "BufferedInputStream", "bis", "=", "new", "BufferedInputStream", "(", "stream", ")", ";", "int", "size", "=", "2048", ";", "byte", "[", "]", "theDat...
Load the contents of an input stream. @param stream input stream that contains the bytes to load @return the byte array loaded from the input stream
[ "Load", "the", "contents", "of", "an", "input", "stream", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/Utils.java#L1399-L1427
redkale/redkale
src/org/redkale/asm/ClassReader.java
ClassReader.readAnnotationTarget
private int readAnnotationTarget(final Context context, int u) { int target = readInt(u); switch (target >>> 24) { case 0x00: // CLASS_TYPE_PARAMETER case 0x01: // METHOD_TYPE_PARAMETER case 0x16: // METHOD_FORMAL_PARAMETER target &= 0xFFFF0000; u += 2; break; case 0x13: // FIELD case 0x14: // METHOD_RETURN case 0x15: // METHOD_RECEIVER target &= 0xFF000000; u += 1; break; case 0x40: // LOCAL_VARIABLE case 0x41: { // RESOURCE_VARIABLE target &= 0xFF000000; int n = readUnsignedShort(u + 1); context.start = new Label[n]; context.end = new Label[n]; context.index = new int[n]; u += 3; for (int i = 0; i < n; ++i) { int start = readUnsignedShort(u); int length = readUnsignedShort(u + 2); context.start[i] = createLabel(start, context.labels); context.end[i] = createLabel(start + length, context.labels); context.index[i] = readUnsignedShort(u + 4); u += 6; } break; } case 0x47: // CAST case 0x48: // CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT case 0x49: // METHOD_INVOCATION_TYPE_ARGUMENT case 0x4A: // CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT case 0x4B: // METHOD_REFERENCE_TYPE_ARGUMENT target &= 0xFF0000FF; u += 4; break; // case 0x10: // CLASS_EXTENDS // case 0x11: // CLASS_TYPE_PARAMETER_BOUND // case 0x12: // METHOD_TYPE_PARAMETER_BOUND // case 0x17: // THROWS // case 0x42: // EXCEPTION_PARAMETER // case 0x43: // INSTANCEOF // case 0x44: // NEW // case 0x45: // CONSTRUCTOR_REFERENCE // case 0x46: // METHOD_REFERENCE default: target &= (target >>> 24) < 0x43 ? 0xFFFFFF00 : 0xFF000000; u += 3; break; } int pathLength = readByte(u); context.typeRef = target; context.typePath = pathLength == 0 ? null : new TypePath(b, u); return u + 1 + 2 * pathLength; }
java
private int readAnnotationTarget(final Context context, int u) { int target = readInt(u); switch (target >>> 24) { case 0x00: // CLASS_TYPE_PARAMETER case 0x01: // METHOD_TYPE_PARAMETER case 0x16: // METHOD_FORMAL_PARAMETER target &= 0xFFFF0000; u += 2; break; case 0x13: // FIELD case 0x14: // METHOD_RETURN case 0x15: // METHOD_RECEIVER target &= 0xFF000000; u += 1; break; case 0x40: // LOCAL_VARIABLE case 0x41: { // RESOURCE_VARIABLE target &= 0xFF000000; int n = readUnsignedShort(u + 1); context.start = new Label[n]; context.end = new Label[n]; context.index = new int[n]; u += 3; for (int i = 0; i < n; ++i) { int start = readUnsignedShort(u); int length = readUnsignedShort(u + 2); context.start[i] = createLabel(start, context.labels); context.end[i] = createLabel(start + length, context.labels); context.index[i] = readUnsignedShort(u + 4); u += 6; } break; } case 0x47: // CAST case 0x48: // CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT case 0x49: // METHOD_INVOCATION_TYPE_ARGUMENT case 0x4A: // CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT case 0x4B: // METHOD_REFERENCE_TYPE_ARGUMENT target &= 0xFF0000FF; u += 4; break; // case 0x10: // CLASS_EXTENDS // case 0x11: // CLASS_TYPE_PARAMETER_BOUND // case 0x12: // METHOD_TYPE_PARAMETER_BOUND // case 0x17: // THROWS // case 0x42: // EXCEPTION_PARAMETER // case 0x43: // INSTANCEOF // case 0x44: // NEW // case 0x45: // CONSTRUCTOR_REFERENCE // case 0x46: // METHOD_REFERENCE default: target &= (target >>> 24) < 0x43 ? 0xFFFFFF00 : 0xFF000000; u += 3; break; } int pathLength = readByte(u); context.typeRef = target; context.typePath = pathLength == 0 ? null : new TypePath(b, u); return u + 1 + 2 * pathLength; }
[ "private", "int", "readAnnotationTarget", "(", "final", "Context", "context", ",", "int", "u", ")", "{", "int", "target", "=", "readInt", "(", "u", ")", ";", "switch", "(", "target", ">>>", "24", ")", "{", "case", "0x00", ":", "// CLASS_TYPE_PARAMETER", ...
Parses the header of a type annotation to extract its target_type and target_path (the result is stored in the given context), and returns the start offset of the rest of the type_annotation structure (i.e. the offset to the type_index field, which is followed by num_element_value_pairs and then the name,value pairs). @param context information about the class being parsed. This is where the extracted target_type and target_path must be stored. @param u the start offset of a type_annotation structure. @return the start offset of the rest of the type_annotation structure.
[ "Parses", "the", "header", "of", "a", "type", "annotation", "to", "extract", "its", "target_type", "and", "target_path", "(", "the", "result", "is", "stored", "in", "the", "given", "context", ")", "and", "returns", "the", "start", "offset", "of", "the", "r...
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/asm/ClassReader.java#L1864-L1923
liyiorg/weixin-popular
src/main/java/weixin/popular/client/LocalHttpClient.java
LocalHttpClient.keyStoreExecuteXmlResult
public static <T> T keyStoreExecuteXmlResult(String mch_id,HttpUriRequest request,Class<T> clazz){ return keyStoreExecuteXmlResult(mch_id, request, clazz, null,null); }
java
public static <T> T keyStoreExecuteXmlResult(String mch_id,HttpUriRequest request,Class<T> clazz){ return keyStoreExecuteXmlResult(mch_id, request, clazz, null,null); }
[ "public", "static", "<", "T", ">", "T", "keyStoreExecuteXmlResult", "(", "String", "mch_id", ",", "HttpUriRequest", "request", ",", "Class", "<", "T", ">", "clazz", ")", "{", "return", "keyStoreExecuteXmlResult", "(", "mch_id", ",", "request", ",", "clazz", ...
MCH keyStore 请求 数据返回自动XML对象解析 @param mch_id mch_id @param request request @param clazz clazz @param <T> T @return result
[ "MCH", "keyStore", "请求", "数据返回自动XML对象解析" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/client/LocalHttpClient.java#L192-L194
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpResponseMessageImpl.java
HttpResponseMessageImpl.setPseudoHeaders
@Override protected void setPseudoHeaders(HashMap<String, String> pseudoHeaders) throws Exception { //Only defined pseudo-header for a response is :status. for (Entry<String, String> entry : pseudoHeaders.entrySet()) { H2HeaderField header = new H2HeaderField(entry.getKey(), entry.getValue()); if (!isValidPseudoHeader(header)) { throw new CompressionException("Invalid pseudo-header for decompression context: " + header.toString()); } } setStatusCode(Integer.getInteger(pseudoHeaders.get(HpackConstants.STATUS))); }
java
@Override protected void setPseudoHeaders(HashMap<String, String> pseudoHeaders) throws Exception { //Only defined pseudo-header for a response is :status. for (Entry<String, String> entry : pseudoHeaders.entrySet()) { H2HeaderField header = new H2HeaderField(entry.getKey(), entry.getValue()); if (!isValidPseudoHeader(header)) { throw new CompressionException("Invalid pseudo-header for decompression context: " + header.toString()); } } setStatusCode(Integer.getInteger(pseudoHeaders.get(HpackConstants.STATUS))); }
[ "@", "Override", "protected", "void", "setPseudoHeaders", "(", "HashMap", "<", "String", ",", "String", ">", "pseudoHeaders", ")", "throws", "Exception", "{", "//Only defined pseudo-header for a response is :status.", "for", "(", "Entry", "<", "String", ",", "String",...
Set the Version and Status for a HTTP/2.0 response. @param pseudoHeader
[ "Set", "the", "Version", "and", "Status", "for", "a", "HTTP", "/", "2", ".", "0", "response", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpResponseMessageImpl.java#L317-L328
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/model/JobWithDetails.java
JobWithDetails.updateDescription
public JobWithDetails updateDescription(String description, boolean crumbFlag) throws IOException { Objects.requireNonNull(description, "description is not allowed to be null."); //JDK9+ // Map.of(...); Map<String, String> params = new HashMap<>(); params.put("description", description); client.post_form(this.getUrl() + "/submitDescription?", params, crumbFlag); return this; }
java
public JobWithDetails updateDescription(String description, boolean crumbFlag) throws IOException { Objects.requireNonNull(description, "description is not allowed to be null."); //JDK9+ // Map.of(...); Map<String, String> params = new HashMap<>(); params.put("description", description); client.post_form(this.getUrl() + "/submitDescription?", params, crumbFlag); return this; }
[ "public", "JobWithDetails", "updateDescription", "(", "String", "description", ",", "boolean", "crumbFlag", ")", "throws", "IOException", "{", "Objects", ".", "requireNonNull", "(", "description", ",", "\"description is not allowed to be null.\"", ")", ";", "//JDK9+", "...
Update the <code>description</code> of a Job. @param description The description which should be set. If you like to set an empty description you should use {@link #EMPTY_DESCRIPTION}. @param crumbFlag <code>true</code> or <code>false</code>. @throws IOException in case of errors.
[ "Update", "the", "<code", ">", "description<", "/", "code", ">", "of", "a", "Job", "." ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/model/JobWithDetails.java#L487-L495
actframework/actframework
src/main/java/act/ws/WebSocketContext.java
WebSocketContext.sendToUser
public WebSocketContext sendToUser(String message, String username) { return sendToConnections(message, username, manager.usernameRegistry(), true); }
java
public WebSocketContext sendToUser(String message, String username) { return sendToConnections(message, username, manager.usernameRegistry(), true); }
[ "public", "WebSocketContext", "sendToUser", "(", "String", "message", ",", "String", "username", ")", "{", "return", "sendToConnections", "(", "message", ",", "username", ",", "manager", ".", "usernameRegistry", "(", ")", ",", "true", ")", ";", "}" ]
Send message to all connections of a certain user @param message the message to be sent @param username the username @return this context
[ "Send", "message", "to", "all", "connections", "of", "a", "certain", "user" ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/ws/WebSocketContext.java#L269-L271
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java
ContinuousDistributions.gammaCdf
public static double gammaCdf(double x, double a, double b) { if(a<=0 || b<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double GammaCdf = ContinuousDistributions.gammaCdf(x/b, a); return GammaCdf; }
java
public static double gammaCdf(double x, double a, double b) { if(a<=0 || b<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double GammaCdf = ContinuousDistributions.gammaCdf(x/b, a); return GammaCdf; }
[ "public", "static", "double", "gammaCdf", "(", "double", "x", ",", "double", "a", ",", "double", "b", ")", "{", "if", "(", "a", "<=", "0", "||", "b", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"All the parameters must be positi...
Calculates the probability from 0 to X under Gamma Distribution @param x @param a @param b @return
[ "Calculates", "the", "probability", "from", "0", "to", "X", "under", "Gamma", "Distribution" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java#L356-L364
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java
DatabasesInner.listByRecommendedElasticPoolAsync
public Observable<List<DatabaseInner>> listByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { return listByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1<ServiceResponse<List<DatabaseInner>>, List<DatabaseInner>>() { @Override public List<DatabaseInner> call(ServiceResponse<List<DatabaseInner>> response) { return response.body(); } }); }
java
public Observable<List<DatabaseInner>> listByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { return listByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1<ServiceResponse<List<DatabaseInner>>, List<DatabaseInner>>() { @Override public List<DatabaseInner> call(ServiceResponse<List<DatabaseInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "DatabaseInner", ">", ">", "listByRecommendedElasticPoolAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "recommendedElasticPoolName", ")", "{", "return", "listByRecommendedElasticPoolWithServi...
Returns a list of databases inside a recommented elastic pool. @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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;DatabaseInner&gt; object
[ "Returns", "a", "list", "of", "databases", "inside", "a", "recommented", "elastic", "pool", "." ]
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/DatabasesInner.java#L1666-L1673
jwtk/jjwt
api/src/main/java/io/jsonwebtoken/lang/Assert.java
Assert.isAssignable
public static void isAssignable(Class superType, Class subType, String message) { notNull(superType, "Type to check against must not be null"); if (subType == null || !superType.isAssignableFrom(subType)) { throw new IllegalArgumentException(message + subType + " is not assignable to " + superType); } }
java
public static void isAssignable(Class superType, Class subType, String message) { notNull(superType, "Type to check against must not be null"); if (subType == null || !superType.isAssignableFrom(subType)) { throw new IllegalArgumentException(message + subType + " is not assignable to " + superType); } }
[ "public", "static", "void", "isAssignable", "(", "Class", "superType", ",", "Class", "subType", ",", "String", "message", ")", "{", "notNull", "(", "superType", ",", "\"Type to check against must not be null\"", ")", ";", "if", "(", "subType", "==", "null", "||"...
Assert that <code>superType.isAssignableFrom(subType)</code> is <code>true</code>. <pre class="code">Assert.isAssignable(Number.class, myClass);</pre> @param superType the super type to check against @param subType the sub type to check @param message a message which will be prepended to the message produced by the function itself, and which may be used to provide context. It should normally end in a ": " or ". " so that the function generate message looks ok when prepended to it. @throws IllegalArgumentException if the classes are not assignable
[ "Assert", "that", "<code", ">", "superType", ".", "isAssignableFrom", "(", "subType", ")", "<", "/", "code", ">", "is", "<code", ">", "true<", "/", "code", ">", ".", "<pre", "class", "=", "code", ">", "Assert", ".", "isAssignable", "(", "Number", ".", ...
train
https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Assert.java#L341-L346
qiujiayu/AutoLoadCache
src/main/java/com/jarvis/cache/script/AbstractScriptParser.java
AbstractScriptParser.isAutoload
public boolean isAutoload(Cache cache, Object target, Object[] arguments, Object retVal) throws Exception { if (cache.opType() == CacheOpType.WRITE) { return false; } boolean autoload = cache.autoload(); if (null != arguments && arguments.length > 0 && null != cache.autoloadCondition() && cache.autoloadCondition().length() > 0) { autoload = this.getElValue(cache.autoloadCondition(), target, arguments, retVal, true, Boolean.class); } return autoload; }
java
public boolean isAutoload(Cache cache, Object target, Object[] arguments, Object retVal) throws Exception { if (cache.opType() == CacheOpType.WRITE) { return false; } boolean autoload = cache.autoload(); if (null != arguments && arguments.length > 0 && null != cache.autoloadCondition() && cache.autoloadCondition().length() > 0) { autoload = this.getElValue(cache.autoloadCondition(), target, arguments, retVal, true, Boolean.class); } return autoload; }
[ "public", "boolean", "isAutoload", "(", "Cache", "cache", ",", "Object", "target", ",", "Object", "[", "]", "arguments", ",", "Object", "retVal", ")", "throws", "Exception", "{", "if", "(", "cache", ".", "opType", "(", ")", "==", "CacheOpType", ".", "WRI...
是否可以自动加载 @param cache Cache 注解 @param target AOP 拦截到的实例 @param arguments 参数 @param retVal return value @return autoload 是否自动加载 @throws Exception 异常
[ "是否可以自动加载" ]
train
https://github.com/qiujiayu/AutoLoadCache/blob/8121c146f1a420fa6d6832e849acadb547c13622/src/main/java/com/jarvis/cache/script/AbstractScriptParser.java#L148-L158
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java
LeafNode.deleteAllItems
public void deleteAllItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub request = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PURGE_OWNER, getId())); pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow(); }
java
public void deleteAllItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub request = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PURGE_OWNER, getId())); pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow(); }
[ "public", "void", "deleteAllItems", "(", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "PubSub", "request", "=", "createPubsubPacket", "(", "Type", ".", "set", ",", "new", "NodeExtensio...
Purges the node of all items. <p>Note: Some implementations may keep the last item sent. @throws XMPPErrorException @throws NoResponseException if there was no response from the server. @throws NotConnectedException @throws InterruptedException
[ "Purges", "the", "node", "of", "all", "items", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java#L343-L347
eserating/siren4j
src/main/java/com/google/code/siren4j/util/ComponentUtils.java
ComponentUtils.getActionByName
public static Action getActionByName(Entity entity, String name) { if(entity == null) { throw new IllegalArgumentException("entity cannot be null."); } if(StringUtils.isBlank(name)) { throw new IllegalArgumentException("name cannot be null or empty."); } List<Action> actions = entity.getActions(); if (actions == null) return null; Action action = null; for (Action a : actions) { if (a.getName().equals(name)) { action = a; break; } } return action; }
java
public static Action getActionByName(Entity entity, String name) { if(entity == null) { throw new IllegalArgumentException("entity cannot be null."); } if(StringUtils.isBlank(name)) { throw new IllegalArgumentException("name cannot be null or empty."); } List<Action> actions = entity.getActions(); if (actions == null) return null; Action action = null; for (Action a : actions) { if (a.getName().equals(name)) { action = a; break; } } return action; }
[ "public", "static", "Action", "getActionByName", "(", "Entity", "entity", ",", "String", "name", ")", "{", "if", "(", "entity", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"entity cannot be null.\"", ")", ";", "}", "if", "(", "...
Retrieve an action by its name. @param entity cannot be <code>null</code>. @param name cannot be <code>null</code> or empty. @return the located action or <code>null</code> if not found.
[ "Retrieve", "an", "action", "by", "its", "name", "." ]
train
https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ComponentUtils.java#L102-L120
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java
RelatedTablesCoreExtension.addAttributesRelationship
public ExtendedRelation addAttributesRelationship(String baseTableName, AttributesTable attributesTable, UserMappingTable userMappingTable) { return addRelationship(baseTableName, attributesTable, userMappingTable); }
java
public ExtendedRelation addAttributesRelationship(String baseTableName, AttributesTable attributesTable, UserMappingTable userMappingTable) { return addRelationship(baseTableName, attributesTable, userMappingTable); }
[ "public", "ExtendedRelation", "addAttributesRelationship", "(", "String", "baseTableName", ",", "AttributesTable", "attributesTable", ",", "UserMappingTable", "userMappingTable", ")", "{", "return", "addRelationship", "(", "baseTableName", ",", "attributesTable", ",", "user...
Adds an attributes relationship between the base table and user attributes related table. Creates the user mapping table and an attributes table if needed. @param baseTableName base table name @param attributesTable user attributes table @param userMappingTable user mapping table @return The relationship that was added @since 3.2.0
[ "Adds", "an", "attributes", "relationship", "between", "the", "base", "table", "and", "user", "attributes", "related", "table", ".", "Creates", "the", "user", "mapping", "table", "and", "an", "attributes", "table", "if", "needed", "." ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java#L660-L663
apache/flink
flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java
ExceptionUtils.rethrow
public static void rethrow(Throwable t, String parentMessage) { if (t instanceof Error) { throw (Error) t; } else if (t instanceof RuntimeException) { throw (RuntimeException) t; } else { throw new RuntimeException(parentMessage, t); } }
java
public static void rethrow(Throwable t, String parentMessage) { if (t instanceof Error) { throw (Error) t; } else if (t instanceof RuntimeException) { throw (RuntimeException) t; } else { throw new RuntimeException(parentMessage, t); } }
[ "public", "static", "void", "rethrow", "(", "Throwable", "t", ",", "String", "parentMessage", ")", "{", "if", "(", "t", "instanceof", "Error", ")", "{", "throw", "(", "Error", ")", "t", ";", "}", "else", "if", "(", "t", "instanceof", "RuntimeException", ...
Throws the given {@code Throwable} in scenarios where the signatures do not allow you to throw an arbitrary Throwable. Errors and RuntimeExceptions are thrown directly, other exceptions are packed into a parent RuntimeException. @param t The throwable to be thrown. @param parentMessage The message for the parent RuntimeException, if one is needed.
[ "Throws", "the", "given", "{", "@code", "Throwable", "}", "in", "scenarios", "where", "the", "signatures", "do", "not", "allow", "you", "to", "throw", "an", "arbitrary", "Throwable", ".", "Errors", "and", "RuntimeExceptions", "are", "thrown", "directly", "othe...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java#L211-L221
Erudika/para
para-client/src/main/java/com/erudika/para/client/ParaClient.java
ParaClient.invokeDelete
public Response invokeDelete(String resourcePath, MultivaluedMap<String, String> params) { logger.debug("DELETE {}, params: {}", getFullPath(resourcePath), params); return invokeSignedRequest(getApiClient(), accessKey, key(true), DELETE, getEndpoint(), getFullPath(resourcePath), null, params, new byte[0]); }
java
public Response invokeDelete(String resourcePath, MultivaluedMap<String, String> params) { logger.debug("DELETE {}, params: {}", getFullPath(resourcePath), params); return invokeSignedRequest(getApiClient(), accessKey, key(true), DELETE, getEndpoint(), getFullPath(resourcePath), null, params, new byte[0]); }
[ "public", "Response", "invokeDelete", "(", "String", "resourcePath", ",", "MultivaluedMap", "<", "String", ",", "String", ">", "params", ")", "{", "logger", ".", "debug", "(", "\"DELETE {}, params: {}\"", ",", "getFullPath", "(", "resourcePath", ")", ",", "param...
Invoke a DELETE request to the Para API. @param resourcePath the subpath after '/v1/', should not start with '/' @param params query parameters @return a {@link Response} object
[ "Invoke", "a", "DELETE", "request", "to", "the", "Para", "API", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L372-L376
apache/spark
sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java
ColumnVector.getInterval
public final CalendarInterval getInterval(int rowId) { if (isNullAt(rowId)) return null; final int months = getChild(0).getInt(rowId); final long microseconds = getChild(1).getLong(rowId); return new CalendarInterval(months, microseconds); }
java
public final CalendarInterval getInterval(int rowId) { if (isNullAt(rowId)) return null; final int months = getChild(0).getInt(rowId); final long microseconds = getChild(1).getLong(rowId); return new CalendarInterval(months, microseconds); }
[ "public", "final", "CalendarInterval", "getInterval", "(", "int", "rowId", ")", "{", "if", "(", "isNullAt", "(", "rowId", ")", ")", "return", "null", ";", "final", "int", "months", "=", "getChild", "(", "0", ")", ".", "getInt", "(", "rowId", ")", ";", ...
Returns the calendar interval type value for rowId. If the slot for rowId is null, it should return null. In Spark, calendar interval type value is basically an integer value representing the number of months in this interval, and a long value representing the number of microseconds in this interval. An interval type vector is the same as a struct type vector with 2 fields: `months` and `microseconds`. To support interval type, implementations must implement {@link #getChild(int)} and define 2 child vectors: the first child vector is an int type vector, containing all the month values of all the interval values in this vector. The second child vector is a long type vector, containing all the microsecond values of all the interval values in this vector.
[ "Returns", "the", "calendar", "interval", "type", "value", "for", "rowId", ".", "If", "the", "slot", "for", "rowId", "is", "null", "it", "should", "return", "null", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L280-L285