repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
daimajia/AndroidSwipeLayout
library/src/main/java/com/daimajia/swipe/SwipeLayout.java
SwipeLayout.addRevealListener
public void addRevealListener(int childId, OnRevealListener l) { View child = findViewById(childId); if (child == null) { throw new IllegalArgumentException("Child does not belong to SwipeListener."); } if (!mShowEntirely.containsKey(child)) { mShowEntirely.put(child, false); } if (mRevealListeners.get(child) == null) mRevealListeners.put(child, new ArrayList<OnRevealListener>()); mRevealListeners.get(child).add(l); }
java
public void addRevealListener(int childId, OnRevealListener l) { View child = findViewById(childId); if (child == null) { throw new IllegalArgumentException("Child does not belong to SwipeListener."); } if (!mShowEntirely.containsKey(child)) { mShowEntirely.put(child, false); } if (mRevealListeners.get(child) == null) mRevealListeners.put(child, new ArrayList<OnRevealListener>()); mRevealListeners.get(child).add(l); }
[ "public", "void", "addRevealListener", "(", "int", "childId", ",", "OnRevealListener", "l", ")", "{", "View", "child", "=", "findViewById", "(", "childId", ")", ";", "if", "(", "child", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(",...
bind a view with a specific {@link com.daimajia.swipe.SwipeLayout.OnRevealListener} @param childId the view id. @param l the target {@link com.daimajia.swipe.SwipeLayout.OnRevealListener}
[ "bind", "a", "view", "with", "a", "specific", "{", "@link", "com", ".", "daimajia", ".", "swipe", ".", "SwipeLayout", ".", "OnRevealListener", "}" ]
train
https://github.com/daimajia/AndroidSwipeLayout/blob/5f8678b04751fb8510a88586b22e07ccf64bca99/library/src/main/java/com/daimajia/swipe/SwipeLayout.java#L176-L189
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/arrays/DoubleIntegerArrayQuickSort.java
DoubleIntegerArrayQuickSort.insertionSort
private static void insertionSort(double[] keys, int[] vals, final int start, final int end) { // Classic insertion sort. for(int i = start + 1; i < end; i++) { for(int j = i; j > start; j--) { if(keys[j] >= keys[j - 1]) { break; } swap(keys, vals, j, j - 1); } } }
java
private static void insertionSort(double[] keys, int[] vals, final int start, final int end) { // Classic insertion sort. for(int i = start + 1; i < end; i++) { for(int j = i; j > start; j--) { if(keys[j] >= keys[j - 1]) { break; } swap(keys, vals, j, j - 1); } } }
[ "private", "static", "void", "insertionSort", "(", "double", "[", "]", "keys", ",", "int", "[", "]", "vals", ",", "final", "int", "start", ",", "final", "int", "end", ")", "{", "// Classic insertion sort.", "for", "(", "int", "i", "=", "start", "+", "1...
Sort via insertion sort. @param keys Keys @param vals Values @param start Interval start @param end Interval end
[ "Sort", "via", "insertion", "sort", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/arrays/DoubleIntegerArrayQuickSort.java#L195-L205
primefaces/primefaces
src/main/java/org/primefaces/renderkit/CoreRenderer.java
CoreRenderer.renderDummyMarkup
protected void renderDummyMarkup(FacesContext context, UIComponent component, String clientId) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("div", null); writer.writeAttribute("id", clientId, null); writer.writeAttribute("style", "display: none;", null); renderPassThruAttributes(context, component, null); writer.endElement("div"); }
java
protected void renderDummyMarkup(FacesContext context, UIComponent component, String clientId) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("div", null); writer.writeAttribute("id", clientId, null); writer.writeAttribute("style", "display: none;", null); renderPassThruAttributes(context, component, null); writer.endElement("div"); }
[ "protected", "void", "renderDummyMarkup", "(", "FacesContext", "context", ",", "UIComponent", "component", ",", "String", "clientId", ")", "throws", "IOException", "{", "ResponseWriter", "writer", "=", "context", ".", "getResponseWriter", "(", ")", ";", "writer", ...
Used by script-only widget to fix #3265 and allow updating of the component. @param context the {@link FacesContext}. @param component the widget without actual HTML markup. @param clientId the component clientId. @throws IOException
[ "Used", "by", "script", "-", "only", "widget", "to", "fix", "#3265", "and", "allow", "updating", "of", "the", "component", "." ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/renderkit/CoreRenderer.java#L821-L831
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/widgets/complex/CmsDataViewClientWidget.java
CmsDataViewClientWidget.isTrue
private boolean isTrue(JSONObject obj, String property) { JSONValue val = obj.get(property); if (val == null) { return false; } boolean stringTrue = ((val.isString() != null) && Boolean.parseBoolean(val.isString().stringValue())); boolean boolTrue = ((val.isBoolean() != null) && val.isBoolean().booleanValue()); return stringTrue || boolTrue; }
java
private boolean isTrue(JSONObject obj, String property) { JSONValue val = obj.get(property); if (val == null) { return false; } boolean stringTrue = ((val.isString() != null) && Boolean.parseBoolean(val.isString().stringValue())); boolean boolTrue = ((val.isBoolean() != null) && val.isBoolean().booleanValue()); return stringTrue || boolTrue; }
[ "private", "boolean", "isTrue", "(", "JSONObject", "obj", ",", "String", "property", ")", "{", "JSONValue", "val", "=", "obj", ".", "get", "(", "property", ")", ";", "if", "(", "val", "==", "null", ")", "{", "return", "false", ";", "}", "boolean", "s...
Checks if a property in a JSON object is either the boolean value 'true' or a string representation of that value.<p> @param obj the JSON object @param property the property name @return true if the value represents the boolean 'true'
[ "Checks", "if", "a", "property", "in", "a", "JSON", "object", "is", "either", "the", "boolean", "value", "true", "or", "a", "string", "representation", "of", "that", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/complex/CmsDataViewClientWidget.java#L198-L207
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/web/utils/SocialWebUtils.java
SocialWebUtils.removeRequestUrlAndParameters
public void removeRequestUrlAndParameters(HttpServletRequest request, HttpServletResponse response) { ReferrerURLCookieHandler referrerURLCookieHandler = getCookieHandler(); referrerURLCookieHandler.invalidateReferrerURLCookie(request, response, ReferrerURLCookieHandler.REFERRER_URL_COOKIENAME); WebAppSecurityConfig webAppSecConfig = getWebAppSecurityConfig(); if (isPostDataSavedInCookie(webAppSecConfig)) { deleteCookie(request, response, PostParameterHelper.POSTPARAM_COOKIE, webAppSecConfig); } else { removePostParameterSessionAttributes(request); } }
java
public void removeRequestUrlAndParameters(HttpServletRequest request, HttpServletResponse response) { ReferrerURLCookieHandler referrerURLCookieHandler = getCookieHandler(); referrerURLCookieHandler.invalidateReferrerURLCookie(request, response, ReferrerURLCookieHandler.REFERRER_URL_COOKIENAME); WebAppSecurityConfig webAppSecConfig = getWebAppSecurityConfig(); if (isPostDataSavedInCookie(webAppSecConfig)) { deleteCookie(request, response, PostParameterHelper.POSTPARAM_COOKIE, webAppSecConfig); } else { removePostParameterSessionAttributes(request); } }
[ "public", "void", "removeRequestUrlAndParameters", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "{", "ReferrerURLCookieHandler", "referrerURLCookieHandler", "=", "getCookieHandler", "(", ")", ";", "referrerURLCookieHandler", ".", "invalid...
Invalidates the original request URL cookie or removes the same respective session attributes, depending on how the data was saved.
[ "Invalidates", "the", "original", "request", "URL", "cookie", "or", "removes", "the", "same", "respective", "session", "attributes", "depending", "on", "how", "the", "data", "was", "saved", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/web/utils/SocialWebUtils.java#L238-L248
inkstand-io/scribble
scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServerBuilder.java
HttpServerBuilder.contentFrom
public HttpServerBuilder contentFrom(String contextRoot, String contentResource){ URL resource = resolver.resolve(contentResource,CallStack.getCallerClass()); resources.put(contextRoot, resource); return this; }
java
public HttpServerBuilder contentFrom(String contextRoot, String contentResource){ URL resource = resolver.resolve(contentResource,CallStack.getCallerClass()); resources.put(contextRoot, resource); return this; }
[ "public", "HttpServerBuilder", "contentFrom", "(", "String", "contextRoot", ",", "String", "contentResource", ")", "{", "URL", "resource", "=", "resolver", ".", "resolve", "(", "contentResource", ",", "CallStack", ".", "getCallerClass", "(", ")", ")", ";", "reso...
Defines a ZIP resource on the classpath that provides the static content the server should host. @param contextRoot the root path to the content @param contentResource the name of the classpath resource denoting a file that should be hosted. If the file denotes a zip file, its content is hosted instead of the file itself. The path may be absolute or relative to the caller of the method. @return this builder
[ "Defines", "a", "ZIP", "resource", "on", "the", "classpath", "that", "provides", "the", "static", "content", "the", "server", "should", "host", "." ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServerBuilder.java#L86-L90
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/UcsApi.java
UcsApi.getContactDetails
public ApiSuccessResponse getContactDetails(String id, ContactDetailsData contactDetailsData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = getContactDetailsWithHttpInfo(id, contactDetailsData); return resp.getData(); }
java
public ApiSuccessResponse getContactDetails(String id, ContactDetailsData contactDetailsData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = getContactDetailsWithHttpInfo(id, contactDetailsData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "getContactDetails", "(", "String", "id", ",", "ContactDetailsData", "contactDetailsData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "getContactDetailsWithHttpInfo", "(", "id", ",", "c...
Get the details of a contact @param id id of the Contact (required) @param contactDetailsData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "the", "details", "of", "a", "contact" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UcsApi.java#L901-L904
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
IterableOfProtosSubject.ignoringFieldDescriptors
public IterableOfProtosFluentAssertion<M> ignoringFieldDescriptors( FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) { return ignoringFieldDescriptors(asList(firstFieldDescriptor, rest)); }
java
public IterableOfProtosFluentAssertion<M> ignoringFieldDescriptors( FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) { return ignoringFieldDescriptors(asList(firstFieldDescriptor, rest)); }
[ "public", "IterableOfProtosFluentAssertion", "<", "M", ">", "ignoringFieldDescriptors", "(", "FieldDescriptor", "firstFieldDescriptor", ",", "FieldDescriptor", "...", "rest", ")", "{", "return", "ignoringFieldDescriptors", "(", "asList", "(", "firstFieldDescriptor", ",", ...
Excludes all message fields matching the given {@link FieldDescriptor}s from the comparison. <p>This method adds on any previous {@link FieldScope} related settings, overriding previous changes to ensure the specified fields are ignored recursively. All sub-fields of these field descriptors are ignored, no matter where they occur in the tree. <p>If a field descriptor which does not, or cannot occur in the proto structure is supplied, it is silently ignored.
[ "Excludes", "all", "message", "fields", "matching", "the", "given", "{", "@link", "FieldDescriptor", "}", "s", "from", "the", "comparison", "." ]
train
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java#L922-L925
jcuda/jcurand
JCurandJava/src/main/java/jcuda/jcurand/JCurand.java
JCurand.curandGenerate
public static int curandGenerate(curandGenerator generator, Pointer outputPtr, long num) { return checkResult(curandGenerateNative(generator, outputPtr, num)); }
java
public static int curandGenerate(curandGenerator generator, Pointer outputPtr, long num) { return checkResult(curandGenerateNative(generator, outputPtr, num)); }
[ "public", "static", "int", "curandGenerate", "(", "curandGenerator", "generator", ",", "Pointer", "outputPtr", ",", "long", "num", ")", "{", "return", "checkResult", "(", "curandGenerateNative", "(", "generator", ",", "outputPtr", ",", "num", ")", ")", ";", "}...
<pre> Generate 32-bit pseudo or quasirandom numbers. Use generator to generate num 32-bit results into the device memory at outputPtr. The device memory must have been previously allocated and be large enough to hold all the results. Launches are done with the stream set using ::curandSetStream(), or the null stream if no stream has been set. Results are 32-bit values with every bit random. @param generator - Generator to use @param outputPtr - Pointer to device memory to store CUDA-generated results, or Pointer to host memory to store CPU-generated results @param num - Number of random 32-bit values to generate @return CURAND_STATUS_NOT_INITIALIZED if the generator was never created CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from a previous kernel launch CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is not a multiple of the quasirandom dimension CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason CURAND_STATUS_SUCCESS if the results were generated successfully </pre>
[ "<pre", ">", "Generate", "32", "-", "bit", "pseudo", "or", "quasirandom", "numbers", "." ]
train
https://github.com/jcuda/jcurand/blob/0f463d2bb72cd93b3988f7ce148cdb6069ba4fd9/JCurandJava/src/main/java/jcuda/jcurand/JCurand.java#L527-L530
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.swapCase
@GwtIncompatible("incompatible method") public static String swapCase(final String str) { if (StringUtils.isEmpty(str)) { return str; } final int strLen = str.length(); final int newCodePoints[] = new int[strLen]; // cannot be longer than the char array int outOffset = 0; for (int i = 0; i < strLen; ) { final int oldCodepoint = str.codePointAt(i); final int newCodePoint; if (Character.isUpperCase(oldCodepoint)) { newCodePoint = Character.toLowerCase(oldCodepoint); } else if (Character.isTitleCase(oldCodepoint)) { newCodePoint = Character.toLowerCase(oldCodepoint); } else if (Character.isLowerCase(oldCodepoint)) { newCodePoint = Character.toUpperCase(oldCodepoint); } else { newCodePoint = oldCodepoint; } newCodePoints[outOffset++] = newCodePoint; i += Character.charCount(newCodePoint); } return new String(newCodePoints, 0, outOffset); }
java
@GwtIncompatible("incompatible method") public static String swapCase(final String str) { if (StringUtils.isEmpty(str)) { return str; } final int strLen = str.length(); final int newCodePoints[] = new int[strLen]; // cannot be longer than the char array int outOffset = 0; for (int i = 0; i < strLen; ) { final int oldCodepoint = str.codePointAt(i); final int newCodePoint; if (Character.isUpperCase(oldCodepoint)) { newCodePoint = Character.toLowerCase(oldCodepoint); } else if (Character.isTitleCase(oldCodepoint)) { newCodePoint = Character.toLowerCase(oldCodepoint); } else if (Character.isLowerCase(oldCodepoint)) { newCodePoint = Character.toUpperCase(oldCodepoint); } else { newCodePoint = oldCodepoint; } newCodePoints[outOffset++] = newCodePoint; i += Character.charCount(newCodePoint); } return new String(newCodePoints, 0, outOffset); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "String", "swapCase", "(", "final", "String", "str", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "str", ")", ")", "{", "return", "str", ";", "}", "final", "int", ...
<p>Swaps the case of a String changing upper and title case to lower case, and lower case to upper case.</p> <ul> <li>Upper case character converts to Lower case</li> <li>Title case character converts to Lower case</li> <li>Lower case character converts to Upper case</li> </ul> <p>For a word based algorithm, see {@link org.apache.commons.lang3.text.WordUtils#swapCase(String)}. A {@code null} input String returns {@code null}.</p> <pre> StringUtils.swapCase(null) = null StringUtils.swapCase("") = "" StringUtils.swapCase("The dog has a BONE") = "tHE DOG HAS A bone" </pre> <p>NOTE: This method changed in Lang version 2.0. It no longer performs a word based algorithm. If you only use ASCII, you will notice no change. That functionality is available in org.apache.commons.lang3.text.WordUtils.</p> @param str the String to swap case, may be null @return the changed String, {@code null} if null String input
[ "<p", ">", "Swaps", "the", "case", "of", "a", "String", "changing", "upper", "and", "title", "case", "to", "lower", "case", "and", "lower", "case", "to", "upper", "case", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L6815-L6840
jamesagnew/hapi-fhir
hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/BaseValidator.java
BaseValidator.txWarning
protected boolean txWarning(List<ValidationMessage> errors, String txLink, IssueType type, int line, int col, String path, boolean thePass, String msg, Object... theMessageArguments) { if (!thePass) { msg = formatMessage(msg, theMessageArguments); errors.add(new ValidationMessage(Source.TerminologyEngine, type, line, col, path, msg, IssueSeverity.WARNING).setTxLink(txLink)); } return thePass; }
java
protected boolean txWarning(List<ValidationMessage> errors, String txLink, IssueType type, int line, int col, String path, boolean thePass, String msg, Object... theMessageArguments) { if (!thePass) { msg = formatMessage(msg, theMessageArguments); errors.add(new ValidationMessage(Source.TerminologyEngine, type, line, col, path, msg, IssueSeverity.WARNING).setTxLink(txLink)); } return thePass; }
[ "protected", "boolean", "txWarning", "(", "List", "<", "ValidationMessage", ">", "errors", ",", "String", "txLink", ",", "IssueType", "type", ",", "int", "line", ",", "int", "col", ",", "String", "path", ",", "boolean", "thePass", ",", "String", "msg", ","...
Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails @param thePass Set this parameter to <code>false</code> if the validation does not pass @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
[ "Test", "a", "rule", "and", "add", "a", "{", "@link", "IssueSeverity#WARNING", "}", "validation", "message", "if", "the", "validation", "fails" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/BaseValidator.java#L338-L345
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/model/globalfac/ConsecutiveSiblingsFactor.java
ConsecutiveSiblingsFactor.getLinkVar
public LinkVar getLinkVar(int parent, int child) { if (parent == -1) { return rootVars[child]; } else { return childVars[parent][child]; } }
java
public LinkVar getLinkVar(int parent, int child) { if (parent == -1) { return rootVars[child]; } else { return childVars[parent][child]; } }
[ "public", "LinkVar", "getLinkVar", "(", "int", "parent", ",", "int", "child", ")", "{", "if", "(", "parent", "==", "-", "1", ")", "{", "return", "rootVars", "[", "child", "]", ";", "}", "else", "{", "return", "childVars", "[", "parent", "]", "[", "...
Get the link var corresponding to the specified parent and child position. @param parent The parent word position, or -1 to indicate the wall node. @param child The child word position. @return The link variable.
[ "Get", "the", "link", "var", "corresponding", "to", "the", "specified", "parent", "and", "child", "position", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/globalfac/ConsecutiveSiblingsFactor.java#L179-L185
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeCRI.java
TreeCRI.execute
public boolean execute(Context context) throws Exception { assert context != null; assert context instanceof WebChainContext; assert ((WebChainContext)context).getServletRequest() instanceof HttpServletRequest; assert ((WebChainContext)context).getServletResponse() instanceof HttpServletResponse; WebChainContext webChainContext = (WebChainContext)context; HttpServletRequest request = (HttpServletRequest)webChainContext.getServletRequest(); HttpServletResponse response = (HttpServletResponse)webChainContext.getServletResponse(); String cmd = parseCommand(request.getRequestURI()); return render(request, response, webChainContext.getServletContext(), cmd); }
java
public boolean execute(Context context) throws Exception { assert context != null; assert context instanceof WebChainContext; assert ((WebChainContext)context).getServletRequest() instanceof HttpServletRequest; assert ((WebChainContext)context).getServletResponse() instanceof HttpServletResponse; WebChainContext webChainContext = (WebChainContext)context; HttpServletRequest request = (HttpServletRequest)webChainContext.getServletRequest(); HttpServletResponse response = (HttpServletResponse)webChainContext.getServletResponse(); String cmd = parseCommand(request.getRequestURI()); return render(request, response, webChainContext.getServletContext(), cmd); }
[ "public", "boolean", "execute", "(", "Context", "context", ")", "throws", "Exception", "{", "assert", "context", "!=", "null", ";", "assert", "context", "instanceof", "WebChainContext", ";", "assert", "(", "(", "WebChainContext", ")", "context", ")", ".", "get...
Implementation of the {@link Command} interface for using this class as part of a Chain of Responsibility. @param context the Chain's context object @return <code>true</code> if the request was handled by this command; <code>false</code> otherwise @throws Exception any exception that is throw during processing
[ "Implementation", "of", "the", "{", "@link", "Command", "}", "interface", "for", "using", "this", "class", "as", "part", "of", "a", "Chain", "of", "Responsibility", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeCRI.java#L65-L79
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/reportv2/ReportClient.java
ReportClient.getMessageStatistic
public MessageStatListResult getMessageStatistic(String timeUnit, String start, int duration) throws APIConnectionException, APIRequestException { Preconditions.checkArgument(verifyDateFormat(timeUnit, start), "Time format error, please check your argument"); if (timeUnit.equals("HOUR")) { Preconditions.checkArgument(0 <= duration && duration <= 24, "time unit is HOUR, duration must between 0 and 24 "); } else if (timeUnit.equals("DAY")) { Preconditions.checkArgument(0 <= duration && duration <= 60, "time unit is DAY, duration must between 0 and 60"); } else if (timeUnit.equals("MONTH")) { Preconditions.checkArgument(0 <= duration && duration <= 2, "time unit is MONTH, duration must between 0 and 2"); } else throw new IllegalArgumentException("Time unit error"); String url = mBaseReportPath + mV2StatisticPath + "/messages?time_unit=" + timeUnit + "&start=" + start + "&duration=" + duration; ResponseWrapper responseWrapper = _httpClient.sendGet(url); return MessageStatListResult.fromResponse(responseWrapper, MessageStatListResult.class); }
java
public MessageStatListResult getMessageStatistic(String timeUnit, String start, int duration) throws APIConnectionException, APIRequestException { Preconditions.checkArgument(verifyDateFormat(timeUnit, start), "Time format error, please check your argument"); if (timeUnit.equals("HOUR")) { Preconditions.checkArgument(0 <= duration && duration <= 24, "time unit is HOUR, duration must between 0 and 24 "); } else if (timeUnit.equals("DAY")) { Preconditions.checkArgument(0 <= duration && duration <= 60, "time unit is DAY, duration must between 0 and 60"); } else if (timeUnit.equals("MONTH")) { Preconditions.checkArgument(0 <= duration && duration <= 2, "time unit is MONTH, duration must between 0 and 2"); } else throw new IllegalArgumentException("Time unit error"); String url = mBaseReportPath + mV2StatisticPath + "/messages?time_unit=" + timeUnit + "&start=" + start + "&duration=" + duration; ResponseWrapper responseWrapper = _httpClient.sendGet(url); return MessageStatListResult.fromResponse(responseWrapper, MessageStatListResult.class); }
[ "public", "MessageStatListResult", "getMessageStatistic", "(", "String", "timeUnit", ",", "String", "start", ",", "int", "duration", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "Preconditions", ".", "checkArgument", "(", "verifyDateFormat", ...
Get message statistic. Detail instructions please refer to https://docs.jiguang.cn/jmessage/server/rest_api_im_report_v2/#_6 @param timeUnit MUST be one of HOUR, DAY, MONTH @param start start time, when timeUnit is HOUR, format: yyyy-MM-dd HH, @param duration depends on timeUnit, the duration has limit @return {@link MessageStatListResult} @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Get", "message", "statistic", ".", "Detail", "instructions", "please", "refer", "to", "https", ":", "//", "docs", ".", "jiguang", ".", "cn", "/", "jmessage", "/", "server", "/", "rest_api_im_report_v2", "/", "#_6" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/reportv2/ReportClient.java#L273-L286
motown-io/motown
domain/core-api/src/main/java/io/motown/domain/api/chargingstation/NumberedTransactionId.java
NumberedTransactionId.numberFromTransactionIdString
private int numberFromTransactionIdString(ChargingStationId chargingStationId, String protocol, String transactionId) { String transactionIdPartBeforeNumber = String.format("%s_%s_", chargingStationId.getId(), protocol); try { return Integer.parseInt(transactionId.substring(transactionIdPartBeforeNumber.length())); } catch (NumberFormatException e) { throw new NumberFormatException(String.format("Cannot retrieve transaction number from string [%s]", transactionId)); } }
java
private int numberFromTransactionIdString(ChargingStationId chargingStationId, String protocol, String transactionId) { String transactionIdPartBeforeNumber = String.format("%s_%s_", chargingStationId.getId(), protocol); try { return Integer.parseInt(transactionId.substring(transactionIdPartBeforeNumber.length())); } catch (NumberFormatException e) { throw new NumberFormatException(String.format("Cannot retrieve transaction number from string [%s]", transactionId)); } }
[ "private", "int", "numberFromTransactionIdString", "(", "ChargingStationId", "chargingStationId", ",", "String", "protocol", ",", "String", "transactionId", ")", "{", "String", "transactionIdPartBeforeNumber", "=", "String", ".", "format", "(", "\"%s_%s_\"", ",", "charg...
Retrieves the number from a transaction id string. ChargingStationId and protocol are passed to make a better guess at the number. @param chargingStationId the charging station's identifier. @param protocol the protocol identifier. @param transactionId the transaction id containing the number. @return the transaction number @throws NumberFormatException if the number cannot be extracted from {@code transactionId}.
[ "Retrieves", "the", "number", "from", "a", "transaction", "id", "string", ".", "ChargingStationId", "and", "protocol", "are", "passed", "to", "make", "a", "better", "guess", "at", "the", "number", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/domain/core-api/src/main/java/io/motown/domain/api/chargingstation/NumberedTransactionId.java#L110-L117
kaazing/gateway
util/src/main/java/org/kaazing/gateway/util/Utils.java
Utils.putByteBuffer
public static void putByteBuffer(ByteBuffer source, ByteBuffer target) { if (source.hasArray()) { byte[] array = source.array(); int arrayOffset = source.arrayOffset(); target.put(array, arrayOffset + source.position(), source.remaining()); } else { target.put(source.duplicate()); } }
java
public static void putByteBuffer(ByteBuffer source, ByteBuffer target) { if (source.hasArray()) { byte[] array = source.array(); int arrayOffset = source.arrayOffset(); target.put(array, arrayOffset + source.position(), source.remaining()); } else { target.put(source.duplicate()); } }
[ "public", "static", "void", "putByteBuffer", "(", "ByteBuffer", "source", ",", "ByteBuffer", "target", ")", "{", "if", "(", "source", ".", "hasArray", "(", ")", ")", "{", "byte", "[", "]", "array", "=", "source", ".", "array", "(", ")", ";", "int", "...
Writes the contents of source to target without mutating source (so safe for multithreaded access to source) and without GC (unless source is a direct buffer).
[ "Writes", "the", "contents", "of", "source", "to", "target", "without", "mutating", "source", "(", "so", "safe", "for", "multithreaded", "access", "to", "source", ")", "and", "without", "GC", "(", "unless", "source", "is", "a", "direct", "buffer", ")", "."...
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/Utils.java#L465-L474
apache/groovy
src/main/groovy/groovy/lang/Script.java
Script.printf
public void printf(String format, Object value) { Object object; try { object = getProperty("out"); } catch (MissingPropertyException e) { DefaultGroovyMethods.printf(System.out, format, value); return; } InvokerHelper.invokeMethod(object, "printf", new Object[] { format, value }); }
java
public void printf(String format, Object value) { Object object; try { object = getProperty("out"); } catch (MissingPropertyException e) { DefaultGroovyMethods.printf(System.out, format, value); return; } InvokerHelper.invokeMethod(object, "printf", new Object[] { format, value }); }
[ "public", "void", "printf", "(", "String", "format", ",", "Object", "value", ")", "{", "Object", "object", ";", "try", "{", "object", "=", "getProperty", "(", "\"out\"", ")", ";", "}", "catch", "(", "MissingPropertyException", "e", ")", "{", "DefaultGroovy...
Prints a formatted string using the specified format string and argument. @param format the format to follow @param value the value to be formatted
[ "Prints", "a", "formatted", "string", "using", "the", "specified", "format", "string", "and", "argument", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/Script.java#L167-L178
wcm-io-caravan/caravan-commons
httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java
CertificateLoader.getKeyManagerFactory
public static KeyManagerFactory getKeyManagerFactory(String keyStoreFilename, StoreProperties storeProperties) throws IOException, GeneralSecurityException { InputStream is = getResourceAsStream(keyStoreFilename); if (is == null) { throw new FileNotFoundException("Certificate file not found: " + getFilenameInfo(keyStoreFilename)); } try { return getKeyManagerFactory(is, storeProperties); } finally { try { is.close(); } catch (IOException ex) { // ignore } } }
java
public static KeyManagerFactory getKeyManagerFactory(String keyStoreFilename, StoreProperties storeProperties) throws IOException, GeneralSecurityException { InputStream is = getResourceAsStream(keyStoreFilename); if (is == null) { throw new FileNotFoundException("Certificate file not found: " + getFilenameInfo(keyStoreFilename)); } try { return getKeyManagerFactory(is, storeProperties); } finally { try { is.close(); } catch (IOException ex) { // ignore } } }
[ "public", "static", "KeyManagerFactory", "getKeyManagerFactory", "(", "String", "keyStoreFilename", ",", "StoreProperties", "storeProperties", ")", "throws", "IOException", ",", "GeneralSecurityException", "{", "InputStream", "is", "=", "getResourceAsStream", "(", "keyStore...
Get key manager factory @param keyStoreFilename Keystore file name @param storeProperties store properties @return Key manager factory @throws IOException @throws GeneralSecurityException
[ "Get", "key", "manager", "factory" ]
train
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java#L113-L130
EsotericSoftware/kryo
src/com/esotericsoftware/kryo/unsafe/UnsafeUtil.java
UnsafeUtil.newDirectBuffer
static public ByteBuffer newDirectBuffer (long address, int size) { if (directByteBufferConstructor == null) throw new UnsupportedOperationException("No direct ByteBuffer constructor is available."); try { return directByteBufferConstructor.newInstance(address, size, null); } catch (Exception ex) { throw new KryoException("Error creating a ByteBuffer at address: " + address, ex); } }
java
static public ByteBuffer newDirectBuffer (long address, int size) { if (directByteBufferConstructor == null) throw new UnsupportedOperationException("No direct ByteBuffer constructor is available."); try { return directByteBufferConstructor.newInstance(address, size, null); } catch (Exception ex) { throw new KryoException("Error creating a ByteBuffer at address: " + address, ex); } }
[ "static", "public", "ByteBuffer", "newDirectBuffer", "(", "long", "address", ",", "int", "size", ")", "{", "if", "(", "directByteBufferConstructor", "==", "null", ")", "throw", "new", "UnsupportedOperationException", "(", "\"No direct ByteBuffer constructor is available.\...
Create a ByteBuffer that uses the specified off-heap memory address instead of allocating a new one. @param address Address of the memory region to be used for a ByteBuffer. @param size Size in bytes of the memory region. @throws UnsupportedOperationException if creating a ByteBuffer this way is not available.
[ "Create", "a", "ByteBuffer", "that", "uses", "the", "specified", "off", "-", "heap", "memory", "address", "instead", "of", "allocating", "a", "new", "one", "." ]
train
https://github.com/EsotericSoftware/kryo/blob/a8be1ab26f347f299a3c3f7171d6447dd5390845/src/com/esotericsoftware/kryo/unsafe/UnsafeUtil.java#L123-L131
azkaban/azkaban
azkaban-common/src/main/java/azkaban/utils/FileIOUtils.java
FileIOUtils.dumpNumberToFile
public static void dumpNumberToFile(final Path filePath, final long num) throws IOException { try (final BufferedWriter writer = Files .newBufferedWriter(filePath, StandardCharsets.UTF_8)) { writer.write(String.valueOf(num)); } catch (final IOException e) { log.error("Failed to write the number {} to the file {}", num, filePath, e); throw e; } }
java
public static void dumpNumberToFile(final Path filePath, final long num) throws IOException { try (final BufferedWriter writer = Files .newBufferedWriter(filePath, StandardCharsets.UTF_8)) { writer.write(String.valueOf(num)); } catch (final IOException e) { log.error("Failed to write the number {} to the file {}", num, filePath, e); throw e; } }
[ "public", "static", "void", "dumpNumberToFile", "(", "final", "Path", "filePath", ",", "final", "long", "num", ")", "throws", "IOException", "{", "try", "(", "final", "BufferedWriter", "writer", "=", "Files", ".", "newBufferedWriter", "(", "filePath", ",", "St...
Dumps a number into a new file. @param filePath the target file @param num the number to dump @throws IOException if file already exists
[ "Dumps", "a", "number", "into", "a", "new", "file", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/utils/FileIOUtils.java#L101-L109
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/builders/GroupBuilder.java
GroupBuilder.setAllowSplitting
public GroupBuilder setAllowSplitting(boolean headerSplit, boolean footerSplit) { group.setAllowHeaederSplit(headerSplit); group.setAllowFooterSplit(footerSplit); return this; }
java
public GroupBuilder setAllowSplitting(boolean headerSplit, boolean footerSplit) { group.setAllowHeaederSplit(headerSplit); group.setAllowFooterSplit(footerSplit); return this; }
[ "public", "GroupBuilder", "setAllowSplitting", "(", "boolean", "headerSplit", ",", "boolean", "footerSplit", ")", "{", "group", ".", "setAllowHeaederSplit", "(", "headerSplit", ")", ";", "group", ".", "setAllowFooterSplit", "(", "footerSplit", ")", ";", "return", ...
* pass-through property to setup group header and footer bands "allowSplit" property. When FALSE, if the content reaches end of the page, the whole band gets pushed to the next page. @param headerSplit @param footerSplit @return
[ "*", "pass", "-", "through", "property", "to", "setup", "group", "header", "and", "footer", "bands", "allowSplit", "property", ".", "When", "FALSE", "if", "the", "content", "reaches", "end", "of", "the", "page", "the", "whole", "band", "gets", "pushed", "t...
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/GroupBuilder.java#L334-L338
dbflute-session/tomcat-boot
src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java
BotmReflectionUtil.getPublicMethodFlexibly
public static Method getPublicMethodFlexibly(Class<?> clazz, String methodName, Class<?>[] argTypes) { assertObjectNotNull("clazz", clazz); assertStringNotNullAndNotTrimmedEmpty("methodName", methodName); return findMethod(clazz, methodName, argTypes, VisibilityType.PUBLIC, true); }
java
public static Method getPublicMethodFlexibly(Class<?> clazz, String methodName, Class<?>[] argTypes) { assertObjectNotNull("clazz", clazz); assertStringNotNullAndNotTrimmedEmpty("methodName", methodName); return findMethod(clazz, methodName, argTypes, VisibilityType.PUBLIC, true); }
[ "public", "static", "Method", "getPublicMethodFlexibly", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "Class", "<", "?", ">", "[", "]", "argTypes", ")", "{", "assertObjectNotNull", "(", "\"clazz\"", ",", "clazz", ")", ";", "asser...
Get the public method. <br> And it has the flexibly searching so you can specify types of sub-class to argTypes. <br> But if overload methods exist, it returns the first-found method. <br> And no cache so you should cache it yourself if you call several times. <br> @param clazz The type of class that defines the method. (NotNull) @param methodName The name of method. (NotNull) @param argTypes The type of argument. (NotNull) @return The instance of method. (NullAllowed: if null, not found)
[ "Get", "the", "public", "method", ".", "<br", ">", "And", "it", "has", "the", "flexibly", "searching", "so", "you", "can", "specify", "types", "of", "sub", "-", "class", "to", "argTypes", ".", "<br", ">", "But", "if", "overload", "methods", "exist", "i...
train
https://github.com/dbflute-session/tomcat-boot/blob/fe941f88b6be083781873126f5b12d4c16bb9073/src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java#L384-L388
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getClosedListEntityRoles
public List<EntityRole> getClosedListEntityRoles(UUID appId, String versionId, UUID entityId) { return getClosedListEntityRolesWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body(); }
java
public List<EntityRole> getClosedListEntityRoles(UUID appId, String versionId, UUID entityId) { return getClosedListEntityRolesWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body(); }
[ "public", "List", "<", "EntityRole", ">", "getClosedListEntityRoles", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ")", "{", "return", "getClosedListEntityRolesWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ...
Get All Entity Roles for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId entity Id @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;EntityRole&gt; object if successful.
[ "Get", "All", "Entity", "Roles", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L8219-L8221
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/query/AggregateResult.java
AggregateResult.get
public <T> T get(String type, Class<T> as) { return ValueConverter.convertToJava(type, value, as); }
java
public <T> T get(String type, Class<T> as) { return ValueConverter.convertToJava(type, value, as); }
[ "public", "<", "T", ">", "T", "get", "(", "String", "type", ",", "Class", "<", "T", ">", "as", ")", "{", "return", "ValueConverter", ".", "convertToJava", "(", "type", ",", "value", ",", "as", ")", ";", "}" ]
Returns the value cast to the specified type. This method converts the value according to the supplied type and then casts it to the specified class. <p>The following types are supported: <code>xs:anySimpleType</code>, <code>xs:base64Binary</code>, <code>xs:boolean</code>, <code>xs:byte</code>, <code>xs:date</code>, <code>xs:dateTime</code>, <code>xs:dayTimeDuration</code>, <code>xs:decimal</code>, <code>xs:double</code>, <code>xs:duration</code>, <code>xs:float</code>, <code>xs:int</code>, <code>xs:integer</code>, <code>xs:long</code>, <code>xs:short</code>, <code>xs:string</code>, <code>xs:time</code>, <code>xs:unsignedInt</code>, <code>xs:unsignedLong</code>, <code>xs:unsignedShort</code>, and <code>xs:yearMonthDuration</code>.</p> @see com.marklogic.client.impl.ValueConverter#convertToJava(String,String) label @param type The name of the XSD type to use for conversion. @param as The class parameter @param <T> The class to cast to @return The value, cast to the specified type or
[ "Returns", "the", "value", "cast", "to", "the", "specified", "type", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/AggregateResult.java#L78-L80
alkacon/opencms-core
src/org/opencms/workplace/editors/directedit/CmsDirectEditJQueryProvider.java
CmsDirectEditJQueryProvider.appendDirectEditData
private String appendDirectEditData(CmsDirectEditParams params, boolean disabled) { StringBuffer result = new StringBuffer(512); String editId = getNextDirectEditId(); result.append("\n<script type=\"text/javascript\">\n"); result.append("ocms_de_data['").append(editId).append("']= {\n"); result.append("\t").append("id: '").append(editId).append("',\n"); result.append("\t").append("deDisabled: ").append(disabled).append(",\n"); result.append("\t").append("hasEdit: ").append(params.getButtonSelection().isShowEdit()).append(",\n"); result.append("\t").append("hasDelete: ").append(params.getButtonSelection().isShowDelete()).append(",\n"); result.append("\t").append("hasNew: ").append(params.getButtonSelection().isShowNew()).append(",\n"); result.append("\t").append("resource: '").append(params.getResourceName()).append("',\n"); result.append("\t").append("editLink: '").append(getLink(params.getLinkForEdit())).append("',\n"); result.append("\t").append("language: '").append(m_cms.getRequestContext().getLocale().toString()); result.append("',\n"); result.append("\t").append("element: '").append(params.getElement()).append("',\n"); result.append("\t").append("backlink: '").append(m_cms.getRequestContext().getUri()).append("',\n"); result.append("\t").append("newlink: '").append(CmsEncoder.encode(params.getLinkForNew())).append("',\n"); result.append("\t").append("closelink: '").append(m_closeLink).append("',\n"); result.append("\t").append("deletelink: '").append(getLink(params.getLinkForDelete())).append("',\n"); if (!disabled) { result.append("\t").append("button_edit: '"); result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_EDIT_0)).append("',\n"); result.append("\t").append("button_delete: '"); result.append(m_messages.key(Messages.GUI_BUTTON_DELETE_0)).append("',\n"); result.append("\t").append("button_new: '"); result.append(m_messages.key(Messages.GUI_BUTTON_NEW_0)).append("',\n"); } else { result.append("\t").append("button_edit: '"); result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0)).append("',\n"); result.append("\t").append("button_delete: '"); result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0)).append("',\n"); result.append("\t").append("button_new: '"); result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0)).append("',\n"); } result.append("\t").append("editortitle: '").append(m_messages.key(Messages.GUI_EDITOR_TITLE_NEW_0)); result.append("'\n"); result.append("};\n"); result.append("</script>\n"); result.append("<div id=\"").append(editId).append("\" class=\"ocms_de_norm\">"); return result.toString(); }
java
private String appendDirectEditData(CmsDirectEditParams params, boolean disabled) { StringBuffer result = new StringBuffer(512); String editId = getNextDirectEditId(); result.append("\n<script type=\"text/javascript\">\n"); result.append("ocms_de_data['").append(editId).append("']= {\n"); result.append("\t").append("id: '").append(editId).append("',\n"); result.append("\t").append("deDisabled: ").append(disabled).append(",\n"); result.append("\t").append("hasEdit: ").append(params.getButtonSelection().isShowEdit()).append(",\n"); result.append("\t").append("hasDelete: ").append(params.getButtonSelection().isShowDelete()).append(",\n"); result.append("\t").append("hasNew: ").append(params.getButtonSelection().isShowNew()).append(",\n"); result.append("\t").append("resource: '").append(params.getResourceName()).append("',\n"); result.append("\t").append("editLink: '").append(getLink(params.getLinkForEdit())).append("',\n"); result.append("\t").append("language: '").append(m_cms.getRequestContext().getLocale().toString()); result.append("',\n"); result.append("\t").append("element: '").append(params.getElement()).append("',\n"); result.append("\t").append("backlink: '").append(m_cms.getRequestContext().getUri()).append("',\n"); result.append("\t").append("newlink: '").append(CmsEncoder.encode(params.getLinkForNew())).append("',\n"); result.append("\t").append("closelink: '").append(m_closeLink).append("',\n"); result.append("\t").append("deletelink: '").append(getLink(params.getLinkForDelete())).append("',\n"); if (!disabled) { result.append("\t").append("button_edit: '"); result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_EDIT_0)).append("',\n"); result.append("\t").append("button_delete: '"); result.append(m_messages.key(Messages.GUI_BUTTON_DELETE_0)).append("',\n"); result.append("\t").append("button_new: '"); result.append(m_messages.key(Messages.GUI_BUTTON_NEW_0)).append("',\n"); } else { result.append("\t").append("button_edit: '"); result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0)).append("',\n"); result.append("\t").append("button_delete: '"); result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0)).append("',\n"); result.append("\t").append("button_new: '"); result.append(m_messages.key(Messages.GUI_EDITOR_FRONTEND_BUTTON_LOCKED_0)).append("',\n"); } result.append("\t").append("editortitle: '").append(m_messages.key(Messages.GUI_EDITOR_TITLE_NEW_0)); result.append("'\n"); result.append("};\n"); result.append("</script>\n"); result.append("<div id=\"").append(editId).append("\" class=\"ocms_de_norm\">"); return result.toString(); }
[ "private", "String", "appendDirectEditData", "(", "CmsDirectEditParams", "params", ",", "boolean", "disabled", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "512", ")", ";", "String", "editId", "=", "getNextDirectEditId", "(", ")", ";", "r...
Appends the data for the direct edit buttons, which are dynamically created with jQuery.<p> Generates the following code:<p> <pre> &#60;script type="text/javascript" &#62; ocms_de_data['key']= { id: key, resource: res, ... }; &#60;/script &#62; </pre> @param params the direct edit parameters @param disabled if the buttons are disabled or not @return the data needed for the direct edit buttons
[ "Appends", "the", "data", "for", "the", "direct", "edit", "buttons", "which", "are", "dynamically", "created", "with", "jQuery", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/directedit/CmsDirectEditJQueryProvider.java#L144-L189
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/searchindex/sourcesearch/CmsSourceSearchCollector.java
CmsSourceSearchCollector.getResource
@Override public CmsResource getResource(CmsObject cms, CmsListItem item) { CmsResource res = null; CmsUUID id = new CmsUUID(item.getId()); if (!id.isNullUUID()) { try { res = cms.readResource(id, CmsResourceFilter.ALL); } catch (CmsException e) { // should never happen if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } } return res; }
java
@Override public CmsResource getResource(CmsObject cms, CmsListItem item) { CmsResource res = null; CmsUUID id = new CmsUUID(item.getId()); if (!id.isNullUUID()) { try { res = cms.readResource(id, CmsResourceFilter.ALL); } catch (CmsException e) { // should never happen if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } } return res; }
[ "@", "Override", "public", "CmsResource", "getResource", "(", "CmsObject", "cms", ",", "CmsListItem", "item", ")", "{", "CmsResource", "res", "=", "null", ";", "CmsUUID", "id", "=", "new", "CmsUUID", "(", "item", ".", "getId", "(", ")", ")", ";", "if", ...
Returns the resource for the given item.<p> @param cms the cms object @param item the item @return the resource
[ "Returns", "the", "resource", "for", "the", "given", "item", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/sourcesearch/CmsSourceSearchCollector.java#L92-L110
lucee/Lucee
core/src/main/java/lucee/runtime/type/scope/client/ClientCookie.java
ClientCookie.getInstance
public static Client getInstance(String name, PageContext pc, Log log) { if (!StringUtil.isEmpty(name)) name = StringUtil.toUpperCase(StringUtil.toVariableName(name)); String cookieName = "CF_" + TYPE + "_" + name; return new ClientCookie(pc, cookieName, _loadData(pc, cookieName, SCOPE_CLIENT, "client", log)); }
java
public static Client getInstance(String name, PageContext pc, Log log) { if (!StringUtil.isEmpty(name)) name = StringUtil.toUpperCase(StringUtil.toVariableName(name)); String cookieName = "CF_" + TYPE + "_" + name; return new ClientCookie(pc, cookieName, _loadData(pc, cookieName, SCOPE_CLIENT, "client", log)); }
[ "public", "static", "Client", "getInstance", "(", "String", "name", ",", "PageContext", "pc", ",", "Log", "log", ")", "{", "if", "(", "!", "StringUtil", ".", "isEmpty", "(", "name", ")", ")", "name", "=", "StringUtil", ".", "toUpperCase", "(", "StringUti...
load new instance of the class @param name @param pc @param log @return
[ "load", "new", "instance", "of", "the", "class" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/client/ClientCookie.java#L60-L64
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java
JBBPTextWriter.SetHR
public JBBPTextWriter SetHR(final String prefix, final int length, final char ch) { this.prefixHR = prefix == null ? "" : prefix; this.hrChar = ch; this.hrLength = length; return this; }
java
public JBBPTextWriter SetHR(final String prefix, final int length, final char ch) { this.prefixHR = prefix == null ? "" : prefix; this.hrChar = ch; this.hrLength = length; return this; }
[ "public", "JBBPTextWriter", "SetHR", "(", "final", "String", "prefix", ",", "final", "int", "length", ",", "final", "char", "ch", ")", "{", "this", ".", "prefixHR", "=", "prefix", "==", "null", "?", "\"\"", ":", "prefix", ";", "this", ".", "hrChar", "=...
Change parameters for horizontal rule. @param prefix the prefix to be printed before rule, it can be null @param length the length in symbols. @param ch symbol to draw @return the context
[ "Change", "parameters", "for", "horizontal", "rule", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L1188-L1193
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/VariableStack.java
VariableStack.getLocalVariable
public XObject getLocalVariable(int index, int frame) throws TransformerException { index += frame; XObject val = _stackFrames[index]; return val; }
java
public XObject getLocalVariable(int index, int frame) throws TransformerException { index += frame; XObject val = _stackFrames[index]; return val; }
[ "public", "XObject", "getLocalVariable", "(", "int", "index", ",", "int", "frame", ")", "throws", "TransformerException", "{", "index", "+=", "frame", ";", "XObject", "val", "=", "_stackFrames", "[", "index", "]", ";", "return", "val", ";", "}" ]
Get a local variable or parameter in the current stack frame. @param index Local variable index relative to the given frame bottom. NEEDSDOC @param frame @return The value of the variable. @throws TransformerException
[ "Get", "a", "local", "variable", "or", "parameter", "in", "the", "current", "stack", "frame", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/VariableStack.java#L336-L345
leancloud/java-sdk-all
realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java
AVIMConversation.getAllMemberInfo
public void getAllMemberInfo(int offset, int limit, final AVIMConversationMemberQueryCallback callback) { QueryConditions conditions = new QueryConditions(); conditions.addWhereItem("cid", QueryOperation.EQUAL_OP, this.conversationId); conditions.setSkip(offset); conditions.setLimit(limit); queryMemberInfo(conditions, callback); }
java
public void getAllMemberInfo(int offset, int limit, final AVIMConversationMemberQueryCallback callback) { QueryConditions conditions = new QueryConditions(); conditions.addWhereItem("cid", QueryOperation.EQUAL_OP, this.conversationId); conditions.setSkip(offset); conditions.setLimit(limit); queryMemberInfo(conditions, callback); }
[ "public", "void", "getAllMemberInfo", "(", "int", "offset", ",", "int", "limit", ",", "final", "AVIMConversationMemberQueryCallback", "callback", ")", "{", "QueryConditions", "conditions", "=", "new", "QueryConditions", "(", ")", ";", "conditions", ".", "addWhereIte...
获取当前对话的所有角色信息 @param offset 查询结果的起始点 @param limit 查询结果集上限 @param callback 结果回调函数
[ "获取当前对话的所有角色信息" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java#L1129-L1135
jayantk/jklol
src/com/jayantkrish/jklol/lisp/LispUtil.java
LispUtil.checkArgument
public static void checkArgument(boolean condition, String message, Object ... values) { if (!condition) { throw new EvalError(String.format(message, values)); } }
java
public static void checkArgument(boolean condition, String message, Object ... values) { if (!condition) { throw new EvalError(String.format(message, values)); } }
[ "public", "static", "void", "checkArgument", "(", "boolean", "condition", ",", "String", "message", ",", "Object", "...", "values", ")", "{", "if", "(", "!", "condition", ")", "{", "throw", "new", "EvalError", "(", "String", ".", "format", "(", "message", ...
Identical to Preconditions.checkArgument but throws an {@code EvalError} instead of an IllegalArgumentException. Use this check to verify properties of a Lisp program execution, i.e., whenever the raised exception should be catchable by the evaluator of the program. @param condition @param message @param values
[ "Identical", "to", "Preconditions", ".", "checkArgument", "but", "throws", "an", "{", "@code", "EvalError", "}", "instead", "of", "an", "IllegalArgumentException", ".", "Use", "this", "check", "to", "verify", "properties", "of", "a", "Lisp", "program", "executio...
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/lisp/LispUtil.java#L56-L60
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/HSTreeNode.java
HSTreeNode.updateMass
public void updateMass(Instance inst, boolean referenceWindow) { if(referenceWindow) r++; else l++; if(internalNode) { if(inst.value(this.splitAttribute) > this.splitValue) right.updateMass(inst, referenceWindow); else left.updateMass(inst, referenceWindow); } }
java
public void updateMass(Instance inst, boolean referenceWindow) { if(referenceWindow) r++; else l++; if(internalNode) { if(inst.value(this.splitAttribute) > this.splitValue) right.updateMass(inst, referenceWindow); else left.updateMass(inst, referenceWindow); } }
[ "public", "void", "updateMass", "(", "Instance", "inst", ",", "boolean", "referenceWindow", ")", "{", "if", "(", "referenceWindow", ")", "r", "++", ";", "else", "l", "++", ";", "if", "(", "internalNode", ")", "{", "if", "(", "inst", ".", "value", "(", ...
Update the mass profile of this node. @param inst the instance being passed through the HSTree. @param referenceWindow if the HSTree is in the initial reference window: <b>true</b>, else: <b>false</b>
[ "Update", "the", "mass", "profile", "of", "this", "node", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/HSTreeNode.java#L120-L134
sockeqwe/mosby
mvp/src/main/java/com/hannesdorfmann/mosby3/mvp/MvpActivity.java
MvpActivity.getMvpDelegate
@NonNull protected ActivityMvpDelegate<V, P> getMvpDelegate() { if (mvpDelegate == null) { mvpDelegate = new ActivityMvpDelegateImpl(this, this, true); } return mvpDelegate; }
java
@NonNull protected ActivityMvpDelegate<V, P> getMvpDelegate() { if (mvpDelegate == null) { mvpDelegate = new ActivityMvpDelegateImpl(this, this, true); } return mvpDelegate; }
[ "@", "NonNull", "protected", "ActivityMvpDelegate", "<", "V", ",", "P", ">", "getMvpDelegate", "(", ")", "{", "if", "(", "mvpDelegate", "==", "null", ")", "{", "mvpDelegate", "=", "new", "ActivityMvpDelegateImpl", "(", "this", ",", "this", ",", "true", ")"...
Get the mvp delegate. This is internally used for creating presenter, attaching and detaching view from presenter. <p><b>Please note that only one instance of mvp delegate should be used per Activity instance</b>. </p> <p> Only override this method if you really know what you are doing. </p> @return {@link ActivityMvpDelegateImpl}
[ "Get", "the", "mvp", "delegate", ".", "This", "is", "internally", "used", "for", "creating", "presenter", "attaching", "and", "detaching", "view", "from", "presenter", "." ]
train
https://github.com/sockeqwe/mosby/blob/7f22118c950b5e6fbba0ec42d8e97586dfb08940/mvp/src/main/java/com/hannesdorfmann/mosby3/mvp/MvpActivity.java#L111-L117
rpau/javalang
src/main/java/org/walkmod/javalang/ast/Refactorization.java
Refactorization.refactorVariable
public boolean refactorVariable(SymbolDefinition n, final String newName) { Map<String, SymbolDefinition> scope = n.getVariableDefinitions(); if (!scope.containsKey(newName)) { if (n.getUsages() != null) { List<SymbolReference> usages = new LinkedList<SymbolReference>(n.getUsages()); VoidVisitorAdapter<?> visitor = new VoidVisitorAdapter<Object>() { @Override public void visit(NameExpr nexpr, Object ctx) { Map<String, SymbolDefinition> innerScope = nexpr.getVariableDefinitions(); if (innerScope.containsKey(newName)) { nexpr.getParentNode().replaceChildNode(nexpr, new FieldAccessExpr(new ThisExpr(), newName)); } else { nexpr.getParentNode().replaceChildNode(nexpr, new NameExpr(newName)); } } @Override public void visit(FieldAccessExpr nexpr, Object ctx) { nexpr.getParentNode().replaceChildNode(nexpr, new FieldAccessExpr(nexpr.getScope(), nexpr.getTypeArgs(), newName)); } }; for (SymbolReference usage : usages) { Node aux = (Node) usage; aux.accept(visitor, null); } } return true; } return false; }
java
public boolean refactorVariable(SymbolDefinition n, final String newName) { Map<String, SymbolDefinition> scope = n.getVariableDefinitions(); if (!scope.containsKey(newName)) { if (n.getUsages() != null) { List<SymbolReference> usages = new LinkedList<SymbolReference>(n.getUsages()); VoidVisitorAdapter<?> visitor = new VoidVisitorAdapter<Object>() { @Override public void visit(NameExpr nexpr, Object ctx) { Map<String, SymbolDefinition> innerScope = nexpr.getVariableDefinitions(); if (innerScope.containsKey(newName)) { nexpr.getParentNode().replaceChildNode(nexpr, new FieldAccessExpr(new ThisExpr(), newName)); } else { nexpr.getParentNode().replaceChildNode(nexpr, new NameExpr(newName)); } } @Override public void visit(FieldAccessExpr nexpr, Object ctx) { nexpr.getParentNode().replaceChildNode(nexpr, new FieldAccessExpr(nexpr.getScope(), nexpr.getTypeArgs(), newName)); } }; for (SymbolReference usage : usages) { Node aux = (Node) usage; aux.accept(visitor, null); } } return true; } return false; }
[ "public", "boolean", "refactorVariable", "(", "SymbolDefinition", "n", ",", "final", "String", "newName", ")", "{", "Map", "<", "String", ",", "SymbolDefinition", ">", "scope", "=", "n", ".", "getVariableDefinitions", "(", ")", ";", "if", "(", "!", "scope", ...
Generic method to rename a SymbolDefinition variable/parameter. @param n variable to rename. @param newName new name to set. @return if the rename procedure has been applied successfully.
[ "Generic", "method", "to", "rename", "a", "SymbolDefinition", "variable", "/", "parameter", "." ]
train
https://github.com/rpau/javalang/blob/17ab1d6cbe7527a2f272049c4958354328de2171/src/main/java/org/walkmod/javalang/ast/Refactorization.java#L34-L71
bazaarvoice/emodb
common/json/src/main/java/com/bazaarvoice/emodb/common/json/deferred/LazyJsonMap.java
LazyJsonMap.put
@Override public Object put(String key, Object value) { DeserializationState deserializationState = _deserState.get(); if (deserializationState.isDeserialized()) { return deserializationState.deserialized.put(key, value); } return deserializationState.overrides.put(key, value); }
java
@Override public Object put(String key, Object value) { DeserializationState deserializationState = _deserState.get(); if (deserializationState.isDeserialized()) { return deserializationState.deserialized.put(key, value); } return deserializationState.overrides.put(key, value); }
[ "@", "Override", "public", "Object", "put", "(", "String", "key", ",", "Object", "value", ")", "{", "DeserializationState", "deserializationState", "=", "_deserState", ".", "get", "(", ")", ";", "if", "(", "deserializationState", ".", "isDeserialized", "(", ")...
For efficiency this method breaks the contract that the old value is returned. Otherwise common operations such as adding intrinsics and template attributes would require deserializing the object.
[ "For", "efficiency", "this", "method", "breaks", "the", "contract", "that", "the", "old", "value", "is", "returned", ".", "Otherwise", "common", "operations", "such", "as", "adding", "intrinsics", "and", "template", "attributes", "would", "require", "deserializing...
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/json/src/main/java/com/bazaarvoice/emodb/common/json/deferred/LazyJsonMap.java#L183-L190
clanie/clanie-core
src/main/java/dk/clanie/collections/NumberMap.java
NumberMap.newBigIntegerMap
public static <K> NumberMap<K, BigInteger> newBigIntegerMap() { return new NumberMap<K, BigInteger>() { @Override public void add(K key, BigInteger addend) { put(key, containsKey(key) ? get(key).add(addend) : addend); } @Override public void sub(K key, BigInteger subtrahend) { put(key, (containsKey(key) ? get(key) : BigInteger.ZERO).subtract(subtrahend)); } }; }
java
public static <K> NumberMap<K, BigInteger> newBigIntegerMap() { return new NumberMap<K, BigInteger>() { @Override public void add(K key, BigInteger addend) { put(key, containsKey(key) ? get(key).add(addend) : addend); } @Override public void sub(K key, BigInteger subtrahend) { put(key, (containsKey(key) ? get(key) : BigInteger.ZERO).subtract(subtrahend)); } }; }
[ "public", "static", "<", "K", ">", "NumberMap", "<", "K", ",", "BigInteger", ">", "newBigIntegerMap", "(", ")", "{", "return", "new", "NumberMap", "<", "K", ",", "BigInteger", ">", "(", ")", "{", "@", "Override", "public", "void", "add", "(", "K", "k...
Creates a NumberMap for BigIntegers. @param <K> @return NumberMap&lt;K, BigInteger&gt;
[ "Creates", "a", "NumberMap", "for", "BigIntegers", "." ]
train
https://github.com/clanie/clanie-core/blob/ac8a655b93127f0e281b741c4d53f429be2816ad/src/main/java/dk/clanie/collections/NumberMap.java#L92-L103
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/JavaBean.java
JavaBean.newBean
public static <T> T newBean(Map<?,?> aValues, Class<?> aClass) throws InstantiationException, IllegalAccessException { return newBean(aValues,aClass,null); }
java
public static <T> T newBean(Map<?,?> aValues, Class<?> aClass) throws InstantiationException, IllegalAccessException { return newBean(aValues,aClass,null); }
[ "public", "static", "<", "T", ">", "T", "newBean", "(", "Map", "<", "?", ",", "?", ">", "aValues", ",", "Class", "<", "?", ">", "aClass", ")", "throws", "InstantiationException", ",", "IllegalAccessException", "{", "return", "newBean", "(", "aValues", ",...
Create new instance of the object @param aValues the map value @param aClass the class to create @param <T> the type of the bean @return the create object instance @throws InstantiationException @throws IllegalAccessException
[ "Create", "new", "instance", "of", "the", "object" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/JavaBean.java#L50-L54
anothem/android-range-seek-bar
rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java
RangeSeekBar.drawThumb
private void drawThumb(float screenCoord, boolean pressed, Canvas canvas, boolean areSelectedValuesDefault) { Bitmap buttonToDraw; if (!activateOnDefaultValues && areSelectedValuesDefault) { buttonToDraw = thumbDisabledImage; } else { buttonToDraw = pressed ? thumbPressedImage : thumbImage; } canvas.drawBitmap(buttonToDraw, screenCoord - thumbHalfWidth, textOffset, paint); }
java
private void drawThumb(float screenCoord, boolean pressed, Canvas canvas, boolean areSelectedValuesDefault) { Bitmap buttonToDraw; if (!activateOnDefaultValues && areSelectedValuesDefault) { buttonToDraw = thumbDisabledImage; } else { buttonToDraw = pressed ? thumbPressedImage : thumbImage; } canvas.drawBitmap(buttonToDraw, screenCoord - thumbHalfWidth, textOffset, paint); }
[ "private", "void", "drawThumb", "(", "float", "screenCoord", ",", "boolean", "pressed", ",", "Canvas", "canvas", ",", "boolean", "areSelectedValuesDefault", ")", "{", "Bitmap", "buttonToDraw", ";", "if", "(", "!", "activateOnDefaultValues", "&&", "areSelectedValuesD...
Draws the "normal" resp. "pressed" thumb image on specified x-coordinate. @param screenCoord The x-coordinate in screen space where to draw the image. @param pressed Is the thumb currently in "pressed" state? @param canvas The canvas to draw upon.
[ "Draws", "the", "normal", "resp", ".", "pressed", "thumb", "image", "on", "specified", "x", "-", "coordinate", "." ]
train
https://github.com/anothem/android-range-seek-bar/blob/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java#L735-L746
jMotif/SAX
src/main/java/net/seninp/util/HeatChart.java
HeatChart.setZValues
public void setZValues(double[][] zValues, double low, double high) { this.zValues = zValues; this.lowValue = low; this.highValue = high; }
java
public void setZValues(double[][] zValues, double low, double high) { this.zValues = zValues; this.lowValue = low; this.highValue = high; }
[ "public", "void", "setZValues", "(", "double", "[", "]", "[", "]", "zValues", ",", "double", "low", ",", "double", "high", ")", "{", "this", ".", "zValues", "=", "zValues", ";", "this", ".", "lowValue", "=", "low", ";", "this", ".", "highValue", "=",...
Replaces the z-values array. The number of elements should match the number of y-values, with each element containing a double array with an equal number of elements that matches the number of x-values. Use this method where the minimum and maximum values possible are not contained within the dataset. @param zValues the array to replace the current array with. The number of elements in each inner array must be identical. @param low the minimum possible value, which may or may not appear in the z-values. @param high the maximum possible value, which may or may not appear in the z-values.
[ "Replaces", "the", "z", "-", "values", "array", ".", "The", "number", "of", "elements", "should", "match", "the", "number", "of", "y", "-", "values", "with", "each", "element", "containing", "a", "double", "array", "with", "an", "equal", "number", "of", ...
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/HeatChart.java#L341-L345
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/weights/WeightInitUtil.java
WeightInitUtil.initWeights
@Deprecated public static INDArray initWeights(double fanIn, double fanOut, int[] shape, WeightInit initScheme, Distribution dist, INDArray paramView) { return initWeights(fanIn, fanOut, ArrayUtil.toLongArray(shape), initScheme, dist, DEFAULT_WEIGHT_INIT_ORDER, paramView); }
java
@Deprecated public static INDArray initWeights(double fanIn, double fanOut, int[] shape, WeightInit initScheme, Distribution dist, INDArray paramView) { return initWeights(fanIn, fanOut, ArrayUtil.toLongArray(shape), initScheme, dist, DEFAULT_WEIGHT_INIT_ORDER, paramView); }
[ "@", "Deprecated", "public", "static", "INDArray", "initWeights", "(", "double", "fanIn", ",", "double", "fanOut", ",", "int", "[", "]", "shape", ",", "WeightInit", "initScheme", ",", "Distribution", "dist", ",", "INDArray", "paramView", ")", "{", "return", ...
Initializes a matrix with the given weight initialization scheme. Note: Defaults to fortran ('f') order arrays for the weights. Use {@link #initWeights(int[], WeightInit, Distribution, char, INDArray)} to control this @param shape the shape of the matrix @param initScheme the scheme to use @return a matrix of the specified dimensions with the specified distribution based on the initialization scheme
[ "Initializes", "a", "matrix", "with", "the", "given", "weight", "initialization", "scheme", ".", "Note", ":", "Defaults", "to", "fortran", "(", "f", ")", "order", "arrays", "for", "the", "weights", ".", "Use", "{", "@link", "#initWeights", "(", "int", "[]"...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/weights/WeightInitUtil.java#L59-L63
baratine/baratine
kraken/src/main/java/com/caucho/v5/kraken/table/KrakenImpl.java
KrakenImpl.findStream
private void findStream(QueryKraken query, Object []args, ResultStream<Cursor> result) { try { TableKraken table = query.table(); TableKelp tableKelp = table.getTableKelp(); TablePod tablePod = table.getTablePod(); if (query.isStaticNode()) { RowCursor cursor = tableKelp.cursor(); query.fillKey(cursor, args); int hash = query.calculateHash(cursor); //ShardPod node = tablePod.getPodNode(hash); if (tablePod.getNode(hash).isSelfCopy() || true) { query.findStream(result, args); return; } else { //tablePod.get(cursor.getKey(), new FindGetResult(result, query, args)); result.ok(); return; } } query.findStream(result, args); } catch (Exception e) { result.fail(e); } }
java
private void findStream(QueryKraken query, Object []args, ResultStream<Cursor> result) { try { TableKraken table = query.table(); TableKelp tableKelp = table.getTableKelp(); TablePod tablePod = table.getTablePod(); if (query.isStaticNode()) { RowCursor cursor = tableKelp.cursor(); query.fillKey(cursor, args); int hash = query.calculateHash(cursor); //ShardPod node = tablePod.getPodNode(hash); if (tablePod.getNode(hash).isSelfCopy() || true) { query.findStream(result, args); return; } else { //tablePod.get(cursor.getKey(), new FindGetResult(result, query, args)); result.ok(); return; } } query.findStream(result, args); } catch (Exception e) { result.fail(e); } }
[ "private", "void", "findStream", "(", "QueryKraken", "query", ",", "Object", "[", "]", "args", ",", "ResultStream", "<", "Cursor", ">", "result", ")", "{", "try", "{", "TableKraken", "table", "=", "query", ".", "table", "(", ")", ";", "TableKelp", "table...
Query implementation for multiple result with the parsed query.
[ "Query", "implementation", "for", "multiple", "result", "with", "the", "parsed", "query", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kraken/table/KrakenImpl.java#L542-L575
phax/ph-css
ph-css/src/main/java/com/helger/css/parser/CSSParseHelper.java
CSSParseHelper.extractStringValue
@Nullable public static String extractStringValue (@Nullable final String sStr) { if (StringHelper.hasNoText (sStr) || sStr.length () < 2) return sStr; final char cFirst = sStr.charAt (0); if ((cFirst == '"' || cFirst == '\'') && StringHelper.getLastChar (sStr) == cFirst) { // Remove quotes around the string return _trimBy (sStr, 1, 1); } return sStr; }
java
@Nullable public static String extractStringValue (@Nullable final String sStr) { if (StringHelper.hasNoText (sStr) || sStr.length () < 2) return sStr; final char cFirst = sStr.charAt (0); if ((cFirst == '"' || cFirst == '\'') && StringHelper.getLastChar (sStr) == cFirst) { // Remove quotes around the string return _trimBy (sStr, 1, 1); } return sStr; }
[ "@", "Nullable", "public", "static", "String", "extractStringValue", "(", "@", "Nullable", "final", "String", "sStr", ")", "{", "if", "(", "StringHelper", ".", "hasNoText", "(", "sStr", ")", "||", "sStr", ".", "length", "(", ")", "<", "2", ")", "return",...
Remove surrounding quotes (single or double) of a string (if present). If the start and the end quote are not equal, nothing happens. @param sStr The string where the quotes should be removed @return The string without quotes.
[ "Remove", "surrounding", "quotes", "(", "single", "or", "double", ")", "of", "a", "string", "(", "if", "present", ")", ".", "If", "the", "start", "and", "the", "end", "quote", "are", "not", "equal", "nothing", "happens", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/parser/CSSParseHelper.java#L66-L79
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/trace/TraceId.java
TraceId.copyLowerBase16To
public void copyLowerBase16To(char[] dest, int destOffset) { BigendianEncoding.longToBase16String(idHi, dest, destOffset); BigendianEncoding.longToBase16String(idLo, dest, destOffset + BASE16_SIZE / 2); }
java
public void copyLowerBase16To(char[] dest, int destOffset) { BigendianEncoding.longToBase16String(idHi, dest, destOffset); BigendianEncoding.longToBase16String(idLo, dest, destOffset + BASE16_SIZE / 2); }
[ "public", "void", "copyLowerBase16To", "(", "char", "[", "]", "dest", ",", "int", "destOffset", ")", "{", "BigendianEncoding", ".", "longToBase16String", "(", "idHi", ",", "dest", ",", "destOffset", ")", ";", "BigendianEncoding", ".", "longToBase16String", "(", ...
Copies the lowercase base16 representations of the {@code TraceId} into the {@code dest} beginning at the {@code destOffset} offset. @param dest the destination buffer. @param destOffset the starting offset in the destination buffer. @throws IndexOutOfBoundsException if {@code destOffset + 2 * TraceId.SIZE} is greater than {@code dest.length}. @since 0.18
[ "Copies", "the", "lowercase", "base16", "representations", "of", "the", "{", "@code", "TraceId", "}", "into", "the", "{", "@code", "dest", "}", "beginning", "at", "the", "{", "@code", "destOffset", "}", "offset", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/TraceId.java#L189-L192
m-m-m/util
reflect/src/main/java/net/sf/mmm/util/reflect/base/ReflectionUtilImpl.java
ReflectionUtilImpl.visitResourceNames
public void visitResourceNames(String packageName, boolean includeSubPackages, ClassLoader classLoader, ResourceVisitor visitor) { try { String path = packageName.replace('.', '/'); if (path.isEmpty()) { LOG.debug("Scanning entire classpath..."); } else { LOG.trace("Scanning for resources on classpath for {}", path); } StringBuilder qualifiedNameBuilder = new StringBuilder(path); if (qualifiedNameBuilder.length() > 0) { qualifiedNameBuilder.append('/'); } String pathWithPrefix = qualifiedNameBuilder.toString(); int qualifiedNamePrefixLength = qualifiedNameBuilder.length(); Enumeration<URL> urls = classLoader.getResources(path); Set<String> urlSet = new HashSet<>(); while (urls.hasMoreElements()) { URL url = urls.nextElement(); visitResourceUrl(includeSubPackages, visitor, pathWithPrefix, qualifiedNameBuilder, qualifiedNamePrefixLength, url, urlSet); } if (path.isEmpty()) { visitResourceClassloader(includeSubPackages, classLoader, visitor, pathWithPrefix, qualifiedNameBuilder, qualifiedNamePrefixLength, urlSet); visitResourceClasspath(includeSubPackages, visitor, qualifiedNameBuilder, pathWithPrefix, qualifiedNamePrefixLength, urlSet); } } catch (IOException e) { throw new IllegalStateException("Error reading resources.", e); } }
java
public void visitResourceNames(String packageName, boolean includeSubPackages, ClassLoader classLoader, ResourceVisitor visitor) { try { String path = packageName.replace('.', '/'); if (path.isEmpty()) { LOG.debug("Scanning entire classpath..."); } else { LOG.trace("Scanning for resources on classpath for {}", path); } StringBuilder qualifiedNameBuilder = new StringBuilder(path); if (qualifiedNameBuilder.length() > 0) { qualifiedNameBuilder.append('/'); } String pathWithPrefix = qualifiedNameBuilder.toString(); int qualifiedNamePrefixLength = qualifiedNameBuilder.length(); Enumeration<URL> urls = classLoader.getResources(path); Set<String> urlSet = new HashSet<>(); while (urls.hasMoreElements()) { URL url = urls.nextElement(); visitResourceUrl(includeSubPackages, visitor, pathWithPrefix, qualifiedNameBuilder, qualifiedNamePrefixLength, url, urlSet); } if (path.isEmpty()) { visitResourceClassloader(includeSubPackages, classLoader, visitor, pathWithPrefix, qualifiedNameBuilder, qualifiedNamePrefixLength, urlSet); visitResourceClasspath(includeSubPackages, visitor, qualifiedNameBuilder, pathWithPrefix, qualifiedNamePrefixLength, urlSet); } } catch (IOException e) { throw new IllegalStateException("Error reading resources.", e); } }
[ "public", "void", "visitResourceNames", "(", "String", "packageName", ",", "boolean", "includeSubPackages", ",", "ClassLoader", "classLoader", ",", "ResourceVisitor", "visitor", ")", "{", "try", "{", "String", "path", "=", "packageName", ".", "replace", "(", "'", ...
This method does the actual magic to locate resources on the classpath. @param packageName is the name of the {@link Package} to scan. Both "." and "/" are accepted as separator (e.g. "net.sf.mmm.util.reflect). @param includeSubPackages - if {@code true} all sub-packages of the specified {@link Package} will be included in the search. @param classLoader is the explicit {@link ClassLoader} to use. @param visitor is the {@link ResourceVisitor}. @if the operation failed with an I/O error.
[ "This", "method", "does", "the", "actual", "magic", "to", "locate", "resources", "on", "the", "classpath", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/reflect/src/main/java/net/sf/mmm/util/reflect/base/ReflectionUtilImpl.java#L731-L759
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/handler/bundle/AbstractResourceBundleHandler.java
AbstractResourceBundleHandler.getResourceBundleChannel
public ReadableByteChannel getResourceBundleChannel(String bundleName, boolean gzipBundle) throws ResourceNotFoundException { String tempFileName = getStoredBundlePath(bundleName, gzipBundle); InputStream is = getTemporaryResourceAsStream(tempFileName); return Channels.newChannel(is); }
java
public ReadableByteChannel getResourceBundleChannel(String bundleName, boolean gzipBundle) throws ResourceNotFoundException { String tempFileName = getStoredBundlePath(bundleName, gzipBundle); InputStream is = getTemporaryResourceAsStream(tempFileName); return Channels.newChannel(is); }
[ "public", "ReadableByteChannel", "getResourceBundleChannel", "(", "String", "bundleName", ",", "boolean", "gzipBundle", ")", "throws", "ResourceNotFoundException", "{", "String", "tempFileName", "=", "getStoredBundlePath", "(", "bundleName", ",", "gzipBundle", ")", ";", ...
Returns the readable byte channel from the bundle name @param bundleName the bundle name @param gzipBundle the flag indicating if we want to retrieve the gzip version or not @return the readable byte channel from the bundle name @throws ResourceNotFoundException if the resource is not found
[ "Returns", "the", "readable", "byte", "channel", "from", "the", "bundle", "name" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/handler/bundle/AbstractResourceBundleHandler.java#L412-L418
before/uadetector
modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/CachingXmlDataStore.java
CachingXmlDataStore.createCachingXmlDataStore
@Nonnull @Deprecated public static CachingXmlDataStore createCachingXmlDataStore(@Nonnull final File cacheFile, @Nonnull final DataStore fallback) { return createCachingXmlDataStore(cacheFile, UrlUtil.build(DEFAULT_DATA_URL), UrlUtil.build(DEFAULT_VERSION_URL), DEFAULT_CHARSET, fallback); }
java
@Nonnull @Deprecated public static CachingXmlDataStore createCachingXmlDataStore(@Nonnull final File cacheFile, @Nonnull final DataStore fallback) { return createCachingXmlDataStore(cacheFile, UrlUtil.build(DEFAULT_DATA_URL), UrlUtil.build(DEFAULT_VERSION_URL), DEFAULT_CHARSET, fallback); }
[ "@", "Nonnull", "@", "Deprecated", "public", "static", "CachingXmlDataStore", "createCachingXmlDataStore", "(", "@", "Nonnull", "final", "File", "cacheFile", ",", "@", "Nonnull", "final", "DataStore", "fallback", ")", "{", "return", "createCachingXmlDataStore", "(", ...
Constructs a new instance of {@code CachingXmlDataStore} with the given arguments. The given {@code cacheFile} can be empty or filled with previously cached data in XML format. The file must be writable otherwise an exception will be thrown. @param cacheFile file with cached <em>UAS data</em> in XML format or empty file @param fallback <em>UAS data</em> as fallback in case the data on the specified resource can not be read correctly @return new instance of {@link CachingXmlDataStore} @throws net.sf.qualitycheck.exception.IllegalNullArgumentException if one of the given arguments is {@code null} @throws net.sf.qualitycheck.exception.IllegalStateOfArgumentException if the given cache file can not be read @throws net.sf.qualitycheck.exception.IllegalStateOfArgumentException if no URL can be resolved to the given given file
[ "Constructs", "a", "new", "instance", "of", "{", "@code", "CachingXmlDataStore", "}", "with", "the", "given", "arguments", ".", "The", "given", "{", "@code", "cacheFile", "}", "can", "be", "empty", "or", "filled", "with", "previously", "cached", "data", "in"...
train
https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/CachingXmlDataStore.java#L143-L148
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/widget/VisWindow.java
VisWindow.closeOnEscape
public void closeOnEscape () { addListener(new InputListener() { @Override public boolean keyDown (InputEvent event, int keycode) { if (keycode == Keys.ESCAPE) { close(); return true; } return false; } @Override public boolean keyUp (InputEvent event, int keycode) { if (keycode == Keys.BACK) { close(); return true; } return false; } }); }
java
public void closeOnEscape () { addListener(new InputListener() { @Override public boolean keyDown (InputEvent event, int keycode) { if (keycode == Keys.ESCAPE) { close(); return true; } return false; } @Override public boolean keyUp (InputEvent event, int keycode) { if (keycode == Keys.BACK) { close(); return true; } return false; } }); }
[ "public", "void", "closeOnEscape", "(", ")", "{", "addListener", "(", "new", "InputListener", "(", ")", "{", "@", "Override", "public", "boolean", "keyDown", "(", "InputEvent", "event", ",", "int", "keycode", ")", "{", "if", "(", "keycode", "==", "Keys", ...
Will make this window close when escape key or back key was pressed. After pressing escape or back, {@link #close()} is called. Back key is Android and iOS only
[ "Will", "make", "this", "window", "close", "when", "escape", "key", "or", "back", "key", "was", "pressed", ".", "After", "pressing", "escape", "or", "back", "{" ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/widget/VisWindow.java#L197-L219
sebastiangraf/jSCSI
bundles/initiator/src/main/java/org/jscsi/initiator/connection/SenderWorker.java
SenderWorker.receiveFromWire
public ProtocolDataUnit receiveFromWire () throws DigestException , InternetSCSIException , IOException { final ProtocolDataUnit protocolDataUnit = protocolDataUnitFactory.create(connection.getSetting(OperationalTextKey.HEADER_DIGEST), connection.getSetting(OperationalTextKey.DATA_DIGEST)); try { protocolDataUnit.read(socketChannel); } catch (ClosedChannelException e) { throw new InternetSCSIException(e); } LOGGER.debug("Receiving this PDU: " + protocolDataUnit); final Exception isCorrect = connection.getState().isCorrect(protocolDataUnit); if (isCorrect == null) { LOGGER.trace("Adding PDU to Receiving Queue."); final TargetMessageParser parser = (TargetMessageParser) protocolDataUnit.getBasicHeaderSegment().getParser(); final Session session = connection.getSession(); // the PDU maxCmdSN is greater than the local maxCmdSN, so we // have to update the local one if (session.getMaximumCommandSequenceNumber().compareTo(parser.getMaximumCommandSequenceNumber()) < 0) { session.setMaximumCommandSequenceNumber(parser.getMaximumCommandSequenceNumber()); } // the PDU expCmdSN is greater than the local expCmdSN, so we // have to update the local one if (parser.incrementSequenceNumber()) { if (connection.getExpectedStatusSequenceNumber().compareTo(parser.getStatusSequenceNumber()) >= 0) { connection.incrementExpectedStatusSequenceNumber(); } else { LOGGER.error("Status Sequence Number Mismatch (received, expected): " + parser.getStatusSequenceNumber() + ", " + (connection.getExpectedStatusSequenceNumber().getValue() - 1)); } } } else { throw new InternetSCSIException(isCorrect); } return protocolDataUnit; }
java
public ProtocolDataUnit receiveFromWire () throws DigestException , InternetSCSIException , IOException { final ProtocolDataUnit protocolDataUnit = protocolDataUnitFactory.create(connection.getSetting(OperationalTextKey.HEADER_DIGEST), connection.getSetting(OperationalTextKey.DATA_DIGEST)); try { protocolDataUnit.read(socketChannel); } catch (ClosedChannelException e) { throw new InternetSCSIException(e); } LOGGER.debug("Receiving this PDU: " + protocolDataUnit); final Exception isCorrect = connection.getState().isCorrect(protocolDataUnit); if (isCorrect == null) { LOGGER.trace("Adding PDU to Receiving Queue."); final TargetMessageParser parser = (TargetMessageParser) protocolDataUnit.getBasicHeaderSegment().getParser(); final Session session = connection.getSession(); // the PDU maxCmdSN is greater than the local maxCmdSN, so we // have to update the local one if (session.getMaximumCommandSequenceNumber().compareTo(parser.getMaximumCommandSequenceNumber()) < 0) { session.setMaximumCommandSequenceNumber(parser.getMaximumCommandSequenceNumber()); } // the PDU expCmdSN is greater than the local expCmdSN, so we // have to update the local one if (parser.incrementSequenceNumber()) { if (connection.getExpectedStatusSequenceNumber().compareTo(parser.getStatusSequenceNumber()) >= 0) { connection.incrementExpectedStatusSequenceNumber(); } else { LOGGER.error("Status Sequence Number Mismatch (received, expected): " + parser.getStatusSequenceNumber() + ", " + (connection.getExpectedStatusSequenceNumber().getValue() - 1)); } } } else { throw new InternetSCSIException(isCorrect); } return protocolDataUnit; }
[ "public", "ProtocolDataUnit", "receiveFromWire", "(", ")", "throws", "DigestException", ",", "InternetSCSIException", ",", "IOException", "{", "final", "ProtocolDataUnit", "protocolDataUnit", "=", "protocolDataUnitFactory", ".", "create", "(", "connection", ".", "getSetti...
Receives a <code>ProtocolDataUnit</code> from the socket and appends it to the end of the receiving queue of this connection. @return Queue with the resulting units @throws IOException if an I/O error occurs. @throws InternetSCSIException if any violation of the iSCSI-Standard emerge. @throws DigestException if a mismatch of the digest exists.
[ "Receives", "a", "<code", ">", "ProtocolDataUnit<", "/", "code", ">", "from", "the", "socket", "and", "appends", "it", "to", "the", "end", "of", "the", "receiving", "queue", "of", "this", "connection", "." ]
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/initiator/src/main/java/org/jscsi/initiator/connection/SenderWorker.java#L115-L155
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/SamlSettingsApi.java
SamlSettingsApi.getSPMetadataAsync
public com.squareup.okhttp.Call getSPMetadataAsync(String location, Boolean download, Boolean noSpinner, final ApiCallback<GetSPMetadataResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getSPMetadataValidateBeforeCall(location, download, noSpinner, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<GetSPMetadataResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call getSPMetadataAsync(String location, Boolean download, Boolean noSpinner, final ApiCallback<GetSPMetadataResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getSPMetadataValidateBeforeCall(location, download, noSpinner, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<GetSPMetadataResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "getSPMetadataAsync", "(", "String", "location", ",", "Boolean", "download", ",", "Boolean", "noSpinner", ",", "final", "ApiCallback", "<", "GetSPMetadataResponse", ">", "callback", ")", "throws", "Ap...
Get Metadata (asynchronously) Returns exist Metadata xml file. @param location Define SAML location. (required) @param download Define if need download file. (required) @param noSpinner Define if need page reload (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "Get", "Metadata", "(", "asynchronously", ")", "Returns", "exist", "Metadata", "xml", "file", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/SamlSettingsApi.java#L653-L678
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java
LocalNetworkGatewaysInner.beginUpdateTagsAsync
public Observable<LocalNetworkGatewayInner> beginUpdateTagsAsync(String resourceGroupName, String localNetworkGatewayName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName, tags).map(new Func1<ServiceResponse<LocalNetworkGatewayInner>, LocalNetworkGatewayInner>() { @Override public LocalNetworkGatewayInner call(ServiceResponse<LocalNetworkGatewayInner> response) { return response.body(); } }); }
java
public Observable<LocalNetworkGatewayInner> beginUpdateTagsAsync(String resourceGroupName, String localNetworkGatewayName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName, tags).map(new Func1<ServiceResponse<LocalNetworkGatewayInner>, LocalNetworkGatewayInner>() { @Override public LocalNetworkGatewayInner call(ServiceResponse<LocalNetworkGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LocalNetworkGatewayInner", ">", "beginUpdateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "localNetworkGatewayName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "beginUpdateTagsWithServiceResp...
Updates a local network gateway tags. @param resourceGroupName The name of the resource group. @param localNetworkGatewayName The name of the local network gateway. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LocalNetworkGatewayInner object
[ "Updates", "a", "local", "network", "gateway", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java#L771-L778
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/math/RangeBigInteger.java
RangeBigInteger.removeIntersect
public Pair<RangeBigInteger,RangeBigInteger> removeIntersect(RangeBigInteger o) { if (o.max.compareTo(min) < 0 || o.min.compareTo(max) > 0) // o is outside: no intersection return new Pair<>(copy(), null); if (o.min.compareTo(min) <= 0) { // nothing before if (o.max.compareTo(max) >= 0) return new Pair<>(null, null); // o is fully overlapping this return new Pair<>(null, new RangeBigInteger(o.max.add(BigInteger.ONE), max)); } if (o.max.compareTo(max) >= 0) { // nothing after return new Pair<>(new RangeBigInteger(min, o.min.subtract(BigInteger.ONE)), null); } // in the middle return new Pair<>(new RangeBigInteger(min, o.min.subtract(BigInteger.ONE)), new RangeBigInteger(o.max.add(BigInteger.ONE), max)); }
java
public Pair<RangeBigInteger,RangeBigInteger> removeIntersect(RangeBigInteger o) { if (o.max.compareTo(min) < 0 || o.min.compareTo(max) > 0) // o is outside: no intersection return new Pair<>(copy(), null); if (o.min.compareTo(min) <= 0) { // nothing before if (o.max.compareTo(max) >= 0) return new Pair<>(null, null); // o is fully overlapping this return new Pair<>(null, new RangeBigInteger(o.max.add(BigInteger.ONE), max)); } if (o.max.compareTo(max) >= 0) { // nothing after return new Pair<>(new RangeBigInteger(min, o.min.subtract(BigInteger.ONE)), null); } // in the middle return new Pair<>(new RangeBigInteger(min, o.min.subtract(BigInteger.ONE)), new RangeBigInteger(o.max.add(BigInteger.ONE), max)); }
[ "public", "Pair", "<", "RangeBigInteger", ",", "RangeBigInteger", ">", "removeIntersect", "(", "RangeBigInteger", "o", ")", "{", "if", "(", "o", ".", "max", ".", "compareTo", "(", "min", ")", "<", "0", "||", "o", ".", "min", ".", "compareTo", "(", "max...
Remove the intersection between this range and the given range, and return the range before and the range after the intersection.
[ "Remove", "the", "intersection", "between", "this", "range", "and", "the", "given", "range", "and", "return", "the", "range", "before", "and", "the", "range", "after", "the", "intersection", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/math/RangeBigInteger.java#L84-L99
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java
ProcfsBasedProcessTree.checkPidPgrpidForMatch
static boolean checkPidPgrpidForMatch(String pidStr, String procfsDir) { Integer pId = Integer.parseInt(pidStr); // Get information for this process ProcessInfo pInfo = new ProcessInfo(pId); pInfo = constructProcessInfo(pInfo, procfsDir); if (pInfo == null) { // process group leader may have finished execution, but we still need to // kill the subProcesses in the process group. return true; } //make sure that pId and its pgrpId match if (!pInfo.getPgrpId().equals(pId)) { LOG.warn("Unexpected: Process with PID " + pId + " is not a process group leader."); return false; } if (LOG.isDebugEnabled()) { LOG.debug(pId + " is a process group leader, as expected."); } return true; }
java
static boolean checkPidPgrpidForMatch(String pidStr, String procfsDir) { Integer pId = Integer.parseInt(pidStr); // Get information for this process ProcessInfo pInfo = new ProcessInfo(pId); pInfo = constructProcessInfo(pInfo, procfsDir); if (pInfo == null) { // process group leader may have finished execution, but we still need to // kill the subProcesses in the process group. return true; } //make sure that pId and its pgrpId match if (!pInfo.getPgrpId().equals(pId)) { LOG.warn("Unexpected: Process with PID " + pId + " is not a process group leader."); return false; } if (LOG.isDebugEnabled()) { LOG.debug(pId + " is a process group leader, as expected."); } return true; }
[ "static", "boolean", "checkPidPgrpidForMatch", "(", "String", "pidStr", ",", "String", "procfsDir", ")", "{", "Integer", "pId", "=", "Integer", ".", "parseInt", "(", "pidStr", ")", ";", "// Get information for this process", "ProcessInfo", "pInfo", "=", "new", "Pr...
Verify that the given process id is same as its process group id. @param pidStr Process id of the to-be-verified-process @param procfsDir Procfs root dir
[ "Verify", "that", "the", "given", "process", "id", "is", "same", "as", "its", "process", "group", "id", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L268-L289
alkacon/opencms-core
src/org/opencms/ui/CmsVaadinUtils.java
CmsVaadinUtils.getMessageText
public static String getMessageText(I_CmsMessageBundle messages, String key, Object... args) { return messages.getBundle(A_CmsUI.get().getLocale()).key(key, args); }
java
public static String getMessageText(I_CmsMessageBundle messages, String key, Object... args) { return messages.getBundle(A_CmsUI.get().getLocale()).key(key, args); }
[ "public", "static", "String", "getMessageText", "(", "I_CmsMessageBundle", "messages", ",", "String", "key", ",", "Object", "...", "args", ")", "{", "return", "messages", ".", "getBundle", "(", "A_CmsUI", ".", "get", "(", ")", ".", "getLocale", "(", ")", "...
Gets the message for the current locale and the given key and arguments.<p> @param messages the messages instance @param key the message key @param args the message arguments @return the message text for the current locale
[ "Gets", "the", "message", "for", "the", "current", "locale", "and", "the", "given", "key", "and", "arguments", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L631-L634
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java
BasicBinder.convertTo
public <S, T> T convertTo(Class<S> input, Class<T> output, Object object, Class<? extends Annotation> qualifier) { return convertTo(new ConverterKey<S,T>(input, output, qualifier), object); }
java
public <S, T> T convertTo(Class<S> input, Class<T> output, Object object, Class<? extends Annotation> qualifier) { return convertTo(new ConverterKey<S,T>(input, output, qualifier), object); }
[ "public", "<", "S", ",", "T", ">", "T", "convertTo", "(", "Class", "<", "S", ">", "input", ",", "Class", "<", "T", ">", "output", ",", "Object", "object", ",", "Class", "<", "?", "extends", "Annotation", ">", "qualifier", ")", "{", "return", "conve...
Convert an object which is an instance of source class to the given target class @param input The class of the object to be converted @param output The target class to convert the object to @param object The object to be converted @param qualifier Match the converter with the given qualifier
[ "Convert", "an", "object", "which", "is", "an", "instance", "of", "source", "class", "to", "the", "given", "target", "class" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L805-L808
JRebirth/JRebirth
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java
AbstractTemplateView.addSlideItem
protected void addSlideItem(final VBox vbox, final SlideItem item) { Node node = null; if (item.isLink()) { final Hyperlink link = HyperlinkBuilder.create() .opacity(1.0) .text(item.getValue()) .build(); link.getStyleClass().add("link" + item.getLevel()); link.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent e) { final ClipboardContent content = new ClipboardContent(); content.putString("http://" + ((Hyperlink) e.getSource()).getText()); Clipboard.getSystemClipboard().setContent(content); } }); node = link; } else if (item.isHtml()) { final WebView web = WebViewBuilder.create() .fontScale(1.4) // .effect(ReflectionBuilder.create().fraction(0.4).build()) .build(); web.getEngine().loadContent(item.getValue()); VBox.setVgrow(web, Priority.NEVER); node = web; // StackPaneBuilder.create().children(web).style("-fx-border-width:2;-fx-border-color:#000000").build(); } else if (item.getImage() != null) { final Image image = Resources.create(new RelImage(item.getImage())).get(); final ImageView imageViewer = ImageViewBuilder.create() .styleClass(ITEM_CLASS_PREFIX + item.getLevel()) .image(image) // .effect(ReflectionBuilder.create().fraction(0.9).build()) .build(); node = imageViewer; } else { final Text text = TextBuilder.create() .styleClass(ITEM_CLASS_PREFIX + item.getLevel()) .text(item.getValue() == null ? "" : item.getValue()) .build(); node = text; } if (item.getStyle() != null) { node.getStyleClass().add(item.getStyle()); } if (item.getScale() != 1.0) { node.setScaleX(item.getScale()); node.setScaleY(item.getScale()); } vbox.getChildren().add(node); }
java
protected void addSlideItem(final VBox vbox, final SlideItem item) { Node node = null; if (item.isLink()) { final Hyperlink link = HyperlinkBuilder.create() .opacity(1.0) .text(item.getValue()) .build(); link.getStyleClass().add("link" + item.getLevel()); link.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent e) { final ClipboardContent content = new ClipboardContent(); content.putString("http://" + ((Hyperlink) e.getSource()).getText()); Clipboard.getSystemClipboard().setContent(content); } }); node = link; } else if (item.isHtml()) { final WebView web = WebViewBuilder.create() .fontScale(1.4) // .effect(ReflectionBuilder.create().fraction(0.4).build()) .build(); web.getEngine().loadContent(item.getValue()); VBox.setVgrow(web, Priority.NEVER); node = web; // StackPaneBuilder.create().children(web).style("-fx-border-width:2;-fx-border-color:#000000").build(); } else if (item.getImage() != null) { final Image image = Resources.create(new RelImage(item.getImage())).get(); final ImageView imageViewer = ImageViewBuilder.create() .styleClass(ITEM_CLASS_PREFIX + item.getLevel()) .image(image) // .effect(ReflectionBuilder.create().fraction(0.9).build()) .build(); node = imageViewer; } else { final Text text = TextBuilder.create() .styleClass(ITEM_CLASS_PREFIX + item.getLevel()) .text(item.getValue() == null ? "" : item.getValue()) .build(); node = text; } if (item.getStyle() != null) { node.getStyleClass().add(item.getStyle()); } if (item.getScale() != 1.0) { node.setScaleX(item.getScale()); node.setScaleY(item.getScale()); } vbox.getChildren().add(node); }
[ "protected", "void", "addSlideItem", "(", "final", "VBox", "vbox", ",", "final", "SlideItem", "item", ")", "{", "Node", "node", "=", "null", ";", "if", "(", "item", ".", "isLink", "(", ")", ")", "{", "final", "Hyperlink", "link", "=", "HyperlinkBuilder",...
Add a slide item by managing level. @param vbox the layout node @param item the slide item to add
[ "Add", "a", "slide", "item", "by", "managing", "level", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java#L488-L552
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.getCustomFieldOutlineCodeValue
private String getCustomFieldOutlineCodeValue(Var2Data varData, Var2Data outlineCodeVarData, Integer id) { String result = null; int uniqueId = id.intValue(); if (uniqueId == 0) { return ""; } CustomFieldValueItem item = m_file.getCustomFields().getCustomFieldValueItemByUniqueID(uniqueId); if (item != null) { Object value = item.getValue(); if (value instanceof String) { result = (String) value; } if (result != null && !NumberHelper.equals(id, item.getParent())) { String result2 = getCustomFieldOutlineCodeValue(varData, outlineCodeVarData, item.getParent()); if (result2 != null && !result2.isEmpty()) { result = result2 + "." + result; } } } return result; }
java
private String getCustomFieldOutlineCodeValue(Var2Data varData, Var2Data outlineCodeVarData, Integer id) { String result = null; int uniqueId = id.intValue(); if (uniqueId == 0) { return ""; } CustomFieldValueItem item = m_file.getCustomFields().getCustomFieldValueItemByUniqueID(uniqueId); if (item != null) { Object value = item.getValue(); if (value instanceof String) { result = (String) value; } if (result != null && !NumberHelper.equals(id, item.getParent())) { String result2 = getCustomFieldOutlineCodeValue(varData, outlineCodeVarData, item.getParent()); if (result2 != null && !result2.isEmpty()) { result = result2 + "." + result; } } } return result; }
[ "private", "String", "getCustomFieldOutlineCodeValue", "(", "Var2Data", "varData", ",", "Var2Data", "outlineCodeVarData", ",", "Integer", "id", ")", "{", "String", "result", "=", "null", ";", "int", "uniqueId", "=", "id", ".", "intValue", "(", ")", ";", "if", ...
Retrieve custom field value. @param varData var data block @param outlineCodeVarData var data block @param id parent item ID @return item value
[ "Retrieve", "custom", "field", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L1999-L2029
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.setVpnclientIpsecParametersAsync
public Observable<VpnClientIPsecParametersInner> setVpnclientIpsecParametersAsync(String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams) { return setVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams).map(new Func1<ServiceResponse<VpnClientIPsecParametersInner>, VpnClientIPsecParametersInner>() { @Override public VpnClientIPsecParametersInner call(ServiceResponse<VpnClientIPsecParametersInner> response) { return response.body(); } }); }
java
public Observable<VpnClientIPsecParametersInner> setVpnclientIpsecParametersAsync(String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams) { return setVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams).map(new Func1<ServiceResponse<VpnClientIPsecParametersInner>, VpnClientIPsecParametersInner>() { @Override public VpnClientIPsecParametersInner call(ServiceResponse<VpnClientIPsecParametersInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VpnClientIPsecParametersInner", ">", "setVpnclientIpsecParametersAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ",", "VpnClientIPsecParametersInner", "vpnclientIpsecParams", ")", "{", "return", "setVpnclientIp...
The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @param vpnclientIpsecParams Parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network Gateway P2S client operation through Network resource provider. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "The", "Set", "VpnclientIpsecParameters", "operation", "sets", "the", "vpnclient", "ipsec", "policy", "for", "P2S", "client", "of", "virtual", "network", "gateway", "in", "the", "specified", "resource", "group", "through", "Network", "resource", "provider", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2686-L2693
resilience4j/resilience4j
resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/CircuitBreakerExports.java
CircuitBreakerExports.ofSupplier
public static CircuitBreakerExports ofSupplier(String prefix, Supplier<Iterable<CircuitBreaker>> circuitBreakersSupplier) { return new CircuitBreakerExports(prefix, circuitBreakersSupplier); }
java
public static CircuitBreakerExports ofSupplier(String prefix, Supplier<Iterable<CircuitBreaker>> circuitBreakersSupplier) { return new CircuitBreakerExports(prefix, circuitBreakersSupplier); }
[ "public", "static", "CircuitBreakerExports", "ofSupplier", "(", "String", "prefix", ",", "Supplier", "<", "Iterable", "<", "CircuitBreaker", ">", ">", "circuitBreakersSupplier", ")", "{", "return", "new", "CircuitBreakerExports", "(", "prefix", ",", "circuitBreakersSu...
Creates a new instance of {@link CircuitBreakerExports} with specified metrics names prefix and {@link Supplier} of circuit breakers @param prefix the prefix of metrics names @param circuitBreakersSupplier the supplier of circuit breakers
[ "Creates", "a", "new", "instance", "of", "{", "@link", "CircuitBreakerExports", "}", "with", "specified", "metrics", "names", "prefix", "and", "{", "@link", "Supplier", "}", "of", "circuit", "breakers" ]
train
https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/CircuitBreakerExports.java#L61-L63
facebookarchive/hadoop-20
src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/HadoopLocationWizard.java
HadoopLocationWizard.createConfNameEditor
private Text createConfNameEditor(ModifyListener listener, Composite parent, String propName, String labelText) { { ConfProp prop = ConfProp.getByName(propName); if (prop != null) return createConfLabelText(listener, parent, prop, labelText); } Label label = new Label(parent, SWT.NONE); if (labelText == null) labelText = propName; label.setText(labelText); Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(data); text.setData("hPropName", propName); text.setText(location.getConfProp(propName)); text.addModifyListener(listener); return text; }
java
private Text createConfNameEditor(ModifyListener listener, Composite parent, String propName, String labelText) { { ConfProp prop = ConfProp.getByName(propName); if (prop != null) return createConfLabelText(listener, parent, prop, labelText); } Label label = new Label(parent, SWT.NONE); if (labelText == null) labelText = propName; label.setText(labelText); Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(data); text.setData("hPropName", propName); text.setText(location.getConfProp(propName)); text.addModifyListener(listener); return text; }
[ "private", "Text", "createConfNameEditor", "(", "ModifyListener", "listener", ",", "Composite", "parent", ",", "String", "propName", ",", "String", "labelText", ")", "{", "{", "ConfProp", "prop", "=", "ConfProp", ".", "getByName", "(", "propName", ")", ";", "i...
Create an editor entry for the given configuration name @param listener the listener to trigger on property change @param parent the SWT parent container @param propName the name of the property to create an editor for @param labelText a label (null will defaults to the property name) @return a SWT Text field
[ "Create", "an", "editor", "entry", "for", "the", "given", "configuration", "name" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/HadoopLocationWizard.java#L562-L584
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java
SqlExecutor.execute
public static boolean execute(PreparedStatement ps, Object... params) throws SQLException { StatementUtil.fillParams(ps, params); return ps.execute(); }
java
public static boolean execute(PreparedStatement ps, Object... params) throws SQLException { StatementUtil.fillParams(ps, params); return ps.execute(); }
[ "public", "static", "boolean", "execute", "(", "PreparedStatement", "ps", ",", "Object", "...", "params", ")", "throws", "SQLException", "{", "StatementUtil", ".", "fillParams", "(", "ps", ",", "params", ")", ";", "return", "ps", ".", "execute", "(", ")", ...
可用于执行任何SQL语句,返回一个boolean值,表明执行该SQL语句是否返回了ResultSet。<br> 如果执行后第一个结果是ResultSet,则返回true,否则返回false。<br> 此方法不会关闭PreparedStatement @param ps PreparedStatement对象 @param params 参数 @return 如果执行后第一个结果是ResultSet,则返回true,否则返回false。 @throws SQLException SQL执行异常
[ "可用于执行任何SQL语句,返回一个boolean值,表明执行该SQL语句是否返回了ResultSet。<br", ">", "如果执行后第一个结果是ResultSet,则返回true,否则返回false。<br", ">", "此方法不会关闭PreparedStatement" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L296-L299
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/openal/AudioLoader.java
AudioLoader.getAudio
public static Audio getAudio(String format, InputStream in) throws IOException { init(); if (format.equals(AIF)) { return SoundStore.get().getAIF(in); } if (format.equals(WAV)) { return SoundStore.get().getWAV(in); } if (format.equals(OGG)) { return SoundStore.get().getOgg(in); } throw new IOException("Unsupported format for non-streaming Audio: "+format); }
java
public static Audio getAudio(String format, InputStream in) throws IOException { init(); if (format.equals(AIF)) { return SoundStore.get().getAIF(in); } if (format.equals(WAV)) { return SoundStore.get().getWAV(in); } if (format.equals(OGG)) { return SoundStore.get().getOgg(in); } throw new IOException("Unsupported format for non-streaming Audio: "+format); }
[ "public", "static", "Audio", "getAudio", "(", "String", "format", ",", "InputStream", "in", ")", "throws", "IOException", "{", "init", "(", ")", ";", "if", "(", "format", ".", "equals", "(", "AIF", ")", ")", "{", "return", "SoundStore", ".", "get", "("...
Get audio data in a playable state by loading the complete audio into memory. @param format The format of the audio to be loaded (something like "XM" or "OGG") @param in The input stream from which to load the audio data @return An object representing the audio data @throws IOException Indicates a failure to access the audio data
[ "Get", "audio", "data", "in", "a", "playable", "state", "by", "loading", "the", "complete", "audio", "into", "memory", "." ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/openal/AudioLoader.java#L47-L61
alkacon/opencms-core
src/org/opencms/gwt/shared/property/CmsClientProperty.java
CmsClientProperty.removeEmptyProperties
public static void removeEmptyProperties(Map<String, CmsClientProperty> props) { Iterator<Map.Entry<String, CmsClientProperty>> iter = props.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<String, CmsClientProperty> entry = iter.next(); CmsClientProperty value = entry.getValue(); if (value.isEmpty()) { iter.remove(); } } }
java
public static void removeEmptyProperties(Map<String, CmsClientProperty> props) { Iterator<Map.Entry<String, CmsClientProperty>> iter = props.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<String, CmsClientProperty> entry = iter.next(); CmsClientProperty value = entry.getValue(); if (value.isEmpty()) { iter.remove(); } } }
[ "public", "static", "void", "removeEmptyProperties", "(", "Map", "<", "String", ",", "CmsClientProperty", ">", "props", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "String", ",", "CmsClientProperty", ">", ">", "iter", "=", "props", ".", "entrySet", ...
Helper method for removing empty properties from a map.<p> @param props the map from which to remove empty properties
[ "Helper", "method", "for", "removing", "empty", "properties", "from", "a", "map", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/shared/property/CmsClientProperty.java#L227-L237
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
MemberSummaryBuilder.buildAnnotationTypeRequiredMemberSummary
public void buildAnnotationTypeRequiredMemberSummary(XMLNode node, Content memberSummaryTree) { MemberSummaryWriter writer = memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED]; VisibleMemberMap visibleMemberMap = visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED]; addSummary(writer, visibleMemberMap, false, memberSummaryTree); }
java
public void buildAnnotationTypeRequiredMemberSummary(XMLNode node, Content memberSummaryTree) { MemberSummaryWriter writer = memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED]; VisibleMemberMap visibleMemberMap = visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED]; addSummary(writer, visibleMemberMap, false, memberSummaryTree); }
[ "public", "void", "buildAnnotationTypeRequiredMemberSummary", "(", "XMLNode", "node", ",", "Content", "memberSummaryTree", ")", "{", "MemberSummaryWriter", "writer", "=", "memberSummaryWriters", "[", "VisibleMemberMap", ".", "ANNOTATION_TYPE_MEMBER_REQUIRED", "]", ";", "Vis...
Build the summary for the optional members. @param node the XML element that specifies which components to document @param memberSummaryTree the content tree to which the documentation will be added
[ "Build", "the", "summary", "for", "the", "optional", "members", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java#L250-L256
grails/grails-core
grails-core/src/main/groovy/grails/util/GrailsMetaClassUtils.java
GrailsMetaClassUtils.getPropertyIfExists
public static Object getPropertyIfExists(Object instance, String property) { return getPropertyIfExists(instance, property, Object.class); }
java
public static Object getPropertyIfExists(Object instance, String property) { return getPropertyIfExists(instance, property, Object.class); }
[ "public", "static", "Object", "getPropertyIfExists", "(", "Object", "instance", ",", "String", "property", ")", "{", "return", "getPropertyIfExists", "(", "instance", ",", "property", ",", "Object", ".", "class", ")", ";", "}" ]
Obtains a property of an instance if it exists @param instance The instance @param property The property @return The value of null if non-exists
[ "Obtains", "a", "property", "of", "an", "instance", "if", "it", "exists" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsMetaClassUtils.java#L195-L197
primefaces-extensions/core
src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java
DynaFormRow.addModel
public DynaFormModelElement addModel(final DynaFormModel model, final int colspan, final int rowspan) { final DynaFormModelElement nestedModel = new DynaFormModelElement(model, colspan, rowspan, row, elements.size() + 1, dynaFormModel.getControls().size() + 1, extended); elements.add(nestedModel); dynaFormModel.getControls().addAll(model.getControls()); totalColspan = totalColspan + colspan; return nestedModel; }
java
public DynaFormModelElement addModel(final DynaFormModel model, final int colspan, final int rowspan) { final DynaFormModelElement nestedModel = new DynaFormModelElement(model, colspan, rowspan, row, elements.size() + 1, dynaFormModel.getControls().size() + 1, extended); elements.add(nestedModel); dynaFormModel.getControls().addAll(model.getControls()); totalColspan = totalColspan + colspan; return nestedModel; }
[ "public", "DynaFormModelElement", "addModel", "(", "final", "DynaFormModel", "model", ",", "final", "int", "colspan", ",", "final", "int", "rowspan", ")", "{", "final", "DynaFormModelElement", "nestedModel", "=", "new", "DynaFormModelElement", "(", "model", ",", "...
* Adds nested model with given colspan and rowspan. @param model @param colspan @param rowspan @return DynaFormModelElement added model
[ "*", "Adds", "nested", "model", "with", "given", "colspan", "and", "rowspan", "." ]
train
https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java#L130-L144
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java
ScopedServletUtils.getScopedRequestAttribute
public static Object getScopedRequestAttribute( String attrName, ServletRequest request ) { if ( request instanceof ScopedRequest ) { return ( ( ScopedRequest ) request ).getAttribute( attrName, false ); } return request.getAttribute( attrName ); }
java
public static Object getScopedRequestAttribute( String attrName, ServletRequest request ) { if ( request instanceof ScopedRequest ) { return ( ( ScopedRequest ) request ).getAttribute( attrName, false ); } return request.getAttribute( attrName ); }
[ "public", "static", "Object", "getScopedRequestAttribute", "(", "String", "attrName", ",", "ServletRequest", "request", ")", "{", "if", "(", "request", "instanceof", "ScopedRequest", ")", "{", "return", "(", "(", "ScopedRequest", ")", "request", ")", ".", "getAt...
Get an attribute from the given request, and if it is a {@link ScopedRequest}, ensure that the attribute is <strong>not</strong> "showing through" from the outer request, even if the ScopedRequest allows that by default. @exclude
[ "Get", "an", "attribute", "from", "the", "given", "request", "and", "if", "it", "is", "a", "{", "@link", "ScopedRequest", "}", "ensure", "that", "the", "attribute", "is", "<strong", ">", "not<", "/", "strong", ">", "showing", "through", "from", "the", "o...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java#L358-L366
Jasig/uPortal
uPortal-rendering/src/main/java/org/apereo/portal/portlet/container/cache/PortletCacheControlServiceImpl.java
PortletCacheControlServiceImpl.cacheElement
protected void cacheElement( Ehcache cache, Serializable cacheKey, CachedPortletResultHolder<?> data, CacheControl cacheControl) { // using validation method, ignore expirationTime and defer to cache configuration if (cacheControl.getETag() != null) { final Element element = new Element(cacheKey, data); cache.put(element); return; } // using expiration method, -1 for CacheControl#expirationTime means "forever" (e.g. ignore // and defer to cache configuration) final int expirationTime = cacheControl.getExpirationTime(); if (expirationTime == -1) { final Element element = new Element(cacheKey, data); cache.put(element); return; } // using expiration method with a positive expiration, set that value as the element's TTL // if it is lower than the configured cache TTL final CacheConfiguration cacheConfiguration = cache.getCacheConfiguration(); final Element element = new Element(cacheKey, data); final long cacheTTL = cacheConfiguration.getTimeToLiveSeconds(); if (expirationTime < cacheTTL) { element.setTimeToLive(expirationTime); } cache.put(element); }
java
protected void cacheElement( Ehcache cache, Serializable cacheKey, CachedPortletResultHolder<?> data, CacheControl cacheControl) { // using validation method, ignore expirationTime and defer to cache configuration if (cacheControl.getETag() != null) { final Element element = new Element(cacheKey, data); cache.put(element); return; } // using expiration method, -1 for CacheControl#expirationTime means "forever" (e.g. ignore // and defer to cache configuration) final int expirationTime = cacheControl.getExpirationTime(); if (expirationTime == -1) { final Element element = new Element(cacheKey, data); cache.put(element); return; } // using expiration method with a positive expiration, set that value as the element's TTL // if it is lower than the configured cache TTL final CacheConfiguration cacheConfiguration = cache.getCacheConfiguration(); final Element element = new Element(cacheKey, data); final long cacheTTL = cacheConfiguration.getTimeToLiveSeconds(); if (expirationTime < cacheTTL) { element.setTimeToLive(expirationTime); } cache.put(element); }
[ "protected", "void", "cacheElement", "(", "Ehcache", "cache", ",", "Serializable", "cacheKey", ",", "CachedPortletResultHolder", "<", "?", ">", "data", ",", "CacheControl", "cacheControl", ")", "{", "// using validation method, ignore expirationTime and defer to cache configu...
Construct an appropriate Cache {@link Element} for the cacheKey and data. The element's ttl will be set depending on whether expiration or validation method is indicated from the CacheControl and the cache's configuration.
[ "Construct", "an", "appropriate", "Cache", "{" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-rendering/src/main/java/org/apereo/portal/portlet/container/cache/PortletCacheControlServiceImpl.java#L517-L547
protostuff/protostuff
protostuff-parser/src/main/java/io/protostuff/parser/DefaultProtoLoader.java
DefaultProtoLoader.getResource
public static URL getResource(String resource, Class<?> context, boolean checkParent) { URL url = Thread.currentThread().getContextClassLoader().getResource(resource); if (url != null) return url; if (context != null) { ClassLoader loader = context.getClassLoader(); while (loader != null) { url = loader.getResource(resource); if (url != null) return url; loader = checkParent ? loader.getParent() : null; } } return ClassLoader.getSystemResource(resource); }
java
public static URL getResource(String resource, Class<?> context, boolean checkParent) { URL url = Thread.currentThread().getContextClassLoader().getResource(resource); if (url != null) return url; if (context != null) { ClassLoader loader = context.getClassLoader(); while (loader != null) { url = loader.getResource(resource); if (url != null) return url; loader = checkParent ? loader.getParent() : null; } } return ClassLoader.getSystemResource(resource); }
[ "public", "static", "URL", "getResource", "(", "String", "resource", ",", "Class", "<", "?", ">", "context", ",", "boolean", "checkParent", ")", "{", "URL", "url", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ".", ...
Loads a {@link URL} resource from the classloader; If not found, the classloader of the {@code context} class specified will be used. If the flag {@code checkParent} is true, the classloader's parent is included in the lookup.
[ "Loads", "a", "{" ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-parser/src/main/java/io/protostuff/parser/DefaultProtoLoader.java#L299-L318
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.checkCallConventions
private void checkCallConventions(NodeTraversal t, Node n) { SubclassRelationship relationship = compiler.getCodingConvention().getClassesDefinedByCall(n); TypedScope scope = t.getTypedScope(); if (relationship != null) { ObjectType superClass = TypeValidator.getInstanceOfCtor( scope.lookupQualifiedName(QualifiedName.of(relationship.superclassName))); ObjectType subClass = TypeValidator.getInstanceOfCtor( scope.lookupQualifiedName(QualifiedName.of(relationship.subclassName))); if (relationship.type == SubclassType.INHERITS && superClass != null && !superClass.isEmptyType() && subClass != null && !subClass.isEmptyType()) { validator.expectSuperType(n, superClass, subClass); } } }
java
private void checkCallConventions(NodeTraversal t, Node n) { SubclassRelationship relationship = compiler.getCodingConvention().getClassesDefinedByCall(n); TypedScope scope = t.getTypedScope(); if (relationship != null) { ObjectType superClass = TypeValidator.getInstanceOfCtor( scope.lookupQualifiedName(QualifiedName.of(relationship.superclassName))); ObjectType subClass = TypeValidator.getInstanceOfCtor( scope.lookupQualifiedName(QualifiedName.of(relationship.subclassName))); if (relationship.type == SubclassType.INHERITS && superClass != null && !superClass.isEmptyType() && subClass != null && !subClass.isEmptyType()) { validator.expectSuperType(n, superClass, subClass); } } }
[ "private", "void", "checkCallConventions", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "SubclassRelationship", "relationship", "=", "compiler", ".", "getCodingConvention", "(", ")", ".", "getClassesDefinedByCall", "(", "n", ")", ";", "TypedScope", "scop...
Validate class-defining calls. Because JS has no 'native' syntax for defining classes, we need to do this manually.
[ "Validate", "class", "-", "defining", "calls", ".", "Because", "JS", "has", "no", "native", "syntax", "for", "defining", "classes", "we", "need", "to", "do", "this", "manually", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2506-L2525
unbescape/unbescape
src/main/java/org/unbescape/xml/XmlEscape.java
XmlEscape.unescapeXml
public static void unescapeXml(final char[] text, final int offset, final int len, final Writer writer) throws IOException{ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } final int textLen = (text == null? 0 : text.length); if (offset < 0 || offset > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } if (len < 0 || (offset + len) > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } // The chosen symbols (1.0 or 1.1) don't really matter, as both contain the same CERs XmlEscapeUtil.unescape(text, offset, len, writer, XmlEscapeSymbols.XML11_SYMBOLS); }
java
public static void unescapeXml(final char[] text, final int offset, final int len, final Writer writer) throws IOException{ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } final int textLen = (text == null? 0 : text.length); if (offset < 0 || offset > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } if (len < 0 || (offset + len) > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } // The chosen symbols (1.0 or 1.1) don't really matter, as both contain the same CERs XmlEscapeUtil.unescape(text, offset, len, writer, XmlEscapeSymbols.XML11_SYMBOLS); }
[ "public", "static", "void", "unescapeXml", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "...
<p> Perform an XML <strong>unescape</strong> operation on a <tt>char[]</tt> input. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> XML 1.0/1.1 unescape of CERs, decimal and hexadecimal references. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be unescaped. @param offset the position in <tt>text</tt> at which the unescape operation should start. @param len the number of characters in <tt>text</tt> that should be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "an", "XML", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ">", "No", "additional", "configuration", "arguments", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L2423-L2445
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicAtomGenerator.java
BasicAtomGenerator.canDraw
protected boolean canDraw(IAtom atom, IAtomContainer container, RendererModel model) { // don't draw atoms without coordinates if (!hasCoordinates(atom)) { return false; } // don't draw invisible hydrogens if (invisibleHydrogen(atom, model)) { return false; } // don't draw invisible carbons if (invisibleCarbon(atom, container, model)) { return false; } return true; }
java
protected boolean canDraw(IAtom atom, IAtomContainer container, RendererModel model) { // don't draw atoms without coordinates if (!hasCoordinates(atom)) { return false; } // don't draw invisible hydrogens if (invisibleHydrogen(atom, model)) { return false; } // don't draw invisible carbons if (invisibleCarbon(atom, container, model)) { return false; } return true; }
[ "protected", "boolean", "canDraw", "(", "IAtom", "atom", ",", "IAtomContainer", "container", ",", "RendererModel", "model", ")", "{", "// don't draw atoms without coordinates", "if", "(", "!", "hasCoordinates", "(", "atom", ")", ")", "{", "return", "false", ";", ...
Checks an atom to see if it should be drawn. There are three reasons not to draw an atom - a) no coordinates, b) an invisible hydrogen or c) an invisible carbon. @param atom the atom to check @param container the atom container the atom is part of @param model the renderer model @return true if the atom should be drawn
[ "Checks", "an", "atom", "to", "see", "if", "it", "should", "be", "drawn", ".", "There", "are", "three", "reasons", "not", "to", "draw", "an", "atom", "-", "a", ")", "no", "coordinates", "b", ")", "an", "invisible", "hydrogen", "or", "c", ")", "an", ...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicAtomGenerator.java#L289-L306
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getCompositeEntityAsync
public Observable<CompositeEntityExtractor> getCompositeEntityAsync(UUID appId, String versionId, UUID cEntityId) { return getCompositeEntityWithServiceResponseAsync(appId, versionId, cEntityId).map(new Func1<ServiceResponse<CompositeEntityExtractor>, CompositeEntityExtractor>() { @Override public CompositeEntityExtractor call(ServiceResponse<CompositeEntityExtractor> response) { return response.body(); } }); }
java
public Observable<CompositeEntityExtractor> getCompositeEntityAsync(UUID appId, String versionId, UUID cEntityId) { return getCompositeEntityWithServiceResponseAsync(appId, versionId, cEntityId).map(new Func1<ServiceResponse<CompositeEntityExtractor>, CompositeEntityExtractor>() { @Override public CompositeEntityExtractor call(ServiceResponse<CompositeEntityExtractor> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CompositeEntityExtractor", ">", "getCompositeEntityAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ")", "{", "return", "getCompositeEntityWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", ...
Gets information about the composite entity model. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CompositeEntityExtractor object
[ "Gets", "information", "about", "the", "composite", "entity", "model", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L3964-L3971
junit-team/junit4
src/main/java/org/junit/runners/ParentRunner.java
ParentRunner.withBeforeClasses
protected Statement withBeforeClasses(Statement statement) { List<FrameworkMethod> befores = testClass .getAnnotatedMethods(BeforeClass.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, null); }
java
protected Statement withBeforeClasses(Statement statement) { List<FrameworkMethod> befores = testClass .getAnnotatedMethods(BeforeClass.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, null); }
[ "protected", "Statement", "withBeforeClasses", "(", "Statement", "statement", ")", "{", "List", "<", "FrameworkMethod", ">", "befores", "=", "testClass", ".", "getAnnotatedMethods", "(", "BeforeClass", ".", "class", ")", ";", "return", "befores", ".", "isEmpty", ...
Returns a {@link Statement}: run all non-overridden {@code @BeforeClass} methods on this class and superclasses before executing {@code statement}; if any throws an Exception, stop execution and pass the exception on.
[ "Returns", "a", "{" ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runners/ParentRunner.java#L236-L241
moleculer-java/moleculer-java
src/main/java/services/moleculer/cacher/DistributedCacher.java
DistributedCacher.getCacheKey
@Override public String getCacheKey(String name, Tree params, String... keys) { if (params == null) { return name; } StringBuilder buffer = new StringBuilder(128); serializeKey(buffer, params, keys); String serializedParams = buffer.toString(); int paramsLength = serializedParams.length(); if (maxParamsLength < 44 || paramsLength <= maxParamsLength) { // Key = action name : serialized key return name + ':' + serializedParams; } // Length of unhashed part (begining of the serialized params) int prefixLength = maxParamsLength - 44; // Create SHA-256 hash from the entire key byte[] bytes = serializedParams.getBytes(StandardCharsets.UTF_8); MessageDigest hasher = hashers.poll(); if (hasher == null) { try { hasher = MessageDigest.getInstance("SHA-256"); } catch (Exception cause) { logger.warn("Unable to get SHA-256 hasher!", cause); return name + ':' + serializedParams; } } bytes = hasher.digest(bytes); hashers.add(hasher); // Concatenate key and the 44 character long hash String base64 = BASE64.encode(bytes); if (prefixLength < 1) { // Fully hashed key = action name : hash code return name + ':' + base64; } // Partly hashed key = action name : beginig of the prefix + hash code return name + ':' + serializedParams.substring(0, prefixLength) + base64; }
java
@Override public String getCacheKey(String name, Tree params, String... keys) { if (params == null) { return name; } StringBuilder buffer = new StringBuilder(128); serializeKey(buffer, params, keys); String serializedParams = buffer.toString(); int paramsLength = serializedParams.length(); if (maxParamsLength < 44 || paramsLength <= maxParamsLength) { // Key = action name : serialized key return name + ':' + serializedParams; } // Length of unhashed part (begining of the serialized params) int prefixLength = maxParamsLength - 44; // Create SHA-256 hash from the entire key byte[] bytes = serializedParams.getBytes(StandardCharsets.UTF_8); MessageDigest hasher = hashers.poll(); if (hasher == null) { try { hasher = MessageDigest.getInstance("SHA-256"); } catch (Exception cause) { logger.warn("Unable to get SHA-256 hasher!", cause); return name + ':' + serializedParams; } } bytes = hasher.digest(bytes); hashers.add(hasher); // Concatenate key and the 44 character long hash String base64 = BASE64.encode(bytes); if (prefixLength < 1) { // Fully hashed key = action name : hash code return name + ':' + base64; } // Partly hashed key = action name : beginig of the prefix + hash code return name + ':' + serializedParams.substring(0, prefixLength) + base64; }
[ "@", "Override", "public", "String", "getCacheKey", "(", "String", "name", ",", "Tree", "params", ",", "String", "...", "keys", ")", "{", "if", "(", "params", "==", "null", ")", "{", "return", "name", ";", "}", "StringBuilder", "buffer", "=", "new", "S...
Creates a cacher-specific key by name and params. Concatenates the name and params. @param name action name @param params input (JSON) structure @param keys keys in the "params" structure (optional) @return generated cache key String
[ "Creates", "a", "cacher", "-", "specific", "key", "by", "name", "and", "params", ".", "Concatenates", "the", "name", "and", "params", "." ]
train
https://github.com/moleculer-java/moleculer-java/blob/27575c44b9ecacc17c4456ceacf5d1851abf1cc4/src/main/java/services/moleculer/cacher/DistributedCacher.java#L82-L124
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/NearestNeighbourDescription.java
NearestNeighbourDescription.getNearestNeighbour
private Instance getNearestNeighbour(Instance inst, List<Instance> neighbourhood2, boolean inNbhd) { double dist = Double.MAX_VALUE; Instance nearestNeighbour = null; for(Instance candidateNN : neighbourhood2) { // If inst is in neighbourhood2 and an identical instance is found, then it is no longer required to // look for inst and the inNbhd flag can be set to FALSE. if(inNbhd && (distance(inst, candidateNN) == 0)) { inNbhd = false; } else { if(distance(inst, candidateNN) < dist) { nearestNeighbour = candidateNN.copy(); dist = distance(inst, candidateNN); } } } return nearestNeighbour; }
java
private Instance getNearestNeighbour(Instance inst, List<Instance> neighbourhood2, boolean inNbhd) { double dist = Double.MAX_VALUE; Instance nearestNeighbour = null; for(Instance candidateNN : neighbourhood2) { // If inst is in neighbourhood2 and an identical instance is found, then it is no longer required to // look for inst and the inNbhd flag can be set to FALSE. if(inNbhd && (distance(inst, candidateNN) == 0)) { inNbhd = false; } else { if(distance(inst, candidateNN) < dist) { nearestNeighbour = candidateNN.copy(); dist = distance(inst, candidateNN); } } } return nearestNeighbour; }
[ "private", "Instance", "getNearestNeighbour", "(", "Instance", "inst", ",", "List", "<", "Instance", ">", "neighbourhood2", ",", "boolean", "inNbhd", ")", "{", "double", "dist", "=", "Double", ".", "MAX_VALUE", ";", "Instance", "nearestNeighbour", "=", "null", ...
Searches the neighbourhood in order to find the argument instance's nearest neighbour. @param inst the instance whose nearest neighbour is sought @param neighbourhood2 the neighbourhood to search for the nearest neighbour @param inNbhd if inst is in neighbourhood2: <b>true</b>, else: <b>false</b> @return the instance that is inst's nearest neighbour in neighbourhood2
[ "Searches", "the", "neighbourhood", "in", "order", "to", "find", "the", "argument", "instance", "s", "nearest", "neighbour", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/NearestNeighbourDescription.java#L170-L194
ulisesbocchio/spring-boot-security-saml
spring-boot-security-saml/src/main/java/com/github/ulisesbocchio/spring/boot/security/saml/resource/KeystoreFactory.java
KeystoreFactory.loadKeystore
@SneakyThrows public KeyStore loadKeystore(String certResourceLocation, String privateKeyResourceLocation, String alias, String keyPassword) { KeyStore keystore = createEmptyKeystore(); X509Certificate cert = loadCert(certResourceLocation); RSAPrivateKey privateKey = loadPrivateKey(privateKeyResourceLocation); addKeyToKeystore(keystore, cert, privateKey, alias, keyPassword); return keystore; }
java
@SneakyThrows public KeyStore loadKeystore(String certResourceLocation, String privateKeyResourceLocation, String alias, String keyPassword) { KeyStore keystore = createEmptyKeystore(); X509Certificate cert = loadCert(certResourceLocation); RSAPrivateKey privateKey = loadPrivateKey(privateKeyResourceLocation); addKeyToKeystore(keystore, cert, privateKey, alias, keyPassword); return keystore; }
[ "@", "SneakyThrows", "public", "KeyStore", "loadKeystore", "(", "String", "certResourceLocation", ",", "String", "privateKeyResourceLocation", ",", "String", "alias", ",", "String", "keyPassword", ")", "{", "KeyStore", "keystore", "=", "createEmptyKeystore", "(", ")",...
Based on a public certificate, private key, alias and password, this method will load the certificate and private key as an entry into a newly created keystore, and it will set the provided alias and password to the keystore entry. @param certResourceLocation @param privateKeyResourceLocation @param alias @param keyPassword @return
[ "Based", "on", "a", "public", "certificate", "private", "key", "alias", "and", "password", "this", "method", "will", "load", "the", "certificate", "and", "private", "key", "as", "an", "entry", "into", "a", "newly", "created", "keystore", "and", "it", "will",...
train
https://github.com/ulisesbocchio/spring-boot-security-saml/blob/63596fe9b4b5504053392b9ee9a925b9a77644d4/spring-boot-security-saml/src/main/java/com/github/ulisesbocchio/spring/boot/security/saml/resource/KeystoreFactory.java#L46-L53
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseThrowIOEForInboundConnections
private void parseThrowIOEForInboundConnections(Map<?, ?> props) { //PI57542 Object value = props.get(HttpConfigConstants.PROPNAME_THROW_IOE_FOR_INBOUND_CONNECTIONS); if (null != value) { this.throwIOEForInboundConnections = convertBoolean(value); if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) { Tr.event(tc, "Config: ThrowIOEForInboundConnections is " + throwIOEForInboundConnections()); } } }
java
private void parseThrowIOEForInboundConnections(Map<?, ?> props) { //PI57542 Object value = props.get(HttpConfigConstants.PROPNAME_THROW_IOE_FOR_INBOUND_CONNECTIONS); if (null != value) { this.throwIOEForInboundConnections = convertBoolean(value); if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) { Tr.event(tc, "Config: ThrowIOEForInboundConnections is " + throwIOEForInboundConnections()); } } }
[ "private", "void", "parseThrowIOEForInboundConnections", "(", "Map", "<", "?", ",", "?", ">", "props", ")", "{", "//PI57542", "Object", "value", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_THROW_IOE_FOR_INBOUND_CONNECTIONS", ")", ";", "if"...
Check the configuration map for if we should swallow inbound connections IOEs @ param props
[ "Check", "the", "configuration", "map", "for", "if", "we", "should", "swallow", "inbound", "connections", "IOEs" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L1326-L1335
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/ExceptionUtils.java
ExceptionUtils.throwAsIAE
public static void throwAsIAE(Throwable t, String msg) { throwIfRTE(t); throwIfError(t); throw new IllegalArgumentException(msg, t); }
java
public static void throwAsIAE(Throwable t, String msg) { throwIfRTE(t); throwIfError(t); throw new IllegalArgumentException(msg, t); }
[ "public", "static", "void", "throwAsIAE", "(", "Throwable", "t", ",", "String", "msg", ")", "{", "throwIfRTE", "(", "t", ")", ";", "throwIfError", "(", "t", ")", ";", "throw", "new", "IllegalArgumentException", "(", "msg", ",", "t", ")", ";", "}" ]
Method that will wrap 't' as an {@link IllegalArgumentException} (and with specified message) if it is a checked exception; otherwise (runtime exception or error) throw as is. @param t the Throwable to possibly propagate @param msg the detail message
[ "Method", "that", "will", "wrap", "t", "as", "an", "{", "@link", "IllegalArgumentException", "}", "(", "and", "with", "specified", "message", ")", "if", "it", "is", "a", "checked", "exception", ";", "otherwise", "(", "runtime", "exception", "or", "error", ...
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ExceptionUtils.java#L146-L150
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/ParagraphBuilder.java
ParagraphBuilder.styledSpan
public ParagraphBuilder styledSpan(final String text, final TextStyle ts) { final ParagraphElement paragraphElement = new Span(text, ts); this.paragraphElements.add(paragraphElement); return this; }
java
public ParagraphBuilder styledSpan(final String text, final TextStyle ts) { final ParagraphElement paragraphElement = new Span(text, ts); this.paragraphElements.add(paragraphElement); return this; }
[ "public", "ParagraphBuilder", "styledSpan", "(", "final", "String", "text", ",", "final", "TextStyle", "ts", ")", "{", "final", "ParagraphElement", "paragraphElement", "=", "new", "Span", "(", "text", ",", "ts", ")", ";", "this", ".", "paragraphElements", ".",...
Create a styled span with a text content @param text the text @param ts the style @return this for fluent style
[ "Create", "a", "styled", "span", "with", "a", "text", "content" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/ParagraphBuilder.java#L183-L187
yshrsmz/KeyboardVisibilityEvent
keyboardvisibilityevent/src/main/java/net/yslibrary/android/keyboardvisibilityevent/util/UIUtil.java
UIUtil.showKeyboard
public static void showKeyboard(Context context, EditText target) { if (context == null || target == null) { return; } InputMethodManager imm = getInputMethodManager(context); imm.showSoftInput(target, InputMethodManager.SHOW_IMPLICIT); }
java
public static void showKeyboard(Context context, EditText target) { if (context == null || target == null) { return; } InputMethodManager imm = getInputMethodManager(context); imm.showSoftInput(target, InputMethodManager.SHOW_IMPLICIT); }
[ "public", "static", "void", "showKeyboard", "(", "Context", "context", ",", "EditText", "target", ")", "{", "if", "(", "context", "==", "null", "||", "target", "==", "null", ")", "{", "return", ";", "}", "InputMethodManager", "imm", "=", "getInputMethodManag...
Show keyboard and focus to given EditText @param context Context @param target EditText to focus
[ "Show", "keyboard", "and", "focus", "to", "given", "EditText" ]
train
https://github.com/yshrsmz/KeyboardVisibilityEvent/blob/fbde29a2c28ff1b2fa44f43cdd1ff3ec1d3321d8/keyboardvisibilityevent/src/main/java/net/yslibrary/android/keyboardvisibilityevent/util/UIUtil.java#L30-L38
thombergs/docx-stamper
src/main/java/org/wickedsource/docxstamper/replace/PlaceholderReplacer.java
PlaceholderReplacer.resolveExpressions
public void resolveExpressions(final WordprocessingMLPackage document, ProxyBuilder<T> proxyBuilder) { try { final T expressionContext = proxyBuilder.build(); CoordinatesWalker walker = new BaseCoordinatesWalker(document) { @Override protected void onParagraph(ParagraphCoordinates paragraphCoordinates) { resolveExpressionsForParagraph(paragraphCoordinates.getParagraph(), expressionContext, document); } }; walker.walk(); } catch (ProxyException e) { throw new DocxStamperException("could not create proxy around context root!", e); } }
java
public void resolveExpressions(final WordprocessingMLPackage document, ProxyBuilder<T> proxyBuilder) { try { final T expressionContext = proxyBuilder.build(); CoordinatesWalker walker = new BaseCoordinatesWalker(document) { @Override protected void onParagraph(ParagraphCoordinates paragraphCoordinates) { resolveExpressionsForParagraph(paragraphCoordinates.getParagraph(), expressionContext, document); } }; walker.walk(); } catch (ProxyException e) { throw new DocxStamperException("could not create proxy around context root!", e); } }
[ "public", "void", "resolveExpressions", "(", "final", "WordprocessingMLPackage", "document", ",", "ProxyBuilder", "<", "T", ">", "proxyBuilder", ")", "{", "try", "{", "final", "T", "expressionContext", "=", "proxyBuilder", ".", "build", "(", ")", ";", "Coordinat...
Finds expressions in a document and resolves them against the specified context object. The expressions in the document are then replaced by the resolved values. @param document the document in which to replace all expressions. @param proxyBuilder builder for a proxy around the context root to customize its interface
[ "Finds", "expressions", "in", "a", "document", "and", "resolves", "them", "against", "the", "specified", "context", "object", ".", "The", "expressions", "in", "the", "document", "are", "then", "replaced", "by", "the", "resolved", "values", "." ]
train
https://github.com/thombergs/docx-stamper/blob/f1a7e3e92a59abaffac299532fe49450c3b041eb/src/main/java/org/wickedsource/docxstamper/replace/PlaceholderReplacer.java#L75-L88
meertensinstituut/mtas
src/main/java/mtas/search/spans/MtasSpanRecurrenceSpans.java
MtasSpanRecurrenceSpans.expandWithIgnoreItem
private List<Match> expandWithIgnoreItem(int docId, Match match) { List<Match> list = new ArrayList<>(); try { Set<Integer> ignoreList = ignoreItem.getFullEndPositionList(docId, match.endPosition); if (ignoreList != null) { for (Integer endPosition : ignoreList) { list.add(new Match(match.startPosition, endPosition)); } } } catch (IOException e) { log.debug(e); } return list; }
java
private List<Match> expandWithIgnoreItem(int docId, Match match) { List<Match> list = new ArrayList<>(); try { Set<Integer> ignoreList = ignoreItem.getFullEndPositionList(docId, match.endPosition); if (ignoreList != null) { for (Integer endPosition : ignoreList) { list.add(new Match(match.startPosition, endPosition)); } } } catch (IOException e) { log.debug(e); } return list; }
[ "private", "List", "<", "Match", ">", "expandWithIgnoreItem", "(", "int", "docId", ",", "Match", "match", ")", "{", "List", "<", "Match", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "try", "{", "Set", "<", "Integer", ">", "ignoreList", ...
Expand with ignore item. @param docId the doc id @param match the match @return the list
[ "Expand", "with", "ignore", "item", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/search/spans/MtasSpanRecurrenceSpans.java#L353-L367
autermann/yaml
src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java
YamlMappingNode.put
public T put(YamlNode key, BigInteger value) { return put(key, getNodeFactory().bigIntegerNode(value)); }
java
public T put(YamlNode key, BigInteger value) { return put(key, getNodeFactory().bigIntegerNode(value)); }
[ "public", "T", "put", "(", "YamlNode", "key", ",", "BigInteger", "value", ")", "{", "return", "put", "(", "key", ",", "getNodeFactory", "(", ")", ".", "bigIntegerNode", "(", "value", ")", ")", ";", "}" ]
Adds the specified {@code key}/{@code value} pair to this mapping. @param key the key @param value the value @return {@code this}
[ "Adds", "the", "specified", "{", "@code", "key", "}", "/", "{", "@code", "value", "}", "pair", "to", "this", "mapping", "." ]
train
https://github.com/autermann/yaml/blob/5f8ab03e4fec3a2abe72c03561cdaa3a3936634d/src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java#L588-L590
yidongnan/grpc-spring-boot-starter
grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/autoconfigure/GrpcClientAutoConfiguration.java
GrpcClientAutoConfiguration.grpcNameResolverFactory
@ConditionalOnMissingBean @Lazy // Not needed for InProcessChannelFactories @Bean public NameResolver.Factory grpcNameResolverFactory(final GrpcChannelsProperties channelProperties) { return new ConfigMappedNameResolverFactory(channelProperties, NameResolverProvider.asFactory(), StaticNameResolverProvider.STATIC_DEFAULT_URI_MAPPER); }
java
@ConditionalOnMissingBean @Lazy // Not needed for InProcessChannelFactories @Bean public NameResolver.Factory grpcNameResolverFactory(final GrpcChannelsProperties channelProperties) { return new ConfigMappedNameResolverFactory(channelProperties, NameResolverProvider.asFactory(), StaticNameResolverProvider.STATIC_DEFAULT_URI_MAPPER); }
[ "@", "ConditionalOnMissingBean", "@", "Lazy", "// Not needed for InProcessChannelFactories", "@", "Bean", "public", "NameResolver", ".", "Factory", "grpcNameResolverFactory", "(", "final", "GrpcChannelsProperties", "channelProperties", ")", "{", "return", "new", "ConfigMapped...
Creates a new name resolver factory with the given channel properties. The properties are used to map the client name to the actual service addresses. If you want to add more name resolver schemes or modify existing ones, you can do that in the following ways: <ul> <li>If you only rely on the client properties or other static beans, then you can simply add an entry to java's service discovery for {@link io.grpc.NameResolverProvider}s.</li> <li>If you need access to other beans, then you have to redefine this bean and use a {@link CompositeNameResolverFactory} as the delegate for the {@link ConfigMappedNameResolverFactory}.</li> </ul> @param channelProperties The properties for the channels. @return The default config mapped name resolver factory.
[ "Creates", "a", "new", "name", "resolver", "factory", "with", "the", "given", "channel", "properties", ".", "The", "properties", "are", "used", "to", "map", "the", "client", "name", "to", "the", "actual", "service", "addresses", ".", "If", "you", "want", "...
train
https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/autoconfigure/GrpcClientAutoConfiguration.java#L125-L131
mfornos/humanize
humanize-slim/src/main/java/humanize/Humanize.java
Humanize.paceFormat
public static String paceFormat(final Number value, final PaceParameters params) { params.checkArguments(); Pace args = pace(value, params.interval); ResourceBundle bundle = context.get().getBundle(); String accuracy = bundle.getString(args.getAccuracy()); String timeUnit = bundle.getString(args.getTimeUnit()); params.exts(accuracy, timeUnit); return capitalize(pluralize(args.getValue(), params.plural)); }
java
public static String paceFormat(final Number value, final PaceParameters params) { params.checkArguments(); Pace args = pace(value, params.interval); ResourceBundle bundle = context.get().getBundle(); String accuracy = bundle.getString(args.getAccuracy()); String timeUnit = bundle.getString(args.getTimeUnit()); params.exts(accuracy, timeUnit); return capitalize(pluralize(args.getValue(), params.plural)); }
[ "public", "static", "String", "paceFormat", "(", "final", "Number", "value", ",", "final", "PaceParameters", "params", ")", "{", "params", ".", "checkArguments", "(", ")", ";", "Pace", "args", "=", "pace", "(", "value", ",", "params", ".", "interval", ")",...
Matches a pace (value and interval) with a logical time frame. Very useful for slow paces. @param value The number of occurrences within the specified interval @param params The pace format parameterization @return an human readable textual representation of the pace
[ "Matches", "a", "pace", "(", "value", "and", "interval", ")", "with", "a", "logical", "time", "frame", ".", "Very", "useful", "for", "slow", "paces", "." ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L2093-L2107
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.updateSecretAsync
public ServiceFuture<SecretBundle> updateSecretAsync(String vaultBaseUrl, String secretName, String secretVersion, final ServiceCallback<SecretBundle> serviceCallback) { return ServiceFuture.fromResponse(updateSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion), serviceCallback); }
java
public ServiceFuture<SecretBundle> updateSecretAsync(String vaultBaseUrl, String secretName, String secretVersion, final ServiceCallback<SecretBundle> serviceCallback) { return ServiceFuture.fromResponse(updateSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion), serviceCallback); }
[ "public", "ServiceFuture", "<", "SecretBundle", ">", "updateSecretAsync", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ",", "String", "secretVersion", ",", "final", "ServiceCallback", "<", "SecretBundle", ">", "serviceCallback", ")", "{", "return", "S...
Updates the attributes associated with a specified secret in a given key vault. The UPDATE operation changes specified attributes of an existing stored secret. Attributes that are not specified in the request are left unchanged. The value of a secret itself cannot be changed. This operation requires the secrets/set permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @param secretVersion The version of the secret. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Updates", "the", "attributes", "associated", "with", "a", "specified", "secret", "in", "a", "given", "key", "vault", ".", "The", "UPDATE", "operation", "changes", "specified", "attributes", "of", "an", "existing", "stored", "secret", ".", "Attributes", "that", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3635-L3637
Whiley/WhileyCompiler
src/main/java/wyil/transform/VerificationConditionGenerator.java
VerificationConditionGenerator.translateAssert
private Context translateAssert(WyilFile.Stmt.Assert stmt, Context context) { Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, context); Expr condition = p.first(); context = p.second(); // VerificationCondition verificationCondition = new VerificationCondition("assertion failed", context.assumptions, condition, stmt.getCondition().getParent(WyilFile.Attribute.Span.class)); context.emit(verificationCondition); // return context.assume(condition); }
java
private Context translateAssert(WyilFile.Stmt.Assert stmt, Context context) { Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, context); Expr condition = p.first(); context = p.second(); // VerificationCondition verificationCondition = new VerificationCondition("assertion failed", context.assumptions, condition, stmt.getCondition().getParent(WyilFile.Attribute.Span.class)); context.emit(verificationCondition); // return context.assume(condition); }
[ "private", "Context", "translateAssert", "(", "WyilFile", ".", "Stmt", ".", "Assert", "stmt", ",", "Context", "context", ")", "{", "Pair", "<", "Expr", ",", "Context", ">", "p", "=", "translateExpressionWithChecks", "(", "stmt", ".", "getCondition", "(", ")"...
Translate an assert statement. This emits a verification condition which ensures the assert condition holds, given the current context. @param stmt @param wyalFile
[ "Translate", "an", "assert", "statement", ".", "This", "emits", "a", "verification", "condition", "which", "ensures", "the", "assert", "condition", "holds", "given", "the", "current", "context", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L474-L484
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java
NumberUtil.partValue
public static int partValue(int total, int partCount, boolean isPlusOneWhenHasRem) { int partValue = 0; if (total % partCount == 0) { partValue = total / partCount; } else { partValue = (int) Math.floor(total / partCount); if (isPlusOneWhenHasRem) { partValue += 1; } } return partValue; }
java
public static int partValue(int total, int partCount, boolean isPlusOneWhenHasRem) { int partValue = 0; if (total % partCount == 0) { partValue = total / partCount; } else { partValue = (int) Math.floor(total / partCount); if (isPlusOneWhenHasRem) { partValue += 1; } } return partValue; }
[ "public", "static", "int", "partValue", "(", "int", "total", ",", "int", "partCount", ",", "boolean", "isPlusOneWhenHasRem", ")", "{", "int", "partValue", "=", "0", ";", "if", "(", "total", "%", "partCount", "==", "0", ")", "{", "partValue", "=", "total"...
把给定的总数平均分成N份,返回每份的个数<br> 如果isPlusOneWhenHasRem为true,则当除以分数有余数时每份+1,否则丢弃余数部分 @param total 总数 @param partCount 份数 @param isPlusOneWhenHasRem 在有余数时是否每份+1 @return 每份的个数 @since 4.0.7
[ "把给定的总数平均分成N份,返回每份的个数<br", ">", "如果isPlusOneWhenHasRem为true,则当除以分数有余数时每份", "+", "1,否则丢弃余数部分" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L2072-L2083
tvesalainen/util
util/src/main/java/org/vesalainen/util/CmdArgs.java
CmdArgs.addOption
public final <T> void addOption(Class<T> cls, String name, String description) { addOption(cls, name, description, null); }
java
public final <T> void addOption(Class<T> cls, String name, String description) { addOption(cls, name, description, null); }
[ "public", "final", "<", "T", ">", "void", "addOption", "(", "Class", "<", "T", ">", "cls", ",", "String", "name", ",", "String", "description", ")", "{", "addOption", "(", "cls", ",", "name", ",", "description", ",", "null", ")", ";", "}" ]
Add a mandatory option @param <T> Type of option @param cls Option type class @param name Option name Option name without @param description Option description
[ "Add", "a", "mandatory", "option" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CmdArgs.java#L331-L334
graknlabs/grakn
server/src/server/exception/TransactionException.java
TransactionException.illegalUnhasWithInstance
public static TransactionException illegalUnhasWithInstance(String type, String attributeType, boolean isKey) { return create(ErrorMessage.ILLEGAL_TYPE_UNHAS_ATTRIBUTE_WITH_INSTANCE.getMessage(type, isKey ? "key" : "has", attributeType)); }
java
public static TransactionException illegalUnhasWithInstance(String type, String attributeType, boolean isKey) { return create(ErrorMessage.ILLEGAL_TYPE_UNHAS_ATTRIBUTE_WITH_INSTANCE.getMessage(type, isKey ? "key" : "has", attributeType)); }
[ "public", "static", "TransactionException", "illegalUnhasWithInstance", "(", "String", "type", ",", "String", "attributeType", ",", "boolean", "isKey", ")", "{", "return", "create", "(", "ErrorMessage", ".", "ILLEGAL_TYPE_UNHAS_ATTRIBUTE_WITH_INSTANCE", ".", "getMessage",...
Thrown when there exists and instance of {@code type} HAS {@code attributeType} upon unlinking the AttributeType from the Type
[ "Thrown", "when", "there", "exists", "and", "instance", "of", "{" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L122-L124
elki-project/elki
elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/VectorUtil.java
VectorUtil.angleSparseDense
public static double angleSparseDense(SparseNumberVector v1, NumberVector v2) { // TODO: exploit precomputed length, when available. final int dim2 = v2.getDimensionality(); double l1 = 0., l2 = 0., cross = 0.; int i1 = v1.iter(), d2 = 0; while(v1.iterValid(i1)) { final int d1 = v1.iterDim(i1); while(d2 < d1 && d2 < dim2) { final double val = v2.doubleValue(d2); l2 += val * val; ++d2; } if(d2 < dim2) { assert (d1 == d2) : "Dimensions not ordered"; final double val1 = v1.iterDoubleValue(i1); final double val2 = v2.doubleValue(d2); l1 += val1 * val1; l2 += val2 * val2; cross += val1 * val2; i1 = v1.iterAdvance(i1); ++d2; } else { final double val = v1.iterDoubleValue(i1); l1 += val * val; i1 = v1.iterAdvance(i1); } } while(d2 < dim2) { final double val = v2.doubleValue(d2); l2 += val * val; ++d2; } final double a = (cross == 0.) ? 0. : // (l1 == 0. || l2 == 0.) ? 1. : // FastMath.sqrt((cross / l1) * (cross / l2)); return (a < 1.) ? a : 1.; }
java
public static double angleSparseDense(SparseNumberVector v1, NumberVector v2) { // TODO: exploit precomputed length, when available. final int dim2 = v2.getDimensionality(); double l1 = 0., l2 = 0., cross = 0.; int i1 = v1.iter(), d2 = 0; while(v1.iterValid(i1)) { final int d1 = v1.iterDim(i1); while(d2 < d1 && d2 < dim2) { final double val = v2.doubleValue(d2); l2 += val * val; ++d2; } if(d2 < dim2) { assert (d1 == d2) : "Dimensions not ordered"; final double val1 = v1.iterDoubleValue(i1); final double val2 = v2.doubleValue(d2); l1 += val1 * val1; l2 += val2 * val2; cross += val1 * val2; i1 = v1.iterAdvance(i1); ++d2; } else { final double val = v1.iterDoubleValue(i1); l1 += val * val; i1 = v1.iterAdvance(i1); } } while(d2 < dim2) { final double val = v2.doubleValue(d2); l2 += val * val; ++d2; } final double a = (cross == 0.) ? 0. : // (l1 == 0. || l2 == 0.) ? 1. : // FastMath.sqrt((cross / l1) * (cross / l2)); return (a < 1.) ? a : 1.; }
[ "public", "static", "double", "angleSparseDense", "(", "SparseNumberVector", "v1", ",", "NumberVector", "v2", ")", "{", "// TODO: exploit precomputed length, when available.", "final", "int", "dim2", "=", "v2", ".", "getDimensionality", "(", ")", ";", "double", "l1", ...
Compute the angle for a sparse and a dense vector. @param v1 Sparse first vector @param v2 Dense second vector @return angle
[ "Compute", "the", "angle", "for", "a", "sparse", "and", "a", "dense", "vector", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/VectorUtil.java#L179-L216
grpc/grpc-java
netty/src/main/java/io/grpc/netty/GrpcSslContexts.java
GrpcSslContexts.configure
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1784") @CanIgnoreReturnValue public static SslContextBuilder configure(SslContextBuilder builder, SslProvider provider) { switch (provider) { case JDK: { Provider jdkProvider = findJdkProvider(); if (jdkProvider == null) { throw new IllegalArgumentException( "Could not find Jetty NPN/ALPN or Conscrypt as installed JDK providers"); } return configure(builder, jdkProvider); } case OPENSSL: { ApplicationProtocolConfig apc; if (OpenSsl.isAlpnSupported()) { apc = NPN_AND_ALPN; } else { apc = NPN; } return builder .sslProvider(SslProvider.OPENSSL) .ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE) .applicationProtocolConfig(apc); } default: throw new IllegalArgumentException("Unsupported provider: " + provider); } }
java
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1784") @CanIgnoreReturnValue public static SslContextBuilder configure(SslContextBuilder builder, SslProvider provider) { switch (provider) { case JDK: { Provider jdkProvider = findJdkProvider(); if (jdkProvider == null) { throw new IllegalArgumentException( "Could not find Jetty NPN/ALPN or Conscrypt as installed JDK providers"); } return configure(builder, jdkProvider); } case OPENSSL: { ApplicationProtocolConfig apc; if (OpenSsl.isAlpnSupported()) { apc = NPN_AND_ALPN; } else { apc = NPN; } return builder .sslProvider(SslProvider.OPENSSL) .ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE) .applicationProtocolConfig(apc); } default: throw new IllegalArgumentException("Unsupported provider: " + provider); } }
[ "@", "ExperimentalApi", "(", "\"https://github.com/grpc/grpc-java/issues/1784\"", ")", "@", "CanIgnoreReturnValue", "public", "static", "SslContextBuilder", "configure", "(", "SslContextBuilder", "builder", ",", "SslProvider", "provider", ")", "{", "switch", "(", "provider"...
Set ciphers and APN appropriate for gRPC. Precisely what is set is permitted to change, so if an application requires particular settings it should override the options set here.
[ "Set", "ciphers", "and", "APN", "appropriate", "for", "gRPC", ".", "Precisely", "what", "is", "set", "is", "permitted", "to", "change", "so", "if", "an", "application", "requires", "particular", "settings", "it", "should", "override", "the", "options", "set", ...
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/GrpcSslContexts.java#L178-L207
ZieIony/Carbon
carbon/src/main/java/carbon/drawable/ripple/LollipopDrawablesCompat.java
LollipopDrawablesCompat.applyTheme
public static void applyTheme(Drawable d, Resources.Theme t) { IMPL.applyTheme(d, t); }
java
public static void applyTheme(Drawable d, Resources.Theme t) { IMPL.applyTheme(d, t); }
[ "public", "static", "void", "applyTheme", "(", "Drawable", "d", ",", "Resources", ".", "Theme", "t", ")", "{", "IMPL", ".", "applyTheme", "(", "d", ",", "t", ")", ";", "}" ]
Applies the specified theme to this Drawable and its children.
[ "Applies", "the", "specified", "theme", "to", "this", "Drawable", "and", "its", "children", "." ]
train
https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/LollipopDrawablesCompat.java#L62-L64
alkacon/opencms-core
src/org/opencms/ui/components/CmsBasicDialog.java
CmsBasicDialog.createResourceListPanel
protected Panel createResourceListPanel(String caption, List<CmsResource> resources) { Panel result = null; if (CmsStringUtil.isEmptyOrWhitespaceOnly(caption)) { result = new Panel(); } else { result = new Panel(caption); } result.addStyleName("v-scrollable"); result.setSizeFull(); VerticalLayout resourcePanel = new VerticalLayout(); result.setContent(resourcePanel); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_MARGIN); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_SPACING); resourcePanel.setSpacing(true); resourcePanel.setMargin(true); for (CmsResource resource : resources) { resourcePanel.addComponent(new CmsResourceInfo(resource)); } return result; }
java
protected Panel createResourceListPanel(String caption, List<CmsResource> resources) { Panel result = null; if (CmsStringUtil.isEmptyOrWhitespaceOnly(caption)) { result = new Panel(); } else { result = new Panel(caption); } result.addStyleName("v-scrollable"); result.setSizeFull(); VerticalLayout resourcePanel = new VerticalLayout(); result.setContent(resourcePanel); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_MARGIN); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_SPACING); resourcePanel.setSpacing(true); resourcePanel.setMargin(true); for (CmsResource resource : resources) { resourcePanel.addComponent(new CmsResourceInfo(resource)); } return result; }
[ "protected", "Panel", "createResourceListPanel", "(", "String", "caption", ",", "List", "<", "CmsResource", ">", "resources", ")", "{", "Panel", "result", "=", "null", ";", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "caption", ")", ")", "...
Creates a resource list panel.<p> @param caption the caption to use @param resources the resources @return the panel
[ "Creates", "a", "resource", "list", "panel", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsBasicDialog.java#L514-L534
thorntail/thorntail
thorntail-runner/src/main/java/org/wildfly/swarm/runner/FatJarBuilder.java
FatJarBuilder.buildWar
private File buildWar(List<ArtifactOrFile> classPathEntries) { try { List<String> classesUrls = classPathEntries.stream() .map(ArtifactOrFile::file) .filter(this::isDirectory) .filter(url -> url.contains("classes")) .collect(Collectors.toList()); List<File> classpathJars = classPathEntries.stream() .map(ArtifactOrFile::file) .filter(file -> file.endsWith(".jar")) .map(File::new) .collect(Collectors.toList()); return WarBuilder.build(classesUrls, classpathJars); } catch (IOException e) { throw new RuntimeException("failed to build war", e); } }
java
private File buildWar(List<ArtifactOrFile> classPathEntries) { try { List<String> classesUrls = classPathEntries.stream() .map(ArtifactOrFile::file) .filter(this::isDirectory) .filter(url -> url.contains("classes")) .collect(Collectors.toList()); List<File> classpathJars = classPathEntries.stream() .map(ArtifactOrFile::file) .filter(file -> file.endsWith(".jar")) .map(File::new) .collect(Collectors.toList()); return WarBuilder.build(classesUrls, classpathJars); } catch (IOException e) { throw new RuntimeException("failed to build war", e); } }
[ "private", "File", "buildWar", "(", "List", "<", "ArtifactOrFile", ">", "classPathEntries", ")", "{", "try", "{", "List", "<", "String", ">", "classesUrls", "=", "classPathEntries", ".", "stream", "(", ")", ".", "map", "(", "ArtifactOrFile", "::", "file", ...
builds war with classes inside @param classPathEntries class path entries as ArtifactSpec or URLs @return the war file
[ "builds", "war", "with", "classes", "inside" ]
train
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/thorntail-runner/src/main/java/org/wildfly/swarm/runner/FatJarBuilder.java#L151-L169
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/randomizers/range/SqlDateRangeRandomizer.java
SqlDateRangeRandomizer.aNewSqlDateRangeRandomizer
public static SqlDateRangeRandomizer aNewSqlDateRangeRandomizer(final Date min, final Date max, final long seed) { return new SqlDateRangeRandomizer(min, max, seed); }
java
public static SqlDateRangeRandomizer aNewSqlDateRangeRandomizer(final Date min, final Date max, final long seed) { return new SqlDateRangeRandomizer(min, max, seed); }
[ "public", "static", "SqlDateRangeRandomizer", "aNewSqlDateRangeRandomizer", "(", "final", "Date", "min", ",", "final", "Date", "max", ",", "final", "long", "seed", ")", "{", "return", "new", "SqlDateRangeRandomizer", "(", "min", ",", "max", ",", "seed", ")", "...
Create a new {@link SqlDateRangeRandomizer}. @param min min value @param max max value @param seed initial seed @return a new {@link SqlDateRangeRandomizer}.
[ "Create", "a", "new", "{", "@link", "SqlDateRangeRandomizer", "}", "." ]
train
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/range/SqlDateRangeRandomizer.java#L75-L77
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/ConnectedStreams.java
ConnectedStreams.flatMap
public <R> SingleOutputStreamOperator<R> flatMap( CoFlatMapFunction<IN1, IN2, R> coFlatMapper) { TypeInformation<R> outTypeInfo = TypeExtractor.getBinaryOperatorReturnType( coFlatMapper, CoFlatMapFunction.class, 0, 1, 2, TypeExtractor.NO_INDEX, getType1(), getType2(), Utils.getCallLocationName(), true); return transform("Co-Flat Map", outTypeInfo, new CoStreamFlatMap<>(inputStream1.clean(coFlatMapper))); }
java
public <R> SingleOutputStreamOperator<R> flatMap( CoFlatMapFunction<IN1, IN2, R> coFlatMapper) { TypeInformation<R> outTypeInfo = TypeExtractor.getBinaryOperatorReturnType( coFlatMapper, CoFlatMapFunction.class, 0, 1, 2, TypeExtractor.NO_INDEX, getType1(), getType2(), Utils.getCallLocationName(), true); return transform("Co-Flat Map", outTypeInfo, new CoStreamFlatMap<>(inputStream1.clean(coFlatMapper))); }
[ "public", "<", "R", ">", "SingleOutputStreamOperator", "<", "R", ">", "flatMap", "(", "CoFlatMapFunction", "<", "IN1", ",", "IN2", ",", "R", ">", "coFlatMapper", ")", "{", "TypeInformation", "<", "R", ">", "outTypeInfo", "=", "TypeExtractor", ".", "getBinary...
Applies a CoFlatMap transformation on a {@link ConnectedStreams} and maps the output to a common type. The transformation calls a {@link CoFlatMapFunction#flatMap1} for each element of the first input and {@link CoFlatMapFunction#flatMap2} for each element of the second input. Each CoFlatMapFunction call returns any number of elements including none. @param coFlatMapper The CoFlatMapFunction used to jointly transform the two input DataStreams @return The transformed {@link DataStream}
[ "Applies", "a", "CoFlatMap", "transformation", "on", "a", "{", "@link", "ConnectedStreams", "}", "and", "maps", "the", "output", "to", "a", "common", "type", ".", "The", "transformation", "calls", "a", "{", "@link", "CoFlatMapFunction#flatMap1", "}", "for", "e...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/ConnectedStreams.java#L257-L273
lotaris/rox-commons-maven-plugin
src/main/java/org/twdata/maven/mojoexecutor/MojoExecutor.java
MojoExecutor.executeMojo
public static void executeMojo(Plugin plugin, String goal, Xpp3Dom configuration, ExecutionEnvironment env) throws MojoExecutionException { if (configuration == null) { throw new NullPointerException("configuration may not be null"); } try { String executionId = null; if (goal != null && goal.length() > 0 && goal.indexOf('#') > -1) { int pos = goal.indexOf('#'); executionId = goal.substring(pos + 1); goal = goal.substring(0, pos); } MavenSession session = env.getMavenSession(); PluginDescriptor pluginDescriptor = env.getPluginManager().loadPlugin( plugin, env.getMavenProject().getRemotePluginRepositories(), session.getRepositorySession()); MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo(goal); if (mojoDescriptor == null) { throw new MojoExecutionException("Could not find goal '" + goal + "' in plugin " + plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion()); } MojoExecution exec = mojoExecution(mojoDescriptor, executionId, configuration); env.getPluginManager().executeMojo(session, exec); } catch (PluginNotFoundException | PluginResolutionException | PluginDescriptorParsingException | InvalidPluginDescriptorException | MojoExecutionException | MojoFailureException | PluginConfigurationException | PluginManagerException e) { throw new MojoExecutionException("Unable to execute mojo", e); } }
java
public static void executeMojo(Plugin plugin, String goal, Xpp3Dom configuration, ExecutionEnvironment env) throws MojoExecutionException { if (configuration == null) { throw new NullPointerException("configuration may not be null"); } try { String executionId = null; if (goal != null && goal.length() > 0 && goal.indexOf('#') > -1) { int pos = goal.indexOf('#'); executionId = goal.substring(pos + 1); goal = goal.substring(0, pos); } MavenSession session = env.getMavenSession(); PluginDescriptor pluginDescriptor = env.getPluginManager().loadPlugin( plugin, env.getMavenProject().getRemotePluginRepositories(), session.getRepositorySession()); MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo(goal); if (mojoDescriptor == null) { throw new MojoExecutionException("Could not find goal '" + goal + "' in plugin " + plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion()); } MojoExecution exec = mojoExecution(mojoDescriptor, executionId, configuration); env.getPluginManager().executeMojo(session, exec); } catch (PluginNotFoundException | PluginResolutionException | PluginDescriptorParsingException | InvalidPluginDescriptorException | MojoExecutionException | MojoFailureException | PluginConfigurationException | PluginManagerException e) { throw new MojoExecutionException("Unable to execute mojo", e); } }
[ "public", "static", "void", "executeMojo", "(", "Plugin", "plugin", ",", "String", "goal", ",", "Xpp3Dom", "configuration", ",", "ExecutionEnvironment", "env", ")", "throws", "MojoExecutionException", "{", "if", "(", "configuration", "==", "null", ")", "{", "thr...
Entry point for executing a mojo @param plugin The plugin to execute @param goal The goal to execute @param configuration The execution configuration @param env The execution environment @throws MojoExecutionException If there are any exceptions locating or executing the mojo
[ "Entry", "point", "for", "executing", "a", "mojo" ]
train
https://github.com/lotaris/rox-commons-maven-plugin/blob/e2602d7f1e8c2e6994c0df07cc0003828adfa2af/src/main/java/org/twdata/maven/mojoexecutor/MojoExecutor.java#L73-L112
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/MapOutputFile.java
MapOutputFile.getInputFile
public Path getInputFile(int mapId, TaskAttemptID reduceTaskId) throws IOException { // TODO *oom* should use a format here return lDirAlloc.getLocalPathToRead(TaskTracker.getIntermediateOutputDir( jobId.toString(), reduceTaskId.toString()) + "/map_" + mapId + ".out", conf); }
java
public Path getInputFile(int mapId, TaskAttemptID reduceTaskId) throws IOException { // TODO *oom* should use a format here return lDirAlloc.getLocalPathToRead(TaskTracker.getIntermediateOutputDir( jobId.toString(), reduceTaskId.toString()) + "/map_" + mapId + ".out", conf); }
[ "public", "Path", "getInputFile", "(", "int", "mapId", ",", "TaskAttemptID", "reduceTaskId", ")", "throws", "IOException", "{", "// TODO *oom* should use a format here", "return", "lDirAlloc", ".", "getLocalPathToRead", "(", "TaskTracker", ".", "getIntermediateOutputDir", ...
Return a local reduce input file created earlier @param mapTaskId a map task id @param reduceTaskId a reduce task id
[ "Return", "a", "local", "reduce", "input", "file", "created", "earlier" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/MapOutputFile.java#L154-L161
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/MethodUtils.java
MethodUtils.invokeSetter
public static void invokeSetter(Object object, String setterName, Object[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { int index = setterName.indexOf('.'); if (index > 0) { String getterName = setterName.substring(0, index); Object o = invokeGetter(object, getterName); invokeSetter(o, setterName.substring(index + 1), args); } else { if (!setterName.startsWith("set")) { setterName = "set" + setterName.substring(0, 1).toUpperCase(Locale.US) + setterName.substring(1); } invokeMethod(object, setterName, args); } }
java
public static void invokeSetter(Object object, String setterName, Object[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { int index = setterName.indexOf('.'); if (index > 0) { String getterName = setterName.substring(0, index); Object o = invokeGetter(object, getterName); invokeSetter(o, setterName.substring(index + 1), args); } else { if (!setterName.startsWith("set")) { setterName = "set" + setterName.substring(0, 1).toUpperCase(Locale.US) + setterName.substring(1); } invokeMethod(object, setterName, args); } }
[ "public", "static", "void", "invokeSetter", "(", "Object", "object", ",", "String", "setterName", ",", "Object", "[", "]", "args", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "int", "index", "=", "s...
Sets the value of a bean property to an Object. @param object the bean to change @param setterName the property name or setter method name @param args use this arguments @throws NoSuchMethodException the no such method exception @throws IllegalAccessException the illegal access exception @throws InvocationTargetException the invocation target exception
[ "Sets", "the", "value", "of", "a", "bean", "property", "to", "an", "Object", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MethodUtils.java#L69-L82