repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/Step.java
Step.selectCheckbox
protected void selectCheckbox(PageElement element, boolean checked, Object... args) throws TechnicalException, FailureException { try { final WebElement webElement = Context.waitUntil(ExpectedConditions.elementToBeClickable(Utilities.getLocator(element, args))); if (webElement.isSelected() != checked) { webElement.click(); } } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_CHECK_ELEMENT), element, element.getPage().getApplication()), true, element.getPage().getCallBack()); } }
java
protected void selectCheckbox(PageElement element, boolean checked, Object... args) throws TechnicalException, FailureException { try { final WebElement webElement = Context.waitUntil(ExpectedConditions.elementToBeClickable(Utilities.getLocator(element, args))); if (webElement.isSelected() != checked) { webElement.click(); } } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_CHECK_ELEMENT), element, element.getPage().getApplication()), true, element.getPage().getCallBack()); } }
[ "protected", "void", "selectCheckbox", "(", "PageElement", "element", ",", "boolean", "checked", ",", "Object", "...", "args", ")", "throws", "TechnicalException", ",", "FailureException", "{", "try", "{", "final", "WebElement", "webElement", "=", "Context", ".", ...
Checks a checkbox type element. @param element Target page element @param checked Final checkbox value @param args list of arguments to format the found selector with @throws TechnicalException is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi. Failure with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_CHECK_ELEMENT} message (with screenshot) @throws FailureException if the scenario encounters a functional error
[ "Checks", "a", "checkbox", "type", "element", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L712-L722
Azure/azure-sdk-for-java
privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/PrivateZonesInner.java
PrivateZonesInner.beginUpdateAsync
public Observable<PrivateZoneInner> beginUpdateAsync(String resourceGroupName, String privateZoneName, PrivateZoneInner parameters, String ifMatch) { return beginUpdateWithServiceResponseAsync(resourceGroupName, privateZoneName, parameters, ifMatch).map(new Func1<ServiceResponse<PrivateZoneInner>, PrivateZoneInner>() { @Override public PrivateZoneInner call(ServiceResponse<PrivateZoneInner> response) { return response.body(); } }); }
java
public Observable<PrivateZoneInner> beginUpdateAsync(String resourceGroupName, String privateZoneName, PrivateZoneInner parameters, String ifMatch) { return beginUpdateWithServiceResponseAsync(resourceGroupName, privateZoneName, parameters, ifMatch).map(new Func1<ServiceResponse<PrivateZoneInner>, PrivateZoneInner>() { @Override public PrivateZoneInner call(ServiceResponse<PrivateZoneInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PrivateZoneInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "privateZoneName", ",", "PrivateZoneInner", "parameters", ",", "String", "ifMatch", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(",...
Updates a Private DNS zone. Does not modify virtual network links or DNS records within the zone. @param resourceGroupName The name of the resource group. @param privateZoneName The name of the Private DNS zone (without a terminating dot). @param parameters Parameters supplied to the Update operation. @param ifMatch The ETag of the Private DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PrivateZoneInner object
[ "Updates", "a", "Private", "DNS", "zone", ".", "Does", "not", "modify", "virtual", "network", "links", "or", "DNS", "records", "within", "the", "zone", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/PrivateZonesInner.java#L757-L764
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/AjaxProxyTask.java
AjaxProxyTask.doProcess
public void doProcess(BasicServlet servlet, HttpServletRequest req, HttpServletResponse res, PrintWriter out) throws ServletException, IOException { super.doProcess(servlet, req, res, out); }
java
public void doProcess(BasicServlet servlet, HttpServletRequest req, HttpServletResponse res, PrintWriter out) throws ServletException, IOException { super.doProcess(servlet, req, res, out); }
[ "public", "void", "doProcess", "(", "BasicServlet", "servlet", ",", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ",", "PrintWriter", "out", ")", "throws", "ServletException", ",", "IOException", "{", "super", ".", "doProcess", "(", "servlet", ",...
Process an HTML get or post. @exception ServletException From inherited class. @exception IOException From inherited class.
[ "Process", "an", "HTML", "get", "or", "post", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/AjaxProxyTask.java#L297-L301
fuzzylite/jfuzzylite
jfuzzylite/src/main/java/com/fuzzylite/Op.java
Op.isEq
public static boolean isEq(double a, double b) { return a == b || Math.abs(a - b) < FuzzyLite.macheps || (Double.isNaN(a) && Double.isNaN(b)); }
java
public static boolean isEq(double a, double b) { return a == b || Math.abs(a - b) < FuzzyLite.macheps || (Double.isNaN(a) && Double.isNaN(b)); }
[ "public", "static", "boolean", "isEq", "(", "double", "a", ",", "double", "b", ")", "{", "return", "a", "==", "b", "||", "Math", ".", "abs", "(", "a", "-", "b", ")", "<", "FuzzyLite", ".", "macheps", "||", "(", "Double", ".", "isNaN", "(", "a", ...
Returns whether `a` is equal to `b` at the default tolerance @param a @param b @return whether `a` is equal to `b` at the default tolerance
[ "Returns", "whether", "a", "is", "equal", "to", "b", "at", "the", "default", "tolerance" ]
train
https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/Op.java#L146-L148
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/parsers/URLParser.java
URLParser.joinURL
public static String joinURL(Map<URLParts, String> urlParts) { try { URI uri = new URI(urlParts.get(URLParts.PROTOCOL), urlParts.get(URLParts.AUTHORITY), urlParts.get(URLParts.PATH), urlParts.get(URLParts.QUERY), urlParts.get(URLParts.REF)); return uri.toString(); } catch (URISyntaxException ex) { throw new RuntimeException(ex); } }
java
public static String joinURL(Map<URLParts, String> urlParts) { try { URI uri = new URI(urlParts.get(URLParts.PROTOCOL), urlParts.get(URLParts.AUTHORITY), urlParts.get(URLParts.PATH), urlParts.get(URLParts.QUERY), urlParts.get(URLParts.REF)); return uri.toString(); } catch (URISyntaxException ex) { throw new RuntimeException(ex); } }
[ "public", "static", "String", "joinURL", "(", "Map", "<", "URLParts", ",", "String", ">", "urlParts", ")", "{", "try", "{", "URI", "uri", "=", "new", "URI", "(", "urlParts", ".", "get", "(", "URLParts", ".", "PROTOCOL", ")", ",", "urlParts", ".", "ge...
This method can be used to build a URL from its parts. @param urlParts @return
[ "This", "method", "can", "be", "used", "to", "build", "a", "URL", "from", "its", "parts", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/parsers/URLParser.java#L205-L213
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageFactoryImpl.java
JsMessageFactoryImpl.getClassName
private final static String getClassName(byte[] buffer, int offset, int length) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getClassName", new Object[]{offset, length}); // If the classname has a length of 0 then we've been given rubbish so pack it in now if (length == 0) { throw new IllegalArgumentException("Invalid buffer: classname length = 0"); } // The classname should be in UTF8, if that fails FFDC and default in the hope of carrying on. String className; try { className = new String(buffer, offset, length, "UTF8"); // the class name itself } catch (UnsupportedEncodingException e) { FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsMessageFactoryImpl.getClassName", "644"); className = new String(buffer, offset, length); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getClassName", className); return className; }
java
private final static String getClassName(byte[] buffer, int offset, int length) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getClassName", new Object[]{offset, length}); // If the classname has a length of 0 then we've been given rubbish so pack it in now if (length == 0) { throw new IllegalArgumentException("Invalid buffer: classname length = 0"); } // The classname should be in UTF8, if that fails FFDC and default in the hope of carrying on. String className; try { className = new String(buffer, offset, length, "UTF8"); // the class name itself } catch (UnsupportedEncodingException e) { FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsMessageFactoryImpl.getClassName", "644"); className = new String(buffer, offset, length); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getClassName", className); return className; }
[ "private", "final", "static", "String", "getClassName", "(", "byte", "[", "]", "buffer", ",", "int", "offset", ",", "int", "length", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ...
Extract the class name from the buffer containing the (first part of) a restored value. @param buffer The buffer @param offset The offset of the classname's encoded bytes in the buffer @param length The length of the classname's encoded bytes @return String The class name of the message to restore @exception This method will throw runtime exceptions if the length is 0, the buffer isn't long enough, etc etc etc. The caller will catch and FFDC it, as the data to be FFDC depends on the caller.
[ "Extract", "the", "class", "name", "from", "the", "buffer", "containing", "the", "(", "first", "part", "of", ")", "a", "restored", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageFactoryImpl.java#L528-L548
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/util/RestUtils.java
RestUtils.checkStatus
public static void checkStatus(CloseableHttpResponse httpResponse, final int httpStatus) throws SDKException { if (httpResponse.getStatusLine().getStatusCode() != httpStatus) { log.error( "Status expected: " + httpStatus + " obtained: " + httpResponse.getStatusLine().getStatusCode()); log.error("httpresponse: " + httpResponse.toString()); String body; try { body = EntityUtils.toString(httpResponse.getEntity()); } catch (IOException e) { e.printStackTrace(); throw new SDKException( "Status is " + httpResponse.getStatusLine().getStatusCode(), new StackTraceElement[0], "could not provide reason because: " + e.getMessage()); } log.error("Body: " + body); throw new SDKException( "Status is " + httpResponse.getStatusLine().getStatusCode(), new StackTraceElement[0], body); } }
java
public static void checkStatus(CloseableHttpResponse httpResponse, final int httpStatus) throws SDKException { if (httpResponse.getStatusLine().getStatusCode() != httpStatus) { log.error( "Status expected: " + httpStatus + " obtained: " + httpResponse.getStatusLine().getStatusCode()); log.error("httpresponse: " + httpResponse.toString()); String body; try { body = EntityUtils.toString(httpResponse.getEntity()); } catch (IOException e) { e.printStackTrace(); throw new SDKException( "Status is " + httpResponse.getStatusLine().getStatusCode(), new StackTraceElement[0], "could not provide reason because: " + e.getMessage()); } log.error("Body: " + body); throw new SDKException( "Status is " + httpResponse.getStatusLine().getStatusCode(), new StackTraceElement[0], body); } }
[ "public", "static", "void", "checkStatus", "(", "CloseableHttpResponse", "httpResponse", ",", "final", "int", "httpStatus", ")", "throws", "SDKException", "{", "if", "(", "httpResponse", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", "!=", "http...
Check whether a json repsonse has the right http status. If not, an SDKException is thrown. @param httpResponse the http response @param httpStatus the (desired) http status of the repsonse @throws SDKException if the request fails
[ "Check", "whether", "a", "json", "repsonse", "has", "the", "right", "http", "status", ".", "If", "not", "an", "SDKException", "is", "thrown", "." ]
train
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/RestUtils.java#L20-L46
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/RuntimeContainerProperties.java
RuntimeContainerProperties.getProperty
public static String getProperty(String key, String defaultValue) { String env = System.getenv(key); if (env != null && !"".equals(env)) { return env; } return System.getProperty(key, defaultValue); }
java
public static String getProperty(String key, String defaultValue) { String env = System.getenv(key); if (env != null && !"".equals(env)) { return env; } return System.getProperty(key, defaultValue); }
[ "public", "static", "String", "getProperty", "(", "String", "key", ",", "String", "defaultValue", ")", "{", "String", "env", "=", "System", ".", "getenv", "(", "key", ")", ";", "if", "(", "env", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "e...
Lookup property from ({@link System#getenv(String)} and {@link System#getProperty(String)} as fallback. @param key the property key @param defaultValue the default value @return the property value.
[ "Lookup", "property", "from", "(", "{", "@link", "System#getenv", "(", "String", ")", "}", "and", "{", "@link", "System#getProperty", "(", "String", ")", "}", "as", "fallback", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/RuntimeContainerProperties.java#L54-L60
dihedron/dihedron-commons
src/main/java/org/dihedron/patterns/activities/engine/ParallelEngine.java
ParallelEngine.setWaitMode
public ParallelEngine setWaitMode(WaitMode mode, long timeout, TimeUnit unit) { this.mode = mode; this.timeout = timeout; this.unit = unit; return this; }
java
public ParallelEngine setWaitMode(WaitMode mode, long timeout, TimeUnit unit) { this.mode = mode; this.timeout = timeout; this.unit = unit; return this; }
[ "public", "ParallelEngine", "setWaitMode", "(", "WaitMode", "mode", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "{", "this", ".", "mode", "=", "mode", ";", "this", ".", "timeout", "=", "timeout", ";", "this", ".", "unit", "=", "unit", ";", "r...
Sets the wait mode, the number of units and their scale before the wait for the background activities times out. @param mode the wait mode: whether it should wait for all background activities to complete or it will exit as soon as one of them is complete. @param timeout the number of time units (milliseconds, seconds...) to wait before timing out. @param unit the time unit used to express the timeout preiod (seconds, minutes...). @return the object itself, to enable method chaining.
[ "Sets", "the", "wait", "mode", "the", "number", "of", "units", "and", "their", "scale", "before", "the", "wait", "for", "the", "background", "activities", "times", "out", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/activities/engine/ParallelEngine.java#L75-L80
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java
ExecutionGraph.createInitialGroupEdges
private void createInitialGroupEdges(final HashMap<AbstractJobVertex, ExecutionVertex> vertexMap) throws GraphConversionException { Iterator<Map.Entry<AbstractJobVertex, ExecutionVertex>> it = vertexMap.entrySet().iterator(); while (it.hasNext()) { final Map.Entry<AbstractJobVertex, ExecutionVertex> entry = it.next(); final AbstractJobVertex sjv = entry.getKey(); final ExecutionVertex sev = entry.getValue(); final ExecutionGroupVertex sgv = sev.getGroupVertex(); // First compare number of output gates if (sjv.getNumberOfForwardConnections() != sgv.getEnvironment().getNumberOfOutputGates()) { throw new GraphConversionException("Job and execution vertex " + sjv.getName() + " have different number of outputs"); } if (sjv.getNumberOfBackwardConnections() != sgv.getEnvironment().getNumberOfInputGates()) { throw new GraphConversionException("Job and execution vertex " + sjv.getName() + " have different number of inputs"); } // First, build the group edges for (int i = 0; i < sjv.getNumberOfForwardConnections(); ++i) { final JobEdge edge = sjv.getForwardConnection(i); final AbstractJobVertex tjv = edge.getConnectedVertex(); final ExecutionVertex tev = vertexMap.get(tjv); final ExecutionGroupVertex tgv = tev.getGroupVertex(); // Use NETWORK as default channel type if nothing else is defined by the user ChannelType channelType = edge.getChannelType(); boolean userDefinedChannelType = true; if (channelType == null) { userDefinedChannelType = false; channelType = ChannelType.NETWORK; } final DistributionPattern distributionPattern = edge.getDistributionPattern(); // Connect the corresponding group vertices and copy the user settings from the job edge final ExecutionGroupEdge groupEdge = sgv.wireTo(tgv, edge.getIndexOfInputGate(), i, channelType, userDefinedChannelType,distributionPattern); final ExecutionGate outputGate = new ExecutionGate(new GateID(), sev, groupEdge, false); sev.insertOutputGate(i, outputGate); final ExecutionGate inputGate = new ExecutionGate(new GateID(), tev, groupEdge, true); tev.insertInputGate(edge.getIndexOfInputGate(), inputGate); } } }
java
private void createInitialGroupEdges(final HashMap<AbstractJobVertex, ExecutionVertex> vertexMap) throws GraphConversionException { Iterator<Map.Entry<AbstractJobVertex, ExecutionVertex>> it = vertexMap.entrySet().iterator(); while (it.hasNext()) { final Map.Entry<AbstractJobVertex, ExecutionVertex> entry = it.next(); final AbstractJobVertex sjv = entry.getKey(); final ExecutionVertex sev = entry.getValue(); final ExecutionGroupVertex sgv = sev.getGroupVertex(); // First compare number of output gates if (sjv.getNumberOfForwardConnections() != sgv.getEnvironment().getNumberOfOutputGates()) { throw new GraphConversionException("Job and execution vertex " + sjv.getName() + " have different number of outputs"); } if (sjv.getNumberOfBackwardConnections() != sgv.getEnvironment().getNumberOfInputGates()) { throw new GraphConversionException("Job and execution vertex " + sjv.getName() + " have different number of inputs"); } // First, build the group edges for (int i = 0; i < sjv.getNumberOfForwardConnections(); ++i) { final JobEdge edge = sjv.getForwardConnection(i); final AbstractJobVertex tjv = edge.getConnectedVertex(); final ExecutionVertex tev = vertexMap.get(tjv); final ExecutionGroupVertex tgv = tev.getGroupVertex(); // Use NETWORK as default channel type if nothing else is defined by the user ChannelType channelType = edge.getChannelType(); boolean userDefinedChannelType = true; if (channelType == null) { userDefinedChannelType = false; channelType = ChannelType.NETWORK; } final DistributionPattern distributionPattern = edge.getDistributionPattern(); // Connect the corresponding group vertices and copy the user settings from the job edge final ExecutionGroupEdge groupEdge = sgv.wireTo(tgv, edge.getIndexOfInputGate(), i, channelType, userDefinedChannelType,distributionPattern); final ExecutionGate outputGate = new ExecutionGate(new GateID(), sev, groupEdge, false); sev.insertOutputGate(i, outputGate); final ExecutionGate inputGate = new ExecutionGate(new GateID(), tev, groupEdge, true); tev.insertInputGate(edge.getIndexOfInputGate(), inputGate); } } }
[ "private", "void", "createInitialGroupEdges", "(", "final", "HashMap", "<", "AbstractJobVertex", ",", "ExecutionVertex", ">", "vertexMap", ")", "throws", "GraphConversionException", "{", "Iterator", "<", "Map", ".", "Entry", "<", "AbstractJobVertex", ",", "ExecutionVe...
Creates the initial edges between the group vertices @param vertexMap the temporary vertex map @throws GraphConversionException if the initial wiring cannot be created
[ "Creates", "the", "initial", "edges", "between", "the", "group", "vertices" ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java#L390-L440
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.longToIntFunction
public static LongToIntFunction longToIntFunction(CheckedLongToIntFunction function, Consumer<Throwable> handler) { return t -> { try { return function.applyAsInt(t); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
java
public static LongToIntFunction longToIntFunction(CheckedLongToIntFunction function, Consumer<Throwable> handler) { return t -> { try { return function.applyAsInt(t); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
[ "public", "static", "LongToIntFunction", "longToIntFunction", "(", "CheckedLongToIntFunction", "function", ",", "Consumer", "<", "Throwable", ">", "handler", ")", "{", "return", "t", "->", "{", "try", "{", "return", "function", ".", "applyAsInt", "(", "t", ")", ...
Wrap a {@link CheckedLongToIntFunction} in a {@link LongToIntFunction} with a custom handler for checked exceptions. <p> Example: <code><pre> LongStream.of(1L, 2L, 3L).mapToInt(Unchecked.longToIntFunction( l -> { if (l &lt; 0L) throw new Exception("Only positive numbers allowed"); return (int) l; }, e -> { throw new IllegalStateException(e); } )); </pre></code>
[ "Wrap", "a", "{", "@link", "CheckedLongToIntFunction", "}", "in", "a", "{", "@link", "LongToIntFunction", "}", "with", "a", "custom", "handler", "for", "checked", "exceptions", ".", "<p", ">", "Example", ":", "<code", ">", "<pre", ">", "LongStream", ".", "...
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L1259-L1270
redisson/redisson
redisson/src/main/java/org/redisson/api/BatchOptions.java
BatchOptions.syncSlaves
public BatchOptions syncSlaves(int slaves, long timeout, TimeUnit unit) { this.syncSlaves = slaves; this.syncTimeout = unit.toMillis(timeout); return this; }
java
public BatchOptions syncSlaves(int slaves, long timeout, TimeUnit unit) { this.syncSlaves = slaves; this.syncTimeout = unit.toMillis(timeout); return this; }
[ "public", "BatchOptions", "syncSlaves", "(", "int", "slaves", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "{", "this", ".", "syncSlaves", "=", "slaves", ";", "this", ".", "syncTimeout", "=", "unit", ".", "toMillis", "(", "timeout", ")", ";", "r...
Synchronize write operations execution within defined timeout across specified amount of Redis slave nodes. <p> NOTE: Redis 3.0+ required @param slaves - synchronization timeout @param timeout - synchronization timeout @param unit - synchronization timeout time unit @return self instance
[ "Synchronize", "write", "operations", "execution", "within", "defined", "timeout", "across", "specified", "amount", "of", "Redis", "slave", "nodes", ".", "<p", ">", "NOTE", ":", "Redis", "3", ".", "0", "+", "required" ]
train
https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/BatchOptions.java#L152-L156
google/closure-compiler
src/com/google/javascript/jscomp/ProcessDefines.java
ProcessDefines.setDefineInfoNotAssignable
private static void setDefineInfoNotAssignable(DefineInfo info, NodeTraversal t) { info.setNotAssignable( format(REASON_DEFINE_NOT_ASSIGNABLE, t.getLineNumber(), t.getSourceName())); }
java
private static void setDefineInfoNotAssignable(DefineInfo info, NodeTraversal t) { info.setNotAssignable( format(REASON_DEFINE_NOT_ASSIGNABLE, t.getLineNumber(), t.getSourceName())); }
[ "private", "static", "void", "setDefineInfoNotAssignable", "(", "DefineInfo", "info", ",", "NodeTraversal", "t", ")", "{", "info", ".", "setNotAssignable", "(", "format", "(", "REASON_DEFINE_NOT_ASSIGNABLE", ",", "t", ".", "getLineNumber", "(", ")", ",", "t", "....
Records the fact that because of the current node in the node traversal, the define can't ever be assigned again. @param info Represents the define variable. @param t The current traversal.
[ "Records", "the", "fact", "that", "because", "of", "the", "current", "node", "in", "the", "node", "traversal", "the", "define", "can", "t", "ever", "be", "assigned", "again", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ProcessDefines.java#L639-L642
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/background/BackgroundAbstract.java
BackgroundAbstract.createElement
public static BackgroundElement createElement(String name, int x, int y) { return new BackgroundElement(x, y, createSprite(Medias.create(name))); }
java
public static BackgroundElement createElement(String name, int x, int y) { return new BackgroundElement(x, y, createSprite(Medias.create(name))); }
[ "public", "static", "BackgroundElement", "createElement", "(", "String", "name", ",", "int", "x", ",", "int", "y", ")", "{", "return", "new", "BackgroundElement", "(", "x", ",", "y", ",", "createSprite", "(", "Medias", ".", "create", "(", "name", ")", ")...
Create an element from a name, plus its coordinates. @param name The element name. @param x The location x. @param y The location y. @return The created element. @throws LionEngineException If media is <code>null</code> or image cannot be read.
[ "Create", "an", "element", "from", "a", "name", "plus", "its", "coordinates", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/background/BackgroundAbstract.java#L45-L48
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/util/TypeUtils.java
TypeUtils.getMoreSpecificType
public static Type getMoreSpecificType(final Type one, final Type two) { return isMoreSpecific(one, two) ? one : two; }
java
public static Type getMoreSpecificType(final Type one, final Type two) { return isMoreSpecific(one, two) ? one : two; }
[ "public", "static", "Type", "getMoreSpecificType", "(", "final", "Type", "one", ",", "final", "Type", "two", ")", "{", "return", "isMoreSpecific", "(", "one", ",", "two", ")", "?", "one", ":", "two", ";", "}" ]
Not resolved type variables are resolved to Object. @param one first type @param two second type @return more specific type or first type if they are equal @see #isMoreSpecific(Type, Type)
[ "Not", "resolved", "type", "variables", "are", "resolved", "to", "Object", "." ]
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/TypeUtils.java#L185-L187
alibaba/ARouter
arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java
Postcard.withByteArray
public Postcard withByteArray(@Nullable String key, @Nullable byte[] value) { mBundle.putByteArray(key, value); return this; }
java
public Postcard withByteArray(@Nullable String key, @Nullable byte[] value) { mBundle.putByteArray(key, value); return this; }
[ "public", "Postcard", "withByteArray", "(", "@", "Nullable", "String", "key", ",", "@", "Nullable", "byte", "[", "]", "value", ")", "{", "mBundle", ".", "putByteArray", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a byte array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a byte array object, or null @return current
[ "Inserts", "a", "byte", "array", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L481-L484
networknt/light-4j
client/src/main/java/org/apache/hc/core5/http/message/copied/TokenParser.java
TokenParser.skipWhiteSpace
public void skipWhiteSpace(final CharSequence buf, final ParserCursor cursor) { Args.notNull(buf, "Char sequence"); Args.notNull(cursor, "Parser cursor"); int pos = cursor.getPos(); final int indexFrom = cursor.getPos(); final int indexTo = cursor.getUpperBound(); for (int i = indexFrom; i < indexTo; i++) { final char current = buf.charAt(i); if (!isWhitespace(current)) { break; } pos++; } cursor.updatePos(pos); }
java
public void skipWhiteSpace(final CharSequence buf, final ParserCursor cursor) { Args.notNull(buf, "Char sequence"); Args.notNull(cursor, "Parser cursor"); int pos = cursor.getPos(); final int indexFrom = cursor.getPos(); final int indexTo = cursor.getUpperBound(); for (int i = indexFrom; i < indexTo; i++) { final char current = buf.charAt(i); if (!isWhitespace(current)) { break; } pos++; } cursor.updatePos(pos); }
[ "public", "void", "skipWhiteSpace", "(", "final", "CharSequence", "buf", ",", "final", "ParserCursor", "cursor", ")", "{", "Args", ".", "notNull", "(", "buf", ",", "\"Char sequence\"", ")", ";", "Args", ".", "notNull", "(", "cursor", ",", "\"Parser cursor\"", ...
Skips semantically insignificant whitespace characters and moves the cursor to the closest non-whitespace character. @param buf buffer with the sequence of chars to be parsed @param cursor defines the bounds and current position of the buffer
[ "Skips", "semantically", "insignificant", "whitespace", "characters", "and", "moves", "the", "cursor", "to", "the", "closest", "non", "-", "whitespace", "character", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/http/message/copied/TokenParser.java#L138-L152
kaazing/gateway
service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/PatternCacheControl.java
PatternCacheControl.parseDirectiveWithValue
private void parseDirectiveWithValue(String directiveName, String directiveValue) { Directive directive; if (directiveName.equals(Directive.MAX_AGE.getName())) { if (directiveValue.startsWith(M_PLUS_STRING)) { directiveValue = directiveValue.replace(M_PLUS_STRING, EMPTY_STRING_VALUE); directive = Directive.MAX_AGE_MPLUS; } else { directive = Directive.MAX_AGE; } } else { directive = Directive.get(directiveName); } long value = Utils.parseTimeInterval(directiveValue, TimeUnit.SECONDS, 0); directives.put(directive, Long.toString(value)); }
java
private void parseDirectiveWithValue(String directiveName, String directiveValue) { Directive directive; if (directiveName.equals(Directive.MAX_AGE.getName())) { if (directiveValue.startsWith(M_PLUS_STRING)) { directiveValue = directiveValue.replace(M_PLUS_STRING, EMPTY_STRING_VALUE); directive = Directive.MAX_AGE_MPLUS; } else { directive = Directive.MAX_AGE; } } else { directive = Directive.get(directiveName); } long value = Utils.parseTimeInterval(directiveValue, TimeUnit.SECONDS, 0); directives.put(directive, Long.toString(value)); }
[ "private", "void", "parseDirectiveWithValue", "(", "String", "directiveName", ",", "String", "directiveValue", ")", "{", "Directive", "directive", ";", "if", "(", "directiveName", ".", "equals", "(", "Directive", ".", "MAX_AGE", ".", "getName", "(", ")", ")", ...
Adds a directive with the associated value to the directives map, after parsing the value from the configuration file @param directiveName @param directiveValue
[ "Adds", "a", "directive", "with", "the", "associated", "value", "to", "the", "directives", "map", "after", "parsing", "the", "value", "from", "the", "configuration", "file" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/PatternCacheControl.java#L134-L148
beangle/beangle3
commons/model/src/main/java/org/beangle/commons/transfer/excel/ExcelTools.java
ExcelTools.object2Excel
public <T> HSSFWorkbook object2Excel(Collection<T> list, String propertyKeys, String propertyShowKeys, PropertyExtractor exporter) throws Exception { HSSFWorkbook wb = new HSSFWorkbook(); // 建立新HSSFWorkbook对象 object2Excel(wb, "export result", list, propertyKeys, propertyShowKeys, exporter); return wb; }
java
public <T> HSSFWorkbook object2Excel(Collection<T> list, String propertyKeys, String propertyShowKeys, PropertyExtractor exporter) throws Exception { HSSFWorkbook wb = new HSSFWorkbook(); // 建立新HSSFWorkbook对象 object2Excel(wb, "export result", list, propertyKeys, propertyShowKeys, exporter); return wb; }
[ "public", "<", "T", ">", "HSSFWorkbook", "object2Excel", "(", "Collection", "<", "T", ">", "list", ",", "String", "propertyKeys", ",", "String", "propertyShowKeys", ",", "PropertyExtractor", "exporter", ")", "throws", "Exception", "{", "HSSFWorkbook", "wb", "=",...
List数据集导出生成Excel文件 @param list 对象数据列表 @param propertyKeys 对象属字符串,中间以","间隔 @param propertyShowKeys 显示字段的名字字符串,中间以","间隔 @return 返回单个HSSFWorkbook(excel) @throws java.lang.Exception if any. @param exporter a {@link org.beangle.commons.transfer.exporter.PropertyExtractor} object. @param <T> a T object.
[ "List数据集导出生成Excel文件" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/model/src/main/java/org/beangle/commons/transfer/excel/ExcelTools.java#L120-L125
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java
AbstractRedisStorage.getLastInstanceActiveTime
protected long getLastInstanceActiveTime(String instanceId, T jedis){ final String lastActiveTime = jedis.hget(redisSchema.lastInstanceActiveTime(), instanceId); if(lastActiveTime == null){ return 0; } return Long.parseLong(lastActiveTime); }
java
protected long getLastInstanceActiveTime(String instanceId, T jedis){ final String lastActiveTime = jedis.hget(redisSchema.lastInstanceActiveTime(), instanceId); if(lastActiveTime == null){ return 0; } return Long.parseLong(lastActiveTime); }
[ "protected", "long", "getLastInstanceActiveTime", "(", "String", "instanceId", ",", "T", "jedis", ")", "{", "final", "String", "lastActiveTime", "=", "jedis", ".", "hget", "(", "redisSchema", ".", "lastInstanceActiveTime", "(", ")", ",", "instanceId", ")", ";", ...
Retrieve the last time (in milliseconds) that the instance was active @param instanceId The instance to check @param jedis a thread-safe Redis connection @return a unix timestamp in milliseconds
[ "Retrieve", "the", "last", "time", "(", "in", "milliseconds", ")", "that", "the", "instance", "was", "active" ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L736-L742
jamesagnew/hapi-fhir
hapi-fhir-base/src/main/java/ca/uhn/fhir/util/StopWatch.java
StopWatch.getThroughput
public double getThroughput(int theNumOperations, TimeUnit theUnit) { if (theNumOperations <= 0) { return 0.0f; } long millisElapsed = Math.max(1, getMillis()); long periodMillis = theUnit.toMillis(1); double numerator = theNumOperations; double denominator = ((double) millisElapsed) / ((double) periodMillis); return numerator / denominator; }
java
public double getThroughput(int theNumOperations, TimeUnit theUnit) { if (theNumOperations <= 0) { return 0.0f; } long millisElapsed = Math.max(1, getMillis()); long periodMillis = theUnit.toMillis(1); double numerator = theNumOperations; double denominator = ((double) millisElapsed) / ((double) periodMillis); return numerator / denominator; }
[ "public", "double", "getThroughput", "(", "int", "theNumOperations", ",", "TimeUnit", "theUnit", ")", "{", "if", "(", "theNumOperations", "<=", "0", ")", "{", "return", "0.0f", ";", "}", "long", "millisElapsed", "=", "Math", ".", "max", "(", "1", ",", "g...
Determine the current throughput per unit of time (specified in theUnit) assuming that theNumOperations operations have happened. <p> For example, if this stopwatch has 2 seconds elapsed, and this method is called for theNumOperations=30 and TimeUnit=SECONDS, this method will return 15 </p> @see #formatThroughput(int, TimeUnit)
[ "Determine", "the", "current", "throughput", "per", "unit", "of", "time", "(", "specified", "in", "theUnit", ")", "assuming", "that", "theNumOperations", "operations", "have", "happened", ".", "<p", ">", "For", "example", "if", "this", "stopwatch", "has", "2",...
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/StopWatch.java#L224-L236
pravega/pravega
controller/src/main/java/io/pravega/controller/server/rpc/auth/StrongPasswordProcessor.java
StrongPasswordProcessor.encryptPassword
public String encryptPassword(String userPassword) throws NoSuchAlgorithmException, InvalidKeySpecException { char[] chars = userPassword.toCharArray(); byte[] salt = getSalt(); PBEKeySpec spec = new PBEKeySpec(chars, salt, iterations, keyLength); SecretKeyFactory skf = SecretKeyFactory.getInstance(keyAlgorythm); byte[] hash = skf.generateSecret(spec).getEncoded(); return toHex((iterations + ":" + toHex(salt) + ":" + toHex(hash)).getBytes()); }
java
public String encryptPassword(String userPassword) throws NoSuchAlgorithmException, InvalidKeySpecException { char[] chars = userPassword.toCharArray(); byte[] salt = getSalt(); PBEKeySpec spec = new PBEKeySpec(chars, salt, iterations, keyLength); SecretKeyFactory skf = SecretKeyFactory.getInstance(keyAlgorythm); byte[] hash = skf.generateSecret(spec).getEncoded(); return toHex((iterations + ":" + toHex(salt) + ":" + toHex(hash)).getBytes()); }
[ "public", "String", "encryptPassword", "(", "String", "userPassword", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeySpecException", "{", "char", "[", "]", "chars", "=", "userPassword", ".", "toCharArray", "(", ")", ";", "byte", "[", "]", "salt", "="...
/* @param userPassword The password to be encrypted. @return The encrypted string digest. @throws NoSuchAlgorithmException encryption exceptions. @throws InvalidKeySpecException encryption exceptions.
[ "/", "*" ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rpc/auth/StrongPasswordProcessor.java#L81-L89
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/labeled/label/LabeledMultiLineLabelPanel.java
LabeledMultiLineLabelPanel.newMultiLineLabelLabel
protected MultiLineLabel newMultiLineLabelLabel(final String id, final IModel<T> model) { final IModel<T> viewableLabelModel = new PropertyModel<>(model.getObject(), this.getId()); return ComponentFactory.newMultiLineLabel(id, viewableLabelModel); }
java
protected MultiLineLabel newMultiLineLabelLabel(final String id, final IModel<T> model) { final IModel<T> viewableLabelModel = new PropertyModel<>(model.getObject(), this.getId()); return ComponentFactory.newMultiLineLabel(id, viewableLabelModel); }
[ "protected", "MultiLineLabel", "newMultiLineLabelLabel", "(", "final", "String", "id", ",", "final", "IModel", "<", "T", ">", "model", ")", "{", "final", "IModel", "<", "T", ">", "viewableLabelModel", "=", "new", "PropertyModel", "<>", "(", "model", ".", "ge...
Factory method for create a new {@link MultiLineLabel}. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link MultiLineLabel}. @param id the id @param model the model @return the new {@link MultiLineLabel}
[ "Factory", "method", "for", "create", "a", "new", "{", "@link", "MultiLineLabel", "}", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "users", "can", "provide",...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/labeled/label/LabeledMultiLineLabelPanel.java#L96-L100
attribyte/wpdb
src/main/java/org/attribyte/wp/db/DB.java
DB.updatePostTitle
public boolean updatePostTitle(long postId, final String title) throws SQLException { Connection conn = null; PreparedStatement stmt = null; Timer.Context ctx = metrics.updatePostTimer.time(); try { conn = connectionSupplier.getConnection(); stmt = conn.prepareStatement(updatePostTitleSQL); stmt.setString(1, title); stmt.setLong(2, postId); return stmt.executeUpdate() > 0; } finally { ctx.stop(); SQLUtil.closeQuietly(conn, stmt); } }
java
public boolean updatePostTitle(long postId, final String title) throws SQLException { Connection conn = null; PreparedStatement stmt = null; Timer.Context ctx = metrics.updatePostTimer.time(); try { conn = connectionSupplier.getConnection(); stmt = conn.prepareStatement(updatePostTitleSQL); stmt.setString(1, title); stmt.setLong(2, postId); return stmt.executeUpdate() > 0; } finally { ctx.stop(); SQLUtil.closeQuietly(conn, stmt); } }
[ "public", "boolean", "updatePostTitle", "(", "long", "postId", ",", "final", "String", "title", ")", "throws", "SQLException", "{", "Connection", "conn", "=", "null", ";", "PreparedStatement", "stmt", "=", "null", ";", "Timer", ".", "Context", "ctx", "=", "m...
Updates the title for a post. @param postId The post to update. @param title The new title. @return Was the post modified? @throws SQLException on database error or missing post id.
[ "Updates", "the", "title", "for", "a", "post", "." ]
train
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L1575-L1589
Waikato/moa
moa/src/main/java/moa/clusterers/clustree/Entry.java
Entry.initializeEntry
protected void initializeEntry(Entry other, long currentTime) { assert (this.isEmpty()); assert (other.getBuffer().isEmpty()); this.data.add(other.data); this.timestamp = currentTime; this.child = other.child; if (child!=null){ for (Entry e : child.getEntries()){ e.setParentEntry(this); } } }
java
protected void initializeEntry(Entry other, long currentTime) { assert (this.isEmpty()); assert (other.getBuffer().isEmpty()); this.data.add(other.data); this.timestamp = currentTime; this.child = other.child; if (child!=null){ for (Entry e : child.getEntries()){ e.setParentEntry(this); } } }
[ "protected", "void", "initializeEntry", "(", "Entry", "other", ",", "long", "currentTime", ")", "{", "assert", "(", "this", ".", "isEmpty", "(", ")", ")", ";", "assert", "(", "other", ".", "getBuffer", "(", ")", ".", "isEmpty", "(", ")", ")", ";", "t...
When this entry is empty, give it it's first values. It makes sense to have this operation separated from the aggregation, because the aggregation first weights the values in <code>data</code> and <code>Kernel</code>, which makes no sense in an empty entry. @param other The entry with the information to be used to initialize this entry. @param currentTime The time at which this is happening.
[ "When", "this", "entry", "is", "empty", "give", "it", "it", "s", "first", "values", ".", "It", "makes", "sense", "to", "have", "this", "operation", "separated", "from", "the", "aggregation", "because", "the", "aggregation", "first", "weights", "the", "values...
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/clustree/Entry.java#L222-L233
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.eachFile
public static void eachFile(final Path self, final Closure closure) throws IOException { // throws FileNotFoundException, IllegalArgumentException { eachFile(self, FileType.ANY, closure); }
java
public static void eachFile(final Path self, final Closure closure) throws IOException { // throws FileNotFoundException, IllegalArgumentException { eachFile(self, FileType.ANY, closure); }
[ "public", "static", "void", "eachFile", "(", "final", "Path", "self", ",", "final", "Closure", "closure", ")", "throws", "IOException", "{", "// throws FileNotFoundException, IllegalArgumentException {", "eachFile", "(", "self", ",", "FileType", ".", "ANY", ",", "cl...
Invokes the closure for each 'child' file in this 'parent' folder/directory. Both regular files and subfolders/subdirectories are processed. @param self a Path (that happens to be a folder/directory) @param closure a closure (the parameter is the Path for the 'child' file) @throws java.io.FileNotFoundException if the given directory does not exist @throws IllegalArgumentException if the provided Path object does not represent a directory @see #eachFile(Path, groovy.io.FileType, groovy.lang.Closure) @since 2.3.0
[ "Invokes", "the", "closure", "for", "each", "child", "file", "in", "this", "parent", "folder", "/", "directory", ".", "Both", "regular", "files", "and", "subfolders", "/", "subdirectories", "are", "processed", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L886-L888
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/records/WarcHeader.java
WarcHeader.addIfNotPresent
public static void addIfNotPresent(final HeaderGroup headers, final WarcHeader.Name name, final String value) { if (! headers.containsHeader(name.value)) headers.addHeader(new WarcHeader(name, value)); }
java
public static void addIfNotPresent(final HeaderGroup headers, final WarcHeader.Name name, final String value) { if (! headers.containsHeader(name.value)) headers.addHeader(new WarcHeader(name, value)); }
[ "public", "static", "void", "addIfNotPresent", "(", "final", "HeaderGroup", "headers", ",", "final", "WarcHeader", ".", "Name", "name", ",", "final", "String", "value", ")", "{", "if", "(", "!", "headers", ".", "containsHeader", "(", "name", ".", "value", ...
Adds the given header, if not present (otherwise does nothing). @param headers the headers where to add the new one. @param name the name of the header to add. @param value the value of the header to add.
[ "Adds", "the", "given", "header", "if", "not", "present", "(", "otherwise", "does", "nothing", ")", "." ]
train
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/records/WarcHeader.java#L112-L114
baasbox/Android-SDK
library/src/main/java/com/baasbox/android/json/JsonArray.java
JsonArray.getLong
public long getLong(int index, long otherwise) { Long l = getLong(index); return l == null ? otherwise : l; }
java
public long getLong(int index, long otherwise) { Long l = getLong(index); return l == null ? otherwise : l; }
[ "public", "long", "getLong", "(", "int", "index", ",", "long", "otherwise", ")", "{", "Long", "l", "=", "getLong", "(", "index", ")", ";", "return", "l", "==", "null", "?", "otherwise", ":", "l", ";", "}" ]
Returns the <code>long</code> at index or otherwise if not found. @param index @return the value at index or null if not found @throws java.lang.IndexOutOfBoundsException if the index is out of the array bounds
[ "Returns", "the", "<code", ">", "long<", "/", "code", ">", "at", "index", "or", "otherwise", "if", "not", "found", "." ]
train
https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/json/JsonArray.java#L540-L543
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/utils/JStormUtils.java
JStormUtils.launchProcess
public static String launchProcess(final String command, final Map<String, String> environment, boolean backend) throws IOException { String[] cmds = command.split(" "); ArrayList<String> cmdList = new ArrayList<>(); for (String tok : cmds) { if (!StringUtils.isBlank(tok)) { cmdList.add(tok); } } return launchProcess(command, cmdList, environment, backend); }
java
public static String launchProcess(final String command, final Map<String, String> environment, boolean backend) throws IOException { String[] cmds = command.split(" "); ArrayList<String> cmdList = new ArrayList<>(); for (String tok : cmds) { if (!StringUtils.isBlank(tok)) { cmdList.add(tok); } } return launchProcess(command, cmdList, environment, backend); }
[ "public", "static", "String", "launchProcess", "(", "final", "String", "command", ",", "final", "Map", "<", "String", ",", "String", ">", "environment", ",", "boolean", "backend", ")", "throws", "IOException", "{", "String", "[", "]", "cmds", "=", "command",...
it should use DefaultExecutor to start a process, but some little problem have been found, such as exitCode/output string so still use the old method to start process @param command command to be executed @param environment env vars @param backend whether the command is executed at backend @return outputString @throws IOException
[ "it", "should", "use", "DefaultExecutor", "to", "start", "a", "process", "but", "some", "little", "problem", "have", "been", "found", "such", "as", "exitCode", "/", "output", "string", "so", "still", "use", "the", "old", "method", "to", "start", "process" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/utils/JStormUtils.java#L764-L776
attribyte/wpdb
src/main/java/org/attribyte/wp/model/Post.java
Post.withTaxonomyTerms
public final Post withTaxonomyTerms(final Map<String, List<TaxonomyTerm>> taxonomyTerms) { ImmutableMap.Builder<String, ImmutableList<TaxonomyTerm>> builder = ImmutableMap.builder(); if(taxonomyTerms != null && taxonomyTerms.size() > 0) { taxonomyTerms.entrySet().forEach(kv -> builder.put(kv.getKey(), ImmutableList.copyOf(kv.getValue()))); } return new Post(id, slug, title, excerpt, content, authorId, author, publishTimestamp, modifiedTimestamp, status, parentId, guid, commentCount, metadata, type, mimeType, builder.build(), children); }
java
public final Post withTaxonomyTerms(final Map<String, List<TaxonomyTerm>> taxonomyTerms) { ImmutableMap.Builder<String, ImmutableList<TaxonomyTerm>> builder = ImmutableMap.builder(); if(taxonomyTerms != null && taxonomyTerms.size() > 0) { taxonomyTerms.entrySet().forEach(kv -> builder.put(kv.getKey(), ImmutableList.copyOf(kv.getValue()))); } return new Post(id, slug, title, excerpt, content, authorId, author, publishTimestamp, modifiedTimestamp, status, parentId, guid, commentCount, metadata, type, mimeType, builder.build(), children); }
[ "public", "final", "Post", "withTaxonomyTerms", "(", "final", "Map", "<", "String", ",", "List", "<", "TaxonomyTerm", ">", ">", "taxonomyTerms", ")", "{", "ImmutableMap", ".", "Builder", "<", "String", ",", "ImmutableList", "<", "TaxonomyTerm", ">", ">", "bu...
Adds taxonomy terms to a post. @param taxonomyTerms The taxonomy terms. @return The post with taxonomy terms added.
[ "Adds", "taxonomy", "terms", "to", "a", "post", "." ]
train
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Post.java#L740-L748
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/URLConnectionFactory.java
URLConnectionFactory.configureTLS
private void configureTLS(URL url, URLConnection conn) { if ("https".equals(url.getProtocol())) { try { final HttpsURLConnection secCon = (HttpsURLConnection) conn; final SSLSocketFactoryEx factory = new SSLSocketFactoryEx(settings); secCon.setSSLSocketFactory(factory); } catch (NoSuchAlgorithmException ex) { LOGGER.debug("Unsupported algorithm in SSLSocketFactoryEx", ex); } catch (KeyManagementException ex) { LOGGER.debug("Key management exception in SSLSocketFactoryEx", ex); } } }
java
private void configureTLS(URL url, URLConnection conn) { if ("https".equals(url.getProtocol())) { try { final HttpsURLConnection secCon = (HttpsURLConnection) conn; final SSLSocketFactoryEx factory = new SSLSocketFactoryEx(settings); secCon.setSSLSocketFactory(factory); } catch (NoSuchAlgorithmException ex) { LOGGER.debug("Unsupported algorithm in SSLSocketFactoryEx", ex); } catch (KeyManagementException ex) { LOGGER.debug("Key management exception in SSLSocketFactoryEx", ex); } } }
[ "private", "void", "configureTLS", "(", "URL", "url", ",", "URLConnection", "conn", ")", "{", "if", "(", "\"https\"", ".", "equals", "(", "url", ".", "getProtocol", "(", ")", ")", ")", "{", "try", "{", "final", "HttpsURLConnection", "secCon", "=", "(", ...
If the protocol is HTTPS, this will configure the cipher suites so that connections can be made to the NVD, and others, using older versions of Java. @param url the URL @param conn the connection
[ "If", "the", "protocol", "is", "HTTPS", "this", "will", "configure", "the", "cipher", "suites", "so", "that", "connections", "can", "be", "made", "to", "the", "NVD", "and", "others", "using", "older", "versions", "of", "Java", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/URLConnectionFactory.java#L213-L225
op4j/op4j
src/main/java/org/op4j/Op.java
Op.onArrayFor
public static <T> Level0ArrayOperator<String[],String> onArrayFor(final String... elements) { return onArrayOf(Types.STRING, VarArgsUtil.asRequiredObjectArray(elements)); }
java
public static <T> Level0ArrayOperator<String[],String> onArrayFor(final String... elements) { return onArrayOf(Types.STRING, VarArgsUtil.asRequiredObjectArray(elements)); }
[ "public", "static", "<", "T", ">", "Level0ArrayOperator", "<", "String", "[", "]", ",", "String", ">", "onArrayFor", "(", "final", "String", "...", "elements", ")", "{", "return", "onArrayOf", "(", "Types", ".", "STRING", ",", "VarArgsUtil", ".", "asRequir...
<p> Creates an array with the specified elements and an <i>operation expression</i> on it. </p> @param elements the elements of the array being created @return an operator, ready for chaining
[ "<p", ">", "Creates", "an", "array", "with", "the", "specified", "elements", "and", "an", "<i", ">", "operation", "expression<", "/", "i", ">", "on", "it", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L984-L986
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java
QueryParametersLazyList.updateCache
private void updateCache(int index, QueryParameters params) { if (generatedCacheMap.containsKey(index) == true) { this.generatedCacheMap.put(index, params); } else { this.resultSetCacheMap.put(index, params); } }
java
private void updateCache(int index, QueryParameters params) { if (generatedCacheMap.containsKey(index) == true) { this.generatedCacheMap.put(index, params); } else { this.resultSetCacheMap.put(index, params); } }
[ "private", "void", "updateCache", "(", "int", "index", ",", "QueryParameters", "params", ")", "{", "if", "(", "generatedCacheMap", ".", "containsKey", "(", "index", ")", "==", "true", ")", "{", "this", ".", "generatedCacheMap", ".", "put", "(", "index", ",...
Updates value in cache. After cache update - cache trim is performed {@link LinkedHashMap#removeEldestEntry(java.util.Map.Entry)} @param index index at which the specified element is to be inserted @param params element to be inserted
[ "Updates", "value", "in", "cache", ".", "After", "cache", "update", "-", "cache", "trim", "is", "performed", "{", "@link", "LinkedHashMap#removeEldestEntry", "(", "java", ".", "util", ".", "Map", ".", "Entry", ")", "}" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParametersLazyList.java#L909-L915
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java
GeometryUtilities.getLineWithPlaneIntersection
public static Coordinate getLineWithPlaneIntersection( Coordinate lC1, Coordinate lC2, Coordinate pC1, Coordinate pC2, Coordinate pC3 ) { double[] p = getPlaneCoefficientsFrom3Points(pC1, pC2, pC3); double denominator = p[0] * (lC1.x - lC2.x) + p[1] * (lC1.y - lC2.y) + p[2] * (lC1.z - lC2.z); if (denominator == 0.0) { return null; } double u = (p[0] * lC1.x + p[1] * lC1.y + p[2] * lC1.z + p[3]) / // denominator; double x = lC1.x + (lC2.x - lC1.x) * u; double y = lC1.y + (lC2.y - lC1.y) * u; double z = lC1.z + (lC2.z - lC1.z) * u; return new Coordinate(x, y, z); }
java
public static Coordinate getLineWithPlaneIntersection( Coordinate lC1, Coordinate lC2, Coordinate pC1, Coordinate pC2, Coordinate pC3 ) { double[] p = getPlaneCoefficientsFrom3Points(pC1, pC2, pC3); double denominator = p[0] * (lC1.x - lC2.x) + p[1] * (lC1.y - lC2.y) + p[2] * (lC1.z - lC2.z); if (denominator == 0.0) { return null; } double u = (p[0] * lC1.x + p[1] * lC1.y + p[2] * lC1.z + p[3]) / // denominator; double x = lC1.x + (lC2.x - lC1.x) * u; double y = lC1.y + (lC2.y - lC1.y) * u; double z = lC1.z + (lC2.z - lC1.z) * u; return new Coordinate(x, y, z); }
[ "public", "static", "Coordinate", "getLineWithPlaneIntersection", "(", "Coordinate", "lC1", ",", "Coordinate", "lC2", ",", "Coordinate", "pC1", ",", "Coordinate", "pC2", ",", "Coordinate", "pC3", ")", "{", "double", "[", "]", "p", "=", "getPlaneCoefficientsFrom3Po...
Get the intersection coordinate between a line and plane. <p>The line is defined by 2 3d coordinates and the plane by 3 3d coordinates.</p> <p>from http://paulbourke.net/geometry/pointlineplane/</p> @param lC1 line coordinate 1. @param lC2 line coordinate 2. @param pC1 plane coordinate 1. @param pC2 plane coordinate 2. @param pC3 plane coordinate 3. @return the intersection coordinate or <code>null</code> if the line is parallel to the plane.
[ "Get", "the", "intersection", "coordinate", "between", "a", "line", "and", "plane", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L766-L780
elki-project/elki
elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/covertree/AbstractCoverTree.java
AbstractCoverTree.collectByCover
protected void collectByCover(DBIDRef cur, ModifiableDoubleDBIDList candidates, double fmax, ModifiableDoubleDBIDList collect) { assert (collect.size() == 0) : "Not empty"; DoubleDBIDListIter it = candidates.iter().advance(); // Except first = cur! while(it.valid()) { assert (!DBIDUtil.equal(cur, it)); final double dist = distance(cur, it); if(dist <= fmax) { // Collect collect.add(dist, it); candidates.removeSwap(it.getOffset()); } else { it.advance(); // Keep in candidates, outside cover radius. } } }
java
protected void collectByCover(DBIDRef cur, ModifiableDoubleDBIDList candidates, double fmax, ModifiableDoubleDBIDList collect) { assert (collect.size() == 0) : "Not empty"; DoubleDBIDListIter it = candidates.iter().advance(); // Except first = cur! while(it.valid()) { assert (!DBIDUtil.equal(cur, it)); final double dist = distance(cur, it); if(dist <= fmax) { // Collect collect.add(dist, it); candidates.removeSwap(it.getOffset()); } else { it.advance(); // Keep in candidates, outside cover radius. } } }
[ "protected", "void", "collectByCover", "(", "DBIDRef", "cur", ",", "ModifiableDoubleDBIDList", "candidates", ",", "double", "fmax", ",", "ModifiableDoubleDBIDList", "collect", ")", "{", "assert", "(", "collect", ".", "size", "(", ")", "==", "0", ")", ":", "\"N...
Collect all elements with respect to a new routing object. @param cur Routing object @param candidates Candidate list @param fmax Maximum distance @param collect Output list
[ "Collect", "all", "elements", "with", "respect", "to", "a", "new", "routing", "object", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/covertree/AbstractCoverTree.java#L193-L207
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java
MessageProcessor.sendAndListen
public <T extends BasicMessage> RPCConnectionContext sendAndListen(ProducerConnectionContext context, BasicMessage basicMessage, BasicMessageListener<T> responseListener) throws JMSException { return sendAndListen(context, basicMessage, responseListener, null); }
java
public <T extends BasicMessage> RPCConnectionContext sendAndListen(ProducerConnectionContext context, BasicMessage basicMessage, BasicMessageListener<T> responseListener) throws JMSException { return sendAndListen(context, basicMessage, responseListener, null); }
[ "public", "<", "T", "extends", "BasicMessage", ">", "RPCConnectionContext", "sendAndListen", "(", "ProducerConnectionContext", "context", ",", "BasicMessage", "basicMessage", ",", "BasicMessageListener", "<", "T", ">", "responseListener", ")", "throws", "JMSException", ...
Same as {@link #sendAndListen(ProducerConnectionContext, BasicMessage, BasicMessageListener, Map)} with <code>null</code> headers.
[ "Same", "as", "{" ]
train
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java#L250-L253
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsOuTree.java
CmsOuTree.loadAndExpand
private void loadAndExpand(Object itemId, I_CmsOuTreeType type) { if (type.isOrgUnit()) { addChildrenForOUNode((CmsOrganizationalUnit)itemId); } if (type.isGroup()) { addChildrenForGroupsNode(type, (String)itemId); } if (type.isRole()) { addChildrenForRolesNode((String)itemId); } expandItem(itemId); }
java
private void loadAndExpand(Object itemId, I_CmsOuTreeType type) { if (type.isOrgUnit()) { addChildrenForOUNode((CmsOrganizationalUnit)itemId); } if (type.isGroup()) { addChildrenForGroupsNode(type, (String)itemId); } if (type.isRole()) { addChildrenForRolesNode((String)itemId); } expandItem(itemId); }
[ "private", "void", "loadAndExpand", "(", "Object", "itemId", ",", "I_CmsOuTreeType", "type", ")", "{", "if", "(", "type", ".", "isOrgUnit", "(", ")", ")", "{", "addChildrenForOUNode", "(", "(", "CmsOrganizationalUnit", ")", "itemId", ")", ";", "}", "if", "...
Load and expand given item.<p> @param itemId to be expanded @param type of item
[ "Load", "and", "expand", "given", "item", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsOuTree.java#L454-L466
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java
ProxyDataSourceBuilder.logSlowQueryByCommons
public ProxyDataSourceBuilder logSlowQueryByCommons(long thresholdTime, TimeUnit timeUnit, CommonsLogLevel logLevel, String logName) { this.createCommonsSlowQueryListener = true; this.slowQueryThreshold = thresholdTime; this.slowQueryTimeUnit = timeUnit; this.commonsSlowQueryLogLevel = logLevel; this.commonsSlowQueryLogName = logName; return this; }
java
public ProxyDataSourceBuilder logSlowQueryByCommons(long thresholdTime, TimeUnit timeUnit, CommonsLogLevel logLevel, String logName) { this.createCommonsSlowQueryListener = true; this.slowQueryThreshold = thresholdTime; this.slowQueryTimeUnit = timeUnit; this.commonsSlowQueryLogLevel = logLevel; this.commonsSlowQueryLogName = logName; return this; }
[ "public", "ProxyDataSourceBuilder", "logSlowQueryByCommons", "(", "long", "thresholdTime", ",", "TimeUnit", "timeUnit", ",", "CommonsLogLevel", "logLevel", ",", "String", "logName", ")", "{", "this", ".", "createCommonsSlowQueryListener", "=", "true", ";", "this", "."...
Register {@link CommonsSlowQueryListener}. @param thresholdTime slow query threshold time @param timeUnit slow query threshold time unit @param logLevel log level for commons @param logName commons logger name @return builder @since 1.4.1
[ "Register", "{", "@link", "CommonsSlowQueryListener", "}", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java#L273-L280
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java
GeneratedDOAuth2UserDaoImpl.queryByUpdatedBy
public Iterable<DOAuth2User> queryByUpdatedBy(java.lang.String updatedBy) { return queryByField(null, DOAuth2UserMapper.Field.UPDATEDBY.getFieldName(), updatedBy); }
java
public Iterable<DOAuth2User> queryByUpdatedBy(java.lang.String updatedBy) { return queryByField(null, DOAuth2UserMapper.Field.UPDATEDBY.getFieldName(), updatedBy); }
[ "public", "Iterable", "<", "DOAuth2User", ">", "queryByUpdatedBy", "(", "java", ".", "lang", ".", "String", "updatedBy", ")", "{", "return", "queryByField", "(", "null", ",", "DOAuth2UserMapper", ".", "Field", ".", "UPDATEDBY", ".", "getFieldName", "(", ")", ...
query-by method for field updatedBy @param updatedBy the specified attribute @return an Iterable of DOAuth2Users for the specified updatedBy
[ "query", "-", "by", "method", "for", "field", "updatedBy" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java#L142-L144
52inc/android-52Kit
library-winds/src/main/java/com/ftinc/kit/winds/Winds.java
Winds.validateVersion
private static boolean validateVersion(Context ctx, ChangeLog clog){ // Get Preferences SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx); int lastSeen = prefs.getInt(PREF_CHANGELOG_LAST_SEEN, -1); // Second sort versions by it's code int latest = Integer.MIN_VALUE; for(Version version: clog.versions){ if(version.code > latest){ latest = version.code; } } // Get applications current version if(latest > lastSeen){ if(!BuildConfig.DEBUG) prefs.edit().putInt(PREF_CHANGELOG_LAST_SEEN, latest).apply(); return true; } return false; }
java
private static boolean validateVersion(Context ctx, ChangeLog clog){ // Get Preferences SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx); int lastSeen = prefs.getInt(PREF_CHANGELOG_LAST_SEEN, -1); // Second sort versions by it's code int latest = Integer.MIN_VALUE; for(Version version: clog.versions){ if(version.code > latest){ latest = version.code; } } // Get applications current version if(latest > lastSeen){ if(!BuildConfig.DEBUG) prefs.edit().putInt(PREF_CHANGELOG_LAST_SEEN, latest).apply(); return true; } return false; }
[ "private", "static", "boolean", "validateVersion", "(", "Context", "ctx", ",", "ChangeLog", "clog", ")", "{", "// Get Preferences", "SharedPreferences", "prefs", "=", "PreferenceManager", ".", "getDefaultSharedPreferences", "(", "ctx", ")", ";", "int", "lastSeen", "...
Validate the last seen stored verion code against the current changelog configuration to see if there is any updates and whether or not we should show the changelog dialog when called. @param ctx @param clog @return
[ "Validate", "the", "last", "seen", "stored", "verion", "code", "against", "the", "current", "changelog", "configuration", "to", "see", "if", "there", "is", "any", "updates", "and", "whether", "or", "not", "we", "should", "show", "the", "changelog", "dialog", ...
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-winds/src/main/java/com/ftinc/kit/winds/Winds.java#L190-L211
zaproxy/zaproxy
src/org/zaproxy/zap/spider/filters/HttpPrefixFetchFilter.java
HttpPrefixFetchFilter.normalisedPort
private static int normalisedPort(String scheme, int port) { if (port != DEFAULT_PORT) { return port; } if (isHttp(scheme)) { return DEFAULT_HTTP_PORT; } if (isHttps(scheme)) { return DEFAULT_HTTPS_PORT; } return UNKNOWN_PORT; }
java
private static int normalisedPort(String scheme, int port) { if (port != DEFAULT_PORT) { return port; } if (isHttp(scheme)) { return DEFAULT_HTTP_PORT; } if (isHttps(scheme)) { return DEFAULT_HTTPS_PORT; } return UNKNOWN_PORT; }
[ "private", "static", "int", "normalisedPort", "(", "String", "scheme", ",", "int", "port", ")", "{", "if", "(", "port", "!=", "DEFAULT_PORT", ")", "{", "return", "port", ";", "}", "if", "(", "isHttp", "(", "scheme", ")", ")", "{", "return", "DEFAULT_HT...
Returns the normalised form of the given {@code port}, based on the given {@code scheme}. <p> If the port is non-default (as given by {@link #DEFAULT_PORT}), it's immediately returned. Otherwise, for schemes HTTP and HTTPS it's returned 80 and 443, respectively, for any other scheme it's returned {@link #UNKNOWN_PORT}. @param scheme the (normalised) scheme of the URI where the port was defined @param port the port to normalise @return the normalised port @see #normalisedScheme(char[]) @see URI#getPort()
[ "Returns", "the", "normalised", "form", "of", "the", "given", "{", "@code", "port", "}", "based", "on", "the", "given", "{", "@code", "scheme", "}", ".", "<p", ">", "If", "the", "port", "is", "non", "-", "default", "(", "as", "given", "by", "{", "@...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/filters/HttpPrefixFetchFilter.java#L187-L201
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/contextmenu/CmsContextMenuHandler.java
CmsContextMenuHandler.transformSingleEntry
protected I_CmsContextMenuEntry transformSingleEntry(CmsContextMenuEntryBean bean, CmsUUID structureId) { String name = bean.getName(); I_CmsContextMenuCommand command = null; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(name)) { command = getContextMenuCommands().get(name); } if (command instanceof I_CmsValidatingContextMenuCommand) { boolean ok = ((I_CmsValidatingContextMenuCommand)command).validate(bean); if (!ok) { return null; } } CmsContextMenuEntry entry = new CmsContextMenuEntry(this, structureId, command); entry.setBean(bean); if (bean.hasSubMenu()) { entry.setSubMenu(transformEntries(bean.getSubMenu(), structureId)); } return entry; }
java
protected I_CmsContextMenuEntry transformSingleEntry(CmsContextMenuEntryBean bean, CmsUUID structureId) { String name = bean.getName(); I_CmsContextMenuCommand command = null; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(name)) { command = getContextMenuCommands().get(name); } if (command instanceof I_CmsValidatingContextMenuCommand) { boolean ok = ((I_CmsValidatingContextMenuCommand)command).validate(bean); if (!ok) { return null; } } CmsContextMenuEntry entry = new CmsContextMenuEntry(this, structureId, command); entry.setBean(bean); if (bean.hasSubMenu()) { entry.setSubMenu(transformEntries(bean.getSubMenu(), structureId)); } return entry; }
[ "protected", "I_CmsContextMenuEntry", "transformSingleEntry", "(", "CmsContextMenuEntryBean", "bean", ",", "CmsUUID", "structureId", ")", "{", "String", "name", "=", "bean", ".", "getName", "(", ")", ";", "I_CmsContextMenuCommand", "command", "=", "null", ";", "if",...
Creates a single context menu entry from a context menu entry bean.<p> @param bean the menu entry bean @param structureId the structure id @return the context menu for the given entry
[ "Creates", "a", "single", "context", "menu", "entry", "from", "a", "context", "menu", "entry", "bean", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/contextmenu/CmsContextMenuHandler.java#L210-L229
kiegroup/drools
drools-model/drools-canonical-model/src/main/java/org/drools/model/bitmask/OpenBitSet.java
OpenBitSet.oversize
public static int oversize(int minTargetSize, int bytesPerElement) { if (minTargetSize < 0) { // catch usage that accidentally overflows int throw new IllegalArgumentException("invalid array size " + minTargetSize); } if (minTargetSize == 0) { // wait until at least one element is requested return 0; } // asymptotic exponential growth by 1/8th, favors // spending a bit more CPU to not tie up too much wasted // RAM: int extra = minTargetSize >> 3; if (extra < 3) { // for very small arrays, where constant overhead of // realloc is presumably relatively high, we grow // faster extra = 3; } int newSize = minTargetSize + extra; // add 7 to allow for worst case byte alignment addition below: if (newSize+7 < 0) { // int overflowed -- return max allowed array size return Integer.MAX_VALUE; } if (JRE_IS_64BIT) { // round up to 8 byte alignment in 64bit env switch(bytesPerElement) { case 4: // round up to project of 2 return (newSize + 1) & 0x7ffffffe; case 2: // round up to project of 4 return (newSize + 3) & 0x7ffffffc; case 1: // round up to project of 8 return (newSize + 7) & 0x7ffffff8; case 8: // no rounding default: // odd (invalid?) size return newSize; } } else { // round up to 4 byte alignment in 64bit env switch(bytesPerElement) { case 2: // round up to project of 2 return (newSize + 1) & 0x7ffffffe; case 1: // round up to project of 4 return (newSize + 3) & 0x7ffffffc; case 4: case 8: // no rounding default: // odd (invalid?) size return newSize; } } }
java
public static int oversize(int minTargetSize, int bytesPerElement) { if (minTargetSize < 0) { // catch usage that accidentally overflows int throw new IllegalArgumentException("invalid array size " + minTargetSize); } if (minTargetSize == 0) { // wait until at least one element is requested return 0; } // asymptotic exponential growth by 1/8th, favors // spending a bit more CPU to not tie up too much wasted // RAM: int extra = minTargetSize >> 3; if (extra < 3) { // for very small arrays, where constant overhead of // realloc is presumably relatively high, we grow // faster extra = 3; } int newSize = minTargetSize + extra; // add 7 to allow for worst case byte alignment addition below: if (newSize+7 < 0) { // int overflowed -- return max allowed array size return Integer.MAX_VALUE; } if (JRE_IS_64BIT) { // round up to 8 byte alignment in 64bit env switch(bytesPerElement) { case 4: // round up to project of 2 return (newSize + 1) & 0x7ffffffe; case 2: // round up to project of 4 return (newSize + 3) & 0x7ffffffc; case 1: // round up to project of 8 return (newSize + 7) & 0x7ffffff8; case 8: // no rounding default: // odd (invalid?) size return newSize; } } else { // round up to 4 byte alignment in 64bit env switch(bytesPerElement) { case 2: // round up to project of 2 return (newSize + 1) & 0x7ffffffe; case 1: // round up to project of 4 return (newSize + 3) & 0x7ffffffc; case 4: case 8: // no rounding default: // odd (invalid?) size return newSize; } } }
[ "public", "static", "int", "oversize", "(", "int", "minTargetSize", ",", "int", "bytesPerElement", ")", "{", "if", "(", "minTargetSize", "<", "0", ")", "{", "// catch usage that accidentally overflows int", "throw", "new", "IllegalArgumentException", "(", "\"invalid a...
Returns an array size >= minTargetSize, generally over-allocating exponentially to achieve amortized linear-time cost as the array grows. NOTE: this was originally borrowed from Python 2.4.2 listobject.c sources (attribution in LICENSE.txt), but has now been substantially changed based on discussions from java-dev thread with subject "Dynamic array reallocation algorithms", started on Jan 12 2010. @param minTargetSize Minimum required value to be returned. @param bytesPerElement Bytes used by each element of the array. @lucene.internal
[ "Returns", "an", "array", "size", ">", "=", "minTargetSize", "generally", "over", "-", "allocating", "exponentially", "to", "achieve", "amortized", "linear", "-", "time", "cost", "as", "the", "array", "grows", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-model/drools-canonical-model/src/main/java/org/drools/model/bitmask/OpenBitSet.java#L919-L986
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/CmsEditorBase.java
CmsEditorBase.saveEntity
public void saveEntity(String entityId, boolean clearOnSuccess, Command callback) { CmsEntity entity = m_entityBackend.getEntity(entityId); saveEntity(entity, clearOnSuccess, callback); }
java
public void saveEntity(String entityId, boolean clearOnSuccess, Command callback) { CmsEntity entity = m_entityBackend.getEntity(entityId); saveEntity(entity, clearOnSuccess, callback); }
[ "public", "void", "saveEntity", "(", "String", "entityId", ",", "boolean", "clearOnSuccess", ",", "Command", "callback", ")", "{", "CmsEntity", "entity", "=", "m_entityBackend", ".", "getEntity", "(", "entityId", ")", ";", "saveEntity", "(", "entity", ",", "cl...
Saves the given entity.<p> @param entityId the entity id @param clearOnSuccess <code>true</code> to clear all entities from entity back-end on success @param callback the callback executed on success
[ "Saves", "the", "given", "entity", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsEditorBase.java#L583-L587
alibaba/jstorm
jstorm-core/src/main/java/backtype/storm/utils/disruptor/RingBuffer.java
RingBuffer.tryPublishEvent
public <A> boolean tryPublishEvent(EventTranslatorOneArg<E, A> translator, A arg0) { try { final long sequence = sequencer.tryNext(); translateAndPublish(translator, sequence, arg0); return true; } catch (InsufficientCapacityException e) { return false; } }
java
public <A> boolean tryPublishEvent(EventTranslatorOneArg<E, A> translator, A arg0) { try { final long sequence = sequencer.tryNext(); translateAndPublish(translator, sequence, arg0); return true; } catch (InsufficientCapacityException e) { return false; } }
[ "public", "<", "A", ">", "boolean", "tryPublishEvent", "(", "EventTranslatorOneArg", "<", "E", ",", "A", ">", "translator", ",", "A", "arg0", ")", "{", "try", "{", "final", "long", "sequence", "=", "sequencer", ".", "tryNext", "(", ")", ";", "translateAn...
Allows one user supplied argument. @see #tryPublishEvent(EventTranslator) @param translator The user specified translation for the event @param arg0 A user supplied argument. @return true if the value was published, false if there was insufficient capacity.
[ "Allows", "one", "user", "supplied", "argument", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/utils/disruptor/RingBuffer.java#L403-L411
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/util/Matrix.java
Matrix.plus
public Matrix plus(final Matrix B) { final Matrix A = this; if ((B.m_rows != A.m_rows) || (B.m_columns != A.m_columns)) { throw new GeometryException("Illegal matrix dimensions"); } final Matrix C = new Matrix(m_rows, m_columns); for (int i = 0; i < m_rows; i++) { for (int j = 0; j < m_columns; j++) { C.m_data[i][j] = A.m_data[i][j] + B.m_data[i][j]; } } return C; }
java
public Matrix plus(final Matrix B) { final Matrix A = this; if ((B.m_rows != A.m_rows) || (B.m_columns != A.m_columns)) { throw new GeometryException("Illegal matrix dimensions"); } final Matrix C = new Matrix(m_rows, m_columns); for (int i = 0; i < m_rows; i++) { for (int j = 0; j < m_columns; j++) { C.m_data[i][j] = A.m_data[i][j] + B.m_data[i][j]; } } return C; }
[ "public", "Matrix", "plus", "(", "final", "Matrix", "B", ")", "{", "final", "Matrix", "A", "=", "this", ";", "if", "(", "(", "B", ".", "m_rows", "!=", "A", ".", "m_rows", ")", "||", "(", "B", ".", "m_columns", "!=", "A", ".", "m_columns", ")", ...
Returns C = A + B @param B @return new Matrix C @throws GeometryException if the matrix dimensions don't match
[ "Returns", "C", "=", "A", "+", "B" ]
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/util/Matrix.java#L136-L154
apache/groovy
src/main/java/org/codehaus/groovy/ast/ClassNode.java
ClassNode.addMethod
public MethodNode addMethod(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code) { MethodNode other = getDeclaredMethod(name, parameters); // let's not add duplicate methods if (other != null) { return other; } MethodNode node = new MethodNode(name, modifiers, returnType, parameters, exceptions, code); addMethod(node); return node; }
java
public MethodNode addMethod(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code) { MethodNode other = getDeclaredMethod(name, parameters); // let's not add duplicate methods if (other != null) { return other; } MethodNode node = new MethodNode(name, modifiers, returnType, parameters, exceptions, code); addMethod(node); return node; }
[ "public", "MethodNode", "addMethod", "(", "String", "name", ",", "int", "modifiers", ",", "ClassNode", "returnType", ",", "Parameter", "[", "]", "parameters", ",", "ClassNode", "[", "]", "exceptions", ",", "Statement", "code", ")", "{", "MethodNode", "other", ...
If a method with the given name and parameters is already defined then it is returned otherwise the given method is added to this node. This method is useful for default method adding like getProperty() or invokeMethod() where there may already be a method defined in a class and so the default implementations should not be added if already present.
[ "If", "a", "method", "with", "the", "given", "name", "and", "parameters", "is", "already", "defined", "then", "it", "is", "returned", "otherwise", "the", "given", "method", "is", "added", "to", "this", "node", ".", "This", "method", "is", "useful", "for", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/ClassNode.java#L645-L659
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerDispatcher.java
ConsumerDispatcher.newReadyConsumer
@Override public long newReadyConsumer(JSConsumerKey consumerKey, boolean bSelector) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "newReadyConsumer", new Object[] { consumerKey, Boolean.valueOf(bSelector) }); // If this is a forward scanning consumer just remember we have one if (consumerKey.getForwardScanning()) { //move the consumerPoint in to the ready list readyFwdScanningCPs.put((SimpleEntry) consumerKey); } else { // If the consumer has a selector... if (bSelector) { //increment the specific consumer count and the version number specificReadyConsumerCount++; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "sepcificReadyConsumerCount:" + specificReadyConsumerCount); } else { //move the consumerPoint in to the ready list nonSpecificReadyCPs.put((SimpleEntry) consumerKey); } } // Increment the ready version ++readyConsumerVersion; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "newReadyConsumer", Long.valueOf(readyConsumerVersion)); return readyConsumerVersion; }
java
@Override public long newReadyConsumer(JSConsumerKey consumerKey, boolean bSelector) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "newReadyConsumer", new Object[] { consumerKey, Boolean.valueOf(bSelector) }); // If this is a forward scanning consumer just remember we have one if (consumerKey.getForwardScanning()) { //move the consumerPoint in to the ready list readyFwdScanningCPs.put((SimpleEntry) consumerKey); } else { // If the consumer has a selector... if (bSelector) { //increment the specific consumer count and the version number specificReadyConsumerCount++; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "sepcificReadyConsumerCount:" + specificReadyConsumerCount); } else { //move the consumerPoint in to the ready list nonSpecificReadyCPs.put((SimpleEntry) consumerKey); } } // Increment the ready version ++readyConsumerVersion; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "newReadyConsumer", Long.valueOf(readyConsumerVersion)); return readyConsumerVersion; }
[ "@", "Override", "public", "long", "newReadyConsumer", "(", "JSConsumerKey", "consumerKey", ",", "boolean", "bSelector", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", "."...
Add a ready consumer into our ready 'lists' @param consumerKey - handle to the ready consumer @param bSelector - consumer has a selector or not @return readyConsumerVersion
[ "Add", "a", "ready", "consumer", "into", "our", "ready", "lists" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerDispatcher.java#L1428-L1464
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermsImpl.java
ListManagementTermsImpl.deleteAllTerms
public String deleteAllTerms(String listId, String language) { return deleteAllTermsWithServiceResponseAsync(listId, language).toBlocking().single().body(); }
java
public String deleteAllTerms(String listId, String language) { return deleteAllTermsWithServiceResponseAsync(listId, language).toBlocking().single().body(); }
[ "public", "String", "deleteAllTerms", "(", "String", "listId", ",", "String", "language", ")", "{", "return", "deleteAllTermsWithServiceResponseAsync", "(", "listId", ",", "language", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(",...
Deletes all terms from the list with list Id equal to the list Id passed. @param listId List Id of the image list. @param language Language of the terms. @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the String object if successful.
[ "Deletes", "all", "terms", "from", "the", "list", "with", "list", "Id", "equal", "to", "the", "list", "Id", "passed", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermsImpl.java#L448-L450
jaxio/javaee-lab
javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java
GenericRepository.findCount
@Transactional public int findCount(E entity, SearchParameters sp) { checkNotNull(entity, "The entity cannot be null"); checkNotNull(sp, "The searchParameters cannot be null"); if (sp.hasNamedQuery()) { return byNamedQueryUtil.numberByNamedQuery(sp).intValue(); } CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<Long> criteriaQuery = builder.createQuery(Long.class); Root<E> root = criteriaQuery.from(type); if (sp.getDistinct()) { criteriaQuery = criteriaQuery.select(builder.countDistinct(root)); } else { criteriaQuery = criteriaQuery.select(builder.count(root)); } // predicate Predicate predicate = getPredicate(criteriaQuery, root, builder, entity, sp); if (predicate != null) { criteriaQuery = criteriaQuery.where(predicate); } // construct order by to fetch or joins if needed orderByUtil.buildJpaOrders(sp.getOrders(), root, builder, sp); TypedQuery<Long> typedQuery = entityManager.createQuery(criteriaQuery); applyCacheHints(typedQuery, sp); return typedQuery.getSingleResult().intValue(); }
java
@Transactional public int findCount(E entity, SearchParameters sp) { checkNotNull(entity, "The entity cannot be null"); checkNotNull(sp, "The searchParameters cannot be null"); if (sp.hasNamedQuery()) { return byNamedQueryUtil.numberByNamedQuery(sp).intValue(); } CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<Long> criteriaQuery = builder.createQuery(Long.class); Root<E> root = criteriaQuery.from(type); if (sp.getDistinct()) { criteriaQuery = criteriaQuery.select(builder.countDistinct(root)); } else { criteriaQuery = criteriaQuery.select(builder.count(root)); } // predicate Predicate predicate = getPredicate(criteriaQuery, root, builder, entity, sp); if (predicate != null) { criteriaQuery = criteriaQuery.where(predicate); } // construct order by to fetch or joins if needed orderByUtil.buildJpaOrders(sp.getOrders(), root, builder, sp); TypedQuery<Long> typedQuery = entityManager.createQuery(criteriaQuery); applyCacheHints(typedQuery, sp); return typedQuery.getSingleResult().intValue(); }
[ "@", "Transactional", "public", "int", "findCount", "(", "E", "entity", ",", "SearchParameters", "sp", ")", "{", "checkNotNull", "(", "entity", ",", "\"The entity cannot be null\"", ")", ";", "checkNotNull", "(", "sp", ",", "\"The searchParameters cannot be null\"", ...
Count the number of E instances. @param entity a sample entity whose non-null properties may be used as search hint @param sp carries additional search information @return the number of entities matching the search.
[ "Count", "the", "number", "of", "E", "instances", "." ]
train
https://github.com/jaxio/javaee-lab/blob/61238b967952446d81cc68424a4e809093a77fcf/javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java#L337-L369
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/validation/XbaseDiagnostician.java
XbaseDiagnostician.doValidateLambdaContents
@Deprecated protected boolean doValidateLambdaContents(XClosure closure, DiagnosticChain diagnostics, Map<Object, Object> context) { return true; }
java
@Deprecated protected boolean doValidateLambdaContents(XClosure closure, DiagnosticChain diagnostics, Map<Object, Object> context) { return true; }
[ "@", "Deprecated", "protected", "boolean", "doValidateLambdaContents", "(", "XClosure", "closure", ",", "DiagnosticChain", "diagnostics", ",", "Map", "<", "Object", ",", "Object", ">", "context", ")", "{", "return", "true", ";", "}" ]
This was here for EMF 2.5 compatibility and was refactored to a no-op.
[ "This", "was", "here", "for", "EMF", "2", ".", "5", "compatibility", "and", "was", "refactored", "to", "a", "no", "-", "op", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/validation/XbaseDiagnostician.java#L49-L52
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java
DateIntervalFormat.getInstance
public static final DateIntervalFormat getInstance(String skeleton, Locale locale, DateIntervalInfo dtitvinf) { return getInstance(skeleton, ULocale.forLocale(locale), dtitvinf); }
java
public static final DateIntervalFormat getInstance(String skeleton, Locale locale, DateIntervalInfo dtitvinf) { return getInstance(skeleton, ULocale.forLocale(locale), dtitvinf); }
[ "public", "static", "final", "DateIntervalFormat", "getInstance", "(", "String", "skeleton", ",", "Locale", "locale", ",", "DateIntervalInfo", "dtitvinf", ")", "{", "return", "getInstance", "(", "skeleton", ",", "ULocale", ".", "forLocale", "(", "locale", ")", "...
Construct a DateIntervalFormat from skeleton a DateIntervalInfo, and the given locale. This is a convenient override of getInstance(String skeleton, ULocale locale, DateIntervalInfo dtitvinf) <p>Example code:{@sample external/icu/android_icu4j/src/samples/java/android/icu/samples/text/dateintervalformat/DateIntervalFormatSample.java dtitvfmtCustomizedExample} @param skeleton the skeleton on which interval format based. @param locale the given locale @param dtitvinf the DateIntervalInfo object to be adopted. @return a date time interval formatter.
[ "Construct", "a", "DateIntervalFormat", "from", "skeleton", "a", "DateIntervalInfo", "and", "the", "given", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java#L510-L515
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/commons/FileUtilsV2_2.java
FileUtilsV2_2.readFileToString
public static String readFileToString(File file, String encoding) throws IOException { InputStream in = null; try { in = openInputStream(file); return IOUtils.toString(in, encoding); } finally { IOUtils.closeQuietly(in); } }
java
public static String readFileToString(File file, String encoding) throws IOException { InputStream in = null; try { in = openInputStream(file); return IOUtils.toString(in, encoding); } finally { IOUtils.closeQuietly(in); } }
[ "public", "static", "String", "readFileToString", "(", "File", "file", ",", "String", "encoding", ")", "throws", "IOException", "{", "InputStream", "in", "=", "null", ";", "try", "{", "in", "=", "openInputStream", "(", "file", ")", ";", "return", "IOUtils", ...
Reads the contents of a file into a String. The file is always closed. @param file the file to read, must not be <code>null</code> @param encoding the encoding to use, <code>null</code> means platform default @return the file contents, never <code>null</code> @throws IOException in case of an I/O error @throws java.io.UnsupportedEncodingException if the encoding is not supported by the VM
[ "Reads", "the", "contents", "of", "a", "file", "into", "a", "String", ".", "The", "file", "is", "always", "closed", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/commons/FileUtilsV2_2.java#L742-L750
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaasqueue/src/main/java/net/minidev/ovh/api/ApiOvhDbaasqueue.java
ApiOvhDbaasqueue.serviceName_user_userId_changePassword_POST
public OvhUserWithPassword serviceName_user_userId_changePassword_POST(String serviceName, String userId) throws IOException { String qPath = "/dbaas/queue/{serviceName}/user/{userId}/changePassword"; StringBuilder sb = path(qPath, serviceName, userId); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhUserWithPassword.class); }
java
public OvhUserWithPassword serviceName_user_userId_changePassword_POST(String serviceName, String userId) throws IOException { String qPath = "/dbaas/queue/{serviceName}/user/{userId}/changePassword"; StringBuilder sb = path(qPath, serviceName, userId); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhUserWithPassword.class); }
[ "public", "OvhUserWithPassword", "serviceName_user_userId_changePassword_POST", "(", "String", "serviceName", ",", "String", "userId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/queue/{serviceName}/user/{userId}/changePassword\"", ";", "StringBuilder", ...
Generate a new user password REST: POST /dbaas/queue/{serviceName}/user/{userId}/changePassword @param serviceName [required] Application ID @param userId [required] User ID API beta
[ "Generate", "a", "new", "user", "password" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaasqueue/src/main/java/net/minidev/ovh/api/ApiOvhDbaasqueue.java#L163-L168
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/FieldCriteria.java
FieldCriteria.buildGreaterCriteria
static FieldCriteria buildGreaterCriteria(Object anAttribute, Object aValue, UserAlias anAlias) { return new FieldCriteria(anAttribute, aValue,GREATER, anAlias); }
java
static FieldCriteria buildGreaterCriteria(Object anAttribute, Object aValue, UserAlias anAlias) { return new FieldCriteria(anAttribute, aValue,GREATER, anAlias); }
[ "static", "FieldCriteria", "buildGreaterCriteria", "(", "Object", "anAttribute", ",", "Object", "aValue", ",", "UserAlias", "anAlias", ")", "{", "return", "new", "FieldCriteria", "(", "anAttribute", ",", "aValue", ",", "GREATER", ",", "anAlias", ")", ";", "}" ]
static FieldCriteria buildGreaterCriteria(Object anAttribute, Object aValue, String anAlias)
[ "static", "FieldCriteria", "buildGreaterCriteria", "(", "Object", "anAttribute", "Object", "aValue", "String", "anAlias", ")" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/FieldCriteria.java#L42-L45
lastaflute/lasta-di
src/main/java/org/lastaflute/di/util/LdiSrl.java
LdiSrl.substringFirstRearIgnoreCase
public static String substringFirstRearIgnoreCase(String str, String... delimiters) { assertStringNotNull(str); return doSubstringFirstRear(false, true, true, str, delimiters); }
java
public static String substringFirstRearIgnoreCase(String str, String... delimiters) { assertStringNotNull(str); return doSubstringFirstRear(false, true, true, str, delimiters); }
[ "public", "static", "String", "substringFirstRearIgnoreCase", "(", "String", "str", ",", "String", "...", "delimiters", ")", "{", "assertStringNotNull", "(", "str", ")", ";", "return", "doSubstringFirstRear", "(", "false", ",", "true", ",", "true", ",", "str", ...
Extract rear sub-string from first-found delimiter ignoring case. <pre> substringFirstRear("foo.bar/baz.qux", "A", "U") returns "ar/baz.qux" </pre> @param str The target string. (NotNull) @param delimiters The array of delimiters. (NotNull) @return The part of string. (NotNull: if delimiter not found, returns argument-plain string)
[ "Extract", "rear", "sub", "-", "string", "from", "first", "-", "found", "delimiter", "ignoring", "case", ".", "<pre", ">", "substringFirstRear", "(", "foo", ".", "bar", "/", "baz", ".", "qux", "A", "U", ")", "returns", "ar", "/", "baz", ".", "qux", "...
train
https://github.com/lastaflute/lasta-di/blob/c4e123610c53a04cc836c5e456660e32d613447b/src/main/java/org/lastaflute/di/util/LdiSrl.java#L672-L675
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/translator/VariableTranslator.java
VariableTranslator.toObject
public static Object toObject(String type, String value){ if(StringHelper.isEmpty(value) || EMPTY_STRING.equals(value)){ return null; } com.centurylink.mdw.variable.VariableTranslator trans = getTranslator(type); return trans.toObject(value); }
java
public static Object toObject(String type, String value){ if(StringHelper.isEmpty(value) || EMPTY_STRING.equals(value)){ return null; } com.centurylink.mdw.variable.VariableTranslator trans = getTranslator(type); return trans.toObject(value); }
[ "public", "static", "Object", "toObject", "(", "String", "type", ",", "String", "value", ")", "{", "if", "(", "StringHelper", ".", "isEmpty", "(", "value", ")", "||", "EMPTY_STRING", ".", "equals", "(", "value", ")", ")", "{", "return", "null", ";", "}...
Translates the Passed in String value based on the Passed in type @param type @param value @return Translated Object
[ "Translates", "the", "Passed", "in", "String", "value", "based", "on", "the", "Passed", "in", "type" ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/translator/VariableTranslator.java#L105-L111
ModeShape/modeshape
modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/JcrTools.java
JcrTools.printQuery
public QueryResult printQuery( Session session, String jcrSql2, long expectedNumberOfResults, Variable... variables ) throws RepositoryException { Map<String, String> keyValuePairs = new HashMap<String, String>(); for (Variable var : variables) { keyValuePairs.put(var.key, var.value); } return printQuery(session, jcrSql2, Query.JCR_SQL2, expectedNumberOfResults, keyValuePairs); }
java
public QueryResult printQuery( Session session, String jcrSql2, long expectedNumberOfResults, Variable... variables ) throws RepositoryException { Map<String, String> keyValuePairs = new HashMap<String, String>(); for (Variable var : variables) { keyValuePairs.put(var.key, var.value); } return printQuery(session, jcrSql2, Query.JCR_SQL2, expectedNumberOfResults, keyValuePairs); }
[ "public", "QueryResult", "printQuery", "(", "Session", "session", ",", "String", "jcrSql2", ",", "long", "expectedNumberOfResults", ",", "Variable", "...", "variables", ")", "throws", "RepositoryException", "{", "Map", "<", "String", ",", "String", ">", "keyValueP...
Execute the supplied JCR-SQL2 query and, if printing is enabled, print out the results. @param session the session @param jcrSql2 the JCR-SQL2 query @param expectedNumberOfResults the expected number of rows in the results, or -1 if this is not to be checked @param variables the variables for the query @return the results @throws RepositoryException
[ "Execute", "the", "supplied", "JCR", "-", "SQL2", "query", "and", "if", "printing", "is", "enabled", "print", "out", "the", "results", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/JcrTools.java#L642-L651
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java
CPDefinitionOptionValueRelPersistenceImpl.findAll
@Override public List<CPDefinitionOptionValueRel> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CPDefinitionOptionValueRel> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CPDefinitionOptionValueRel", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the cp definition option value rels. @return the cp definition option value rels
[ "Returns", "all", "the", "cp", "definition", "option", "value", "rels", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java#L4638-L4641
katharsis-project/katharsis-framework
katharsis-core/src/main/java/io/katharsis/module/ModuleRegistry.java
ModuleRegistry.getResourceInformationBuilder
public ResourceInformationBuilder getResourceInformationBuilder() { CombinedResourceInformationBuilder resourceInformationBuilder = new CombinedResourceInformationBuilder(aggregatedModule.getResourceInformationBuilders()); DefaultResourceInformationBuilderContext context = new DefaultResourceInformationBuilderContext(resourceInformationBuilder, typeParser); resourceInformationBuilder.init(context); return resourceInformationBuilder; }
java
public ResourceInformationBuilder getResourceInformationBuilder() { CombinedResourceInformationBuilder resourceInformationBuilder = new CombinedResourceInformationBuilder(aggregatedModule.getResourceInformationBuilders()); DefaultResourceInformationBuilderContext context = new DefaultResourceInformationBuilderContext(resourceInformationBuilder, typeParser); resourceInformationBuilder.init(context); return resourceInformationBuilder; }
[ "public", "ResourceInformationBuilder", "getResourceInformationBuilder", "(", ")", "{", "CombinedResourceInformationBuilder", "resourceInformationBuilder", "=", "new", "CombinedResourceInformationBuilder", "(", "aggregatedModule", ".", "getResourceInformationBuilders", "(", ")", ")...
Returns a {@link ResourceInformationBuilder} instance that combines all instances registered by modules. @return resource information builder
[ "Returns", "a", "{", "@link", "ResourceInformationBuilder", "}", "instance", "that", "combines", "all", "instances", "registered", "by", "modules", "." ]
train
https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/module/ModuleRegistry.java#L234-L239
jtmelton/appsensor
analysis-engines/appsensor-analysis-reference/src/main/java/org/owasp/appsensor/analysis/ReferenceEventAnalysisEngine.java
ReferenceEventAnalysisEngine.countEvents
protected int countEvents(Collection<Event> existingEvents, Event triggeringEvent, DetectionPoint configuredDetectionPoint) { int count = 0; long intervalInMillis = configuredDetectionPoint.getThreshold().getInterval().toMillis(); //grab the startTime to begin counting from based on the current time - interval DateTime startTime = DateUtils.getCurrentTimestamp().minusMillis((int)intervalInMillis); //count events after most recent attack. DateTime mostRecentAttackTime = findMostRecentAttackTime(triggeringEvent, configuredDetectionPoint); for (Event event : existingEvents) { DateTime eventTimestamp = DateUtils.fromString(event.getTimestamp()); //ensure only events that have occurred since the last attack are considered if (eventTimestamp.isAfter(mostRecentAttackTime)) { if (intervalInMillis > 0) { if (DateUtils.fromString(event.getTimestamp()).isAfter(startTime)) { //only increment when event occurs within specified interval count++; } } else { //no interval - all events considered count++; } } } return count; }
java
protected int countEvents(Collection<Event> existingEvents, Event triggeringEvent, DetectionPoint configuredDetectionPoint) { int count = 0; long intervalInMillis = configuredDetectionPoint.getThreshold().getInterval().toMillis(); //grab the startTime to begin counting from based on the current time - interval DateTime startTime = DateUtils.getCurrentTimestamp().minusMillis((int)intervalInMillis); //count events after most recent attack. DateTime mostRecentAttackTime = findMostRecentAttackTime(triggeringEvent, configuredDetectionPoint); for (Event event : existingEvents) { DateTime eventTimestamp = DateUtils.fromString(event.getTimestamp()); //ensure only events that have occurred since the last attack are considered if (eventTimestamp.isAfter(mostRecentAttackTime)) { if (intervalInMillis > 0) { if (DateUtils.fromString(event.getTimestamp()).isAfter(startTime)) { //only increment when event occurs within specified interval count++; } } else { //no interval - all events considered count++; } } } return count; }
[ "protected", "int", "countEvents", "(", "Collection", "<", "Event", ">", "existingEvents", ",", "Event", "triggeringEvent", ",", "DetectionPoint", "configuredDetectionPoint", ")", "{", "int", "count", "=", "0", ";", "long", "intervalInMillis", "=", "configuredDetect...
Count the number of {@link Event}s over a time {@link Interval} specified in milliseconds. @param existingEvents set of {@link Event}s matching triggering {@link Event} id/user pulled from {@link Event} storage @param triggeringEvent the {@link Event} that triggered analysis @param configuredDetectionPoint the {@link DetectionPoint} we are currently considering @return number of {@link Event}s matching time {@link Interval} and configured {@link DetectionPoint}
[ "Count", "the", "number", "of", "{", "@link", "Event", "}", "s", "over", "a", "time", "{", "@link", "Interval", "}", "specified", "in", "milliseconds", "." ]
train
https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/analysis-engines/appsensor-analysis-reference/src/main/java/org/owasp/appsensor/analysis/ReferenceEventAnalysisEngine.java#L116-L144
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java
CPOptionCategoryPersistenceImpl.findAll
@Override public List<CPOptionCategory> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CPOptionCategory> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CPOptionCategory", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp option categories. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPOptionCategoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of cp option categories @param end the upper bound of the range of cp option categories (not inclusive) @return the range of cp option categories
[ "Returns", "a", "range", "of", "all", "the", "cp", "option", "categories", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java#L3452-L3455
tvesalainen/util
util/src/main/java/org/vesalainen/util/AbstractStateMachine.java
AbstractStateMachine.addState
public void addState(String name, Runnable enter) { addState(name, (S) new AdhocState(name, enter, null, null)); }
java
public void addState(String name, Runnable enter) { addState(name, (S) new AdhocState(name, enter, null, null)); }
[ "public", "void", "addState", "(", "String", "name", ",", "Runnable", "enter", ")", "{", "addState", "(", "name", ",", "(", "S", ")", "new", "AdhocState", "(", "name", ",", "enter", ",", "null", ",", "null", ")", ")", ";", "}" ]
Creates named state with functional interface. @param name @param enter Called when state is entered.
[ "Creates", "named", "state", "with", "functional", "interface", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/AbstractStateMachine.java#L69-L72
craftercms/core
src/main/java/org/craftercms/core/cache/impl/CacheRefresherImpl.java
CacheRefresherImpl.refreshItems
public void refreshItems(List<CacheItem> itemsToRefresh, Cache cache) { for (CacheItem item : itemsToRefresh) { try { refreshItem(item, cache); } catch (Exception ex) { logger.error("Refresh for " + getScopeAndKeyString(item) + " failed", ex); } } }
java
public void refreshItems(List<CacheItem> itemsToRefresh, Cache cache) { for (CacheItem item : itemsToRefresh) { try { refreshItem(item, cache); } catch (Exception ex) { logger.error("Refresh for " + getScopeAndKeyString(item) + " failed", ex); } } }
[ "public", "void", "refreshItems", "(", "List", "<", "CacheItem", ">", "itemsToRefresh", ",", "Cache", "cache", ")", "{", "for", "(", "CacheItem", "item", ":", "itemsToRefresh", ")", "{", "try", "{", "refreshItem", "(", "item", ",", "cache", ")", ";", "}"...
Refreshes the specified list of {@link org.craftercms.core.cache.CacheItem}s.
[ "Refreshes", "the", "specified", "list", "of", "{" ]
train
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/cache/impl/CacheRefresherImpl.java#L40-L48
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
HttpContext.POST
public Optional<Response> POST(String partialUrl, Object payload) { URI uri = buildUri(partialUrl); return executePostRequest(uri, payload); }
java
public Optional<Response> POST(String partialUrl, Object payload) { URI uri = buildUri(partialUrl); return executePostRequest(uri, payload); }
[ "public", "Optional", "<", "Response", ">", "POST", "(", "String", "partialUrl", ",", "Object", "payload", ")", "{", "URI", "uri", "=", "buildUri", "(", "partialUrl", ")", ";", "return", "executePostRequest", "(", "uri", ",", "payload", ")", ";", "}" ]
Execute a POST call against the partial URL. @param partialUrl The partial URL to build @param payload The object to use for the POST @return The response to the POST
[ "Execute", "a", "POST", "call", "against", "the", "partial", "URL", "." ]
train
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L193-L197
azkaban/azkaban
azkaban-common/src/main/java/azkaban/executor/ExecutorManager.java
ExecutorManager.isFlowRunning
@Override public boolean isFlowRunning(final int projectId, final String flowId) { boolean isRunning = false; isRunning = isRunning || isFlowRunningHelper(projectId, flowId, this.queuedFlows.getAllEntries()); isRunning = isRunning || isFlowRunningHelper(projectId, flowId, this.runningExecutions.get().values()); return isRunning; }
java
@Override public boolean isFlowRunning(final int projectId, final String flowId) { boolean isRunning = false; isRunning = isRunning || isFlowRunningHelper(projectId, flowId, this.queuedFlows.getAllEntries()); isRunning = isRunning || isFlowRunningHelper(projectId, flowId, this.runningExecutions.get().values()); return isRunning; }
[ "@", "Override", "public", "boolean", "isFlowRunning", "(", "final", "int", "projectId", ",", "final", "String", "flowId", ")", "{", "boolean", "isRunning", "=", "false", ";", "isRunning", "=", "isRunning", "||", "isFlowRunningHelper", "(", "projectId", ",", "...
Checks whether the given flow has an active (running, non-dispatched) executions {@inheritDoc} @see azkaban.executor.ExecutorManagerAdapter#isFlowRunning(int, java.lang.String)
[ "Checks", "whether", "the", "given", "flow", "has", "an", "active", "(", "running", "non", "-", "dispatched", ")", "executions", "{", "@inheritDoc", "}" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/executor/ExecutorManager.java#L497-L507
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/codec/TIFFDirectory.java
TIFFDirectory.getFieldAsByte
public byte getFieldAsByte(int tag, int index) { Integer i = (Integer)fieldIndex.get(Integer.valueOf(tag)); byte [] b = fields[i.intValue()].getAsBytes(); return b[index]; }
java
public byte getFieldAsByte(int tag, int index) { Integer i = (Integer)fieldIndex.get(Integer.valueOf(tag)); byte [] b = fields[i.intValue()].getAsBytes(); return b[index]; }
[ "public", "byte", "getFieldAsByte", "(", "int", "tag", ",", "int", "index", ")", "{", "Integer", "i", "=", "(", "Integer", ")", "fieldIndex", ".", "get", "(", "Integer", ".", "valueOf", "(", "tag", ")", ")", ";", "byte", "[", "]", "b", "=", "fields...
Returns the value of a particular index of a given tag as a byte. The caller is responsible for ensuring that the tag is present and has type TIFFField.TIFF_SBYTE, TIFF_BYTE, or TIFF_UNDEFINED.
[ "Returns", "the", "value", "of", "a", "particular", "index", "of", "a", "given", "tag", "as", "a", "byte", ".", "The", "caller", "is", "responsible", "for", "ensuring", "that", "the", "tag", "is", "present", "and", "has", "type", "TIFFField", ".", "TIFF_...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/codec/TIFFDirectory.java#L446-L450
belaban/JGroups
src/org/jgroups/protocols/tom/SenderManager.java
SenderManager.addPropose
public long addPropose(MessageID messageID, Address from, long sequenceNumber) { MessageInfo messageInfo = sentMessages.get(messageID); if (messageInfo != null && messageInfo.addPropose(from, sequenceNumber)) { return messageInfo.getAndMarkFinalSent(); } return NOT_READY; }
java
public long addPropose(MessageID messageID, Address from, long sequenceNumber) { MessageInfo messageInfo = sentMessages.get(messageID); if (messageInfo != null && messageInfo.addPropose(from, sequenceNumber)) { return messageInfo.getAndMarkFinalSent(); } return NOT_READY; }
[ "public", "long", "addPropose", "(", "MessageID", "messageID", ",", "Address", "from", ",", "long", "sequenceNumber", ")", "{", "MessageInfo", "messageInfo", "=", "sentMessages", ".", "get", "(", "messageID", ")", ";", "if", "(", "messageInfo", "!=", "null", ...
Add a propose from a member in destination set @param messageID the message ID @param from the originator of the propose @param sequenceNumber the proposed sequence number @return NOT_READY if the final sequence number is not know, or the final sequence number
[ "Add", "a", "propose", "from", "a", "member", "in", "destination", "set" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/tom/SenderManager.java#L44-L50
tvesalainen/util
util/src/main/java/org/vesalainen/text/CamelCase.java
CamelCase.delimited
public static final String delimited(String text, String delim) { return stream(text).collect(Collectors.joining(delim)); }
java
public static final String delimited(String text, String delim) { return stream(text).collect(Collectors.joining(delim)); }
[ "public", "static", "final", "String", "delimited", "(", "String", "text", ",", "String", "delim", ")", "{", "return", "stream", "(", "text", ")", ".", "collect", "(", "Collectors", ".", "joining", "(", "delim", ")", ")", ";", "}" ]
Returns Camel-Case if delim = '-' @param text @param delim @return
[ "Returns", "Camel", "-", "Case", "if", "delim", "=", "-" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/text/CamelCase.java#L79-L82
ppicas/custom-typeface
library/src/main/java/cat/ppicas/customtypeface/CustomTypefaceSpan.java
CustomTypefaceSpan.applyToText
public static void applyToText(CharSequence charSequence, Typeface typeface) { applyToText(charSequence, typeface, 0, charSequence.length()); }
java
public static void applyToText(CharSequence charSequence, Typeface typeface) { applyToText(charSequence, typeface, 0, charSequence.length()); }
[ "public", "static", "void", "applyToText", "(", "CharSequence", "charSequence", ",", "Typeface", "typeface", ")", "{", "applyToText", "(", "charSequence", ",", "typeface", ",", "0", ",", "charSequence", ".", "length", "(", ")", ")", ";", "}" ]
Applies a {@link CustomTypefaceSpan} along the whole passed {@link CharSequence}. The {@code charSequence} must implement {@link Spannable}, otherwise this method won't do anything. @param charSequence a {@code CharSequence} implementing {@code Spannable} to apply the styles @param typeface the {@code Typeface} that you want to be applied on the text @see Spannable#setSpan
[ "Applies", "a", "{", "@link", "CustomTypefaceSpan", "}", "along", "the", "whole", "passed", "{", "@link", "CharSequence", "}", ".", "The", "{", "@code", "charSequence", "}", "must", "implement", "{", "@link", "Spannable", "}", "otherwise", "this", "method", ...
train
https://github.com/ppicas/custom-typeface/blob/3a2a68cc8584a72076c545a8b7c9f741f6002241/library/src/main/java/cat/ppicas/customtypeface/CustomTypefaceSpan.java#L86-L88
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java
BlockDrawingHelper.DrawPrimitive
private void DrawPrimitive( DrawBlock b, World w ) throws Exception { XMLBlockState blockType = new XMLBlockState(b.getType(), b.getColour(), b.getFace(), b.getVariant()); if (!blockType.isValid()) throw new Exception("Unrecogised item type: " + b.getType().value()); BlockPos pos = new BlockPos( b.getX(), b.getY(), b.getZ() ); clearEntities(w, b.getX(), b.getY(), b.getZ(), b.getX() + 1, b.getY() + 1, b.getZ() + 1); setBlockState(w, pos, blockType ); }
java
private void DrawPrimitive( DrawBlock b, World w ) throws Exception { XMLBlockState blockType = new XMLBlockState(b.getType(), b.getColour(), b.getFace(), b.getVariant()); if (!blockType.isValid()) throw new Exception("Unrecogised item type: " + b.getType().value()); BlockPos pos = new BlockPos( b.getX(), b.getY(), b.getZ() ); clearEntities(w, b.getX(), b.getY(), b.getZ(), b.getX() + 1, b.getY() + 1, b.getZ() + 1); setBlockState(w, pos, blockType ); }
[ "private", "void", "DrawPrimitive", "(", "DrawBlock", "b", ",", "World", "w", ")", "throws", "Exception", "{", "XMLBlockState", "blockType", "=", "new", "XMLBlockState", "(", "b", ".", "getType", "(", ")", ",", "b", ".", "getColour", "(", ")", ",", "b", ...
Draw a single Minecraft block. @param b Contains information about the block to be drawn. @param w The world in which to draw. @throws Exception Throws an exception if the block type is not recognised.
[ "Draw", "a", "single", "Minecraft", "block", "." ]
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java#L217-L225
rampatra/jbot
jbot-example/src/main/java/example/jbot/slack/SlackBot.java
SlackBot.askTimeForMeeting
@Controller(next = "askWhetherToRepeat") public void askTimeForMeeting(WebSocketSession session, Event event) { if (event.getText().contains("yes")) { reply(session, event, "Okay. Would you like me to set a reminder for you?"); nextConversation(event); // jump to next question in conversation } else { reply(session, event, "No problem. You can always schedule one with 'setup meeting' command."); stopConversation(event); // stop conversation only if user says no } }
java
@Controller(next = "askWhetherToRepeat") public void askTimeForMeeting(WebSocketSession session, Event event) { if (event.getText().contains("yes")) { reply(session, event, "Okay. Would you like me to set a reminder for you?"); nextConversation(event); // jump to next question in conversation } else { reply(session, event, "No problem. You can always schedule one with 'setup meeting' command."); stopConversation(event); // stop conversation only if user says no } }
[ "@", "Controller", "(", "next", "=", "\"askWhetherToRepeat\"", ")", "public", "void", "askTimeForMeeting", "(", "WebSocketSession", "session", ",", "Event", "event", ")", "{", "if", "(", "event", ".", "getText", "(", ")", ".", "contains", "(", "\"yes\"", ")"...
This method will be invoked after {@link SlackBot#confirmTiming(WebSocketSession, Event)}. @param session @param event
[ "This", "method", "will", "be", "invoked", "after", "{", "@link", "SlackBot#confirmTiming", "(", "WebSocketSession", "Event", ")", "}", "." ]
train
https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot-example/src/main/java/example/jbot/slack/SlackBot.java#L138-L147
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.checkArgNotNullOrEmpty
public static <T extends CharSequence> T checkArgNotNullOrEmpty(final T arg, final String argNameOrErrorMsg) { if (N.isNullOrEmpty(arg)) { if (argNameOrErrorMsg.indexOf(' ') == N.INDEX_NOT_FOUND) { throw new IllegalArgumentException("'" + argNameOrErrorMsg + "' can not be null or empty"); } else { throw new IllegalArgumentException(argNameOrErrorMsg); } } return arg; }
java
public static <T extends CharSequence> T checkArgNotNullOrEmpty(final T arg, final String argNameOrErrorMsg) { if (N.isNullOrEmpty(arg)) { if (argNameOrErrorMsg.indexOf(' ') == N.INDEX_NOT_FOUND) { throw new IllegalArgumentException("'" + argNameOrErrorMsg + "' can not be null or empty"); } else { throw new IllegalArgumentException(argNameOrErrorMsg); } } return arg; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "checkArgNotNullOrEmpty", "(", "final", "T", "arg", ",", "final", "String", "argNameOrErrorMsg", ")", "{", "if", "(", "N", ".", "isNullOrEmpty", "(", "arg", ")", ")", "{", "if", "(", "arg...
Checks if the specified {@code arg} is {@code null} or empty, and throws {@code IllegalArgumentException} if it is. @param arg @param argNameOrErrorMsg @throws IllegalArgumentException if the specified {@code arg} is {@code null} or empty.
[ "Checks", "if", "the", "specified", "{", "@code", "arg", "}", "is", "{", "@code", "null", "}", "or", "empty", "and", "throws", "{", "@code", "IllegalArgumentException", "}", "if", "it", "is", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L5578-L5588
jbundle/jcalendarbutton
src/main/java/org/jbundle/util/jcalendarbutton/JTimePopup.java
JTimePopup.createTimePopup
public static JTimePopup createTimePopup(Date dateTarget, Component button) { return JTimePopup.createTimePopup(null, dateTarget, button, null); }
java
public static JTimePopup createTimePopup(Date dateTarget, Component button) { return JTimePopup.createTimePopup(null, dateTarget, button, null); }
[ "public", "static", "JTimePopup", "createTimePopup", "(", "Date", "dateTarget", ",", "Component", "button", ")", "{", "return", "JTimePopup", ".", "createTimePopup", "(", "null", ",", "dateTarget", ",", "button", ",", "null", ")", ";", "}" ]
Create this calendar in a popup menu and synchronize the text field on change. @param dateTarget The initial date for this button. @param button The calling button.
[ "Create", "this", "calendar", "in", "a", "popup", "menu", "and", "synchronize", "the", "text", "field", "on", "change", "." ]
train
https://github.com/jbundle/jcalendarbutton/blob/2944e6a0b634b83768d5c0b7b4a2898176421403/src/main/java/org/jbundle/util/jcalendarbutton/JTimePopup.java#L197-L200
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java
LazyTreeReader.seekToPresentRow
protected void seekToPresentRow(long currentRow) throws IOException { if (currentRow != previousPresentRow + 1) { long rowInStripe = currentRow - rowBaseInStripe - 1; int rowIndexEntry = computeRowIndexEntry(currentRow); if (rowIndexEntry != computeRowIndexEntry(previousPresentRow) || currentRow < previousPresentRow) { // Since we're resetting numNulls we need to seek to the appropriate row not just in the // present stream, but in all streams for the column seek(rowIndexEntry, currentRow < previousPresentRow); numNonNulls = countNonNulls(rowInStripe - (rowIndexEntry * rowIndexStride)); } else { numNonNulls += countNonNulls(currentRow - previousPresentRow - 1); } } // If this is the first row in a row index stride update the number of non-null values to 0 if ((currentRow - rowBaseInStripe - 1) % rowIndexStride == 0) { numNonNulls = 0; } previousPresentRow = currentRow; }
java
protected void seekToPresentRow(long currentRow) throws IOException { if (currentRow != previousPresentRow + 1) { long rowInStripe = currentRow - rowBaseInStripe - 1; int rowIndexEntry = computeRowIndexEntry(currentRow); if (rowIndexEntry != computeRowIndexEntry(previousPresentRow) || currentRow < previousPresentRow) { // Since we're resetting numNulls we need to seek to the appropriate row not just in the // present stream, but in all streams for the column seek(rowIndexEntry, currentRow < previousPresentRow); numNonNulls = countNonNulls(rowInStripe - (rowIndexEntry * rowIndexStride)); } else { numNonNulls += countNonNulls(currentRow - previousPresentRow - 1); } } // If this is the first row in a row index stride update the number of non-null values to 0 if ((currentRow - rowBaseInStripe - 1) % rowIndexStride == 0) { numNonNulls = 0; } previousPresentRow = currentRow; }
[ "protected", "void", "seekToPresentRow", "(", "long", "currentRow", ")", "throws", "IOException", "{", "if", "(", "currentRow", "!=", "previousPresentRow", "+", "1", ")", "{", "long", "rowInStripe", "=", "currentRow", "-", "rowBaseInStripe", "-", "1", ";", "in...
Shifts only the present stream so that next will return the value for currentRow @param currentRow @throws IOException
[ "Shifts", "only", "the", "present", "stream", "so", "that", "next", "will", "return", "the", "value", "for", "currentRow" ]
train
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java#L185-L206
apereo/cas
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/authenticator/OAuth20CasAuthenticationBuilder.java
OAuth20CasAuthenticationBuilder.buildService
public Service buildService(final OAuthRegisteredService registeredService, final J2EContext context, final boolean useServiceHeader) { var id = StringUtils.EMPTY; if (useServiceHeader) { id = OAuth20Utils.getServiceRequestHeaderIfAny(context.getRequest()); LOGGER.debug("Located service based on request header is [{}]", id); } if (StringUtils.isBlank(id)) { id = registeredService.getClientId(); } return webApplicationServiceServiceFactory.createService(id); }
java
public Service buildService(final OAuthRegisteredService registeredService, final J2EContext context, final boolean useServiceHeader) { var id = StringUtils.EMPTY; if (useServiceHeader) { id = OAuth20Utils.getServiceRequestHeaderIfAny(context.getRequest()); LOGGER.debug("Located service based on request header is [{}]", id); } if (StringUtils.isBlank(id)) { id = registeredService.getClientId(); } return webApplicationServiceServiceFactory.createService(id); }
[ "public", "Service", "buildService", "(", "final", "OAuthRegisteredService", "registeredService", ",", "final", "J2EContext", "context", ",", "final", "boolean", "useServiceHeader", ")", "{", "var", "id", "=", "StringUtils", ".", "EMPTY", ";", "if", "(", "useServi...
Build service. @param registeredService the registered service @param context the context @param useServiceHeader the use service header @return the service
[ "Build", "service", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/authenticator/OAuth20CasAuthenticationBuilder.java#L70-L80
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java
IntInterval.evensFromTo
public static IntInterval evensFromTo(int from, int to) { if (from % 2 != 0) { if (from < to) { from++; } else { from--; } } if (to % 2 != 0) { if (to > from) { to--; } else { to++; } } return IntInterval.fromToBy(from, to, to > from ? 2 : -2); }
java
public static IntInterval evensFromTo(int from, int to) { if (from % 2 != 0) { if (from < to) { from++; } else { from--; } } if (to % 2 != 0) { if (to > from) { to--; } else { to++; } } return IntInterval.fromToBy(from, to, to > from ? 2 : -2); }
[ "public", "static", "IntInterval", "evensFromTo", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "from", "%", "2", "!=", "0", ")", "{", "if", "(", "from", "<", "to", ")", "{", "from", "++", ";", "}", "else", "{", "from", "--", ";", ...
Returns an IntInterval representing the even values from the value from to the value to.
[ "Returns", "an", "IntInterval", "representing", "the", "even", "values", "from", "the", "value", "from", "to", "the", "value", "to", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java#L177-L202
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.incidents_GET
public ArrayList<Long> incidents_GET(Date creationDate, Date endDate) throws IOException { String qPath = "/xdsl/incidents"; StringBuilder sb = path(qPath); query(sb, "creationDate", creationDate); query(sb, "endDate", endDate); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t15); }
java
public ArrayList<Long> incidents_GET(Date creationDate, Date endDate) throws IOException { String qPath = "/xdsl/incidents"; StringBuilder sb = path(qPath); query(sb, "creationDate", creationDate); query(sb, "endDate", endDate); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t15); }
[ "public", "ArrayList", "<", "Long", ">", "incidents_GET", "(", "Date", "creationDate", ",", "Date", "endDate", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/incidents\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", ...
List of incidents REST: GET /xdsl/incidents @param creationDate [required] Filter the value of creationDate property (>) @param endDate [required] Filter the value of endDate property (<)
[ "List", "of", "incidents" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1977-L1984
yavijava/yavijava
src/main/java/com/vmware/vim25/mo/VRPResourceManager.java
VRPResourceManager.getChildRPforHub
public ResourcePool getChildRPforHub(String vrpId, ManagedEntity hub) throws InvalidState, NotFound, RuntimeFault, RemoteException { ManagedObjectReference rpMor = getVimService().getChildRPforHub(getMOR(), vrpId, hub.getMOR()); return new ResourcePool(getServerConnection(), rpMor); }
java
public ResourcePool getChildRPforHub(String vrpId, ManagedEntity hub) throws InvalidState, NotFound, RuntimeFault, RemoteException { ManagedObjectReference rpMor = getVimService().getChildRPforHub(getMOR(), vrpId, hub.getMOR()); return new ResourcePool(getServerConnection(), rpMor); }
[ "public", "ResourcePool", "getChildRPforHub", "(", "String", "vrpId", ",", "ManagedEntity", "hub", ")", "throws", "InvalidState", ",", "NotFound", ",", "RuntimeFault", ",", "RemoteException", "{", "ManagedObjectReference", "rpMor", "=", "getVimService", "(", ")", "....
Given the VRP Id and a hub, gets the associated child resource pool. @param vrpId ID of the VRP. @param hub ManagedEntity representing the hub. @return A ResourcePool @throws InvalidState @throws NotFound @throws RuntimeFault @throws RemoteException
[ "Given", "the", "VRP", "Id", "and", "a", "hub", "gets", "the", "associated", "child", "resource", "pool", "." ]
train
https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/VRPResourceManager.java#L106-L109
baratine/baratine
framework/src/main/java/com/caucho/v5/json/ser/JavaSerializerJson.java
JavaSerializerJson.writeFields
private void writeFields(JsonWriterImpl out, Object value) { for (JsonField field : _fields) { field.write(out, value); } }
java
private void writeFields(JsonWriterImpl out, Object value) { for (JsonField field : _fields) { field.write(out, value); } }
[ "private", "void", "writeFields", "(", "JsonWriterImpl", "out", ",", "Object", "value", ")", "{", "for", "(", "JsonField", "field", ":", "_fields", ")", "{", "field", ".", "write", "(", "out", ",", "value", ")", ";", "}", "}" ]
/* @Override public void write(JsonWriter out, String name, Object value) { out.writeStartObject(name); writeFields(out, value); out.writeEnd(); }
[ "/", "*", "@Override", "public", "void", "write", "(", "JsonWriter", "out", "String", "name", "Object", "value", ")", "{", "out", ".", "writeStartObject", "(", "name", ")", ";" ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/json/ser/JavaSerializerJson.java#L210-L215
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java
Disk.createImage
public Operation createImage(String image, String description, OperationOption... options) { ImageInfo imageInfo = ImageInfo.newBuilder(ImageId.of(image), DiskImageConfiguration.of(getDiskId())) .setDescription(description) .build(); return compute.create(imageInfo, options); }
java
public Operation createImage(String image, String description, OperationOption... options) { ImageInfo imageInfo = ImageInfo.newBuilder(ImageId.of(image), DiskImageConfiguration.of(getDiskId())) .setDescription(description) .build(); return compute.create(imageInfo, options); }
[ "public", "Operation", "createImage", "(", "String", "image", ",", "String", "description", ",", "OperationOption", "...", "options", ")", "{", "ImageInfo", "imageInfo", "=", "ImageInfo", ".", "newBuilder", "(", "ImageId", ".", "of", "(", "image", ")", ",", ...
Creates an image for this disk given the image's name and description. @return a global operation if the image creation was successfully requested @throws ComputeException upon failure
[ "Creates", "an", "image", "for", "this", "disk", "given", "the", "image", "s", "name", "and", "description", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java#L204-L210
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ConversationHelperImpl.java
ConversationHelperImpl.requestMoreMessages
public void requestMoreMessages(int receivedBytes, int requestedBytes) throws SIConnectionDroppedException, SIConnectionLostException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "requestMoreMessages", new Object[]{""+receivedBytes, ""+requestedBytes}); if (sessionId == 0) { // If the session Id = 0, then no one called setSessionId(). As such we are unable to flow // to the server as we do not know which session to instruct the server to use. SIErrorException e = new SIErrorException( nls.getFormattedMessage("SESSION_ID_HAS_NOT_BEEN_SET_SICO1043", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".requestMoreMessages", CommsConstants.CONVERSATIONHELPERIMPL_07, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); throw e; } CommsByteBuffer request = getCommsByteBuffer(); // Connection object id request.putShort(connectionObjectId); // Consumer session id request.putShort(sessionId); // Received bytes request.putInt(receivedBytes); // Requested bytes request.putInt(requestedBytes); // Pass on call to server jfapSend(request, JFapChannelConstants.SEG_REQUEST_MSGS, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "requestMoreMessages"); }
java
public void requestMoreMessages(int receivedBytes, int requestedBytes) throws SIConnectionDroppedException, SIConnectionLostException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "requestMoreMessages", new Object[]{""+receivedBytes, ""+requestedBytes}); if (sessionId == 0) { // If the session Id = 0, then no one called setSessionId(). As such we are unable to flow // to the server as we do not know which session to instruct the server to use. SIErrorException e = new SIErrorException( nls.getFormattedMessage("SESSION_ID_HAS_NOT_BEEN_SET_SICO1043", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".requestMoreMessages", CommsConstants.CONVERSATIONHELPERIMPL_07, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); throw e; } CommsByteBuffer request = getCommsByteBuffer(); // Connection object id request.putShort(connectionObjectId); // Consumer session id request.putShort(sessionId); // Received bytes request.putInt(receivedBytes); // Requested bytes request.putInt(requestedBytes); // Pass on call to server jfapSend(request, JFapChannelConstants.SEG_REQUEST_MSGS, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "requestMoreMessages"); }
[ "public", "void", "requestMoreMessages", "(", "int", "receivedBytes", ",", "int", "requestedBytes", ")", "throws", "SIConnectionDroppedException", ",", "SIConnectionLostException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", "."...
Requests more messages (read ahead) @param receivedBytes @param requestedBytes
[ "Requests", "more", "messages", "(", "read", "ahead", ")" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ConversationHelperImpl.java#L549-L589
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.completeCircularPasses
public static int completeCircularPasses(int index, int seqLength) { int count = 0; while (index > seqLength) { count++; index -= seqLength; } return count - 1; }
java
public static int completeCircularPasses(int index, int seqLength) { int count = 0; while (index > seqLength) { count++; index -= seqLength; } return count - 1; }
[ "public", "static", "int", "completeCircularPasses", "(", "int", "index", ",", "int", "seqLength", ")", "{", "int", "count", "=", "0", ";", "while", "(", "index", ">", "seqLength", ")", "{", "count", "++", ";", "index", "-=", "seqLength", ";", "}", "re...
Works in a similar way to modulateCircularLocation but returns the number of complete passes over a Sequence length a circular location makes i.e. if we have a sequence of length 10 and the location 3..52 we make 4 complete passes through the genome to go from position 3 to position 52.
[ "Works", "in", "a", "similar", "way", "to", "modulateCircularLocation", "but", "returns", "the", "number", "of", "complete", "passes", "over", "a", "Sequence", "length", "a", "circular", "location", "makes", "i", ".", "e", ".", "if", "we", "have", "a", "se...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L245-L252
code4everything/util
src/main/java/com/zhazhapan/config/JsonParser.java
JsonParser.containsValue
public boolean containsValue(String path, Object value) { return JSONPath.containsValue(jsonObject, checkPath(path), value); }
java
public boolean containsValue(String path, Object value) { return JSONPath.containsValue(jsonObject, checkPath(path), value); }
[ "public", "boolean", "containsValue", "(", "String", "path", ",", "Object", "value", ")", "{", "return", "JSONPath", ".", "containsValue", "(", "jsonObject", ",", "checkPath", "(", "path", ")", ",", "value", ")", ";", "}" ]
是否包含某个值 @param path <a href= "https://github.com/alibaba/fastjson/wiki/JSONPath">路径语法</a> @param value 值 @return {@link Boolean}
[ "是否包含某个值" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/config/JsonParser.java#L170-L172
google/closure-compiler
src/com/google/javascript/jscomp/graph/LinkedDirectedGraph.java
LinkedDirectedGraph.isConnectedInDirection
@Override public boolean isConnectedInDirection(N n1, N n2) { return isConnectedInDirection(n1, Predicates.<E>alwaysTrue(), n2); }
java
@Override public boolean isConnectedInDirection(N n1, N n2) { return isConnectedInDirection(n1, Predicates.<E>alwaysTrue(), n2); }
[ "@", "Override", "public", "boolean", "isConnectedInDirection", "(", "N", "n1", ",", "N", "n2", ")", "{", "return", "isConnectedInDirection", "(", "n1", ",", "Predicates", ".", "<", "E", ">", "alwaysTrue", "(", ")", ",", "n2", ")", ";", "}" ]
DiGraphNode look ups can be expensive for a large graph operation, prefer the version below that takes DiGraphNodes, if you have them available.
[ "DiGraphNode", "look", "ups", "can", "be", "expensive", "for", "a", "large", "graph", "operation", "prefer", "the", "version", "below", "that", "takes", "DiGraphNodes", "if", "you", "have", "them", "available", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/LinkedDirectedGraph.java#L226-L229
apache/incubator-shardingsphere
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/ShardingRule.java
ShardingRule.isShardingColumn
public boolean isShardingColumn(final String columnName, final String tableName) { for (TableRule each : tableRules) { if (each.getLogicTable().equalsIgnoreCase(tableName) && isShardingColumn(each, columnName)) { return true; } } return false; }
java
public boolean isShardingColumn(final String columnName, final String tableName) { for (TableRule each : tableRules) { if (each.getLogicTable().equalsIgnoreCase(tableName) && isShardingColumn(each, columnName)) { return true; } } return false; }
[ "public", "boolean", "isShardingColumn", "(", "final", "String", "columnName", ",", "final", "String", "tableName", ")", "{", "for", "(", "TableRule", "each", ":", "tableRules", ")", "{", "if", "(", "each", ".", "getLogicTable", "(", ")", ".", "equalsIgnoreC...
Judge is sharding column or not. @param columnName column name @param tableName table name @return is sharding column or not
[ "Judge", "is", "sharding", "column", "or", "not", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/ShardingRule.java#L323-L330
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/SnippetsApi.java
SnippetsApi.getSnippet
public Snippet getSnippet(Integer snippetId, boolean downloadContent) throws GitLabApiException { if (snippetId == null) { throw new RuntimeException("snippetId can't be null"); } Response response = get(Response.Status.OK, null, "snippets", snippetId); Snippet snippet = response.readEntity(Snippet.class); if (downloadContent) { snippet.setContent(getSnippetContent(snippet.getId())); } return snippet; }
java
public Snippet getSnippet(Integer snippetId, boolean downloadContent) throws GitLabApiException { if (snippetId == null) { throw new RuntimeException("snippetId can't be null"); } Response response = get(Response.Status.OK, null, "snippets", snippetId); Snippet snippet = response.readEntity(Snippet.class); if (downloadContent) { snippet.setContent(getSnippetContent(snippet.getId())); } return snippet; }
[ "public", "Snippet", "getSnippet", "(", "Integer", "snippetId", ",", "boolean", "downloadContent", ")", "throws", "GitLabApiException", "{", "if", "(", "snippetId", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"snippetId can't be null\"", ")", ...
Get a specific Snippet. @param snippetId the snippet ID to get @param downloadContent indicating whether to download the snippet content @return the snippet with the given id @throws GitLabApiException if any exception occurs
[ "Get", "a", "specific", "Snippet", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/SnippetsApi.java#L104-L118
telly/groundy
library/src/main/java/com/telly/groundy/TaskResult.java
TaskResult.addIntegerArrayList
public TaskResult addIntegerArrayList(String key, ArrayList<Integer> value) { mBundle.putIntegerArrayList(key, value); return this; }
java
public TaskResult addIntegerArrayList(String key, ArrayList<Integer> value) { mBundle.putIntegerArrayList(key, value); return this; }
[ "public", "TaskResult", "addIntegerArrayList", "(", "String", "key", ",", "ArrayList", "<", "Integer", ">", "value", ")", "{", "mBundle", ".", "putIntegerArrayList", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts an ArrayList<Integer> value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value an ArrayList<Integer> object, or null
[ "Inserts", "an", "ArrayList<Integer", ">", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/TaskResult.java#L227-L230
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/agent/PluginUtils.java
PluginUtils.addInstanceTracking
public static byte[] addInstanceTracking(byte[] bytes, String classToCall) { ClassReader cr = new ClassReader(bytes); ClassVisitingConstructorAppender ca = new ClassVisitingConstructorAppender(classToCall, "recordInstance"); cr.accept(ca, 0); byte[] newbytes = ca.getBytes(); return newbytes; }
java
public static byte[] addInstanceTracking(byte[] bytes, String classToCall) { ClassReader cr = new ClassReader(bytes); ClassVisitingConstructorAppender ca = new ClassVisitingConstructorAppender(classToCall, "recordInstance"); cr.accept(ca, 0); byte[] newbytes = ca.getBytes(); return newbytes; }
[ "public", "static", "byte", "[", "]", "addInstanceTracking", "(", "byte", "[", "]", "bytes", ",", "String", "classToCall", ")", "{", "ClassReader", "cr", "=", "new", "ClassReader", "(", "bytes", ")", ";", "ClassVisitingConstructorAppender", "ca", "=", "new", ...
If adding instance tracking, the classToCall must implement: <tt>public static void recordInstance(Object obj)</tt>. @param bytes the bytes for the class to which instance tracking is being added @param classToCall the class to call when a new instance is created @return the modified bytes for the class
[ "If", "adding", "instance", "tracking", "the", "classToCall", "must", "implement", ":", "<tt", ">", "public", "static", "void", "recordInstance", "(", "Object", "obj", ")", "<", "/", "tt", ">", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/agent/PluginUtils.java#L31-L37
networknt/light-4j
email-sender/src/main/java/com/networknt/email/EmailSender.java
EmailSender.sendMailWithAttachment
public void sendMailWithAttachment (String to, String subject, String content, String filename) throws MessagingException{ Properties props = new Properties(); props.put("mail.smtp.user", emailConfg.getUser()); props.put("mail.smtp.host", emailConfg.getHost()); props.put("mail.smtp.port", emailConfg.getPort()); props.put("mail.smtp.starttls.enable","true"); props.put("mail.smtp.debug", emailConfg.getDebug()); props.put("mail.smtp.auth", emailConfg.getAuth()); props.put("mail.smtp.ssl.trust", emailConfg.host); SMTPAuthenticator auth = new SMTPAuthenticator(emailConfg.getUser(), (String)secret.get(SecretConstants.EMAIL_PASSWORD)); Session session = Session.getInstance(props, auth); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(emailConfg.getUser())); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject(subject); // Create the message part BodyPart messageBodyPart = new MimeBodyPart(); // Now set the actual message messageBodyPart.setText(content); // Create a multipar message Multipart multipart = new MimeMultipart(); // Set text message part multipart.addBodyPart(messageBodyPart); // Part two is attachment messageBodyPart = new MimeBodyPart(); DataSource source = new FileDataSource(filename); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName(filename); multipart.addBodyPart(messageBodyPart); // Send the complete message parts message.setContent(multipart); // Send message Transport.send(message); if(logger.isInfoEnabled()) logger.info("An email has been sent to " + to + " with subject " + subject); }
java
public void sendMailWithAttachment (String to, String subject, String content, String filename) throws MessagingException{ Properties props = new Properties(); props.put("mail.smtp.user", emailConfg.getUser()); props.put("mail.smtp.host", emailConfg.getHost()); props.put("mail.smtp.port", emailConfg.getPort()); props.put("mail.smtp.starttls.enable","true"); props.put("mail.smtp.debug", emailConfg.getDebug()); props.put("mail.smtp.auth", emailConfg.getAuth()); props.put("mail.smtp.ssl.trust", emailConfg.host); SMTPAuthenticator auth = new SMTPAuthenticator(emailConfg.getUser(), (String)secret.get(SecretConstants.EMAIL_PASSWORD)); Session session = Session.getInstance(props, auth); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(emailConfg.getUser())); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject(subject); // Create the message part BodyPart messageBodyPart = new MimeBodyPart(); // Now set the actual message messageBodyPart.setText(content); // Create a multipar message Multipart multipart = new MimeMultipart(); // Set text message part multipart.addBodyPart(messageBodyPart); // Part two is attachment messageBodyPart = new MimeBodyPart(); DataSource source = new FileDataSource(filename); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName(filename); multipart.addBodyPart(messageBodyPart); // Send the complete message parts message.setContent(multipart); // Send message Transport.send(message); if(logger.isInfoEnabled()) logger.info("An email has been sent to " + to + " with subject " + subject); }
[ "public", "void", "sendMailWithAttachment", "(", "String", "to", ",", "String", "subject", ",", "String", "content", ",", "String", "filename", ")", "throws", "MessagingException", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "props", "...
Send email with a string content and attachment @param to destination eamil address @param subject email subject @param content email content @param filename attachment filename @throws MessagingException messaging exception
[ "Send", "email", "with", "a", "string", "content", "and", "attachment" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/email-sender/src/main/java/com/networknt/email/EmailSender.java#L97-L141
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.chflags
public void chflags(String resourcename, int flags) throws CmsException { CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION); getResourceType(resource).chflags(this, m_securityManager, resource, flags); }
java
public void chflags(String resourcename, int flags) throws CmsException { CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION); getResourceType(resource).chflags(this, m_securityManager, resource, flags); }
[ "public", "void", "chflags", "(", "String", "resourcename", ",", "int", "flags", ")", "throws", "CmsException", "{", "CmsResource", "resource", "=", "readResource", "(", "resourcename", ",", "CmsResourceFilter", ".", "IGNORE_EXPIRATION", ")", ";", "getResourceType",...
Changes the resource flags of a resource.<p> The resource flags are used to indicate various "special" conditions for a resource. Most notably, the "internal only" setting which signals that a resource can not be directly requested with it's URL.<p> @param resourcename the name of the resource to change the flags for (full current site relative path) @param flags the new flags for this resource @throws CmsException if something goes wrong
[ "Changes", "the", "resource", "flags", "of", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L478-L482
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/randomizers/range/LongRangeRandomizer.java
LongRangeRandomizer.aNewLongRangeRandomizer
public static LongRangeRandomizer aNewLongRangeRandomizer(final Long min, final Long max, final long seed) { return new LongRangeRandomizer(min, max, seed); }
java
public static LongRangeRandomizer aNewLongRangeRandomizer(final Long min, final Long max, final long seed) { return new LongRangeRandomizer(min, max, seed); }
[ "public", "static", "LongRangeRandomizer", "aNewLongRangeRandomizer", "(", "final", "Long", "min", ",", "final", "Long", "max", ",", "final", "long", "seed", ")", "{", "return", "new", "LongRangeRandomizer", "(", "min", ",", "max", ",", "seed", ")", ";", "}"...
Create a new {@link LongRangeRandomizer}. @param min min value @param max max value @param seed initial seed @return a new {@link LongRangeRandomizer}.
[ "Create", "a", "new", "{", "@link", "LongRangeRandomizer", "}", "." ]
train
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/range/LongRangeRandomizer.java#L73-L75
btrplace/scheduler
api/src/main/java/org/btrplace/plan/event/Action.java
Action.applyEvents
public boolean applyEvents(Hook k, Model i) { for (Event n : getEvents(k)) { if (!n.apply(i)) { return false; } } return true; }
java
public boolean applyEvents(Hook k, Model i) { for (Event n : getEvents(k)) { if (!n.apply(i)) { return false; } } return true; }
[ "public", "boolean", "applyEvents", "(", "Hook", "k", ",", "Model", "i", ")", "{", "for", "(", "Event", "n", ":", "getEvents", "(", "k", ")", ")", "{", "if", "(", "!", "n", ".", "apply", "(", "i", ")", ")", "{", "return", "false", ";", "}", "...
Apply the events attached to a given hook. @param k the hook @param i the model to modify with the application of the events @return {@code true} iff all the events were applied successfully
[ "Apply", "the", "events", "attached", "to", "a", "given", "hook", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/plan/event/Action.java#L107-L114
GoogleCloudPlatform/appengine-mapreduce
java/src/main/java/com/google/appengine/tools/mapreduce/impl/BigQueryMarshallerByType.java
BigQueryMarshallerByType.toBytes
@Override public ByteBuffer toBytes(T object) { if (!type.equals(object.getClass())) { throw new RuntimeException( "The type of the object does not match the parameter type of this marshaller. "); } Map<String, Object> jsonObject = dataMarshaller.mapFieldNameToValue(object); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { objectMapper.writeValue(out, jsonObject); out.write(NEWLINE_CHARACTER.getBytes()); } catch (IOException e) { throw new RuntimeException("Error in serializing to bigquery json " + jsonObject, e); } return ByteBuffer.wrap(out.toByteArray()); }
java
@Override public ByteBuffer toBytes(T object) { if (!type.equals(object.getClass())) { throw new RuntimeException( "The type of the object does not match the parameter type of this marshaller. "); } Map<String, Object> jsonObject = dataMarshaller.mapFieldNameToValue(object); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { objectMapper.writeValue(out, jsonObject); out.write(NEWLINE_CHARACTER.getBytes()); } catch (IOException e) { throw new RuntimeException("Error in serializing to bigquery json " + jsonObject, e); } return ByteBuffer.wrap(out.toByteArray()); }
[ "@", "Override", "public", "ByteBuffer", "toBytes", "(", "T", "object", ")", "{", "if", "(", "!", "type", ".", "equals", "(", "object", ".", "getClass", "(", ")", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"The type of the object does not matc...
Validates that the type of the object to serialize is the same as the type for which schema was generated. The type should match exactly as interface and abstract classes are not supported.
[ "Validates", "that", "the", "type", "of", "the", "object", "to", "serialize", "is", "the", "same", "as", "the", "type", "for", "which", "schema", "was", "generated", ".", "The", "type", "should", "match", "exactly", "as", "interface", "and", "abstract", "c...
train
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/impl/BigQueryMarshallerByType.java#L55-L70
molgenis/molgenis
molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java
SemanticSearchServiceHelper.createDisMaxQueryRuleForTerms
public QueryRule createDisMaxQueryRuleForTerms(List<String> queryTerms) { List<QueryRule> rules = new ArrayList<>(); queryTerms .stream() .filter(StringUtils::isNotEmpty) .map(this::escapeCharsExcludingCaretChar) .forEach( query -> { rules.add(new QueryRule(AttributeMetadata.LABEL, Operator.FUZZY_MATCH, query)); rules.add(new QueryRule(AttributeMetadata.DESCRIPTION, Operator.FUZZY_MATCH, query)); }); QueryRule finalDisMaxQuery = new QueryRule(rules); finalDisMaxQuery.setOperator(Operator.DIS_MAX); return finalDisMaxQuery; }
java
public QueryRule createDisMaxQueryRuleForTerms(List<String> queryTerms) { List<QueryRule> rules = new ArrayList<>(); queryTerms .stream() .filter(StringUtils::isNotEmpty) .map(this::escapeCharsExcludingCaretChar) .forEach( query -> { rules.add(new QueryRule(AttributeMetadata.LABEL, Operator.FUZZY_MATCH, query)); rules.add(new QueryRule(AttributeMetadata.DESCRIPTION, Operator.FUZZY_MATCH, query)); }); QueryRule finalDisMaxQuery = new QueryRule(rules); finalDisMaxQuery.setOperator(Operator.DIS_MAX); return finalDisMaxQuery; }
[ "public", "QueryRule", "createDisMaxQueryRuleForTerms", "(", "List", "<", "String", ">", "queryTerms", ")", "{", "List", "<", "QueryRule", ">", "rules", "=", "new", "ArrayList", "<>", "(", ")", ";", "queryTerms", ".", "stream", "(", ")", ".", "filter", "("...
Create disMaxJunc query rule based a list of queryTerm. All queryTerms are lower cased and stop words are removed @return disMaxJunc queryRule
[ "Create", "disMaxJunc", "query", "rule", "based", "a", "list", "of", "queryTerm", ".", "All", "queryTerms", "are", "lower", "cased", "and", "stop", "words", "are", "removed" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/SemanticSearchServiceHelper.java#L101-L115
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.transformEntries
public static boolean transformEntries(final File zip, final ZipEntryTransformerEntry[] entries) { return operateInPlace(zip, new InPlaceAction() { public boolean act(File tmpFile) { return transformEntries(zip, entries, tmpFile); } }); }
java
public static boolean transformEntries(final File zip, final ZipEntryTransformerEntry[] entries) { return operateInPlace(zip, new InPlaceAction() { public boolean act(File tmpFile) { return transformEntries(zip, entries, tmpFile); } }); }
[ "public", "static", "boolean", "transformEntries", "(", "final", "File", "zip", ",", "final", "ZipEntryTransformerEntry", "[", "]", "entries", ")", "{", "return", "operateInPlace", "(", "zip", ",", "new", "InPlaceAction", "(", ")", "{", "public", "boolean", "a...
Changes an existing ZIP file: transforms a given entries in it. @param zip an existing ZIP file (only read). @param entries ZIP entry transformers. @return <code>true</code> if the entry was replaced.
[ "Changes", "an", "existing", "ZIP", "file", ":", "transforms", "a", "given", "entries", "in", "it", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2874-L2880
alkacon/opencms-core
src/org/opencms/main/OpenCms.java
OpenCms.addCmsEventListener
public static void addCmsEventListener(I_CmsEventListener listener, int[] eventTypes) { OpenCmsCore.getInstance().getEventManager().addCmsEventListener(listener, eventTypes); }
java
public static void addCmsEventListener(I_CmsEventListener listener, int[] eventTypes) { OpenCmsCore.getInstance().getEventManager().addCmsEventListener(listener, eventTypes); }
[ "public", "static", "void", "addCmsEventListener", "(", "I_CmsEventListener", "listener", ",", "int", "[", "]", "eventTypes", ")", "{", "OpenCmsCore", ".", "getInstance", "(", ")", ".", "getEventManager", "(", ")", ".", "addCmsEventListener", "(", "listener", ",...
Add a cms event listener that listens only to particular events.<p> @param listener the listener to add @param eventTypes the events to listen for
[ "Add", "a", "cms", "event", "listener", "that", "listens", "only", "to", "particular", "events", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCms.java#L147-L150
Jasig/uPortal
uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/account/UserAccountHelper.java
UserAccountHelper.fixPortletPath
private String fixPortletPath(HttpServletRequest request, IPortalUrlBuilder urlBuilder) { String path = urlBuilder.getUrlString(); String context = request.getContextPath(); if (StringUtils.isBlank(context)) { context = "/"; } if (!path.startsWith(context + "/f/")) { return path.replaceFirst(context, context + "/f/" + loginPortletFolderName); } return path; }
java
private String fixPortletPath(HttpServletRequest request, IPortalUrlBuilder urlBuilder) { String path = urlBuilder.getUrlString(); String context = request.getContextPath(); if (StringUtils.isBlank(context)) { context = "/"; } if (!path.startsWith(context + "/f/")) { return path.replaceFirst(context, context + "/f/" + loginPortletFolderName); } return path; }
[ "private", "String", "fixPortletPath", "(", "HttpServletRequest", "request", ",", "IPortalUrlBuilder", "urlBuilder", ")", "{", "String", "path", "=", "urlBuilder", ".", "getUrlString", "(", ")", ";", "String", "context", "=", "request", ".", "getContextPath", "(",...
This entire method is a hack! The login portlet URL only seems to load correctly if you pass in the folder name for the guest layout. For the short term, allow configuration of the folder name and manually re-write the URL to include the folder if it doesn't already. <p>This is terrible and needs to go away as soon as I can find a better approach. @param request @param urlBuilder @return
[ "This", "entire", "method", "is", "a", "hack!", "The", "login", "portlet", "URL", "only", "seems", "to", "load", "correctly", "if", "you", "pass", "in", "the", "folder", "name", "for", "the", "guest", "layout", ".", "For", "the", "short", "term", "allow"...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/account/UserAccountHelper.java#L515-L527
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.typeText
public void typeText(EditText editText, String text) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "typeText("+editText+", \""+text+"\")"); } editText = (EditText) waiter.waitForView(editText, Timeout.getSmallTimeout()); textEnterer.typeText(editText, text); }
java
public void typeText(EditText editText, String text) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "typeText("+editText+", \""+text+"\")"); } editText = (EditText) waiter.waitForView(editText, Timeout.getSmallTimeout()); textEnterer.typeText(editText, text); }
[ "public", "void", "typeText", "(", "EditText", "editText", ",", "String", "text", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "commandLoggingTag", ",", "\"typeText(\"", "+", "editText", "+", "\", \\\...
Types text in the specified EditText. @param editText the {@link EditText} to type text in @param text the text to type in the {@link EditText} field
[ "Types", "text", "in", "the", "specified", "EditText", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L2728-L2735
mozilla/rhino
src/org/mozilla/javascript/ScriptableObject.java
ScriptableObject.defineOwnProperties
public void defineOwnProperties(Context cx, ScriptableObject props) { Object[] ids = props.getIds(false, true); ScriptableObject[] descs = new ScriptableObject[ids.length]; for (int i = 0, len = ids.length; i < len; ++i) { Object descObj = ScriptRuntime.getObjectElem(props, ids[i], cx); ScriptableObject desc = ensureScriptableObject(descObj); checkPropertyDefinition(desc); descs[i] = desc; } for (int i = 0, len = ids.length; i < len; ++i) { defineOwnProperty(cx, ids[i], descs[i]); } }
java
public void defineOwnProperties(Context cx, ScriptableObject props) { Object[] ids = props.getIds(false, true); ScriptableObject[] descs = new ScriptableObject[ids.length]; for (int i = 0, len = ids.length; i < len; ++i) { Object descObj = ScriptRuntime.getObjectElem(props, ids[i], cx); ScriptableObject desc = ensureScriptableObject(descObj); checkPropertyDefinition(desc); descs[i] = desc; } for (int i = 0, len = ids.length; i < len; ++i) { defineOwnProperty(cx, ids[i], descs[i]); } }
[ "public", "void", "defineOwnProperties", "(", "Context", "cx", ",", "ScriptableObject", "props", ")", "{", "Object", "[", "]", "ids", "=", "props", ".", "getIds", "(", "false", ",", "true", ")", ";", "ScriptableObject", "[", "]", "descs", "=", "new", "Sc...
Defines one or more properties on this object. @param cx the current Context @param props a map of property ids to property descriptors
[ "Defines", "one", "or", "more", "properties", "on", "this", "object", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L1877-L1889