repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
matthewhorridge/owlexplanation
src/main/java/org/semanticweb/owl/explanation/impl/blackbox/BlackBoxExplanationGenerator.java
BlackBoxExplanationGenerator.getOrderedJustifications
private static <E> List<OWLAxiom> getOrderedJustifications(List<OWLAxiom> mups, final Set<Explanation<E>> allJustifications) { Comparator<OWLAxiom> mupsComparator = new Comparator<OWLAxiom>() { public int compare(OWLAxiom o1, OWLAxiom o2) { // The checker that appears in most MUPS has the lowest index // in the list int occ1 = getOccurrences(o1, allJustifications); int occ2 = getOccurrences(o2, allJustifications); return -occ1 + occ2; } }; Collections.sort(mups, mupsComparator); return mups; }
java
private static <E> List<OWLAxiom> getOrderedJustifications(List<OWLAxiom> mups, final Set<Explanation<E>> allJustifications) { Comparator<OWLAxiom> mupsComparator = new Comparator<OWLAxiom>() { public int compare(OWLAxiom o1, OWLAxiom o2) { // The checker that appears in most MUPS has the lowest index // in the list int occ1 = getOccurrences(o1, allJustifications); int occ2 = getOccurrences(o2, allJustifications); return -occ1 + occ2; } }; Collections.sort(mups, mupsComparator); return mups; }
[ "private", "static", "<", "E", ">", "List", "<", "OWLAxiom", ">", "getOrderedJustifications", "(", "List", "<", "OWLAxiom", ">", "mups", ",", "final", "Set", "<", "Explanation", "<", "E", ">", ">", "allJustifications", ")", "{", "Comparator", "<", "OWLAxio...
Orders the axioms in a single MUPS by the frequency of which they appear in all MUPS. @param mups The MUPS containing the axioms to be ordered @param allJustifications The set of all justifications which is used to calculate the ordering @return The ordered axioms
[ "Orders", "the", "axioms", "in", "a", "single", "MUPS", "by", "the", "frequency", "of", "which", "they", "appear", "in", "all", "MUPS", "." ]
train
https://github.com/matthewhorridge/owlexplanation/blob/439c5ca67835f5e421adde725e4e8a3bcd760ac8/src/main/java/org/semanticweb/owl/explanation/impl/blackbox/BlackBoxExplanationGenerator.java#L279-L291
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateBetween
public static void validateBetween(Number value, Number min, Number max, String errorMsg) throws ValidateException { if (false == isBetween(value, min, max)) { throw new ValidateException(errorMsg); } }
java
public static void validateBetween(Number value, Number min, Number max, String errorMsg) throws ValidateException { if (false == isBetween(value, min, max)) { throw new ValidateException(errorMsg); } }
[ "public", "static", "void", "validateBetween", "(", "Number", "value", ",", "Number", "min", ",", "Number", "max", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isBetween", "(", "value", ",", "min", ",", "ma...
检查给定的数字是否在指定范围内 @param value 值 @param min 最小值(包含) @param max 最大值(包含) @param errorMsg 验证错误的信息 @throws ValidateException 验证异常 @since 4.1.10
[ "检查给定的数字是否在指定范围内" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L1064-L1068
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java
Matrix.setMatrix
public void setMatrix(int[] r, int[] c, Matrix X) { try { for (int i = 0; i < r.length; i++) { for (int j = 0; j < c.length; j++) { A[r[i]][c[j]] = X.get(i, j); } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } }
java
public void setMatrix(int[] r, int[] c, Matrix X) { try { for (int i = 0; i < r.length; i++) { for (int j = 0; j < c.length; j++) { A[r[i]][c[j]] = X.get(i, j); } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } }
[ "public", "void", "setMatrix", "(", "int", "[", "]", "r", ",", "int", "[", "]", "c", ",", "Matrix", "X", ")", "{", "try", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "r", ".", "length", ";", "i", "++", ")", "{", "for", "(", "int...
Set a submatrix. @param r Array of row indices. @param c Array of column indices. @param X A(r(:),c(:)) @throws ArrayIndexOutOfBoundsException Submatrix indices
[ "Set", "a", "submatrix", "." ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L527-L543
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/util/rhino/NodeUtil.java
NodeUtil.moduleDepsFromConfigDeps
public static Node moduleDepsFromConfigDeps(Node cursor, String configVarName) { if (cursor.getType() == Token.STRING && cursor.getString().equals("deps")) { //$NON-NLS-1$ // handle require.deps assignment of array literal Node parent = cursor.getParent(), previousSibling = parent.getChildBefore(cursor); if (previousSibling != null && parent.getType() == Token.GETPROP && parent.getParent().getType() == Token.ASSIGN && (previousSibling.getType() == Token.NAME && previousSibling.getString().equals(configVarName) || previousSibling.getType() == Token.GETPROP && previousSibling.getFirstChild().getNext().getString().equals(configVarName)) && parent.getNext() != null && parent.getNext().getType() == Token.ARRAYLIT) { // require.deps = [...]; return parent.getNext(); } else if (parent.getType() == Token.OBJECTLIT && parent.getParent().getType() == Token.ASSIGN && (parent.getParent().getFirstChild().getType() == Token.NAME && parent.getParent().getFirstChild().getString().equals(configVarName) || parent.getParent().getFirstChild().getType() == Token.GETPROP && parent.getParent().getFirstChild().getFirstChild().getNext().getString().equals(configVarName)) && cursor.getFirstChild() != null && cursor.getFirstChild().getType() == Token.ARRAYLIT) { // require = { deps: [...] } return cursor.getFirstChild(); } else if (parent.getType() == Token.OBJECTLIT && parent.getParent().getType() == Token.NAME && parent.getParent().getString().equals(configVarName) && parent.getParent().getParent().getType() == Token.VAR && cursor.getFirstChild() != null && cursor.getFirstChild().getType() == Token.ARRAYLIT) { // var require = { deps: [...] } return cursor.getFirstChild(); } else if (parent.getType() == Token.OBJECTLIT && parent.getParent().getType() == Token.STRING && parent.getParent().getString().equals(configVarName) && parent.getParent().getParent().getType() == Token.OBJECTLIT && cursor.getFirstChild() != null && cursor.getFirstChild().getType() == Token.ARRAYLIT) { // require: { deps: [...] } return cursor.getFirstChild(); } } return null; }
java
public static Node moduleDepsFromConfigDeps(Node cursor, String configVarName) { if (cursor.getType() == Token.STRING && cursor.getString().equals("deps")) { //$NON-NLS-1$ // handle require.deps assignment of array literal Node parent = cursor.getParent(), previousSibling = parent.getChildBefore(cursor); if (previousSibling != null && parent.getType() == Token.GETPROP && parent.getParent().getType() == Token.ASSIGN && (previousSibling.getType() == Token.NAME && previousSibling.getString().equals(configVarName) || previousSibling.getType() == Token.GETPROP && previousSibling.getFirstChild().getNext().getString().equals(configVarName)) && parent.getNext() != null && parent.getNext().getType() == Token.ARRAYLIT) { // require.deps = [...]; return parent.getNext(); } else if (parent.getType() == Token.OBJECTLIT && parent.getParent().getType() == Token.ASSIGN && (parent.getParent().getFirstChild().getType() == Token.NAME && parent.getParent().getFirstChild().getString().equals(configVarName) || parent.getParent().getFirstChild().getType() == Token.GETPROP && parent.getParent().getFirstChild().getFirstChild().getNext().getString().equals(configVarName)) && cursor.getFirstChild() != null && cursor.getFirstChild().getType() == Token.ARRAYLIT) { // require = { deps: [...] } return cursor.getFirstChild(); } else if (parent.getType() == Token.OBJECTLIT && parent.getParent().getType() == Token.NAME && parent.getParent().getString().equals(configVarName) && parent.getParent().getParent().getType() == Token.VAR && cursor.getFirstChild() != null && cursor.getFirstChild().getType() == Token.ARRAYLIT) { // var require = { deps: [...] } return cursor.getFirstChild(); } else if (parent.getType() == Token.OBJECTLIT && parent.getParent().getType() == Token.STRING && parent.getParent().getString().equals(configVarName) && parent.getParent().getParent().getType() == Token.OBJECTLIT && cursor.getFirstChild() != null && cursor.getFirstChild().getType() == Token.ARRAYLIT) { // require: { deps: [...] } return cursor.getFirstChild(); } } return null; }
[ "public", "static", "Node", "moduleDepsFromConfigDeps", "(", "Node", "cursor", ",", "String", "configVarName", ")", "{", "if", "(", "cursor", ".", "getType", "(", ")", "==", "Token", ".", "STRING", "&&", "cursor", ".", "getString", "(", ")", ".", "equals",...
If the specified node is for a property named 'deps' and the property is a member of the object identified by <code>configVarName</code>, and the 'deps' property is being assigned an array literal, then return the node for the array literal, else return null. <p> For example, if <code>configVarName</code> is <code>require</code> and the specified node is for the 'deps' property in <code>require.deps = ["foo", "bar"];</code>, then this method will return the node for the array. Various flavors of the assignment are supported. @param cursor the node for the 'deps' property. @param configVarName The name of the object containing the 'deps' property. @return the node for the array being assigned to the 'deps' property, or null.
[ "If", "the", "specified", "node", "is", "for", "a", "property", "named", "deps", "and", "the", "property", "is", "a", "member", "of", "the", "object", "identified", "by", "<code", ">", "configVarName<", "/", "code", ">", "and", "the", "deps", "property", ...
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/rhino/NodeUtil.java#L145-L190
line/armeria
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerRpcClient.java
CircuitBreakerRpcClient.newDecorator
public static Function<Client<RpcRequest, RpcResponse>, CircuitBreakerRpcClient> newDecorator(CircuitBreaker circuitBreaker, CircuitBreakerStrategyWithContent<RpcResponse> strategy) { return newDecorator((ctx, req) -> circuitBreaker, strategy); }
java
public static Function<Client<RpcRequest, RpcResponse>, CircuitBreakerRpcClient> newDecorator(CircuitBreaker circuitBreaker, CircuitBreakerStrategyWithContent<RpcResponse> strategy) { return newDecorator((ctx, req) -> circuitBreaker, strategy); }
[ "public", "static", "Function", "<", "Client", "<", "RpcRequest", ",", "RpcResponse", ">", ",", "CircuitBreakerRpcClient", ">", "newDecorator", "(", "CircuitBreaker", "circuitBreaker", ",", "CircuitBreakerStrategyWithContent", "<", "RpcResponse", ">", "strategy", ")", ...
Creates a new decorator using the specified {@link CircuitBreaker} instance and {@link CircuitBreakerStrategy}. <p>Since {@link CircuitBreaker} is a unit of failure detection, don't reuse the same instance for unrelated services. @param circuitBreaker The {@link CircuitBreaker} instance to be used
[ "Creates", "a", "new", "decorator", "using", "the", "specified", "{", "@link", "CircuitBreaker", "}", "instance", "and", "{", "@link", "CircuitBreakerStrategy", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerRpcClient.java#L42-L45
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFileAttributes.java
SftpFileAttributes.setTimes
public void setTimes(UnsignedInteger64 atime, UnsignedInteger64 mtime) { this.atime = atime; this.mtime = mtime; // Set the flag if (atime != null) { flags |= SSH_FILEXFER_ATTR_ACCESSTIME; } else { flags ^= SSH_FILEXFER_ATTR_ACCESSTIME; } }
java
public void setTimes(UnsignedInteger64 atime, UnsignedInteger64 mtime) { this.atime = atime; this.mtime = mtime; // Set the flag if (atime != null) { flags |= SSH_FILEXFER_ATTR_ACCESSTIME; } else { flags ^= SSH_FILEXFER_ATTR_ACCESSTIME; } }
[ "public", "void", "setTimes", "(", "UnsignedInteger64", "atime", ",", "UnsignedInteger64", "mtime", ")", "{", "this", ".", "atime", "=", "atime", ";", "this", ".", "mtime", "=", "mtime", ";", "// Set the flag", "if", "(", "atime", "!=", "null", ")", "{", ...
Set the last access and last modified times. These times are represented by integers containing the number of seconds from Jan 1, 1970 UTC. NOTE: You should divide any value returned from Java's System.currentTimeMillis() method by 1000 to set the correct times as this returns the time in milliseconds from Jan 1, 1970 UTC. @param atime @param mtime
[ "Set", "the", "last", "access", "and", "last", "modified", "times", ".", "These", "times", "are", "represented", "by", "integers", "containing", "the", "number", "of", "seconds", "from", "Jan", "1", "1970", "UTC", ".", "NOTE", ":", "You", "should", "divide...
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFileAttributes.java#L556-L566
jcuda/jcuda
JCudaJava/src/main/java/jcuda/cuComplex.java
cuComplex.cuCdiv
public static cuComplex cuCdiv (cuComplex x, cuComplex y) { cuComplex quot; float s = ((float)Math.abs(cuCreal(y))) + ((float)Math.abs(cuCimag(y))); float oos = 1.0f / s; float ars = cuCreal(x) * oos; float ais = cuCimag(x) * oos; float brs = cuCreal(y) * oos; float bis = cuCimag(y) * oos; s = (brs * brs) + (bis * bis); oos = 1.0f / s; quot = cuCmplx (((ars * brs) + (ais * bis)) * oos, ((ais * brs) - (ars * bis)) * oos); return quot; }
java
public static cuComplex cuCdiv (cuComplex x, cuComplex y) { cuComplex quot; float s = ((float)Math.abs(cuCreal(y))) + ((float)Math.abs(cuCimag(y))); float oos = 1.0f / s; float ars = cuCreal(x) * oos; float ais = cuCimag(x) * oos; float brs = cuCreal(y) * oos; float bis = cuCimag(y) * oos; s = (brs * brs) + (bis * bis); oos = 1.0f / s; quot = cuCmplx (((ars * brs) + (ais * bis)) * oos, ((ais * brs) - (ars * bis)) * oos); return quot; }
[ "public", "static", "cuComplex", "cuCdiv", "(", "cuComplex", "x", ",", "cuComplex", "y", ")", "{", "cuComplex", "quot", ";", "float", "s", "=", "(", "(", "float", ")", "Math", ".", "abs", "(", "cuCreal", "(", "y", ")", ")", ")", "+", "(", "(", "f...
Returns the quotient of the given complex numbers.<br /> <br /> Original comment:<br /> <br /> This implementation guards against intermediate underflow and overflow by scaling. Such guarded implementations are usually the default for complex library implementations, with some also offering an unguarded, faster version. @param x The dividend @param y The divisor @return The quotient of the given complex numbers
[ "Returns", "the", "quotient", "of", "the", "given", "complex", "numbers", ".", "<br", "/", ">", "<br", "/", ">", "Original", "comment", ":", "<br", "/", ">", "<br", "/", ">", "This", "implementation", "guards", "against", "intermediate", "underflow", "and"...
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/cuComplex.java#L144-L158
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.fireControlRelease
private void fireControlRelease(int index, int controllerIndex) { consumed = false; for (int i=0;i<controllerListeners.size();i++) { ControllerListener listener = (ControllerListener) controllerListeners.get(i); if (listener.isAcceptingInput()) { switch (index) { case LEFT: listener.controllerLeftReleased(controllerIndex); break; case RIGHT: listener.controllerRightReleased(controllerIndex); break; case UP: listener.controllerUpReleased(controllerIndex); break; case DOWN: listener.controllerDownReleased(controllerIndex); break; default: // assume button release listener.controllerButtonReleased(controllerIndex, (index - BUTTON1) + 1); break; } if (consumed) { break; } } } }
java
private void fireControlRelease(int index, int controllerIndex) { consumed = false; for (int i=0;i<controllerListeners.size();i++) { ControllerListener listener = (ControllerListener) controllerListeners.get(i); if (listener.isAcceptingInput()) { switch (index) { case LEFT: listener.controllerLeftReleased(controllerIndex); break; case RIGHT: listener.controllerRightReleased(controllerIndex); break; case UP: listener.controllerUpReleased(controllerIndex); break; case DOWN: listener.controllerDownReleased(controllerIndex); break; default: // assume button release listener.controllerButtonReleased(controllerIndex, (index - BUTTON1) + 1); break; } if (consumed) { break; } } } }
[ "private", "void", "fireControlRelease", "(", "int", "index", ",", "int", "controllerIndex", ")", "{", "consumed", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "controllerListeners", ".", "size", "(", ")", ";", "i", "++", ")", ...
Fire an event indicating that a control has been released @param index The index of the control released @param controllerIndex The index of the controller on which the control was released
[ "Fire", "an", "event", "indicating", "that", "a", "control", "has", "been", "released" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L1439-L1467
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java
WebhooksInner.listEventsAsync
public Observable<Page<EventInner>> listEventsAsync(final String resourceGroupName, final String registryName, final String webhookName) { return listEventsWithServiceResponseAsync(resourceGroupName, registryName, webhookName) .map(new Func1<ServiceResponse<Page<EventInner>>, Page<EventInner>>() { @Override public Page<EventInner> call(ServiceResponse<Page<EventInner>> response) { return response.body(); } }); }
java
public Observable<Page<EventInner>> listEventsAsync(final String resourceGroupName, final String registryName, final String webhookName) { return listEventsWithServiceResponseAsync(resourceGroupName, registryName, webhookName) .map(new Func1<ServiceResponse<Page<EventInner>>, Page<EventInner>>() { @Override public Page<EventInner> call(ServiceResponse<Page<EventInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "EventInner", ">", ">", "listEventsAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "registryName", ",", "final", "String", "webhookName", ")", "{", "return", "listEventsWithServiceResponseAsync", ...
Lists recent events for the specified webhook. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param webhookName The name of the webhook. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;EventInner&gt; object
[ "Lists", "recent", "events", "for", "the", "specified", "webhook", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java#L1097-L1105
Talend/tesb-rt-se
locator-service/locator-rest-service/src/main/java/org/talend/esb/locator/service/rest/LocatorRestServiceImpl.java
LocatorRestServiceImpl.registerEndpoint
public void registerEndpoint(RegisterEndpointRequest arg0) { String endpointURL = arg0.getEndpointURL(); QName serviceName = QName.valueOf(arg0.getServiceName()); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Registering endpoint " + endpointURL + " for service " + serviceName + "..."); } try { initLocator(); BindingType bindingType = arg0.getBinding() == null ? BindingType.OTHER : BindingType .valueOf(arg0.getBinding().value()); TransportType transportType = arg0.getTransport() == null ? TransportType.OTHER : TransportType.valueOf(arg0.getTransport().value()); SLPropertiesImpl slProps = null; if (!arg0.getEntryType().isEmpty()) { slProps = new SLPropertiesImpl(); List<EntryType> entries = arg0.getEntryType(); for (EntryType entry : entries) { slProps.addProperty(entry.getKey(), entry.getValue()); } } Endpoint simpleEndpoint = new SimpleEndpoint(serviceName, endpointURL, bindingType, transportType, slProps); locatorClient.register(simpleEndpoint, true); } catch (ServiceLocatorException e) { // throw new ServiceLocatorFault(e.getMessage(), e); throw new WebApplicationException(Response .status(Status.INTERNAL_SERVER_ERROR) .entity(e.getMessage()).build()); } catch (InterruptedException e) { // throw new InterruptedExceptionFault(e.getMessage(), e); throw new WebApplicationException(Response .status(Status.INTERNAL_SERVER_ERROR) .entity(e.getMessage()).build()); } }
java
public void registerEndpoint(RegisterEndpointRequest arg0) { String endpointURL = arg0.getEndpointURL(); QName serviceName = QName.valueOf(arg0.getServiceName()); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Registering endpoint " + endpointURL + " for service " + serviceName + "..."); } try { initLocator(); BindingType bindingType = arg0.getBinding() == null ? BindingType.OTHER : BindingType .valueOf(arg0.getBinding().value()); TransportType transportType = arg0.getTransport() == null ? TransportType.OTHER : TransportType.valueOf(arg0.getTransport().value()); SLPropertiesImpl slProps = null; if (!arg0.getEntryType().isEmpty()) { slProps = new SLPropertiesImpl(); List<EntryType> entries = arg0.getEntryType(); for (EntryType entry : entries) { slProps.addProperty(entry.getKey(), entry.getValue()); } } Endpoint simpleEndpoint = new SimpleEndpoint(serviceName, endpointURL, bindingType, transportType, slProps); locatorClient.register(simpleEndpoint, true); } catch (ServiceLocatorException e) { // throw new ServiceLocatorFault(e.getMessage(), e); throw new WebApplicationException(Response .status(Status.INTERNAL_SERVER_ERROR) .entity(e.getMessage()).build()); } catch (InterruptedException e) { // throw new InterruptedExceptionFault(e.getMessage(), e); throw new WebApplicationException(Response .status(Status.INTERNAL_SERVER_ERROR) .entity(e.getMessage()).build()); } }
[ "public", "void", "registerEndpoint", "(", "RegisterEndpointRequest", "arg0", ")", "{", "String", "endpointURL", "=", "arg0", ".", "getEndpointURL", "(", ")", ";", "QName", "serviceName", "=", "QName", ".", "valueOf", "(", "arg0", ".", "getServiceName", "(", "...
Register the endpoint for given service. @param input RegisterEndpointRequestType encapsulate name of service and endpointURL. Must not be <code>null</code>
[ "Register", "the", "endpoint", "for", "given", "service", "." ]
train
https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/locator-service/locator-rest-service/src/main/java/org/talend/esb/locator/service/rest/LocatorRestServiceImpl.java#L175-L210
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/Environment.java
Environment.doHttpGet
public HttpResponse doHttpGet(String url, Map<String, Object> headers, boolean followRedirect) { HttpResponse response = new HttpResponse(); doGet(url, response, headers, followRedirect); return response; }
java
public HttpResponse doHttpGet(String url, Map<String, Object> headers, boolean followRedirect) { HttpResponse response = new HttpResponse(); doGet(url, response, headers, followRedirect); return response; }
[ "public", "HttpResponse", "doHttpGet", "(", "String", "url", ",", "Map", "<", "String", ",", "Object", ">", "headers", ",", "boolean", "followRedirect", ")", "{", "HttpResponse", "response", "=", "new", "HttpResponse", "(", ")", ";", "doGet", "(", "url", "...
GETs content from URL. @param url url to get from. @param headers headers to add @return response.
[ "GETs", "content", "from", "URL", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L354-L358
Waikato/moa
moa/src/main/java/moa/clusterers/clustree/ClusKernel.java
ClusKernel.makeOlder
protected void makeOlder(long timeDifference, double negLambda) { if (timeDifference == 0) { return; } //double weightFactor = AuxiliaryFunctions.weight(negLambda, timeDifference); assert (negLambda < 0); assert (timeDifference > 0); double weightFactor = Math.pow(2.0, negLambda * timeDifference); this.N *= weightFactor; for (int i = 0; i < LS.length; i++) { LS[i] *= weightFactor; SS[i] *= weightFactor; } }
java
protected void makeOlder(long timeDifference, double negLambda) { if (timeDifference == 0) { return; } //double weightFactor = AuxiliaryFunctions.weight(negLambda, timeDifference); assert (negLambda < 0); assert (timeDifference > 0); double weightFactor = Math.pow(2.0, negLambda * timeDifference); this.N *= weightFactor; for (int i = 0; i < LS.length; i++) { LS[i] *= weightFactor; SS[i] *= weightFactor; } }
[ "protected", "void", "makeOlder", "(", "long", "timeDifference", ",", "double", "negLambda", ")", "{", "if", "(", "timeDifference", "==", "0", ")", "{", "return", ";", "}", "//double weightFactor = AuxiliaryFunctions.weight(negLambda, timeDifference);", "assert", "(", ...
Make this cluster older. This means multiplying weighted N, LS and SS with a weight factor given by the time difference and the parameter negLambda. @param timeDifference The time elapsed between this current update and the last one. @param negLambda
[ "Make", "this", "cluster", "older", ".", "This", "means", "multiplying", "weighted", "N", "LS", "and", "SS", "with", "a", "weight", "factor", "given", "by", "the", "time", "difference", "and", "the", "parameter", "negLambda", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/clustree/ClusKernel.java#L114-L129
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java
Shape.getOffset
public static long getOffset(IntBuffer shapeInformation, int dim0, int dim1, int dim2) { int rank = rank(shapeInformation); if (rank != 3) throw new IllegalArgumentException( "Cannot use this getOffset method on arrays of rank != 3 (rank is: " + rank + ")"); long offset = 0; int size_0 = size(shapeInformation, 0); int size_1 = size(shapeInformation, 1); int size_2 = size(shapeInformation, 2); if (dim0 >= size_0 || dim1 >= size_1 || dim2 >= size_2) throw new IllegalArgumentException("Invalid indices: cannot get [" + dim0 + "," + dim1 + "," + dim2 + "] from a " + Arrays.toString(shape(shapeInformation)) + " NDArray"); if (size_0 != 1) offset += dim0 * stride(shapeInformation, 0); if (size_1 != 1) offset += dim1 * stride(shapeInformation, 1); if (size_2 != 1) offset += dim2 * stride(shapeInformation, 2); return offset; }
java
public static long getOffset(IntBuffer shapeInformation, int dim0, int dim1, int dim2) { int rank = rank(shapeInformation); if (rank != 3) throw new IllegalArgumentException( "Cannot use this getOffset method on arrays of rank != 3 (rank is: " + rank + ")"); long offset = 0; int size_0 = size(shapeInformation, 0); int size_1 = size(shapeInformation, 1); int size_2 = size(shapeInformation, 2); if (dim0 >= size_0 || dim1 >= size_1 || dim2 >= size_2) throw new IllegalArgumentException("Invalid indices: cannot get [" + dim0 + "," + dim1 + "," + dim2 + "] from a " + Arrays.toString(shape(shapeInformation)) + " NDArray"); if (size_0 != 1) offset += dim0 * stride(shapeInformation, 0); if (size_1 != 1) offset += dim1 * stride(shapeInformation, 1); if (size_2 != 1) offset += dim2 * stride(shapeInformation, 2); return offset; }
[ "public", "static", "long", "getOffset", "(", "IntBuffer", "shapeInformation", ",", "int", "dim0", ",", "int", "dim1", ",", "int", "dim2", ")", "{", "int", "rank", "=", "rank", "(", "shapeInformation", ")", ";", "if", "(", "rank", "!=", "3", ")", "thro...
Get the offset of the specified [dim0,dim1,dim2] for the 3d array @param shapeInformation Shape information @param dim0 Row index to get the offset for @param dim1 Column index to get the offset for @param dim2 dimension 2 index to get the offset for @return Buffer offset
[ "Get", "the", "offset", "of", "the", "specified", "[", "dim0", "dim1", "dim2", "]", "for", "the", "3d", "array" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L1086-L1107
lawloretienne/ImageGallery
library/src/main/java/com/etiennelawlor/imagegallery/library/ui/TouchImageView.java
TouchImageView.transformCoordTouchToBitmap
private PointF transformCoordTouchToBitmap(float x, float y, boolean clipToBitmap) { matrix.getValues(m); float origW = getDrawable().getIntrinsicWidth(); float origH = getDrawable().getIntrinsicHeight(); float transX = m[Matrix.MTRANS_X]; float transY = m[Matrix.MTRANS_Y]; float finalX = ((x - transX) * origW) / getImageWidth(); float finalY = ((y - transY) * origH) / getImageHeight(); if (clipToBitmap) { finalX = Math.min(Math.max(finalX, 0), origW); finalY = Math.min(Math.max(finalY, 0), origH); } return new PointF(finalX, finalY); }
java
private PointF transformCoordTouchToBitmap(float x, float y, boolean clipToBitmap) { matrix.getValues(m); float origW = getDrawable().getIntrinsicWidth(); float origH = getDrawable().getIntrinsicHeight(); float transX = m[Matrix.MTRANS_X]; float transY = m[Matrix.MTRANS_Y]; float finalX = ((x - transX) * origW) / getImageWidth(); float finalY = ((y - transY) * origH) / getImageHeight(); if (clipToBitmap) { finalX = Math.min(Math.max(finalX, 0), origW); finalY = Math.min(Math.max(finalY, 0), origH); } return new PointF(finalX, finalY); }
[ "private", "PointF", "transformCoordTouchToBitmap", "(", "float", "x", ",", "float", "y", ",", "boolean", "clipToBitmap", ")", "{", "matrix", ".", "getValues", "(", "m", ")", ";", "float", "origW", "=", "getDrawable", "(", ")", ".", "getIntrinsicWidth", "(",...
This function will transform the coordinates in the touch event to the coordinate system of the drawable that the imageview contain @param x x-coordinate of touch event @param y y-coordinate of touch event @param clipToBitmap Touch event may occur within view, but outside image content. True, to clip return value to the bounds of the bitmap size. @return Coordinates of the point touched, in the coordinate system of the original drawable.
[ "This", "function", "will", "transform", "the", "coordinates", "in", "the", "touch", "event", "to", "the", "coordinate", "system", "of", "the", "drawable", "that", "the", "imageview", "contain" ]
train
https://github.com/lawloretienne/ImageGallery/blob/960d68dfb2b81d05322a576723ac4f090e10eda7/library/src/main/java/com/etiennelawlor/imagegallery/library/ui/TouchImageView.java#L1077-L1092
foundation-runtime/logging
logging-log4j/src/main/java/com/cisco/oss/foundation/logging/LoggingHelper.java
LoggingHelper.formatConnectionEstablishmentMessage
public static String formatConnectionEstablishmentMessage(final String connectionName, final String host, final String connectionReason) { return CON_ESTABLISHMENT_FORMAT.format(new Object[] { connectionName, host, connectionReason }); }
java
public static String formatConnectionEstablishmentMessage(final String connectionName, final String host, final String connectionReason) { return CON_ESTABLISHMENT_FORMAT.format(new Object[] { connectionName, host, connectionReason }); }
[ "public", "static", "String", "formatConnectionEstablishmentMessage", "(", "final", "String", "connectionName", ",", "final", "String", "host", ",", "final", "String", "connectionReason", ")", "{", "return", "CON_ESTABLISHMENT_FORMAT", ".", "format", "(", "new", "Obje...
Helper method for formatting connection establishment messages. @param connectionName The name of the connection @param host The remote host @param connectionReason The reason for establishing the connection @return A formatted message in the format: "[&lt;connectionName&gt;] remote host[&lt;host&gt;] &lt;connectionReason&gt;" <br/> e.g. [con1] remote host[123.123.123.123] connection to ECMG.
[ "Helper", "method", "for", "formatting", "connection", "establishment", "messages", "." ]
train
https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/LoggingHelper.java#L465-L467
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java
Uris.toRawString
public static String toRawString(final URI uri, final boolean strict) throws NormalizationException { final StringBuffer sb = new StringBuffer(getScheme(uri)).append("://"); if (hasUserInfo(uri)) { sb.append(getRawUserInfo(uri)).append('@'); } sb.append(getHost(uri)).append(':').append(getPort(uri)).append(getRawPath(uri, strict)); if (hasQuery(uri)) { sb.append('?').append(getRawQuery(uri, strict)); } if (hasFragment(uri)) { sb.append('#').append(getRawFragment(uri, strict)); } return sb.toString(); }
java
public static String toRawString(final URI uri, final boolean strict) throws NormalizationException { final StringBuffer sb = new StringBuffer(getScheme(uri)).append("://"); if (hasUserInfo(uri)) { sb.append(getRawUserInfo(uri)).append('@'); } sb.append(getHost(uri)).append(':').append(getPort(uri)).append(getRawPath(uri, strict)); if (hasQuery(uri)) { sb.append('?').append(getRawQuery(uri, strict)); } if (hasFragment(uri)) { sb.append('#').append(getRawFragment(uri, strict)); } return sb.toString(); }
[ "public", "static", "String", "toRawString", "(", "final", "URI", "uri", ",", "final", "boolean", "strict", ")", "throws", "NormalizationException", "{", "final", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "getScheme", "(", "uri", ")", ")", ".", ...
Returns the entire URL as a string with its raw components normalized @param uri the URI to convert @param strict whether or not to do strict escaping @return the raw string representation of the URI @throws NormalizationException if the given URI doesn't meet our stricter restrictions
[ "Returns", "the", "entire", "URL", "as", "a", "string", "with", "its", "raw", "components", "normalized" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L285-L298
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listWebWorkerMetricDefinitionsAsync
public Observable<Page<ResourceMetricDefinitionInner>> listWebWorkerMetricDefinitionsAsync(final String resourceGroupName, final String name, final String workerPoolName) { return listWebWorkerMetricDefinitionsWithServiceResponseAsync(resourceGroupName, name, workerPoolName) .map(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Page<ResourceMetricDefinitionInner>>() { @Override public Page<ResourceMetricDefinitionInner> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> response) { return response.body(); } }); }
java
public Observable<Page<ResourceMetricDefinitionInner>> listWebWorkerMetricDefinitionsAsync(final String resourceGroupName, final String name, final String workerPoolName) { return listWebWorkerMetricDefinitionsWithServiceResponseAsync(resourceGroupName, name, workerPoolName) .map(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Page<ResourceMetricDefinitionInner>>() { @Override public Page<ResourceMetricDefinitionInner> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ResourceMetricDefinitionInner", ">", ">", "listWebWorkerMetricDefinitionsAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ",", "final", "String", "workerPoolName", ")", "{", "return", "list...
Get metric definitions for a worker pool of an App Service Environment. Get metric definitions for a worker pool of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param workerPoolName Name of the worker pool. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceMetricDefinitionInner&gt; object
[ "Get", "metric", "definitions", "for", "a", "worker", "pool", "of", "an", "App", "Service", "Environment", ".", "Get", "metric", "definitions", "for", "a", "worker", "pool", "of", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5975-L5983
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy2.java
Hierarchy2.findExactMethod
public static XMethod findExactMethod(InvokeInstruction inv, ConstantPoolGen cpg, JavaClassAndMethodChooser chooser) { String className = inv.getClassName(cpg); String methodName = inv.getName(cpg); String methodSig = inv.getSignature(cpg); XMethod result = findMethod(DescriptorFactory.createClassDescriptorFromDottedClassName(className), methodName, methodSig, inv instanceof INVOKESTATIC); return thisOrNothing(result, chooser); }
java
public static XMethod findExactMethod(InvokeInstruction inv, ConstantPoolGen cpg, JavaClassAndMethodChooser chooser) { String className = inv.getClassName(cpg); String methodName = inv.getName(cpg); String methodSig = inv.getSignature(cpg); XMethod result = findMethod(DescriptorFactory.createClassDescriptorFromDottedClassName(className), methodName, methodSig, inv instanceof INVOKESTATIC); return thisOrNothing(result, chooser); }
[ "public", "static", "XMethod", "findExactMethod", "(", "InvokeInstruction", "inv", ",", "ConstantPoolGen", "cpg", ",", "JavaClassAndMethodChooser", "chooser", ")", "{", "String", "className", "=", "inv", ".", "getClassName", "(", "cpg", ")", ";", "String", "method...
Look up the method referenced by given InvokeInstruction. This method does <em>not</em> look for implementations in super or subclasses according to the virtual dispatch rules. @param inv the InvokeInstruction @param cpg the ConstantPoolGen used by the class the InvokeInstruction belongs to @param chooser JavaClassAndMethodChooser to use to pick the method from among the candidates @return the JavaClassAndMethod, or null if no such method is defined in the class
[ "Look", "up", "the", "method", "referenced", "by", "given", "InvokeInstruction", ".", "This", "method", "does", "<em", ">", "not<", "/", "em", ">", "look", "for", "implementations", "in", "super", "or", "subclasses", "according", "to", "the", "virtual", "dis...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy2.java#L85-L95
apiman/apiman
gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/AbstractMappedPolicy.java
AbstractMappedPolicy.doApply
protected void doApply(ApiResponse response, IPolicyContext context, C config, IPolicyChain<ApiResponse> chain) { chain.doApply(response); }
java
protected void doApply(ApiResponse response, IPolicyContext context, C config, IPolicyChain<ApiResponse> chain) { chain.doApply(response); }
[ "protected", "void", "doApply", "(", "ApiResponse", "response", ",", "IPolicyContext", "context", ",", "C", "config", ",", "IPolicyChain", "<", "ApiResponse", ">", "chain", ")", "{", "chain", ".", "doApply", "(", "response", ")", ";", "}" ]
Apply the policy to the response. @param response @param context @param config @param chain
[ "Apply", "the", "policy", "to", "the", "response", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/AbstractMappedPolicy.java#L101-L103
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java
DateFormatSymbols.setLeapMonthPattern
@Deprecated public void setLeapMonthPattern(String leapMonthPattern, int context, int width) { if (leapMonthPatterns != null) { int leapMonthPatternIndex = -1; switch (context) { case FORMAT : switch(width) { case WIDE : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_WIDE; break; case ABBREVIATED : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV; break; case NARROW : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_NARROW; break; default : // HANDLE SHORT, etc. break; } break; case STANDALONE : switch(width) { case WIDE : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_STANDALONE_WIDE; break; case ABBREVIATED : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV; break; case NARROW : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_STANDALONE_NARROW; break; default : // HANDLE SHORT, etc. break; } break; case NUMERIC : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_NUMERIC; break; default : break; } if (leapMonthPatternIndex >= 0) { leapMonthPatterns[leapMonthPatternIndex] = leapMonthPattern; } } }
java
@Deprecated public void setLeapMonthPattern(String leapMonthPattern, int context, int width) { if (leapMonthPatterns != null) { int leapMonthPatternIndex = -1; switch (context) { case FORMAT : switch(width) { case WIDE : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_WIDE; break; case ABBREVIATED : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV; break; case NARROW : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_NARROW; break; default : // HANDLE SHORT, etc. break; } break; case STANDALONE : switch(width) { case WIDE : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_STANDALONE_WIDE; break; case ABBREVIATED : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV; break; case NARROW : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_STANDALONE_NARROW; break; default : // HANDLE SHORT, etc. break; } break; case NUMERIC : leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_NUMERIC; break; default : break; } if (leapMonthPatternIndex >= 0) { leapMonthPatterns[leapMonthPatternIndex] = leapMonthPattern; } } }
[ "@", "Deprecated", "public", "void", "setLeapMonthPattern", "(", "String", "leapMonthPattern", ",", "int", "context", ",", "int", "width", ")", "{", "if", "(", "leapMonthPatterns", "!=", "null", ")", "{", "int", "leapMonthPatternIndex", "=", "-", "1", ";", "...
Sets a leapMonthPattern, for example: "{0}bis" @param leapMonthPattern The new leapMonthPattern. @param context The usage context: FORMAT, STANDALONE, NUMERIC. @param width The name width: WIDE, ABBREVIATED, NARROW. @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Sets", "a", "leapMonthPattern", "for", "example", ":", "{", "0", "}", "bis" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java#L1219-L1264
projectodd/wunderboss-release
web/src/main/java/org/projectodd/wunderboss/web/async/OutputStreamHttpChannel.java
OutputStreamHttpChannel.send
@Override public synchronized boolean send(final Object message, final boolean shouldClose, final OnComplete onComplete) throws IOException { if (!isOpen()) { return false; } this.sendQueued = true; byte[] data; if (message == null) { data = null; } else if (message instanceof String) { data = ((String)message).getBytes(getResponseCharset()); } else if (message instanceof byte[]) { data = (byte[])message; } else { throw WebsocketUtil.wrongMessageType(message.getClass()); } enqueue(new PendingSend(data, shouldClose, onComplete)); return true; }
java
@Override public synchronized boolean send(final Object message, final boolean shouldClose, final OnComplete onComplete) throws IOException { if (!isOpen()) { return false; } this.sendQueued = true; byte[] data; if (message == null) { data = null; } else if (message instanceof String) { data = ((String)message).getBytes(getResponseCharset()); } else if (message instanceof byte[]) { data = (byte[])message; } else { throw WebsocketUtil.wrongMessageType(message.getClass()); } enqueue(new PendingSend(data, shouldClose, onComplete)); return true; }
[ "@", "Override", "public", "synchronized", "boolean", "send", "(", "final", "Object", "message", ",", "final", "boolean", "shouldClose", ",", "final", "OnComplete", "onComplete", ")", "throws", "IOException", "{", "if", "(", "!", "isOpen", "(", ")", ")", "{"...
message must be String or byte[]. Allowing Object makes life easier from clojure
[ "message", "must", "be", "String", "or", "byte", "[]", ".", "Allowing", "Object", "makes", "life", "easier", "from", "clojure" ]
train
https://github.com/projectodd/wunderboss-release/blob/f67c68e80c5798169e3a9b2015e278239dbf005d/web/src/main/java/org/projectodd/wunderboss/web/async/OutputStreamHttpChannel.java#L93-L117
redkale/redkale
src/org/redkale/util/Utility.java
Utility.createAsyncHandler
public static <V> CompletionHandler<V, Void> createAsyncHandler(final Consumer<V> success, final Consumer<Throwable> fail) { return new CompletionHandler<V, Void>() { @Override public void completed(V result, Void attachment) { if (success != null) success.accept(result); } @Override public void failed(Throwable exc, Void attachment) { if (fail != null) fail.accept(exc); } }; }
java
public static <V> CompletionHandler<V, Void> createAsyncHandler(final Consumer<V> success, final Consumer<Throwable> fail) { return new CompletionHandler<V, Void>() { @Override public void completed(V result, Void attachment) { if (success != null) success.accept(result); } @Override public void failed(Throwable exc, Void attachment) { if (fail != null) fail.accept(exc); } }; }
[ "public", "static", "<", "V", ">", "CompletionHandler", "<", "V", ",", "Void", ">", "createAsyncHandler", "(", "final", "Consumer", "<", "V", ">", "success", ",", "final", "Consumer", "<", "Throwable", ">", "fail", ")", "{", "return", "new", "CompletionHan...
创建没有附件对象的 CompletionHandler 对象 @param <V> 结果对象的泛型 @param success 成功的回调函数 @param fail 失败的回调函数 @return CompletionHandler
[ "创建没有附件对象的", "CompletionHandler", "对象" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/util/Utility.java#L931-L943
cdk/cdk
tool/group/src/main/java/org/openscience/cdk/group/PermutationGroup.java
PermutationGroup.makeSymN
public static PermutationGroup makeSymN(int size) { List<Permutation> generators = new ArrayList<Permutation>(); // p1 is (0, 1) int[] p1 = new int[size]; p1[0] = 1; p1[1] = 0; for (int i = 2; i < size; i++) { p1[i] = i; } // p2 is (1, 2, ...., n, 0) int[] p2 = new int[size]; p2[0] = 1; for (int i = 1; i < size - 1; i++) { p2[i] = i + 1; } p2[size - 1] = 0; generators.add(new Permutation(p1)); generators.add(new Permutation(p2)); return new PermutationGroup(size, generators); }
java
public static PermutationGroup makeSymN(int size) { List<Permutation> generators = new ArrayList<Permutation>(); // p1 is (0, 1) int[] p1 = new int[size]; p1[0] = 1; p1[1] = 0; for (int i = 2; i < size; i++) { p1[i] = i; } // p2 is (1, 2, ...., n, 0) int[] p2 = new int[size]; p2[0] = 1; for (int i = 1; i < size - 1; i++) { p2[i] = i + 1; } p2[size - 1] = 0; generators.add(new Permutation(p1)); generators.add(new Permutation(p2)); return new PermutationGroup(size, generators); }
[ "public", "static", "PermutationGroup", "makeSymN", "(", "int", "size", ")", "{", "List", "<", "Permutation", ">", "generators", "=", "new", "ArrayList", "<", "Permutation", ">", "(", ")", ";", "// p1 is (0, 1)", "int", "[", "]", "p1", "=", "new", "int", ...
Make the symmetric group Sym(N) for N. That is, a group of permutations that represents _all_ permutations of size N. @param size the size of the permutation @return a group for all permutations of N
[ "Make", "the", "symmetric", "group", "Sym", "(", "N", ")", "for", "N", ".", "That", "is", "a", "group", "of", "permutations", "that", "represents", "_all_", "permutations", "of", "size", "N", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/group/src/main/java/org/openscience/cdk/group/PermutationGroup.java#L159-L182
Netflix/conductor
core/src/main/java/com/netflix/conductor/core/events/EventProcessor.java
EventProcessor.executeEvent
private List<EventExecution> executeEvent(String event, Message msg) throws Exception { List<EventHandler> eventHandlerList = metadataService.getEventHandlersForEvent(event, true); Object payloadObject = getPayloadObject(msg.getPayload()); List<EventExecution> transientFailures = new ArrayList<>(); for (EventHandler eventHandler : eventHandlerList) { String condition = eventHandler.getCondition(); if (StringUtils.isNotEmpty(condition)) { logger.debug("Checking condition: {} for event: {}", condition, event); Boolean success = ScriptEvaluator.evalBool(condition, jsonUtils.expand(payloadObject)); if (!success) { String id = msg.getId() + "_" + 0; EventExecution eventExecution = new EventExecution(id, msg.getId()); eventExecution.setCreated(System.currentTimeMillis()); eventExecution.setEvent(eventHandler.getEvent()); eventExecution.setName(eventHandler.getName()); eventExecution.setStatus(Status.SKIPPED); eventExecution.getOutput().put("msg", msg.getPayload()); eventExecution.getOutput().put("condition", condition); executionService.addEventExecution(eventExecution); logger.debug("Condition: {} not successful for event: {} with payload: {}", condition, eventHandler.getEvent(), msg.getPayload()); continue; } } CompletableFuture<List<EventExecution>> future = executeActionsForEventHandler(eventHandler, msg); future.whenComplete((result, error) -> result.forEach(eventExecution -> { if (error != null || eventExecution.getStatus() == Status.IN_PROGRESS) { executionService.removeEventExecution(eventExecution); transientFailures.add(eventExecution); } else { executionService.updateEventExecution(eventExecution); } })).get(); } return transientFailures; }
java
private List<EventExecution> executeEvent(String event, Message msg) throws Exception { List<EventHandler> eventHandlerList = metadataService.getEventHandlersForEvent(event, true); Object payloadObject = getPayloadObject(msg.getPayload()); List<EventExecution> transientFailures = new ArrayList<>(); for (EventHandler eventHandler : eventHandlerList) { String condition = eventHandler.getCondition(); if (StringUtils.isNotEmpty(condition)) { logger.debug("Checking condition: {} for event: {}", condition, event); Boolean success = ScriptEvaluator.evalBool(condition, jsonUtils.expand(payloadObject)); if (!success) { String id = msg.getId() + "_" + 0; EventExecution eventExecution = new EventExecution(id, msg.getId()); eventExecution.setCreated(System.currentTimeMillis()); eventExecution.setEvent(eventHandler.getEvent()); eventExecution.setName(eventHandler.getName()); eventExecution.setStatus(Status.SKIPPED); eventExecution.getOutput().put("msg", msg.getPayload()); eventExecution.getOutput().put("condition", condition); executionService.addEventExecution(eventExecution); logger.debug("Condition: {} not successful for event: {} with payload: {}", condition, eventHandler.getEvent(), msg.getPayload()); continue; } } CompletableFuture<List<EventExecution>> future = executeActionsForEventHandler(eventHandler, msg); future.whenComplete((result, error) -> result.forEach(eventExecution -> { if (error != null || eventExecution.getStatus() == Status.IN_PROGRESS) { executionService.removeEventExecution(eventExecution); transientFailures.add(eventExecution); } else { executionService.updateEventExecution(eventExecution); } })).get(); } return transientFailures; }
[ "private", "List", "<", "EventExecution", ">", "executeEvent", "(", "String", "event", ",", "Message", "msg", ")", "throws", "Exception", "{", "List", "<", "EventHandler", ">", "eventHandlerList", "=", "metadataService", ".", "getEventHandlersForEvent", "(", "even...
Executes all the actions configured on all the event handlers triggered by the {@link Message} on the queue If any of the actions on an event handler fails due to a transient failure, the execution is not persisted such that it can be retried @return a list of {@link EventExecution} that failed due to transient failures.
[ "Executes", "all", "the", "actions", "configured", "on", "all", "the", "event", "handlers", "triggered", "by", "the", "{", "@link", "Message", "}", "on", "the", "queue", "If", "any", "of", "the", "actions", "on", "an", "event", "handler", "fails", "due", ...
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/core/events/EventProcessor.java#L174-L210
line/armeria
core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
ServerBuilder.withVirtualHost
public ChainedVirtualHostBuilder withVirtualHost(String hostnamePattern) { final ChainedVirtualHostBuilder virtualHostBuilder = new ChainedVirtualHostBuilder(hostnamePattern, this); virtualHostBuilders.add(virtualHostBuilder); return virtualHostBuilder; }
java
public ChainedVirtualHostBuilder withVirtualHost(String hostnamePattern) { final ChainedVirtualHostBuilder virtualHostBuilder = new ChainedVirtualHostBuilder(hostnamePattern, this); virtualHostBuilders.add(virtualHostBuilder); return virtualHostBuilder; }
[ "public", "ChainedVirtualHostBuilder", "withVirtualHost", "(", "String", "hostnamePattern", ")", "{", "final", "ChainedVirtualHostBuilder", "virtualHostBuilder", "=", "new", "ChainedVirtualHostBuilder", "(", "hostnamePattern", ",", "this", ")", ";", "virtualHostBuilders", "...
Adds the <a href="https://en.wikipedia.org/wiki/Virtual_hosting#Name-based">name-based virtual host</a> specified by {@link VirtualHost}. @param hostnamePattern virtual host name regular expression @return {@link VirtualHostBuilder} for build the virtual host
[ "Adds", "the", "<a", "href", "=", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Virtual_hosting#Name", "-", "based", ">", "name", "-", "based", "virtual", "host<", "/", "a", ">", "specified", "by", "{", "@link", "VirtualHos...
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L1153-L1158
ModeShape/modeshape
index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/client/EsRequest.java
EsRequest.put
public void put(String name, Object[] values) { if (values instanceof EsRequest[]) { Object[] docs = new Object[values.length]; for (int i = 0; i < docs.length; i++) { docs[i] = ((EsRequest)values[i]).document; } document.setArray(name, docs); } else { document.setArray(name, values); } }
java
public void put(String name, Object[] values) { if (values instanceof EsRequest[]) { Object[] docs = new Object[values.length]; for (int i = 0; i < docs.length; i++) { docs[i] = ((EsRequest)values[i]).document; } document.setArray(name, docs); } else { document.setArray(name, values); } }
[ "public", "void", "put", "(", "String", "name", ",", "Object", "[", "]", "values", ")", "{", "if", "(", "values", "instanceof", "EsRequest", "[", "]", ")", "{", "Object", "[", "]", "docs", "=", "new", "Object", "[", "values", ".", "length", "]", ";...
Adds multivalued property value. @param name property name. @param value property values.
[ "Adds", "multivalued", "property", "value", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/client/EsRequest.java#L70-L80
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/cli/CliOptions.java
CliOptions.parseArgs
public static Properties parseArgs(Class<?> caller, String[] args) throws IOException { try { // Parse command-line options CommandLine cmd = new DefaultParser().parse(options(), args); if (cmd.hasOption(HELP_OPTION.getOpt())) { printUsage(caller); System.exit(0); } if (!cmd.hasOption(SYS_CONFIG_OPTION.getLongOpt()) || !cmd.hasOption(JOB_CONFIG_OPTION.getLongOpt())) { printUsage(caller); System.exit(1); } // Load system and job configuration properties Properties sysConfig = JobConfigurationUtils.fileToProperties(cmd.getOptionValue(SYS_CONFIG_OPTION.getLongOpt())); Properties jobConfig = JobConfigurationUtils.fileToProperties(cmd.getOptionValue(JOB_CONFIG_OPTION.getLongOpt())); return JobConfigurationUtils.combineSysAndJobProperties(sysConfig, jobConfig); } catch (ParseException | ConfigurationException e) { throw new IOException(e); } }
java
public static Properties parseArgs(Class<?> caller, String[] args) throws IOException { try { // Parse command-line options CommandLine cmd = new DefaultParser().parse(options(), args); if (cmd.hasOption(HELP_OPTION.getOpt())) { printUsage(caller); System.exit(0); } if (!cmd.hasOption(SYS_CONFIG_OPTION.getLongOpt()) || !cmd.hasOption(JOB_CONFIG_OPTION.getLongOpt())) { printUsage(caller); System.exit(1); } // Load system and job configuration properties Properties sysConfig = JobConfigurationUtils.fileToProperties(cmd.getOptionValue(SYS_CONFIG_OPTION.getLongOpt())); Properties jobConfig = JobConfigurationUtils.fileToProperties(cmd.getOptionValue(JOB_CONFIG_OPTION.getLongOpt())); return JobConfigurationUtils.combineSysAndJobProperties(sysConfig, jobConfig); } catch (ParseException | ConfigurationException e) { throw new IOException(e); } }
[ "public", "static", "Properties", "parseArgs", "(", "Class", "<", "?", ">", "caller", ",", "String", "[", "]", "args", ")", "throws", "IOException", "{", "try", "{", "// Parse command-line options", "CommandLine", "cmd", "=", "new", "DefaultParser", "(", ")", ...
Parse command line arguments and return a {@link java.util.Properties} object for the gobblin job found. @param caller Class of the calling main method. Used for error logs. @param args Command line arguments. @return Instance of {@link Properties} for the Gobblin job to run. @throws IOException
[ "Parse", "command", "line", "arguments", "and", "return", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/cli/CliOptions.java#L53-L76
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/util/TableUtils.java
TableUtils.createTableIfNotExists
public static final boolean createTableIfNotExists(final AmazonDynamoDB dynamo, final CreateTableRequest createTableRequest) { try { dynamo.createTable(createTableRequest); return true; } catch (final ResourceInUseException e) { if (LOG.isTraceEnabled()) { LOG.trace("Table " + createTableRequest.getTableName() + " already exists", e); } } return false; }
java
public static final boolean createTableIfNotExists(final AmazonDynamoDB dynamo, final CreateTableRequest createTableRequest) { try { dynamo.createTable(createTableRequest); return true; } catch (final ResourceInUseException e) { if (LOG.isTraceEnabled()) { LOG.trace("Table " + createTableRequest.getTableName() + " already exists", e); } } return false; }
[ "public", "static", "final", "boolean", "createTableIfNotExists", "(", "final", "AmazonDynamoDB", "dynamo", ",", "final", "CreateTableRequest", "createTableRequest", ")", "{", "try", "{", "dynamo", ".", "createTable", "(", "createTableRequest", ")", ";", "return", "...
Creates the table and ignores any errors if it already exists. @param dynamo The Dynamo client to use. @param createTableRequest The create table request. @return True if created, false otherwise.
[ "Creates", "the", "table", "and", "ignores", "any", "errors", "if", "it", "already", "exists", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/util/TableUtils.java#L233-L243
sarl/sarl
docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/SarlDoclet.java
SarlDoclet.validOptions
public static boolean validOptions(String[][] options, DocErrorReporter reporter) { return SARL_DOCLET.configuration.validOptions(options, reporter); }
java
public static boolean validOptions(String[][] options, DocErrorReporter reporter) { return SARL_DOCLET.configuration.validOptions(options, reporter); }
[ "public", "static", "boolean", "validOptions", "(", "String", "[", "]", "[", "]", "options", ",", "DocErrorReporter", "reporter", ")", "{", "return", "SARL_DOCLET", ".", "configuration", ".", "validOptions", "(", "options", ",", "reporter", ")", ";", "}" ]
Validate the given options. @param options the options to validate, which their parameters. @param reporter the receiver of errors. @return the validation status.
[ "Validate", "the", "given", "options", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/SarlDoclet.java#L104-L106
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/Tr.java
Tr.formatMessage
public static final String formatMessage(TraceComponent tc, List<Locale> locales, String msgKey, Object... objs) { // WsLogRecord.createWsLogRecord + BaseTraceService.formatMessage // The best odds for finding the resource bundle are with using the // classloader that loaded the associated class to begin with. Start // there. ResourceBundle rb; String msg; try { rb = TraceNLSResolver.getInstance().getResourceBundle(tc.getTraceClass(), tc.getResourceBundleName(), locales); msg = rb.getString(msgKey); } catch (Exception ex) { // no FFDC required msg = msgKey; } if (msg.contains("{0")) { return MessageFormat.format(msg, objs); } return msg; }
java
public static final String formatMessage(TraceComponent tc, List<Locale> locales, String msgKey, Object... objs) { // WsLogRecord.createWsLogRecord + BaseTraceService.formatMessage // The best odds for finding the resource bundle are with using the // classloader that loaded the associated class to begin with. Start // there. ResourceBundle rb; String msg; try { rb = TraceNLSResolver.getInstance().getResourceBundle(tc.getTraceClass(), tc.getResourceBundleName(), locales); msg = rb.getString(msgKey); } catch (Exception ex) { // no FFDC required msg = msgKey; } if (msg.contains("{0")) { return MessageFormat.format(msg, objs); } return msg; }
[ "public", "static", "final", "String", "formatMessage", "(", "TraceComponent", "tc", ",", "List", "<", "Locale", ">", "locales", ",", "String", "msgKey", ",", "Object", "...", "objs", ")", "{", "// WsLogRecord.createWsLogRecord + BaseTraceService.formatMessage", "// T...
Translate a message in the context of the input trace component. This method is typically used to provide translated messages that might help resolve an exception that is surfaced to a user. @param tc the non-null <code>TraceComponent</code> of the message @param locales the possible locales to use for translation. Locales from the front of the list are preferred over Locales from the back of the list. If the list is null or empty, the default Locale will be used. @param msgKey the message key identifying an NLS message for this event. This message must be in the resource bundle currently associated with the <code>TraceComponent</code>. @param objs a number of <code>Objects</code> to include as substitution text in the message. The number of objects passed must equal the number of substitution parameters the message expects. Null is tolerated. @return the translated message
[ "Translate", "a", "message", "in", "the", "context", "of", "the", "input", "trace", "component", ".", "This", "method", "is", "typically", "used", "to", "provide", "translated", "messages", "that", "might", "help", "resolve", "an", "exception", "that", "is", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/Tr.java#L723-L744
JodaOrg/joda-time
src/main/java/org/joda/time/field/ImpreciseDateTimeField.java
ImpreciseDateTimeField.getDifferenceAsLong
public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) { if (minuendInstant < subtrahendInstant) { return -getDifferenceAsLong(subtrahendInstant, minuendInstant); } long difference = (minuendInstant - subtrahendInstant) / iUnitMillis; if (add(subtrahendInstant, difference) < minuendInstant) { do { difference++; } while (add(subtrahendInstant, difference) <= minuendInstant); difference--; } else if (add(subtrahendInstant, difference) > minuendInstant) { do { difference--; } while (add(subtrahendInstant, difference) > minuendInstant); } return difference; }
java
public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) { if (minuendInstant < subtrahendInstant) { return -getDifferenceAsLong(subtrahendInstant, minuendInstant); } long difference = (minuendInstant - subtrahendInstant) / iUnitMillis; if (add(subtrahendInstant, difference) < minuendInstant) { do { difference++; } while (add(subtrahendInstant, difference) <= minuendInstant); difference--; } else if (add(subtrahendInstant, difference) > minuendInstant) { do { difference--; } while (add(subtrahendInstant, difference) > minuendInstant); } return difference; }
[ "public", "long", "getDifferenceAsLong", "(", "long", "minuendInstant", ",", "long", "subtrahendInstant", ")", "{", "if", "(", "minuendInstant", "<", "subtrahendInstant", ")", "{", "return", "-", "getDifferenceAsLong", "(", "subtrahendInstant", ",", "minuendInstant", ...
Computes the difference between two instants, as measured in the units of this field. Any fractional units are dropped from the result. Calling getDifference reverses the effect of calling add. In the following code: <pre> long instant = ... long v = ... long age = getDifferenceAsLong(add(instant, v), instant); </pre> The value 'age' is the same as the value 'v'. <p> The default implementation performs a guess-and-check algorithm using getDurationField().getUnitMillis() and the add() method. Subclasses are encouraged to provide a more efficient implementation. @param minuendInstant the milliseconds from 1970-01-01T00:00:00Z to subtract from @param subtrahendInstant the milliseconds from 1970-01-01T00:00:00Z to subtract off the minuend @return the difference in the units of this field
[ "Computes", "the", "difference", "between", "two", "instants", "as", "measured", "in", "the", "units", "of", "this", "field", ".", "Any", "fractional", "units", "are", "dropped", "from", "the", "result", ".", "Calling", "getDifference", "reverses", "the", "eff...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/field/ImpreciseDateTimeField.java#L118-L135
infinispan/infinispan
query/src/main/java/org/infinispan/query/backend/KeyTransformationHandler.java
KeyTransformationHandler.registerTransformer
public void registerTransformer(Class<?> keyClass, Class<? extends Transformer> transformerClass) { transformerTypes.put(keyClass, transformerClass); }
java
public void registerTransformer(Class<?> keyClass, Class<? extends Transformer> transformerClass) { transformerTypes.put(keyClass, transformerClass); }
[ "public", "void", "registerTransformer", "(", "Class", "<", "?", ">", "keyClass", ",", "Class", "<", "?", "extends", "Transformer", ">", "transformerClass", ")", "{", "transformerTypes", ".", "put", "(", "keyClass", ",", "transformerClass", ")", ";", "}" ]
Registers a {@link org.infinispan.query.Transformer} for the supplied key class. @param keyClass the key class for which the supplied transformerClass should be used @param transformerClass the transformer class to use for the supplied key class
[ "Registers", "a", "{", "@link", "org", ".", "infinispan", ".", "query", ".", "Transformer", "}", "for", "the", "supplied", "key", "class", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query/src/main/java/org/infinispan/query/backend/KeyTransformationHandler.java#L213-L215
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/configuration/JspConfiguration.java
JspConfiguration.createClonedJspConfiguration
public JspConfiguration createClonedJspConfiguration() { return new JspConfiguration(configManager, this.getServletVersion(), this.jspVersion, this.isXml, this.isXmlSpecified, this.elIgnored, this.scriptingInvalid(), this.isTrimDirectiveWhitespaces(), this.isDeferredSyntaxAllowedAsLiteral(), this.getTrimDirectiveWhitespaces(), this.getDeferredSyntaxAllowedAsLiteral(), this.elIgnoredSetTrueInPropGrp(), this.elIgnoredSetTrueInPage(), this.getDefaultContentType(), this.getBuffer(), this.isErrorOnUndeclaredNamespace()); }
java
public JspConfiguration createClonedJspConfiguration() { return new JspConfiguration(configManager, this.getServletVersion(), this.jspVersion, this.isXml, this.isXmlSpecified, this.elIgnored, this.scriptingInvalid(), this.isTrimDirectiveWhitespaces(), this.isDeferredSyntaxAllowedAsLiteral(), this.getTrimDirectiveWhitespaces(), this.getDeferredSyntaxAllowedAsLiteral(), this.elIgnoredSetTrueInPropGrp(), this.elIgnoredSetTrueInPage(), this.getDefaultContentType(), this.getBuffer(), this.isErrorOnUndeclaredNamespace()); }
[ "public", "JspConfiguration", "createClonedJspConfiguration", "(", ")", "{", "return", "new", "JspConfiguration", "(", "configManager", ",", "this", ".", "getServletVersion", "(", ")", ",", "this", ".", "jspVersion", ",", "this", ".", "isXml", ",", "this", ".", ...
This method is used for creating a configuration for a tag file. The tag file may want to override some properties if it's jsp version in the tld is different than the server version
[ "This", "method", "is", "used", "for", "creating", "a", "configuration", "for", "a", "tag", "file", ".", "The", "tag", "file", "may", "want", "to", "override", "some", "properties", "if", "it", "s", "jsp", "version", "in", "the", "tld", "is", "different"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/configuration/JspConfiguration.java#L118-L120
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/graphics/GraphicUtils.java
GraphicUtils.filterColor
public static int filterColor(int color, Filter filter) { if (filter == Filter.NONE) { return color; } int a = color >>> 24; int r = (color >> 16) & 0xFF; int g = (color >> 8) & 0xFF; int b = color & 0xFF; switch (filter) { case GRAYSCALE: r = g = b = (int) (0.213f * r + 0.715f * g + 0.072f * b); break; case GRAYSCALE_INVERT: r = g = b = 255 - (int) (0.213f * r + 0.715f * g + 0.072f * b); break; case INVERT: r = 255 - r; g = 255 - g; b = 255 - b; break; } return (a << 24) | (r << 16) | (g << 8) | b; }
java
public static int filterColor(int color, Filter filter) { if (filter == Filter.NONE) { return color; } int a = color >>> 24; int r = (color >> 16) & 0xFF; int g = (color >> 8) & 0xFF; int b = color & 0xFF; switch (filter) { case GRAYSCALE: r = g = b = (int) (0.213f * r + 0.715f * g + 0.072f * b); break; case GRAYSCALE_INVERT: r = g = b = 255 - (int) (0.213f * r + 0.715f * g + 0.072f * b); break; case INVERT: r = 255 - r; g = 255 - g; b = 255 - b; break; } return (a << 24) | (r << 16) | (g << 8) | b; }
[ "public", "static", "int", "filterColor", "(", "int", "color", ",", "Filter", "filter", ")", "{", "if", "(", "filter", "==", "Filter", ".", "NONE", ")", "{", "return", "color", ";", "}", "int", "a", "=", "color", ">>>", "24", ";", "int", "r", "=", ...
Color filtering. @param color color value in layout 0xAARRGGBB. @param filter filter to apply on the color. @return the filtered color.
[ "Color", "filtering", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/graphics/GraphicUtils.java#L30-L52
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java
ArgumentAttr.processArg
@SuppressWarnings("unchecked") <T extends JCExpression, Z extends ArgumentType<T>> void processArg(T that, Function<T, Z> argumentTypeFactory) { UniquePos pos = new UniquePos(that); processArg(that, () -> { T speculativeTree = (T)deferredAttr.attribSpeculative(that, env, attr.new MethodAttrInfo() { @Override protected boolean needsArgumentAttr(JCTree tree) { return !new UniquePos(tree).equals(pos); } }); return argumentTypeFactory.apply(speculativeTree); }); }
java
@SuppressWarnings("unchecked") <T extends JCExpression, Z extends ArgumentType<T>> void processArg(T that, Function<T, Z> argumentTypeFactory) { UniquePos pos = new UniquePos(that); processArg(that, () -> { T speculativeTree = (T)deferredAttr.attribSpeculative(that, env, attr.new MethodAttrInfo() { @Override protected boolean needsArgumentAttr(JCTree tree) { return !new UniquePos(tree).equals(pos); } }); return argumentTypeFactory.apply(speculativeTree); }); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "<", "T", "extends", "JCExpression", ",", "Z", "extends", "ArgumentType", "<", "T", ">", ">", "void", "processArg", "(", "T", "that", ",", "Function", "<", "T", ",", "Z", ">", "argumentTypeFactory", ")", ...
Process a method argument; this method takes care of performing a speculative pass over the argument tree and calling a well-defined entry point to build the argument type associated with such tree.
[ "Process", "a", "method", "argument", ";", "this", "method", "takes", "care", "of", "performing", "a", "speculative", "pass", "over", "the", "argument", "tree", "and", "calling", "a", "well", "-", "defined", "entry", "point", "to", "build", "the", "argument"...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java#L212-L224
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.startsWithIgnoreCase
public static boolean startsWithIgnoreCase(final String base, final String start) { if (base.length() < start.length()) { return false; } return base.regionMatches(true, 0, start, 0, start.length()); }
java
public static boolean startsWithIgnoreCase(final String base, final String start) { if (base.length() < start.length()) { return false; } return base.regionMatches(true, 0, start, 0, start.length()); }
[ "public", "static", "boolean", "startsWithIgnoreCase", "(", "final", "String", "base", ",", "final", "String", "start", ")", "{", "if", "(", "base", ".", "length", "(", ")", "<", "start", ".", "length", "(", ")", ")", "{", "return", "false", ";", "}", ...
Helper functions to query a strings start portion. The comparison is case insensitive. @param base the base string. @param start the starting text. @return true, if the string starts with the given starting text.
[ "Helper", "functions", "to", "query", "a", "strings", "start", "portion", ".", "The", "comparison", "is", "case", "insensitive", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L889-L894
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/Util.java
Util.mkString
public static String mkString(@javax.annotation.Nonnull final String separator, final String... strs) { return Arrays.asList(strs).stream().collect(Collectors.joining(separator)); }
java
public static String mkString(@javax.annotation.Nonnull final String separator, final String... strs) { return Arrays.asList(strs).stream().collect(Collectors.joining(separator)); }
[ "public", "static", "String", "mkString", "(", "@", "javax", ".", "annotation", ".", "Nonnull", "final", "String", "separator", ",", "final", "String", "...", "strs", ")", "{", "return", "Arrays", ".", "asList", "(", "strs", ")", ".", "stream", "(", ")",...
Mk string string. @param separator the separator @param strs the strs @return the string
[ "Mk", "string", "string", "." ]
train
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/Util.java#L345-L347
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_publicFolder_path_permission_allowedAccountId_GET
public OvhExchangePublicFolderPermission organizationName_service_exchangeService_publicFolder_path_permission_allowedAccountId_GET(String organizationName, String exchangeService, String path, Long allowedAccountId) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}/permission/{allowedAccountId}"; StringBuilder sb = path(qPath, organizationName, exchangeService, path, allowedAccountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExchangePublicFolderPermission.class); }
java
public OvhExchangePublicFolderPermission organizationName_service_exchangeService_publicFolder_path_permission_allowedAccountId_GET(String organizationName, String exchangeService, String path, Long allowedAccountId) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}/permission/{allowedAccountId}"; StringBuilder sb = path(qPath, organizationName, exchangeService, path, allowedAccountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExchangePublicFolderPermission.class); }
[ "public", "OvhExchangePublicFolderPermission", "organizationName_service_exchangeService_publicFolder_path_permission_allowedAccountId_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "path", ",", "Long", "allowedAccountId", ")", "throws", "...
Get this object properties REST: GET /email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}/permission/{allowedAccountId} @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param path [required] Path for public folder @param allowedAccountId [required] Account id
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L248-L253
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionRelPersistenceImpl.java
CPDefinitionOptionRelPersistenceImpl.findAll
@Override public List<CPDefinitionOptionRel> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CPDefinitionOptionRel> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CPDefinitionOptionRel", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the cp definition option rels. @return the cp definition option rels
[ "Returns", "all", "the", "cp", "definition", "option", "rels", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionRelPersistenceImpl.java#L4572-L4575
rhuss/jolokia
agent/core/src/main/java/org/jolokia/detector/ServerHandle.java
ServerHandle.getDetectorOptions
protected JSONObject getDetectorOptions(Configuration pConfig, LogHandler pLogHandler) { String options = pConfig.get(ConfigKey.DETECTOR_OPTIONS); try { if (options != null) { JSONObject opts = (JSONObject) new JSONParser().parse(options); return (JSONObject) opts.get(getProduct()); } return null; } catch (ParseException e) { pLogHandler.error("Could not parse detector options '" + options + "' as JSON object: " + e,e); } return null; }
java
protected JSONObject getDetectorOptions(Configuration pConfig, LogHandler pLogHandler) { String options = pConfig.get(ConfigKey.DETECTOR_OPTIONS); try { if (options != null) { JSONObject opts = (JSONObject) new JSONParser().parse(options); return (JSONObject) opts.get(getProduct()); } return null; } catch (ParseException e) { pLogHandler.error("Could not parse detector options '" + options + "' as JSON object: " + e,e); } return null; }
[ "protected", "JSONObject", "getDetectorOptions", "(", "Configuration", "pConfig", ",", "LogHandler", "pLogHandler", ")", "{", "String", "options", "=", "pConfig", ".", "get", "(", "ConfigKey", ".", "DETECTOR_OPTIONS", ")", ";", "try", "{", "if", "(", "options", ...
Get the optional options used for detectors. This should be a JSON string specifying all options for all detectors. Keys are the name of the detector's product, the values are JSON object containing specific parameters for this agent. E.g. <pre> { "glassfish" : { "bootAmx": true } } </pre> @param pConfig the agent configuration @param pLogHandler a log handler for putting out error messages @return the detector specific configuration
[ "Get", "the", "optional", "options", "used", "for", "detectors", ".", "This", "should", "be", "a", "JSON", "string", "specifying", "all", "options", "for", "all", "detectors", ".", "Keys", "are", "the", "name", "of", "the", "detector", "s", "product", "the...
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/detector/ServerHandle.java#L201-L213
stephanenicolas/afterburner
afterburner-library/src/main/java/com/github/stephanenicolas/afterburner/AfterBurner.java
AfterBurner.extractExistingMethod
public CtMethod extractExistingMethod(final CtClass classToTransform, String methodName) { try { return classToTransform.getDeclaredMethod(methodName); } catch (Exception e) { return null; } }
java
public CtMethod extractExistingMethod(final CtClass classToTransform, String methodName) { try { return classToTransform.getDeclaredMethod(methodName); } catch (Exception e) { return null; } }
[ "public", "CtMethod", "extractExistingMethod", "(", "final", "CtClass", "classToTransform", ",", "String", "methodName", ")", "{", "try", "{", "return", "classToTransform", ".", "getDeclaredMethod", "(", "methodName", ")", ";", "}", "catch", "(", "Exception", "e",...
Returns the method named {@code methodName} in {@code classToTransform}. Null if not found. Due to limitations of javassist, in case of multiple overloads, one of them only is returned. (https://github.com/jboss-javassist/javassist/issues/9) @param classToTransform the class that should contain a method methodName. @param methodName the name of the method to retrieve. @return the method named {@code methodName} in {@code classToTransform}. Null if not found.
[ "Returns", "the", "method", "named", "{" ]
train
https://github.com/stephanenicolas/afterburner/blob/b126d70e063895b036b6ac47e39e582439f58d12/afterburner-library/src/main/java/com/github/stephanenicolas/afterburner/AfterBurner.java#L119-L126
adamfisk/littleshoot-commons-id
src/main/java/org/apache/commons/id/uuid/state/StateHelper.java
StateHelper.decodeMACAddress
public static byte[] decodeMACAddress(String address) { StringBuffer buf = new StringBuffer(MAC_ADDRESS_TOKEN_COUNT * 2); StringTokenizer tokens = new StringTokenizer(address, "-"); if (tokens.countTokens() != MAC_ADDRESS_TOKEN_COUNT) { return null; } else { for (int i = 0; i < MAC_ADDRESS_TOKEN_COUNT; i++) { buf.append(tokens.nextToken()); } } try { char[] c = buf.toString().toCharArray(); return Hex.decodeHex(c); } catch (DecoderException de) { de.printStackTrace(); return null; } }
java
public static byte[] decodeMACAddress(String address) { StringBuffer buf = new StringBuffer(MAC_ADDRESS_TOKEN_COUNT * 2); StringTokenizer tokens = new StringTokenizer(address, "-"); if (tokens.countTokens() != MAC_ADDRESS_TOKEN_COUNT) { return null; } else { for (int i = 0; i < MAC_ADDRESS_TOKEN_COUNT; i++) { buf.append(tokens.nextToken()); } } try { char[] c = buf.toString().toCharArray(); return Hex.decodeHex(c); } catch (DecoderException de) { de.printStackTrace(); return null; } }
[ "public", "static", "byte", "[", "]", "decodeMACAddress", "(", "String", "address", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", "MAC_ADDRESS_TOKEN_COUNT", "*", "2", ")", ";", "StringTokenizer", "tokens", "=", "new", "StringTokenizer", "(", ...
<p>Utility method decodes a valid MAC address in the form of XX-XX-XX-XX-XX-XX where each XX represents a hexidecimal value.</p> <p> Returns null if the address can not be decoded. </p> @param address the String hexidecimal dash separated MAC address. @return a byte array representing the the address. Null if not a valid address.
[ "<p", ">", "Utility", "method", "decodes", "a", "valid", "MAC", "address", "in", "the", "form", "of", "XX", "-", "XX", "-", "XX", "-", "XX", "-", "XX", "-", "XX", "where", "each", "XX", "represents", "a", "hexidecimal", "value", ".", "<", "/", "p",...
train
https://github.com/adamfisk/littleshoot-commons-id/blob/49a8f5f2b10831c509876ca463bf1a87e1e49ae9/src/main/java/org/apache/commons/id/uuid/state/StateHelper.java#L215-L232
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/style/SymbolizerWrapper.java
SymbolizerWrapper.setFillExternalGraphicFillPath
public void setFillExternalGraphicFillPath( String externalGraphicPath, double size ) throws MalformedURLException { Graphic graphic = null; PolygonSymbolizerWrapper polygonSymbolizerWrapper = adapt(PolygonSymbolizerWrapper.class); if (polygonSymbolizerWrapper != null) { graphic = polygonSymbolizerWrapper.getFillGraphicFill(); if (graphic == null) { graphic = sf.createDefaultGraphic(); } polygonSymbolizerWrapper.setFillGraphicFill(graphic); } else { return; } graphic.graphicalSymbols().clear(); String urlStr = externalGraphicPath; if (!externalGraphicPath.startsWith("http:") && !externalGraphicPath.startsWith("file:")) { //$NON-NLS-1$ //$NON-NLS-2$ urlStr = "file:" + externalGraphicPath; //$NON-NLS-1$ } if (fillExternalGraphicFill == null) { fillExternalGraphicFill = sb.createExternalGraphic(new URL(urlStr), getFormat(externalGraphicPath)); } else { setExternalGraphicPath(externalGraphicPath, fillExternalGraphicFill); } graphic.graphicalSymbols().add(fillExternalGraphicFill); FilterFactory ff = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints()); graphic.setSize(ff.literal(size)); }
java
public void setFillExternalGraphicFillPath( String externalGraphicPath, double size ) throws MalformedURLException { Graphic graphic = null; PolygonSymbolizerWrapper polygonSymbolizerWrapper = adapt(PolygonSymbolizerWrapper.class); if (polygonSymbolizerWrapper != null) { graphic = polygonSymbolizerWrapper.getFillGraphicFill(); if (graphic == null) { graphic = sf.createDefaultGraphic(); } polygonSymbolizerWrapper.setFillGraphicFill(graphic); } else { return; } graphic.graphicalSymbols().clear(); String urlStr = externalGraphicPath; if (!externalGraphicPath.startsWith("http:") && !externalGraphicPath.startsWith("file:")) { //$NON-NLS-1$ //$NON-NLS-2$ urlStr = "file:" + externalGraphicPath; //$NON-NLS-1$ } if (fillExternalGraphicFill == null) { fillExternalGraphicFill = sb.createExternalGraphic(new URL(urlStr), getFormat(externalGraphicPath)); } else { setExternalGraphicPath(externalGraphicPath, fillExternalGraphicFill); } graphic.graphicalSymbols().add(fillExternalGraphicFill); FilterFactory ff = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints()); graphic.setSize(ff.literal(size)); }
[ "public", "void", "setFillExternalGraphicFillPath", "(", "String", "externalGraphicPath", ",", "double", "size", ")", "throws", "MalformedURLException", "{", "Graphic", "graphic", "=", "null", ";", "PolygonSymbolizerWrapper", "polygonSymbolizerWrapper", "=", "adapt", "(",...
Set the fill's {@link ExternalGraphic} path. <p>Currently one {@link ExternalGraphic} per {@link Symbolizer} is supported. <p>This is used for polygons. @param externalGraphicPath the path to set. @throws MalformedURLException
[ "Set", "the", "fill", "s", "{", "@link", "ExternalGraphic", "}", "path", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/style/SymbolizerWrapper.java#L289-L315
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java
PDBFileParser.formBonds
private void formBonds() { BondMaker maker = new BondMaker(structure, params); // LINK records should be preserved, they are the way that // inter-residue bonds are created for ligands such as trisaccharides, unusual polymers. // The analogy in mmCIF is the _struct_conn record. for (LinkRecord linkRecord : linkRecords) { maker.formLinkRecordBond(linkRecord); } maker.formDisulfideBonds(ssbonds); maker.makeBonds(); }
java
private void formBonds() { BondMaker maker = new BondMaker(structure, params); // LINK records should be preserved, they are the way that // inter-residue bonds are created for ligands such as trisaccharides, unusual polymers. // The analogy in mmCIF is the _struct_conn record. for (LinkRecord linkRecord : linkRecords) { maker.formLinkRecordBond(linkRecord); } maker.formDisulfideBonds(ssbonds); maker.makeBonds(); }
[ "private", "void", "formBonds", "(", ")", "{", "BondMaker", "maker", "=", "new", "BondMaker", "(", "structure", ",", "params", ")", ";", "// LINK records should be preserved, they are the way that", "// inter-residue bonds are created for ligands such as trisaccharides, unusual p...
Handles creation of all bonds. Looks at LINK records, SSBOND (Disulfide bonds), peptide bonds, and intra-residue bonds. <p> Note: the current implementation only looks at the first model of each structure. This may need to be fixed in the future.
[ "Handles", "creation", "of", "all", "bonds", ".", "Looks", "at", "LINK", "records", "SSBOND", "(", "Disulfide", "bonds", ")", "peptide", "bonds", "and", "intra", "-", "residue", "bonds", ".", "<p", ">", "Note", ":", "the", "current", "implementation", "onl...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L2767-L2781
graknlabs/grakn
server/src/server/kb/structure/AbstractElement.java
AbstractElement.propertyUnique
public void propertyUnique(P key, String value) { GraphTraversal<Vertex, Vertex> traversal = tx().getTinkerTraversal().V().has(key.name(), value); if (traversal.hasNext()) { Vertex vertex = traversal.next(); if (!vertex.equals(element()) || traversal.hasNext()) { if (traversal.hasNext()) vertex = traversal.next(); throw PropertyNotUniqueException.cannotChangeProperty(element(), vertex, key, value); } } property(key, value); }
java
public void propertyUnique(P key, String value) { GraphTraversal<Vertex, Vertex> traversal = tx().getTinkerTraversal().V().has(key.name(), value); if (traversal.hasNext()) { Vertex vertex = traversal.next(); if (!vertex.equals(element()) || traversal.hasNext()) { if (traversal.hasNext()) vertex = traversal.next(); throw PropertyNotUniqueException.cannotChangeProperty(element(), vertex, key, value); } } property(key, value); }
[ "public", "void", "propertyUnique", "(", "P", "key", ",", "String", "value", ")", "{", "GraphTraversal", "<", "Vertex", ",", "Vertex", ">", "traversal", "=", "tx", "(", ")", ".", "getTinkerTraversal", "(", ")", ".", "V", "(", ")", ".", "has", "(", "k...
Sets the value of a property with the added restriction that no other vertex can have that property. @param key The key of the unique property to mutate @param value The new value of the unique property
[ "Sets", "the", "value", "of", "a", "property", "with", "the", "added", "restriction", "that", "no", "other", "vertex", "can", "have", "that", "property", "." ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/structure/AbstractElement.java#L131-L143
k3po/k3po
junit/src/main/java/org/kaazing/k3po/junit/rules/K3poRule.java
K3poRule.addScriptRoot
public K3poRule addScriptRoot(String shortName, String packagePath) { packagePathsByName.put(shortName, packagePath); return this; }
java
public K3poRule addScriptRoot(String shortName, String packagePath) { packagePathsByName.put(shortName, packagePath); return this; }
[ "public", "K3poRule", "addScriptRoot", "(", "String", "shortName", ",", "String", "packagePath", ")", "{", "packagePathsByName", ".", "put", "(", "shortName", ",", "packagePath", ")", ";", "return", "this", ";", "}" ]
Adds a named ClassPath root of where to look for scripts when resolving them. Specifications should reference the short name using {@code "${shortName}/..." } in script names. @param shortName the short name used to refer to the package path @param packagePath a package path used resolve relative script names @return an instance of K3poRule for convenience
[ "Adds", "a", "named", "ClassPath", "root", "of", "where", "to", "look", "for", "scripts", "when", "resolving", "them", ".", "Specifications", "should", "reference", "the", "short", "name", "using", "{", "@code", "$", "{", "shortName", "}", "/", "...", "}",...
train
https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/junit/src/main/java/org/kaazing/k3po/junit/rules/K3poRule.java#L114-L117
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplace.java
CmsWorkplace.generatePageStartExtended
public static String generatePageStartExtended(CmsObject cms, String encoding) { StringBuffer result = new StringBuffer(128); result.append("<html>\n<head>\n"); result.append("<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset="); result.append(encoding); result.append("'>\n"); result.append(generateCssStyle(cms)); result.append("</head>\n"); result.append("<body style='overflow: auto;'>\n"); result.append("<div class='main'>\n"); return result.toString(); }
java
public static String generatePageStartExtended(CmsObject cms, String encoding) { StringBuffer result = new StringBuffer(128); result.append("<html>\n<head>\n"); result.append("<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset="); result.append(encoding); result.append("'>\n"); result.append(generateCssStyle(cms)); result.append("</head>\n"); result.append("<body style='overflow: auto;'>\n"); result.append("<div class='main'>\n"); return result.toString(); }
[ "public", "static", "String", "generatePageStartExtended", "(", "CmsObject", "cms", ",", "String", "encoding", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "128", ")", ";", "result", ".", "append", "(", "\"<html>\\n<head>\\n\"", ")", ";",...
Generates the header for the extended report view.<p> @param cms the current users context @param encoding the encoding string @return html code
[ "Generates", "the", "header", "for", "the", "extended", "report", "view", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L505-L517
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXCoordinate.java
GPXCoordinate.createCoordinate
public static Coordinate createCoordinate(Attributes attributes) throws NumberFormatException { // Associate a latitude and a longitude to the point double lat; double lon; try { lat = Double.parseDouble(attributes.getValue(GPXTags.LAT)); } catch (NumberFormatException e) { throw new NumberFormatException("Cannot parse the latitude value"); } try { lon = Double.parseDouble(attributes.getValue(GPXTags.LON)); } catch (NumberFormatException e) { throw new NumberFormatException("Cannot parse the longitude value"); } String eleValue = attributes.getValue(GPXTags.ELE); double ele = Double.NaN; if (eleValue != null) { try { ele = Double.parseDouble(eleValue); } catch (NumberFormatException e) { throw new NumberFormatException("Cannot parse the elevation value"); } } return new Coordinate(lon, lat, ele); }
java
public static Coordinate createCoordinate(Attributes attributes) throws NumberFormatException { // Associate a latitude and a longitude to the point double lat; double lon; try { lat = Double.parseDouble(attributes.getValue(GPXTags.LAT)); } catch (NumberFormatException e) { throw new NumberFormatException("Cannot parse the latitude value"); } try { lon = Double.parseDouble(attributes.getValue(GPXTags.LON)); } catch (NumberFormatException e) { throw new NumberFormatException("Cannot parse the longitude value"); } String eleValue = attributes.getValue(GPXTags.ELE); double ele = Double.NaN; if (eleValue != null) { try { ele = Double.parseDouble(eleValue); } catch (NumberFormatException e) { throw new NumberFormatException("Cannot parse the elevation value"); } } return new Coordinate(lon, lat, ele); }
[ "public", "static", "Coordinate", "createCoordinate", "(", "Attributes", "attributes", ")", "throws", "NumberFormatException", "{", "// Associate a latitude and a longitude to the point", "double", "lat", ";", "double", "lon", ";", "try", "{", "lat", "=", "Double", ".",...
General method to create a coordinate from a gpx point. @param attributes Attributes of the point. Here it is latitude and longitude @throws NumberFormatException @return a coordinate
[ "General", "method", "to", "create", "a", "coordinate", "from", "a", "gpx", "point", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXCoordinate.java#L40-L65
twilliamson/mogwee-logging
src/main/java/com/mogwee/logging/Logger.java
Logger.debugf
public final void debugf(String message, Object... args) { logf(Level.DEBUG, null, message, args); }
java
public final void debugf(String message, Object... args) { logf(Level.DEBUG, null, message, args); }
[ "public", "final", "void", "debugf", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "logf", "(", "Level", ".", "DEBUG", ",", "null", ",", "message", ",", "args", ")", ";", "}" ]
Logs a formatted message if DEBUG logging is enabled. @param message a <a href="http://download.oracle.com/javase/6/docs/api/java/util/Formatter.html#syntax">format string</a> @param args arguments referenced by the format specifiers in the format string
[ "Logs", "a", "formatted", "message", "if", "DEBUG", "logging", "is", "enabled", "." ]
train
https://github.com/twilliamson/mogwee-logging/blob/30b99c2649de455432d956a8f6a74316de4cd62c/src/main/java/com/mogwee/logging/Logger.java#L83-L86
google/closure-compiler
src/com/google/javascript/rhino/jstype/JSTypeRegistry.java
JSTypeRegistry.getLookupScope
private static StaticScope getLookupScope(StaticScope scope, String name) { if (scope != null && scope.getParentScope() != null) { StaticSlot slot = scope.getSlot(getRootElementOfName(name)); return slot != null ? slot.getScope() : null; } return scope; }
java
private static StaticScope getLookupScope(StaticScope scope, String name) { if (scope != null && scope.getParentScope() != null) { StaticSlot slot = scope.getSlot(getRootElementOfName(name)); return slot != null ? slot.getScope() : null; } return scope; }
[ "private", "static", "StaticScope", "getLookupScope", "(", "StaticScope", "scope", ",", "String", "name", ")", "{", "if", "(", "scope", "!=", "null", "&&", "scope", ".", "getParentScope", "(", ")", "!=", "null", ")", "{", "StaticSlot", "slot", "=", "scope"...
@return Which scope in the provided scope chain the provided name is declared in, or else null. This assumed that the Scope construction is complete. It can not be used during scope construction to determine if a name is already defined as a shadowed name from a parent scope would be returned.
[ "@return", "Which", "scope", "in", "the", "provided", "scope", "chain", "the", "provided", "name", "is", "declared", "in", "or", "else", "null", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L784-L790
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java
Encoding.addQuaternaryClause
void addQuaternaryClause(final MiniSatStyleSolver s, int a, int b, int c, int d) { this.addQuaternaryClause(s, a, b, c, d, LIT_UNDEF); }
java
void addQuaternaryClause(final MiniSatStyleSolver s, int a, int b, int c, int d) { this.addQuaternaryClause(s, a, b, c, d, LIT_UNDEF); }
[ "void", "addQuaternaryClause", "(", "final", "MiniSatStyleSolver", "s", ",", "int", "a", ",", "int", "b", ",", "int", "c", ",", "int", "d", ")", "{", "this", ".", "addQuaternaryClause", "(", "s", ",", "a", ",", "b", ",", "c", ",", "d", ",", "LIT_UN...
Adds a quaterary clause to the given SAT solver. @param s the sat solver @param a the first literal @param b the second literal @param c the third literal @param d the fourth literal
[ "Adds", "a", "quaterary", "clause", "to", "the", "given", "SAT", "solver", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java#L170-L172
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpViewerProxy.java
HelpViewerProxy.sendRequest
private void sendRequest(String methodName, Object... params) { sendRequest(new InvocationRequest(methodName, params), true); }
java
private void sendRequest(String methodName, Object... params) { sendRequest(new InvocationRequest(methodName, params), true); }
[ "private", "void", "sendRequest", "(", "String", "methodName", ",", "Object", "...", "params", ")", "{", "sendRequest", "(", "new", "InvocationRequest", "(", "methodName", ",", "params", ")", ",", "true", ")", ";", "}" ]
Send a request to the remote viewer to request execution of the specified method. @param methodName Name of the method to execute. @param params Parameters to pass to the method (may be null).
[ "Send", "a", "request", "to", "the", "remote", "viewer", "to", "request", "execution", "of", "the", "specified", "method", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpViewerProxy.java#L96-L99
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MissionBehaviour.java
MissionBehaviour.appendExtraServerInformation
public void appendExtraServerInformation(HashMap<String, String> map) { List<HandlerBase> handlers = getClientHandlerList(); for (HandlerBase handler : handlers) handler.appendExtraServerInformation(map); }
java
public void appendExtraServerInformation(HashMap<String, String> map) { List<HandlerBase> handlers = getClientHandlerList(); for (HandlerBase handler : handlers) handler.appendExtraServerInformation(map); }
[ "public", "void", "appendExtraServerInformation", "(", "HashMap", "<", "String", ",", "String", ">", "map", ")", "{", "List", "<", "HandlerBase", ">", "handlers", "=", "getClientHandlerList", "(", ")", ";", "for", "(", "HandlerBase", "handler", ":", "handlers"...
This method gives our handlers a chance to add any information to the ping message which the client sends (repeatedly) to the server while the agents are assembling. This message is guaranteed to get through to the server, so it is a good place to communicate. (NOTE this is called BEFORE addExtraHandlers - but that mechanism is provided to allow the *server* to add extra handlers on the *client* - so the server should already know whatever the extra handlers might want to tell it!) @param map the map of data passed to the server
[ "This", "method", "gives", "our", "handlers", "a", "chance", "to", "add", "any", "information", "to", "the", "ping", "message", "which", "the", "client", "sends", "(", "repeatedly", ")", "to", "the", "server", "while", "the", "agents", "are", "assembling", ...
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MissionBehaviour.java#L337-L342
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/CmsGalleriesTab.java
CmsGalleriesTab.updateListContent
public void updateListContent(List<CmsGalleryFolderBean> galleries, List<String> selectedGalleries) { clearList(); fillContent(galleries, selectedGalleries); }
java
public void updateListContent(List<CmsGalleryFolderBean> galleries, List<String> selectedGalleries) { clearList(); fillContent(galleries, selectedGalleries); }
[ "public", "void", "updateListContent", "(", "List", "<", "CmsGalleryFolderBean", ">", "galleries", ",", "List", "<", "String", ">", "selectedGalleries", ")", "{", "clearList", "(", ")", ";", "fillContent", "(", "galleries", ",", "selectedGalleries", ")", ";", ...
Update the galleries list.<p> @param galleries the new gallery list @param selectedGalleries the list of galleries to select
[ "Update", "the", "galleries", "list", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsGalleriesTab.java#L416-L420
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
FileSupport.getFilesInDirectoryTree
public static List<File> getFilesInDirectoryTree(String path, String includeMask) { File file = new File(path); return getContentsInDirectoryTree(file, includeMask, true, false); }
java
public static List<File> getFilesInDirectoryTree(String path, String includeMask) { File file = new File(path); return getContentsInDirectoryTree(file, includeMask, true, false); }
[ "public", "static", "List", "<", "File", ">", "getFilesInDirectoryTree", "(", "String", "path", ",", "String", "includeMask", ")", "{", "File", "file", "=", "new", "File", "(", "path", ")", ";", "return", "getContentsInDirectoryTree", "(", "file", ",", "incl...
Retrieves files for a given mask from a directory and its subdirectories. @param path root of directory tree @param includeMask exact filename, or mask containing wildcards @return A list containing the found files
[ "Retrieves", "files", "for", "a", "given", "mask", "from", "a", "directory", "and", "its", "subdirectories", "." ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L69-L72
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXReader.java
MPXReader.populateCalendarException
private void populateCalendarException(Record record, ProjectCalendar calendar) throws MPXJException { Date fromDate = record.getDate(0); Date toDate = record.getDate(1); boolean working = record.getNumericBoolean(2); // I have found an example MPX file where a single day exception is expressed with just the start date set. // If we find this for we assume that the end date is the same as the start date. if (fromDate != null && toDate == null) { toDate = fromDate; } ProjectCalendarException exception = calendar.addCalendarException(fromDate, toDate); if (working) { addExceptionRange(exception, record.getTime(3), record.getTime(4)); addExceptionRange(exception, record.getTime(5), record.getTime(6)); addExceptionRange(exception, record.getTime(7), record.getTime(8)); } }
java
private void populateCalendarException(Record record, ProjectCalendar calendar) throws MPXJException { Date fromDate = record.getDate(0); Date toDate = record.getDate(1); boolean working = record.getNumericBoolean(2); // I have found an example MPX file where a single day exception is expressed with just the start date set. // If we find this for we assume that the end date is the same as the start date. if (fromDate != null && toDate == null) { toDate = fromDate; } ProjectCalendarException exception = calendar.addCalendarException(fromDate, toDate); if (working) { addExceptionRange(exception, record.getTime(3), record.getTime(4)); addExceptionRange(exception, record.getTime(5), record.getTime(6)); addExceptionRange(exception, record.getTime(7), record.getTime(8)); } }
[ "private", "void", "populateCalendarException", "(", "Record", "record", ",", "ProjectCalendar", "calendar", ")", "throws", "MPXJException", "{", "Date", "fromDate", "=", "record", ".", "getDate", "(", "0", ")", ";", "Date", "toDate", "=", "record", ".", "getD...
Populates a calendar exception instance. @param record MPX record @param calendar calendar to which the exception will be added @throws MPXJException
[ "Populates", "a", "calendar", "exception", "instance", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L673-L693
netheosgithub/pcs_api
java/src/main/java/net/netheos/pcsapi/providers/googledrive/GoogleDrive.java
GoogleDrive.rawCreateFolder
private String rawCreateFolder( CPath path, String parentId ) { JSONObject body = new JSONObject(); body.put( "title", path.getBaseName() ); body.put( "mimeType", MIME_TYPE_DIRECTORY ); JSONArray ids = new JSONArray(); JSONObject idObj = new JSONObject(); idObj.put( "id", parentId ); ids.put( idObj ); body.put( "parents", ids ); HttpPost request = new HttpPost( FILES_ENDPOINT + "?fields=id" ); request.setEntity( new JSONEntity( body ) ); RequestInvoker<CResponse> ri = getApiRequestInvoker( request, path ); JSONObject jresp = retryStrategy.invokeRetry( ri ).asJSONObject(); return jresp.getString( "id" ); }
java
private String rawCreateFolder( CPath path, String parentId ) { JSONObject body = new JSONObject(); body.put( "title", path.getBaseName() ); body.put( "mimeType", MIME_TYPE_DIRECTORY ); JSONArray ids = new JSONArray(); JSONObject idObj = new JSONObject(); idObj.put( "id", parentId ); ids.put( idObj ); body.put( "parents", ids ); HttpPost request = new HttpPost( FILES_ENDPOINT + "?fields=id" ); request.setEntity( new JSONEntity( body ) ); RequestInvoker<CResponse> ri = getApiRequestInvoker( request, path ); JSONObject jresp = retryStrategy.invokeRetry( ri ).asJSONObject(); return jresp.getString( "id" ); }
[ "private", "String", "rawCreateFolder", "(", "CPath", "path", ",", "String", "parentId", ")", "{", "JSONObject", "body", "=", "new", "JSONObject", "(", ")", ";", "body", ".", "put", "(", "\"title\"", ",", "path", ".", "getBaseName", "(", ")", ")", ";", ...
Create a folder without creating any higher level intermediate folders, and returned id of created folder. @param path @param parentId @return id of created folder
[ "Create", "a", "folder", "without", "creating", "any", "higher", "level", "intermediate", "folders", "and", "returned", "id", "of", "created", "folder", "." ]
train
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/googledrive/GoogleDrive.java#L374-L391
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleUserSegmentRelPersistenceImpl.java
CPRuleUserSegmentRelPersistenceImpl.findByCPRuleId
@Override public List<CPRuleUserSegmentRel> findByCPRuleId(long CPRuleId, int start, int end) { return findByCPRuleId(CPRuleId, start, end, null); }
java
@Override public List<CPRuleUserSegmentRel> findByCPRuleId(long CPRuleId, int start, int end) { return findByCPRuleId(CPRuleId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPRuleUserSegmentRel", ">", "findByCPRuleId", "(", "long", "CPRuleId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCPRuleId", "(", "CPRuleId", ",", "start", ",", "end", ",", "null", ")", ";", ...
Returns a range of all the cp rule user segment rels where CPRuleId = &#63;. <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 CPRuleUserSegmentRelModelImpl}. 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 CPRuleId the cp rule ID @param start the lower bound of the range of cp rule user segment rels @param end the upper bound of the range of cp rule user segment rels (not inclusive) @return the range of matching cp rule user segment rels
[ "Returns", "a", "range", "of", "all", "the", "cp", "rule", "user", "segment", "rels", "where", "CPRuleId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleUserSegmentRelPersistenceImpl.java#L140-L144
cuba-platform/yarg
core/modules/core/src/com/haulmont/yarg/util/db/DbUtils.java
DbUtils.printWarnings
public static void printWarnings(Connection conn, PrintWriter pw) { if (conn != null) { try { printStackTrace(conn.getWarnings(), pw); } catch (SQLException e) { printStackTrace(e, pw); } } }
java
public static void printWarnings(Connection conn, PrintWriter pw) { if (conn != null) { try { printStackTrace(conn.getWarnings(), pw); } catch (SQLException e) { printStackTrace(e, pw); } } }
[ "public", "static", "void", "printWarnings", "(", "Connection", "conn", ",", "PrintWriter", "pw", ")", "{", "if", "(", "conn", "!=", "null", ")", "{", "try", "{", "printStackTrace", "(", "conn", ".", "getWarnings", "(", ")", ",", "pw", ")", ";", "}", ...
Print warnings on a Connection to a specified PrintWriter. @param conn Connection to print warnings from @param pw PrintWriter to print to
[ "Print", "warnings", "on", "a", "Connection", "to", "a", "specified", "PrintWriter", "." ]
train
https://github.com/cuba-platform/yarg/blob/d157286cbe29448f3e1f445e8c5dd88808351da0/core/modules/core/src/com/haulmont/yarg/util/db/DbUtils.java#L234-L242
twitter/finagle
finagle-serversets/src/main/java/com/twitter/finagle/common/zookeeper/ServerSets.java
ServerSets.serializeServiceInstance
public static byte[] serializeServiceInstance( InetSocketAddress address, Map<String, Endpoint> additionalEndpoints, Status status, Codec<ServiceInstance> codec) throws IOException { ServiceInstance serviceInstance = new ServiceInstance(toEndpoint(address), additionalEndpoints, status); return serializeServiceInstance(serviceInstance, codec); }
java
public static byte[] serializeServiceInstance( InetSocketAddress address, Map<String, Endpoint> additionalEndpoints, Status status, Codec<ServiceInstance> codec) throws IOException { ServiceInstance serviceInstance = new ServiceInstance(toEndpoint(address), additionalEndpoints, status); return serializeServiceInstance(serviceInstance, codec); }
[ "public", "static", "byte", "[", "]", "serializeServiceInstance", "(", "InetSocketAddress", "address", ",", "Map", "<", "String", ",", "Endpoint", ">", "additionalEndpoints", ",", "Status", "status", ",", "Codec", "<", "ServiceInstance", ">", "codec", ")", "thro...
Serializes a service instance based on endpoints. @see #serializeServiceInstance(ServiceInstance, Codec) @param address the target address of the service instance @param additionalEndpoints additional endpoints of the service instance @param status service status
[ "Serializes", "a", "service", "instance", "based", "on", "endpoints", ".", "@see", "#serializeServiceInstance", "(", "ServiceInstance", "Codec", ")" ]
train
https://github.com/twitter/finagle/blob/872be5f2b147fa50351bdbf08b003a26745e1df8/finagle-serversets/src/main/java/com/twitter/finagle/common/zookeeper/ServerSets.java#L52-L61
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getFromLastExcl
@Nullable public static String getFromLastExcl (@Nullable final String sStr, @Nullable final String sSearch) { return _getFromLast (sStr, sSearch, false); }
java
@Nullable public static String getFromLastExcl (@Nullable final String sStr, @Nullable final String sSearch) { return _getFromLast (sStr, sSearch, false); }
[ "@", "Nullable", "public", "static", "String", "getFromLastExcl", "(", "@", "Nullable", "final", "String", "sStr", ",", "@", "Nullable", "final", "String", "sSearch", ")", "{", "return", "_getFromLast", "(", "sStr", ",", "sSearch", ",", "false", ")", ";", ...
Get everything from the string from and excluding the passed string. @param sStr The source string. May be <code>null</code>. @param sSearch The string to search. May be <code>null</code>. @return <code>null</code> if the passed string does not contain the search string. If the search string is empty, the input string is returned unmodified.
[ "Get", "everything", "from", "the", "string", "from", "and", "excluding", "the", "passed", "string", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L5089-L5093
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/compound/AminoAcidCompoundSet.java
AminoAcidCompoundSet.addAmbiguousEquivalents
private void addAmbiguousEquivalents(String one, String two, String either) { Set<AminoAcidCompound> equivalents; AminoAcidCompound cOne, cTwo, cEither; equivalents = new HashSet<AminoAcidCompound>(); equivalents.add(cOne = aminoAcidCompoundCache.get(one)); equivalents.add(cTwo = aminoAcidCompoundCache.get(two)); equivalents.add(cEither = aminoAcidCompoundCache.get(either)); equivalentsCache.put(cEither, equivalents); equivalents = new HashSet<AminoAcidCompound>(); equivalents.add(cOne); equivalents.add(cEither); equivalentsCache.put(cOne, equivalents); equivalents = new HashSet<AminoAcidCompound>(); equivalents.add(cTwo); equivalents.add(cEither); equivalentsCache.put(cTwo, equivalents); }
java
private void addAmbiguousEquivalents(String one, String two, String either) { Set<AminoAcidCompound> equivalents; AminoAcidCompound cOne, cTwo, cEither; equivalents = new HashSet<AminoAcidCompound>(); equivalents.add(cOne = aminoAcidCompoundCache.get(one)); equivalents.add(cTwo = aminoAcidCompoundCache.get(two)); equivalents.add(cEither = aminoAcidCompoundCache.get(either)); equivalentsCache.put(cEither, equivalents); equivalents = new HashSet<AminoAcidCompound>(); equivalents.add(cOne); equivalents.add(cEither); equivalentsCache.put(cOne, equivalents); equivalents = new HashSet<AminoAcidCompound>(); equivalents.add(cTwo); equivalents.add(cEither); equivalentsCache.put(cTwo, equivalents); }
[ "private", "void", "addAmbiguousEquivalents", "(", "String", "one", ",", "String", "two", ",", "String", "either", ")", "{", "Set", "<", "AminoAcidCompound", ">", "equivalents", ";", "AminoAcidCompound", "cOne", ",", "cTwo", ",", "cEither", ";", "equivalents", ...
helper method to initialize the equivalent sets for 2 amino acid compounds and their ambiguity compound
[ "helper", "method", "to", "initialize", "the", "equivalent", "sets", "for", "2", "amino", "acid", "compounds", "and", "their", "ambiguity", "compound" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/compound/AminoAcidCompoundSet.java#L171-L190
Labs64/swid-generator
src/main/java/com/labs64/utils/swid/support/JAXBUtils.java
JAXBUtils.convertDateToXMLGregorianCalendar
public static XMLGregorianCalendar convertDateToXMLGregorianCalendar(final Date date) { try { GregorianCalendar cal = new GregorianCalendar(); cal.setTime(date); XMLGregorianCalendar calXml = DatatypeFactory.newInstance().newXMLGregorianCalendar( cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND), cal.get(Calendar.MILLISECOND), 0); return calXml; } catch (DatatypeConfigurationException e) { throw new SwidException("Cannot convert date", e); } }
java
public static XMLGregorianCalendar convertDateToXMLGregorianCalendar(final Date date) { try { GregorianCalendar cal = new GregorianCalendar(); cal.setTime(date); XMLGregorianCalendar calXml = DatatypeFactory.newInstance().newXMLGregorianCalendar( cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND), cal.get(Calendar.MILLISECOND), 0); return calXml; } catch (DatatypeConfigurationException e) { throw new SwidException("Cannot convert date", e); } }
[ "public", "static", "XMLGregorianCalendar", "convertDateToXMLGregorianCalendar", "(", "final", "Date", "date", ")", "{", "try", "{", "GregorianCalendar", "cal", "=", "new", "GregorianCalendar", "(", ")", ";", "cal", ".", "setTime", "(", "date", ")", ";", "XMLGre...
Convert {@link Date} to {@link XMLGregorianCalendar}. @param date XML entity
[ "Convert", "{", "@link", "Date", "}", "to", "{", "@link", "XMLGregorianCalendar", "}", "." ]
train
https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/support/JAXBUtils.java#L128-L145
getsentry/sentry-java
sentry/src/main/java/io/sentry/event/UserBuilder.java
UserBuilder.withData
public UserBuilder withData(String name, Object value) { if (this.data == null) { this.data = new HashMap<>(); } this.data.put(name, value); return this; }
java
public UserBuilder withData(String name, Object value) { if (this.data == null) { this.data = new HashMap<>(); } this.data.put(name, value); return this; }
[ "public", "UserBuilder", "withData", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "this", ".", "data", "==", "null", ")", "{", "this", ".", "data", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "this", ".", "data", ".", ...
Adds to the extra data for the user. @param name Name of the data @param value Value of the data @return current instance of UserBuilder
[ "Adds", "to", "the", "extra", "data", "for", "the", "user", "." ]
train
https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/event/UserBuilder.java#L78-L85
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Widgets.java
Widgets.newLabel
public static Label newLabel (String text, String... styles) { return setStyleNames(new Label(text), styles); }
java
public static Label newLabel (String text, String... styles) { return setStyleNames(new Label(text), styles); }
[ "public", "static", "Label", "newLabel", "(", "String", "text", ",", "String", "...", "styles", ")", "{", "return", "setStyleNames", "(", "new", "Label", "(", "text", ")", ",", "styles", ")", ";", "}" ]
Creates a label with the supplied text and style and optional additional styles.
[ "Creates", "a", "label", "with", "the", "supplied", "text", "and", "style", "and", "optional", "additional", "styles", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L178-L181
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.convertPixelToNorm
public static Point2D_F64 convertPixelToNorm(CameraModel param , Point2D_F64 pixel , Point2D_F64 norm ) { return ImplPerspectiveOps_F64.convertPixelToNorm(param, pixel, norm); }
java
public static Point2D_F64 convertPixelToNorm(CameraModel param , Point2D_F64 pixel , Point2D_F64 norm ) { return ImplPerspectiveOps_F64.convertPixelToNorm(param, pixel, norm); }
[ "public", "static", "Point2D_F64", "convertPixelToNorm", "(", "CameraModel", "param", ",", "Point2D_F64", "pixel", ",", "Point2D_F64", "norm", ")", "{", "return", "ImplPerspectiveOps_F64", ".", "convertPixelToNorm", "(", "param", ",", "pixel", ",", "norm", ")", ";...
<p> Convenient function for converting from distorted image pixel coordinate to undistorted normalized image coordinates. If speed is a concern then {@link PinholePtoN_F64} should be used instead. </p> NOTE: norm and pixel can be the same instance. @param param Intrinsic camera parameters @param pixel Pixel coordinate @param norm Optional storage for output. If null a new instance will be declared. @return normalized image coordinate
[ "<p", ">", "Convenient", "function", "for", "converting", "from", "distorted", "image", "pixel", "coordinate", "to", "undistorted", "normalized", "image", "coordinates", ".", "If", "speed", "is", "a", "concern", "then", "{", "@link", "PinholePtoN_F64", "}", "sho...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L445-L447
FDMediagroep/hamcrest-jsoup
src/main/java/nl/fd/hamcrest/jsoup/Selecting.java
Selecting.selecting
@Factory @SuppressWarnings("unchecked") public static Matcher<Element> selecting(final String cssExpression, final Matcher<Iterable<? super Element>> elementsMatcher) { return new Selecting(cssExpression, elementsMatcher); }
java
@Factory @SuppressWarnings("unchecked") public static Matcher<Element> selecting(final String cssExpression, final Matcher<Iterable<? super Element>> elementsMatcher) { return new Selecting(cssExpression, elementsMatcher); }
[ "@", "Factory", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Matcher", "<", "Element", ">", "selecting", "(", "final", "String", "cssExpression", ",", "final", "Matcher", "<", "Iterable", "<", "?", "super", "Element", ">", ">", "e...
Creates a {@link org.hamcrest.Matcher} for a JSoup {@link org.jsoup.nodes.Element} that has a list of child nodes matching the specified cssExpression that are matched by the specified elementsMatcher. @param cssExpression The Jsoup CSS expression used to selected a list of child nodes @param elementsMatcher the matcher that the selected child nodes will be matched against @return a {@link org.hamcrest.Matcher} for a JSoup {@link org.jsoup.nodes.Element}
[ "Creates", "a", "{", "@link", "org", ".", "hamcrest", ".", "Matcher", "}", "for", "a", "JSoup", "{", "@link", "org", ".", "jsoup", ".", "nodes", ".", "Element", "}", "that", "has", "a", "list", "of", "child", "nodes", "matching", "the", "specified", ...
train
https://github.com/FDMediagroep/hamcrest-jsoup/blob/b7152dac6f834e40117fb7cfdd3149a268d95f7b/src/main/java/nl/fd/hamcrest/jsoup/Selecting.java#L31-L35
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Annotation.java
Annotation.setFields
public void setFields(Map<String, String> fields) { _fields.clear(); if (fields != null) { _fields.putAll(fields); } }
java
public void setFields(Map<String, String> fields) { _fields.clear(); if (fields != null) { _fields.putAll(fields); } }
[ "public", "void", "setFields", "(", "Map", "<", "String", ",", "String", ">", "fields", ")", "{", "_fields", ".", "clear", "(", ")", ";", "if", "(", "fields", "!=", "null", ")", "{", "_fields", ".", "putAll", "(", "fields", ")", ";", "}", "}" ]
Replaces the user defined fields associated with the annotation. This information can be used to store information about the annotation such as the event name, the associated user or any other relevant information. Existing fields will always be deleted. @param fields The user defined fields. May be null.
[ "Replaces", "the", "user", "defined", "fields", "associated", "with", "the", "annotation", ".", "This", "information", "can", "be", "used", "to", "store", "information", "about", "the", "annotation", "such", "as", "the", "event", "name", "the", "associated", "...
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Annotation.java#L258-L263
qiniu/java-sdk
src/main/java/com/qiniu/streaming/UrlFactory.java
UrlFactory.rtmpPublishUrl
public String rtmpPublishUrl(String streamKey, int expireAfterSeconds) { long expire = System.currentTimeMillis() / 1000 + expireAfterSeconds; String path = String.format("/%s/%s?e=%d", hub, streamKey, expire); String token; try { token = auth.sign(path); } catch (Exception e) { e.printStackTrace(); return null; } return String.format("rtmp://%s%s&token=%s", rtmpPublishDomain, path, token); }
java
public String rtmpPublishUrl(String streamKey, int expireAfterSeconds) { long expire = System.currentTimeMillis() / 1000 + expireAfterSeconds; String path = String.format("/%s/%s?e=%d", hub, streamKey, expire); String token; try { token = auth.sign(path); } catch (Exception e) { e.printStackTrace(); return null; } return String.format("rtmp://%s%s&token=%s", rtmpPublishDomain, path, token); }
[ "public", "String", "rtmpPublishUrl", "(", "String", "streamKey", ",", "int", "expireAfterSeconds", ")", "{", "long", "expire", "=", "System", ".", "currentTimeMillis", "(", ")", "/", "1000", "+", "expireAfterSeconds", ";", "String", "path", "=", "String", "."...
生成带有效期鉴权的RTMP推流地址 @param streamKey 流名称 @param expireAfterSeconds 流过期时间,单位秒
[ "生成带有效期鉴权的RTMP推流地址" ]
train
https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/streaming/UrlFactory.java#L74-L85
Stratio/stratio-cassandra
src/java/org/apache/cassandra/cli/CliClient.java
CliClient.getColumnDefByName
private ColumnDef getColumnDefByName(CfDef columnFamily, ByteBuffer columnName) { for (ColumnDef columnDef : columnFamily.getColumn_metadata()) { byte[] currName = columnDef.getName(); if (ByteBufferUtil.compare(currName, columnName) == 0) { return columnDef; } } return null; }
java
private ColumnDef getColumnDefByName(CfDef columnFamily, ByteBuffer columnName) { for (ColumnDef columnDef : columnFamily.getColumn_metadata()) { byte[] currName = columnDef.getName(); if (ByteBufferUtil.compare(currName, columnName) == 0) { return columnDef; } } return null; }
[ "private", "ColumnDef", "getColumnDefByName", "(", "CfDef", "columnFamily", ",", "ByteBuffer", "columnName", ")", "{", "for", "(", "ColumnDef", "columnDef", ":", "columnFamily", ".", "getColumn_metadata", "(", ")", ")", "{", "byte", "[", "]", "currName", "=", ...
Get specific ColumnDef in column family meta data by column name @param columnFamily - CfDef record @param columnName - column name represented as byte[] @return ColumnDef - found column definition
[ "Get", "specific", "ColumnDef", "in", "column", "family", "meta", "data", "by", "column", "name" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliClient.java#L2877-L2890
alkacon/opencms-core
src/org/opencms/ui/apps/sessions/CmsSessionsTable.java
CmsSessionsTable.showKillDialog
protected static void showKillDialog(Set<String> ids, String caption, final CmsSessionsTable table) { final Window window = CmsBasicDialog.prepareWindow(); window.setCaption(caption); window.setContent(new CmsKillSessionDialog(ids, getCloseRunnable(window, table))); A_CmsUI.get().addWindow(window); }
java
protected static void showKillDialog(Set<String> ids, String caption, final CmsSessionsTable table) { final Window window = CmsBasicDialog.prepareWindow(); window.setCaption(caption); window.setContent(new CmsKillSessionDialog(ids, getCloseRunnable(window, table))); A_CmsUI.get().addWindow(window); }
[ "protected", "static", "void", "showKillDialog", "(", "Set", "<", "String", ">", "ids", ",", "String", "caption", ",", "final", "CmsSessionsTable", "table", ")", "{", "final", "Window", "window", "=", "CmsBasicDialog", ".", "prepareWindow", "(", ")", ";", "w...
Shows the dialog to destroy given sessions.<p> @param ids to kill session @param caption of the window @param table to be updated
[ "Shows", "the", "dialog", "to", "destroy", "given", "sessions", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sessions/CmsSessionsTable.java#L482-L488
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java
SVGPath.drawTo
public SVGPath drawTo(double x, double y) { return !isStarted() ? moveTo(x, y) : lineTo(x, y); }
java
public SVGPath drawTo(double x, double y) { return !isStarted() ? moveTo(x, y) : lineTo(x, y); }
[ "public", "SVGPath", "drawTo", "(", "double", "x", ",", "double", "y", ")", "{", "return", "!", "isStarted", "(", ")", "?", "moveTo", "(", "x", ",", "y", ")", ":", "lineTo", "(", "x", ",", "y", ")", ";", "}" ]
Draw a line given a series of coordinates. Helper function that will use "move" for the first point, "lineto" for the remaining. @param x new coordinates @param y new coordinates @return path object, for compact syntax.
[ "Draw", "a", "line", "given", "a", "series", "of", "coordinates", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L196-L198
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesInner.java
DatabaseThreatDetectionPoliciesInner.createOrUpdateAsync
public Observable<DatabaseSecurityAlertPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseSecurityAlertPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseSecurityAlertPolicyInner>, DatabaseSecurityAlertPolicyInner>() { @Override public DatabaseSecurityAlertPolicyInner call(ServiceResponse<DatabaseSecurityAlertPolicyInner> response) { return response.body(); } }); }
java
public Observable<DatabaseSecurityAlertPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseSecurityAlertPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseSecurityAlertPolicyInner>, DatabaseSecurityAlertPolicyInner>() { @Override public DatabaseSecurityAlertPolicyInner call(ServiceResponse<DatabaseSecurityAlertPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DatabaseSecurityAlertPolicyInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "DatabaseSecurityAlertPolicyInner", "parameters", ")", "{", "return", "createOrU...
Creates or updates a database's threat detection policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database for which database Threat Detection policy is defined. @param parameters The database Threat Detection policy. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DatabaseSecurityAlertPolicyInner object
[ "Creates", "or", "updates", "a", "database", "s", "threat", "detection", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesInner.java#L202-L209
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/model/Entry.java
Entry.changeStartDate
public final void changeStartDate(LocalDate date, boolean keepDuration) { requireNonNull(date); Interval interval = getInterval(); LocalDateTime newStartDateTime = getStartAsLocalDateTime().with(date); LocalDateTime endDateTime = getEndAsLocalDateTime(); if (keepDuration) { endDateTime = newStartDateTime.plus(getDuration()); setInterval(newStartDateTime, endDateTime, getZoneId()); } else { /* * We might have a problem if the new start time is AFTER the current end time. */ if (newStartDateTime.isAfter(endDateTime)) { interval = interval.withEndDateTime(newStartDateTime.plus(interval.getDuration())); } setInterval(interval.withStartDate(date)); } }
java
public final void changeStartDate(LocalDate date, boolean keepDuration) { requireNonNull(date); Interval interval = getInterval(); LocalDateTime newStartDateTime = getStartAsLocalDateTime().with(date); LocalDateTime endDateTime = getEndAsLocalDateTime(); if (keepDuration) { endDateTime = newStartDateTime.plus(getDuration()); setInterval(newStartDateTime, endDateTime, getZoneId()); } else { /* * We might have a problem if the new start time is AFTER the current end time. */ if (newStartDateTime.isAfter(endDateTime)) { interval = interval.withEndDateTime(newStartDateTime.plus(interval.getDuration())); } setInterval(interval.withStartDate(date)); } }
[ "public", "final", "void", "changeStartDate", "(", "LocalDate", "date", ",", "boolean", "keepDuration", ")", "{", "requireNonNull", "(", "date", ")", ";", "Interval", "interval", "=", "getInterval", "(", ")", ";", "LocalDateTime", "newStartDateTime", "=", "getSt...
Changes the start date of the entry interval. @param date the new start date @param keepDuration if true then this method will also change the end date and time in such a way that the total duration of the entry will not change. If false then this method will ensure that the entry's interval stays valid, which means that the start time will be before the end time and that the duration of the entry will be at least the duration defined by the {@link #minimumDurationProperty()}.
[ "Changes", "the", "start", "date", "of", "the", "entry", "interval", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Entry.java#L397-L419
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java
Math.floorMod
public static int floorMod(int x, int y) { int r = x - floorDiv(x, y) * y; return r; }
java
public static int floorMod(int x, int y) { int r = x - floorDiv(x, y) * y; return r; }
[ "public", "static", "int", "floorMod", "(", "int", "x", ",", "int", "y", ")", "{", "int", "r", "=", "x", "-", "floorDiv", "(", "x", ",", "y", ")", "*", "y", ";", "return", "r", ";", "}" ]
Returns the floor modulus of the {@code int} arguments. <p> The floor modulus is {@code x - (floorDiv(x, y) * y)}, has the same sign as the divisor {@code y}, and is in the range of {@code -abs(y) < r < +abs(y)}. <p> The relationship between {@code floorDiv} and {@code floorMod} is such that: <ul> <li>{@code floorDiv(x, y) * y + floorMod(x, y) == x} </ul> <p> The difference in values between {@code floorMod} and the {@code %} operator is due to the difference between {@code floorDiv} that returns the integer less than or equal to the quotient and the {@code /} operator that returns the integer closest to zero. <p> Examples: <ul> <li>If the signs of the arguments are the same, the results of {@code floorMod} and the {@code %} operator are the same. <br> <ul> <li>{@code floorMod(4, 3) == 1}; &nbsp; and {@code (4 % 3) == 1}</li> </ul> <li>If the signs of the arguments are different, the results differ from the {@code %} operator.<br> <ul> <li>{@code floorMod(+4, -3) == -2}; &nbsp; and {@code (+4 % -3) == +1} </li> <li>{@code floorMod(-4, +3) == +2}; &nbsp; and {@code (-4 % +3) == -1} </li> <li>{@code floorMod(-4, -3) == -1}; &nbsp; and {@code (-4 % -3) == -1 } </li> </ul> </li> </ul> <p> If the signs of arguments are unknown and a positive modulus is needed it can be computed as {@code (floorMod(x, y) + abs(y)) % abs(y)}. @param x the dividend @param y the divisor @return the floor modulus {@code x - (floorDiv(x, y) * y)} @throws ArithmeticException if the divisor {@code y} is zero @see #floorDiv(int, int) @since 1.8
[ "Returns", "the", "floor", "modulus", "of", "the", "{", "@code", "int", "}", "arguments", ".", "<p", ">", "The", "floor", "modulus", "is", "{", "@code", "x", "-", "(", "floorDiv", "(", "x", "y", ")", "*", "y", ")", "}", "has", "the", "same", "sig...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java#L1143-L1146
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.setColumn
public Matrix4x3f setColumn(int column, Vector3fc src) throws IndexOutOfBoundsException { switch (column) { case 0: this.m00 = src.x(); this.m01 = src.y(); this.m02 = src.z(); break; case 1: this.m10 = src.x(); this.m11 = src.y(); this.m12 = src.z(); break; case 2: this.m20 = src.x(); this.m21 = src.y(); this.m22 = src.z(); break; case 3: this.m30 = src.x(); this.m31 = src.y(); this.m32 = src.z(); break; default: throw new IndexOutOfBoundsException(); } properties = 0; return this; }
java
public Matrix4x3f setColumn(int column, Vector3fc src) throws IndexOutOfBoundsException { switch (column) { case 0: this.m00 = src.x(); this.m01 = src.y(); this.m02 = src.z(); break; case 1: this.m10 = src.x(); this.m11 = src.y(); this.m12 = src.z(); break; case 2: this.m20 = src.x(); this.m21 = src.y(); this.m22 = src.z(); break; case 3: this.m30 = src.x(); this.m31 = src.y(); this.m32 = src.z(); break; default: throw new IndexOutOfBoundsException(); } properties = 0; return this; }
[ "public", "Matrix4x3f", "setColumn", "(", "int", "column", ",", "Vector3fc", "src", ")", "throws", "IndexOutOfBoundsException", "{", "switch", "(", "column", ")", "{", "case", "0", ":", "this", ".", "m00", "=", "src", ".", "x", "(", ")", ";", "this", "...
Set the column at the given <code>column</code> index, starting with <code>0</code>. @param column the column index in <code>[0..3]</code> @param src the column components to set @return this @throws IndexOutOfBoundsException if <code>column</code> is not in <code>[0..3]</code>
[ "Set", "the", "column", "at", "the", "given", "<code", ">", "column<", "/", "code", ">", "index", "starting", "with", "<code", ">", "0<", "/", "code", ">", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L7567-L7594
fcrepo4-exts/fcrepo-camel-toolbox
fcrepo-ldpath/src/main/java/org/fcrepo/camel/ldpath/ClientFactory.java
ClientFactory.createClient
public static ClientConfiguration createClient(final AuthScope authScope, final Credentials credentials) { return createClient(authScope, credentials, emptyList(), emptyList()); }
java
public static ClientConfiguration createClient(final AuthScope authScope, final Credentials credentials) { return createClient(authScope, credentials, emptyList(), emptyList()); }
[ "public", "static", "ClientConfiguration", "createClient", "(", "final", "AuthScope", "authScope", ",", "final", "Credentials", "credentials", ")", "{", "return", "createClient", "(", "authScope", ",", "credentials", ",", "emptyList", "(", ")", ",", "emptyList", "...
Configure a linked data client suitable for use with a Fedora Repository. @param authScope the authentication scope @param credentials the credentials @return a configuration for use with an LDClient
[ "Configure", "a", "linked", "data", "client", "suitable", "for", "use", "with", "a", "Fedora", "Repository", "." ]
train
https://github.com/fcrepo4-exts/fcrepo-camel-toolbox/blob/9e0cf220937b2d5c050e0e071f0cdc4c7a084c0f/fcrepo-ldpath/src/main/java/org/fcrepo/camel/ldpath/ClientFactory.java#L92-L94
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/collections/CollectionUtils.java
CollectionUtils.toStringLimited
public static String toStringLimited(ImmutableSet<?> items, int limit) { if (items.size() <= limit) { return items.toString(); } else { return items.asList().subList(0, limit).toString() + "... (" + (items.size() - limit) + " more)"; } }
java
public static String toStringLimited(ImmutableSet<?> items, int limit) { if (items.size() <= limit) { return items.toString(); } else { return items.asList().subList(0, limit).toString() + "... (" + (items.size() - limit) + " more)"; } }
[ "public", "static", "String", "toStringLimited", "(", "ImmutableSet", "<", "?", ">", "items", ",", "int", "limit", ")", "{", "if", "(", "items", ".", "size", "(", ")", "<=", "limit", ")", "{", "return", "items", ".", "toString", "(", ")", ";", "}", ...
Acts like {@code items.toString()} unless {@code items} has more elements than {@code limit}, in which case it simply prints the number of excess items. This is useful for making toStrings for objects which may contain large collections.
[ "Acts", "like", "{" ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/collections/CollectionUtils.java#L428-L434
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java
LayoutUtils.getJRDesignGroup
public static JRDesignGroup getJRDesignGroup(DynamicJasperDesign jd, LayoutManager layoutManager, DJGroup group) { Map references = layoutManager.getReferencesMap(); for (Object o : references.keySet()) { String groupName = (String) o; DJGroup djGroup = (DJGroup) references.get(groupName); if (group == djGroup) { return (JRDesignGroup) jd.getGroupsMap().get(groupName); } } return null; }
java
public static JRDesignGroup getJRDesignGroup(DynamicJasperDesign jd, LayoutManager layoutManager, DJGroup group) { Map references = layoutManager.getReferencesMap(); for (Object o : references.keySet()) { String groupName = (String) o; DJGroup djGroup = (DJGroup) references.get(groupName); if (group == djGroup) { return (JRDesignGroup) jd.getGroupsMap().get(groupName); } } return null; }
[ "public", "static", "JRDesignGroup", "getJRDesignGroup", "(", "DynamicJasperDesign", "jd", ",", "LayoutManager", "layoutManager", ",", "DJGroup", "group", ")", "{", "Map", "references", "=", "layoutManager", ".", "getReferencesMap", "(", ")", ";", "for", "(", "Obj...
Returns the JRDesignGroup for the DJGroup passed @param jd @param layoutManager @param group @return
[ "Returns", "the", "JRDesignGroup", "for", "the", "DJGroup", "passed" ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java#L122-L132
zaproxy/zaproxy
src/org/parosproxy/paros/network/GenericMethod.java
GenericMethod.addParameter
public void addParameter(String paramName, String paramValue) throws IllegalArgumentException { log.trace("enter PostMethod.addParameter(String, String)"); if ((paramName == null) || (paramValue == null)) { throw new IllegalArgumentException( "Arguments to addParameter(String, String) cannot be null"); } super.clearRequestBody(); this.params.add(new NameValuePair(paramName, paramValue)); }
java
public void addParameter(String paramName, String paramValue) throws IllegalArgumentException { log.trace("enter PostMethod.addParameter(String, String)"); if ((paramName == null) || (paramValue == null)) { throw new IllegalArgumentException( "Arguments to addParameter(String, String) cannot be null"); } super.clearRequestBody(); this.params.add(new NameValuePair(paramName, paramValue)); }
[ "public", "void", "addParameter", "(", "String", "paramName", ",", "String", "paramValue", ")", "throws", "IllegalArgumentException", "{", "log", ".", "trace", "(", "\"enter PostMethod.addParameter(String, String)\"", ")", ";", "if", "(", "(", "paramName", "==", "nu...
Adds a new parameter to be used in the POST request body. @param paramName The parameter name to add. @param paramValue The parameter value to add. @throws IllegalArgumentException if either argument is null @since 1.0
[ "Adds", "a", "new", "parameter", "to", "be", "used", "in", "the", "POST", "request", "body", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/network/GenericMethod.java#L224-L234
dita-ot/dita-ot
src/main/java/org/dita/dost/module/reader/AbstractReaderModule.java
AbstractReaderModule.initXMLReader
void initXMLReader(final File ditaDir, final boolean validate) throws SAXException { reader = XMLUtils.getXMLReader(); reader.setFeature(FEATURE_NAMESPACE, true); reader.setFeature(FEATURE_NAMESPACE_PREFIX, true); if (validate) { reader.setFeature(FEATURE_VALIDATION, true); try { reader.setFeature(FEATURE_VALIDATION_SCHEMA, true); } catch (final SAXNotRecognizedException e) { // Not Xerces, ignore exception } } else { logger.warn(MessageUtils.getMessage("DOTJ037W").toString()); } if (gramcache) { final XMLGrammarPool grammarPool = GrammarPoolManager.getGrammarPool(); try { reader.setProperty("http://apache.org/xml/properties/internal/grammar-pool", grammarPool); logger.info("Using Xerces grammar pool for DTD and schema caching."); } catch (final NoClassDefFoundError e) { logger.debug("Xerces not available, not using grammar caching"); } catch (final SAXNotRecognizedException | SAXNotSupportedException e) { logger.warn("Failed to set Xerces grammar pool for parser: " + e.getMessage()); } } CatalogUtils.setDitaDir(ditaDir); reader.setEntityResolver(CatalogUtils.getCatalogResolver()); }
java
void initXMLReader(final File ditaDir, final boolean validate) throws SAXException { reader = XMLUtils.getXMLReader(); reader.setFeature(FEATURE_NAMESPACE, true); reader.setFeature(FEATURE_NAMESPACE_PREFIX, true); if (validate) { reader.setFeature(FEATURE_VALIDATION, true); try { reader.setFeature(FEATURE_VALIDATION_SCHEMA, true); } catch (final SAXNotRecognizedException e) { // Not Xerces, ignore exception } } else { logger.warn(MessageUtils.getMessage("DOTJ037W").toString()); } if (gramcache) { final XMLGrammarPool grammarPool = GrammarPoolManager.getGrammarPool(); try { reader.setProperty("http://apache.org/xml/properties/internal/grammar-pool", grammarPool); logger.info("Using Xerces grammar pool for DTD and schema caching."); } catch (final NoClassDefFoundError e) { logger.debug("Xerces not available, not using grammar caching"); } catch (final SAXNotRecognizedException | SAXNotSupportedException e) { logger.warn("Failed to set Xerces grammar pool for parser: " + e.getMessage()); } } CatalogUtils.setDitaDir(ditaDir); reader.setEntityResolver(CatalogUtils.getCatalogResolver()); }
[ "void", "initXMLReader", "(", "final", "File", "ditaDir", ",", "final", "boolean", "validate", ")", "throws", "SAXException", "{", "reader", "=", "XMLUtils", ".", "getXMLReader", "(", ")", ";", "reader", ".", "setFeature", "(", "FEATURE_NAMESPACE", ",", "true"...
Init xml reader used for pipeline parsing. @param ditaDir absolute path to DITA-OT directory @param validate whether validate input file @throws SAXException parsing exception
[ "Init", "xml", "reader", "used", "for", "pipeline", "parsing", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/reader/AbstractReaderModule.java#L186-L213
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/FormLogoutExtensionProcessor.java
FormLogoutExtensionProcessor.isRequestURLEqualsExitPageHost
private boolean isRequestURLEqualsExitPageHost(HttpServletRequest req, String logoutURLhost) { boolean acceptURL = false; try { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "about to attempt matching the logout exit url with the domain of the request."); StringBuffer requestURLString = req.getRequestURL(); URL requestURL = new URL(new String(requestURLString)); String requestURLhost = requestURL.getHost(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, " host of the request url is: " + requestURLhost + " and the host of the logout URL is: " + logoutURLhost); if (logoutURLhost != null && requestURLhost != null && logoutURLhost.equalsIgnoreCase(requestURLhost)) { acceptURL = true; } } catch (MalformedURLException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "caught Exception trying to form request URL object: " + e.getMessage()); } } return acceptURL; }
java
private boolean isRequestURLEqualsExitPageHost(HttpServletRequest req, String logoutURLhost) { boolean acceptURL = false; try { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "about to attempt matching the logout exit url with the domain of the request."); StringBuffer requestURLString = req.getRequestURL(); URL requestURL = new URL(new String(requestURLString)); String requestURLhost = requestURL.getHost(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, " host of the request url is: " + requestURLhost + " and the host of the logout URL is: " + logoutURLhost); if (logoutURLhost != null && requestURLhost != null && logoutURLhost.equalsIgnoreCase(requestURLhost)) { acceptURL = true; } } catch (MalformedURLException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "caught Exception trying to form request URL object: " + e.getMessage()); } } return acceptURL; }
[ "private", "boolean", "isRequestURLEqualsExitPageHost", "(", "HttpServletRequest", "req", ",", "String", "logoutURLhost", ")", "{", "boolean", "acceptURL", "=", "false", ";", "try", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc"...
Attempt to match the request URL's host with the URL for the exitPage this might be the case of a proxy URL that is used in the request. @param req @param acceptURL @return
[ "Attempt", "to", "match", "the", "request", "URL", "s", "host", "with", "the", "URL", "for", "the", "exitPage", "this", "might", "be", "the", "case", "of", "a", "proxy", "URL", "that", "is", "used", "in", "the", "request", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/FormLogoutExtensionProcessor.java#L359-L378
networknt/light-4j
resource/src/main/java/com/networknt/resource/ResourceHelpers.java
ResourceHelpers.isResourcePath
public static boolean isResourcePath(String requestPath, PathResourceProvider[] pathResourceProviders) { boolean isResourcePath = false; if (pathResourceProviders != null && pathResourceProviders.length > 0) { for (PathResourceProvider pathResourceProvider : pathResourceProviders) { if ((pathResourceProvider.isPrefixPath() && requestPath.startsWith(pathResourceProvider.getPath())) || (!pathResourceProvider.isPrefixPath() && requestPath.equals(pathResourceProvider.getPath()))) { isResourcePath = true; } } } return isResourcePath; }
java
public static boolean isResourcePath(String requestPath, PathResourceProvider[] pathResourceProviders) { boolean isResourcePath = false; if (pathResourceProviders != null && pathResourceProviders.length > 0) { for (PathResourceProvider pathResourceProvider : pathResourceProviders) { if ((pathResourceProvider.isPrefixPath() && requestPath.startsWith(pathResourceProvider.getPath())) || (!pathResourceProvider.isPrefixPath() && requestPath.equals(pathResourceProvider.getPath()))) { isResourcePath = true; } } } return isResourcePath; }
[ "public", "static", "boolean", "isResourcePath", "(", "String", "requestPath", ",", "PathResourceProvider", "[", "]", "pathResourceProviders", ")", "{", "boolean", "isResourcePath", "=", "false", ";", "if", "(", "pathResourceProviders", "!=", "null", "&&", "pathReso...
Helper to check if a given requestPath could resolve to a PathResourceProvider. @param requestPath The client request path. @param pathResourceProviders The list of PathResourceProviders that could potentially resolve this path. @return true if the path could resolve, false otherwise.
[ "Helper", "to", "check", "if", "a", "given", "requestPath", "could", "resolve", "to", "a", "PathResourceProvider", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/resource/src/main/java/com/networknt/resource/ResourceHelpers.java#L72-L83
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java
MSPDIWriter.writeAvailability
private void writeAvailability(Project.Resources.Resource xml, Resource mpx) { AvailabilityPeriods periods = m_factory.createProjectResourcesResourceAvailabilityPeriods(); xml.setAvailabilityPeriods(periods); List<AvailabilityPeriod> list = periods.getAvailabilityPeriod(); for (Availability availability : mpx.getAvailability()) { AvailabilityPeriod period = m_factory.createProjectResourcesResourceAvailabilityPeriodsAvailabilityPeriod(); list.add(period); DateRange range = availability.getRange(); period.setAvailableFrom(range.getStart()); period.setAvailableTo(range.getEnd()); period.setAvailableUnits(DatatypeConverter.printUnits(availability.getUnits())); } }
java
private void writeAvailability(Project.Resources.Resource xml, Resource mpx) { AvailabilityPeriods periods = m_factory.createProjectResourcesResourceAvailabilityPeriods(); xml.setAvailabilityPeriods(periods); List<AvailabilityPeriod> list = periods.getAvailabilityPeriod(); for (Availability availability : mpx.getAvailability()) { AvailabilityPeriod period = m_factory.createProjectResourcesResourceAvailabilityPeriodsAvailabilityPeriod(); list.add(period); DateRange range = availability.getRange(); period.setAvailableFrom(range.getStart()); period.setAvailableTo(range.getEnd()); period.setAvailableUnits(DatatypeConverter.printUnits(availability.getUnits())); } }
[ "private", "void", "writeAvailability", "(", "Project", ".", "Resources", ".", "Resource", "xml", ",", "Resource", "mpx", ")", "{", "AvailabilityPeriods", "periods", "=", "m_factory", ".", "createProjectResourcesResourceAvailabilityPeriods", "(", ")", ";", "xml", "....
This method writes a resource's availability table. @param xml MSPDI resource @param mpx MPXJ resource
[ "This", "method", "writes", "a", "resource", "s", "availability", "table", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1012-L1027
msteiger/jxmapviewer2
jxmapviewer2/src/main/java/org/jxmapviewer/painter/AbstractPainter.java
AbstractPainter.setVisible
public void setVisible(boolean visible) { boolean old = isVisible(); this.visible = visible; if (old != visible) setDirty(true); //not the most efficient, but I must do this otherwise a CompoundPainter //or other aggregate painter won't know that it is now invalid //there might be a tricky solution but that is a performance optimization firePropertyChange("visible", old, isVisible()); }
java
public void setVisible(boolean visible) { boolean old = isVisible(); this.visible = visible; if (old != visible) setDirty(true); //not the most efficient, but I must do this otherwise a CompoundPainter //or other aggregate painter won't know that it is now invalid //there might be a tricky solution but that is a performance optimization firePropertyChange("visible", old, isVisible()); }
[ "public", "void", "setVisible", "(", "boolean", "visible", ")", "{", "boolean", "old", "=", "isVisible", "(", ")", ";", "this", ".", "visible", "=", "visible", ";", "if", "(", "old", "!=", "visible", ")", "setDirty", "(", "true", ")", ";", "//not the m...
<p>Sets the visible property. This controls if the painter should paint itself. It is true by default. Setting visible to false is good when you want to temporarily turn off a painter. An example of this is a painter that you only use when a button is highlighted.</p> @param visible New value of visible property.
[ "<p", ">", "Sets", "the", "visible", "property", ".", "This", "controls", "if", "the", "painter", "should", "paint", "itself", ".", "It", "is", "true", "by", "default", ".", "Setting", "visible", "to", "false", "is", "good", "when", "you", "want", "to", ...
train
https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/painter/AbstractPainter.java#L211-L218
Scalified/viewmover
viewmover/src/main/java/com/scalified/viewmover/movers/PositionViewMover.java
PositionViewMover.changeViewPosition
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override void changeViewPosition(float xAxisDelta, float yAxisDelta) { float endLeftBoundPointX = calculateEndLeftBound(xAxisDelta); float endTopBoundPointY = calculateEndTopBound(yAxisDelta); getView().setX(endLeftBoundPointX); getView().setY(endTopBoundPointY); LOGGER.trace("Updated view position: leftX = {}, topY = {}", endLeftBoundPointX, endTopBoundPointY); }
java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override void changeViewPosition(float xAxisDelta, float yAxisDelta) { float endLeftBoundPointX = calculateEndLeftBound(xAxisDelta); float endTopBoundPointY = calculateEndTopBound(yAxisDelta); getView().setX(endLeftBoundPointX); getView().setY(endTopBoundPointY); LOGGER.trace("Updated view position: leftX = {}, topY = {}", endLeftBoundPointX, endTopBoundPointY); }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN", ")", "@", "Override", "void", "changeViewPosition", "(", "float", "xAxisDelta", ",", "float", "yAxisDelta", ")", "{", "float", "endLeftBoundPointX", "=", "calculateEndLeftBound", "(", "xAxisD...
Changes the position of the view based on view's visual position within its parent container @param xAxisDelta X-axis delta in actual pixels @param yAxisDelta Y-axis delta in actual pixels
[ "Changes", "the", "position", "of", "the", "view", "based", "on", "view", "s", "visual", "position", "within", "its", "parent", "container" ]
train
https://github.com/Scalified/viewmover/blob/e2b35f7d8517a5533afe8b68a4c1ee352d9aec34/viewmover/src/main/java/com/scalified/viewmover/movers/PositionViewMover.java#L57-L65
cojen/Cojen
src/main/java/org/cojen/classfile/attribute/CodeAttr.java
CodeAttr.getLocalVariable
public LocalVariable getLocalVariable(Location useLocation, int number) { int useLoc = useLocation.getLocation(); if (useLoc < 0) { return null; } else { return getLocalVariable(useLoc, number); } }
java
public LocalVariable getLocalVariable(Location useLocation, int number) { int useLoc = useLocation.getLocation(); if (useLoc < 0) { return null; } else { return getLocalVariable(useLoc, number); } }
[ "public", "LocalVariable", "getLocalVariable", "(", "Location", "useLocation", ",", "int", "number", ")", "{", "int", "useLoc", "=", "useLocation", ".", "getLocation", "(", ")", ";", "if", "(", "useLoc", "<", "0", ")", "{", "return", "null", ";", "}", "e...
Returns local variable info at the given location, for the given number. @return null if unknown
[ "Returns", "local", "variable", "info", "at", "the", "given", "location", "for", "the", "given", "number", "." ]
train
https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/classfile/attribute/CodeAttr.java#L156-L163
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.directories_availableZipCodes_GET
public ArrayList<String> directories_availableZipCodes_GET(OvhNumberCountryEnum country, String number) throws IOException { String qPath = "/telephony/directories/availableZipCodes"; StringBuilder sb = path(qPath); query(sb, "country", country); query(sb, "number", number); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
java
public ArrayList<String> directories_availableZipCodes_GET(OvhNumberCountryEnum country, String number) throws IOException { String qPath = "/telephony/directories/availableZipCodes"; StringBuilder sb = path(qPath); query(sb, "country", country); query(sb, "number", number); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
[ "public", "ArrayList", "<", "String", ">", "directories_availableZipCodes_GET", "(", "OvhNumberCountryEnum", "country", ",", "String", "number", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/directories/availableZipCodes\"", ";", "StringBuilder", ...
Get all zip codes compatible for a number REST: GET /telephony/directories/availableZipCodes @param country [required] The country of the city @param number [required] The number (can be a range terminated by XXXX)
[ "Get", "all", "zip", "codes", "compatible", "for", "a", "number" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8712-L8719
codegist/crest
core/src/main/java/org/codegist/crest/CRestBuilder.java
CRestBuilder.bindDeserializer
public CRestBuilder bindDeserializer(Class<? extends Deserializer> deserializer, String[] mimeTypes, Map<String, Object> config) { this.mimeDeserializerBuilder.register(deserializer, mimeTypes, config); return this; }
java
public CRestBuilder bindDeserializer(Class<? extends Deserializer> deserializer, String[] mimeTypes, Map<String, Object> config) { this.mimeDeserializerBuilder.register(deserializer, mimeTypes, config); return this; }
[ "public", "CRestBuilder", "bindDeserializer", "(", "Class", "<", "?", "extends", "Deserializer", ">", "deserializer", ",", "String", "[", "]", "mimeTypes", ",", "Map", "<", "String", ",", "Object", ">", "config", ")", "{", "this", ".", "mimeDeserializerBuilder...
<p>Binds a deserializer to a list of response Content-Type mime-types.</p> <p>By default, <b>CRest</b> handle the following types:</p> <ul> <li>application/xml, text/xml for Xml deserialization</li> <li>application/json, application/javascript, text/javascript, text/json for Json deserialization</li> </ul> @param deserializer Deserializer class to use for the given mime-types @param mimeTypes Response Content-Types to bind deserializer to @param config State that will be passed to the deserializer along with the CRestConfig object if the deserializer has declared a single argument constructor with CRestConfig parameter type @return current builder @see org.codegist.crest.CRestConfig
[ "<p", ">", "Binds", "a", "deserializer", "to", "a", "list", "of", "response", "Content", "-", "Type", "mime", "-", "types", ".", "<", "/", "p", ">", "<p", ">", "By", "default", "<b", ">", "CRest<", "/", "b", ">", "handle", "the", "following", "type...
train
https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L528-L531
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.newWriter
public static BufferedWriter newWriter(Path self, String charset, boolean append) throws IOException { return newWriter(self, charset, append, false); }
java
public static BufferedWriter newWriter(Path self, String charset, boolean append) throws IOException { return newWriter(self, charset, append, false); }
[ "public", "static", "BufferedWriter", "newWriter", "(", "Path", "self", ",", "String", "charset", ",", "boolean", "append", ")", "throws", "IOException", "{", "return", "newWriter", "(", "self", ",", "charset", ",", "append", ",", "false", ")", ";", "}" ]
Helper method to create a buffered writer for a file without writing a BOM. @param self a Path @param charset the name of the encoding used to write in this file @param append true if in append mode @return a BufferedWriter @throws java.io.IOException if an IOException occurs. @since 2.3.0
[ "Helper", "method", "to", "create", "a", "buffered", "writer", "for", "a", "file", "without", "writing", "a", "BOM", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L1573-L1575
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/OperationContextImpl.java
OperationContextImpl.getServiceTarget
CapabilityServiceTarget getServiceTarget(final Step targetActiveStep) throws UnsupportedOperationException { readOnly = false; assert isControllingThread(); if (!isRuntimeChangeAllowed()) { throw ControllerLogger.ROOT_LOGGER.serviceTargetRuntimeOperationsOnly(); } ensureWriteLockForRuntime(); final ContextServiceBuilderSupplier supplier = new ContextServiceBuilderSupplier() { @Override public <T> ContextServiceBuilder<T> getContextServiceBuilder(ServiceBuilder<T> delegate, final ServiceName name) { final ContextServiceInstaller csi = new ContextServiceInstaller() { @Override public <X> ServiceController<X> installService(ServiceBuilder<X> realBuilder) { return OperationContextImpl.this.installService(realBuilder, name, targetActiveStep); } @Override public ServiceName getCapabilityServiceName(String capabilityName, Class<?> serviceType, PathAddress address) { return OperationContextImpl.this.getCapabilityServiceName(capabilityName, serviceType, address); } }; return new ContextServiceBuilder<T>(delegate, csi); } }; ServiceTarget delegate = targetActiveStep.getScopedServiceTarget(modelController.getServiceTarget()); ContextServiceTarget cst = new ContextServiceTarget(delegate, supplier, targetActiveStep.address); serviceTargets.add(cst); return cst; }
java
CapabilityServiceTarget getServiceTarget(final Step targetActiveStep) throws UnsupportedOperationException { readOnly = false; assert isControllingThread(); if (!isRuntimeChangeAllowed()) { throw ControllerLogger.ROOT_LOGGER.serviceTargetRuntimeOperationsOnly(); } ensureWriteLockForRuntime(); final ContextServiceBuilderSupplier supplier = new ContextServiceBuilderSupplier() { @Override public <T> ContextServiceBuilder<T> getContextServiceBuilder(ServiceBuilder<T> delegate, final ServiceName name) { final ContextServiceInstaller csi = new ContextServiceInstaller() { @Override public <X> ServiceController<X> installService(ServiceBuilder<X> realBuilder) { return OperationContextImpl.this.installService(realBuilder, name, targetActiveStep); } @Override public ServiceName getCapabilityServiceName(String capabilityName, Class<?> serviceType, PathAddress address) { return OperationContextImpl.this.getCapabilityServiceName(capabilityName, serviceType, address); } }; return new ContextServiceBuilder<T>(delegate, csi); } }; ServiceTarget delegate = targetActiveStep.getScopedServiceTarget(modelController.getServiceTarget()); ContextServiceTarget cst = new ContextServiceTarget(delegate, supplier, targetActiveStep.address); serviceTargets.add(cst); return cst; }
[ "CapabilityServiceTarget", "getServiceTarget", "(", "final", "Step", "targetActiveStep", ")", "throws", "UnsupportedOperationException", "{", "readOnly", "=", "false", ";", "assert", "isControllingThread", "(", ")", ";", "if", "(", "!", "isRuntimeChangeAllowed", "(", ...
Gets a service target that will ensure that any {@link org.jboss.msc.service.ServiceTarget#addService(org.jboss.msc.service.ServiceName, org.jboss.msc.service.Service) added services} will be tracked for subsequent verification of service stability. @param targetActiveStep the {@link org.jboss.as.controller.AbstractOperationContext.Step} that encapsulates the {@link org.jboss.as.controller.OperationStepHandler} that is making the call. @return the service target
[ "Gets", "a", "service", "target", "that", "will", "ensure", "that", "any", "{", "@link", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceTarget#addService", "(", "org", ".", "jboss", ".", "msc", ".", "service", ".", "ServiceName", "org", "....
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/OperationContextImpl.java#L743-L777
dodie/scott
scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java
ScottClassTransformer.transform
public byte[] transform(byte[] classfileBuffer, Configuration configuration) { InstrumentationActions instrumentationActions = calculateTransformationParameters(classfileBuffer, configuration); if (!instrumentationActions.includeClass) { return classfileBuffer; } return transform(classfileBuffer, instrumentationActions); }
java
public byte[] transform(byte[] classfileBuffer, Configuration configuration) { InstrumentationActions instrumentationActions = calculateTransformationParameters(classfileBuffer, configuration); if (!instrumentationActions.includeClass) { return classfileBuffer; } return transform(classfileBuffer, instrumentationActions); }
[ "public", "byte", "[", "]", "transform", "(", "byte", "[", "]", "classfileBuffer", ",", "Configuration", "configuration", ")", "{", "InstrumentationActions", "instrumentationActions", "=", "calculateTransformationParameters", "(", "classfileBuffer", ",", "configuration", ...
Instrument the given class based on the configuration. @param classfileBuffer class to be instrumented @param configuration configuration settings @return instrumented class
[ "Instrument", "the", "given", "class", "based", "on", "the", "configuration", "." ]
train
https://github.com/dodie/scott/blob/fd6b492584d3ae7e072871ff2b094cce6041fc99/scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java#L25-L31
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/StringUtil.java
StringUtil.bytesToString
public static String bytesToString(byte[] bytes, int offset, int length) { return new String(bytes, offset, length, UTF8_CHARSET); }
java
public static String bytesToString(byte[] bytes, int offset, int length) { return new String(bytes, offset, length, UTF8_CHARSET); }
[ "public", "static", "String", "bytesToString", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "length", ")", "{", "return", "new", "String", "(", "bytes", ",", "offset", ",", "length", ",", "UTF8_CHARSET", ")", ";", "}" ]
Creates a UTF8_CHARSET string from a byte array. @param bytes the byte array. @param offset the index of the first byte to decode @param length the number of bytes to decode @return the string created from the byte array.
[ "Creates", "a", "UTF8_CHARSET", "string", "from", "a", "byte", "array", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/StringUtil.java#L75-L77
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java
DataStream.partitionCustom
public <K> DataStream<T> partitionCustom(Partitioner<K> partitioner, int field) { Keys.ExpressionKeys<T> outExpressionKeys = new Keys.ExpressionKeys<>(new int[]{field}, getType()); return partitionCustom(partitioner, outExpressionKeys); }
java
public <K> DataStream<T> partitionCustom(Partitioner<K> partitioner, int field) { Keys.ExpressionKeys<T> outExpressionKeys = new Keys.ExpressionKeys<>(new int[]{field}, getType()); return partitionCustom(partitioner, outExpressionKeys); }
[ "public", "<", "K", ">", "DataStream", "<", "T", ">", "partitionCustom", "(", "Partitioner", "<", "K", ">", "partitioner", ",", "int", "field", ")", "{", "Keys", ".", "ExpressionKeys", "<", "T", ">", "outExpressionKeys", "=", "new", "Keys", ".", "Express...
Partitions a tuple DataStream on the specified key fields using a custom partitioner. This method takes the key position to partition on, and a partitioner that accepts the key type. <p>Note: This method works only on single field keys. @param partitioner The partitioner to assign partitions to keys. @param field The field index on which the DataStream is partitioned. @return The partitioned DataStream.
[ "Partitions", "a", "tuple", "DataStream", "on", "the", "specified", "key", "fields", "using", "a", "custom", "partitioner", ".", "This", "method", "takes", "the", "key", "position", "to", "partition", "on", "and", "a", "partitioner", "that", "accepts", "the", ...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L355-L358
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedField.java
MappedField.addAnnotation
public void addAnnotation(final Class<? extends Annotation> clazz, final Annotation ann) { foundAnnotations.put(clazz, ann); discoverNames(); }
java
public void addAnnotation(final Class<? extends Annotation> clazz, final Annotation ann) { foundAnnotations.put(clazz, ann); discoverNames(); }
[ "public", "void", "addAnnotation", "(", "final", "Class", "<", "?", "extends", "Annotation", ">", "clazz", ",", "final", "Annotation", "ann", ")", "{", "foundAnnotations", ".", "put", "(", "clazz", ",", "ann", ")", ";", "discoverNames", "(", ")", ";", "}...
Adds the annotation, if it exists on the field. @param clazz type of the annotation @param ann the annotation
[ "Adds", "the", "annotation", "if", "it", "exists", "on", "the", "field", "." ]
train
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedField.java#L164-L167
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Counters.java
Counters.L2Normalize
public static <E, C extends Counter<E>> C L2Normalize(C c) { return scale(c, 1.0 / L2Norm(c)); }
java
public static <E, C extends Counter<E>> C L2Normalize(C c) { return scale(c, 1.0 / L2Norm(c)); }
[ "public", "static", "<", "E", ",", "C", "extends", "Counter", "<", "E", ">", ">", "C", "L2Normalize", "(", "C", "c", ")", "{", "return", "scale", "(", "c", ",", "1.0", "/", "L2Norm", "(", "c", ")", ")", ";", "}" ]
L2 normalize a counter. @param c The {@link Counter} to be L2 normalized. This counter is not modified. @return A new l2-normalized Counter based on c.
[ "L2", "normalize", "a", "counter", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L1301-L1303
mozilla/rhino
src/org/mozilla/javascript/Context.java
Context.setDebugger
public final void setDebugger(Debugger debugger, Object contextData) { if (sealed) onSealedMutation(); this.debugger = debugger; debuggerData = contextData; }
java
public final void setDebugger(Debugger debugger, Object contextData) { if (sealed) onSealedMutation(); this.debugger = debugger; debuggerData = contextData; }
[ "public", "final", "void", "setDebugger", "(", "Debugger", "debugger", ",", "Object", "contextData", ")", "{", "if", "(", "sealed", ")", "onSealedMutation", "(", ")", ";", "this", ".", "debugger", "=", "debugger", ";", "debuggerData", "=", "contextData", ";"...
Set the associated debugger. @param debugger the debugger to be used on callbacks from the engine. @param contextData arbitrary object that debugger can use to store per Context data.
[ "Set", "the", "associated", "debugger", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Context.java#L2277-L2282
googleapis/google-cloud-java
google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClient.java
AlertPolicyServiceClient.createAlertPolicy
public final AlertPolicy createAlertPolicy(ProjectName name, AlertPolicy alertPolicy) { CreateAlertPolicyRequest request = CreateAlertPolicyRequest.newBuilder() .setName(name == null ? null : name.toString()) .setAlertPolicy(alertPolicy) .build(); return createAlertPolicy(request); }
java
public final AlertPolicy createAlertPolicy(ProjectName name, AlertPolicy alertPolicy) { CreateAlertPolicyRequest request = CreateAlertPolicyRequest.newBuilder() .setName(name == null ? null : name.toString()) .setAlertPolicy(alertPolicy) .build(); return createAlertPolicy(request); }
[ "public", "final", "AlertPolicy", "createAlertPolicy", "(", "ProjectName", "name", ",", "AlertPolicy", "alertPolicy", ")", "{", "CreateAlertPolicyRequest", "request", "=", "CreateAlertPolicyRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", "==", "n...
Creates a new alerting policy. <p>Sample code: <pre><code> try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) { ProjectName name = ProjectName.of("[PROJECT]"); AlertPolicy alertPolicy = AlertPolicy.newBuilder().build(); AlertPolicy response = alertPolicyServiceClient.createAlertPolicy(name, alertPolicy); } </code></pre> @param name The project in which to create the alerting policy. The format is `projects/[PROJECT_ID]`. <p>Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form `/alertPolicies/[POLICY_ID]`, identifying the policy in the container. @param alertPolicy The requested alerting policy. You should omit the `name` field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "new", "alerting", "policy", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClient.java#L430-L438
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/security/csiv2/CommonCfg.java
CommonCfg.printTrace
@Trivial public static void printTrace(String key, Object value, int tabLevel) { if (tc.isDebugEnabled()) { StringBuilder msg = new StringBuilder(); for (int count = 0; count < tabLevel; count++) { msg.append("\t"); } if (value != null) { msg.append(key); msg.append(":"); msg.append(value); } else { msg.append(key); } Tr.debug(tc, msg.toString()); } }
java
@Trivial public static void printTrace(String key, Object value, int tabLevel) { if (tc.isDebugEnabled()) { StringBuilder msg = new StringBuilder(); for (int count = 0; count < tabLevel; count++) { msg.append("\t"); } if (value != null) { msg.append(key); msg.append(":"); msg.append(value); } else { msg.append(key); } Tr.debug(tc, msg.toString()); } }
[ "@", "Trivial", "public", "static", "void", "printTrace", "(", "String", "key", ",", "Object", "value", ",", "int", "tabLevel", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "StringBuilder", "msg", "=", "new", "StringBuilder", "("...
printTrace: This method print the messages to the trace file. @param key @param value @param tabLevel
[ "printTrace", ":", "This", "method", "print", "the", "messages", "to", "the", "trace", "file", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/security/csiv2/CommonCfg.java#L269-L285
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/CodedOutputStream.java
CodedOutputStream.writeEnum
public void writeEnum(final int fieldNumber, final int value) throws IOException { writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT); writeEnumNoTag(value); }
java
public void writeEnum(final int fieldNumber, final int value) throws IOException { writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT); writeEnumNoTag(value); }
[ "public", "void", "writeEnum", "(", "final", "int", "fieldNumber", ",", "final", "int", "value", ")", "throws", "IOException", "{", "writeTag", "(", "fieldNumber", ",", "WireFormat", ".", "WIRETYPE_VARINT", ")", ";", "writeEnumNoTag", "(", "value", ")", ";", ...
Write an enum field, including tag, to the stream. Caller is responsible for converting the enum value to its numeric value.
[ "Write", "an", "enum", "field", "including", "tag", "to", "the", "stream", ".", "Caller", "is", "responsible", "for", "converting", "the", "enum", "value", "to", "its", "numeric", "value", "." ]
train
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L243-L247