repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/util/WorkQueue.java
WorkQueue.await
public boolean await(Object taskGroupId, long timeout, TimeUnit unit) { CountDownLatch latch = taskKeyToLatch.get(taskGroupId); if (latch == null) throw new IllegalArgumentException( "Unknown task group: " + taskGroupId); try { if (latch.await(timeout, unit)) { // Once finished, remove the key so it can be associated with a // new task taskKeyToLatch.remove(taskGroupId); return true; } return false; } catch (InterruptedException ie) { throw new IllegalStateException("Not all tasks finished", ie); } }
java
public boolean await(Object taskGroupId, long timeout, TimeUnit unit) { CountDownLatch latch = taskKeyToLatch.get(taskGroupId); if (latch == null) throw new IllegalArgumentException( "Unknown task group: " + taskGroupId); try { if (latch.await(timeout, unit)) { // Once finished, remove the key so it can be associated with a // new task taskKeyToLatch.remove(taskGroupId); return true; } return false; } catch (InterruptedException ie) { throw new IllegalStateException("Not all tasks finished", ie); } }
[ "public", "boolean", "await", "(", "Object", "taskGroupId", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "{", "CountDownLatch", "latch", "=", "taskKeyToLatch", ".", "get", "(", "taskGroupId", ")", ";", "if", "(", "latch", "==", "null", ")", "throw...
Waits until all the tasks associated with the group identifier have finished. Once a task group has been successfully waited upon, the group identifier is removed from the queue and is valid to be reused for a new task group. @throws IllegalArgumentException if the {@code taskGroupId} is not currently associated with any active taskGroup
[ "Waits", "until", "all", "the", "tasks", "associated", "with", "the", "group", "identifier", "have", "finished", ".", "Once", "a", "task", "group", "has", "been", "successfully", "waited", "upon", "the", "group", "identifier", "is", "removed", "from", "the", ...
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/WorkQueue.java#L186-L203
google/closure-templates
java/src/com/google/template/soy/soyparse/Tokens.java
Tokens.areAdjacent
static boolean areAdjacent(Token first, Token second) { return first.endLine == second.beginLine && first.endColumn == second.beginColumn - 1; }
java
static boolean areAdjacent(Token first, Token second) { return first.endLine == second.beginLine && first.endColumn == second.beginColumn - 1; }
[ "static", "boolean", "areAdjacent", "(", "Token", "first", ",", "Token", "second", ")", "{", "return", "first", ".", "endLine", "==", "second", ".", "beginLine", "&&", "first", ".", "endColumn", "==", "second", ".", "beginColumn", "-", "1", ";", "}" ]
Returns {@code true} if the two tokens are adjacent in the input stream with no intervening characters.
[ "Returns", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soyparse/Tokens.java#L62-L64
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.HEADING
public static HtmlTree HEADING(HtmlTag headingTag, boolean printTitle, HtmlStyle styleClass, Content body) { HtmlTree htmltree = new HtmlTree(headingTag, nullCheck(body)); if (printTitle) htmltree.setTitle(body); if (styleClass != null) htmltree.addStyle(styleClass); return htmltree; }
java
public static HtmlTree HEADING(HtmlTag headingTag, boolean printTitle, HtmlStyle styleClass, Content body) { HtmlTree htmltree = new HtmlTree(headingTag, nullCheck(body)); if (printTitle) htmltree.setTitle(body); if (styleClass != null) htmltree.addStyle(styleClass); return htmltree; }
[ "public", "static", "HtmlTree", "HEADING", "(", "HtmlTag", "headingTag", ",", "boolean", "printTitle", ",", "HtmlStyle", "styleClass", ",", "Content", "body", ")", "{", "HtmlTree", "htmltree", "=", "new", "HtmlTree", "(", "headingTag", ",", "nullCheck", "(", "...
Generates a heading tag (h1 to h6) with the title and style class attributes. It also encloses a content. @param headingTag the heading tag to be generated @param printTitle true if title for the tag needs to be printed else false @param styleClass stylesheet class for the tag @param body content for the tag @return an HtmlTree object for the tag
[ "Generates", "a", "heading", "tag", "(", "h1", "to", "h6", ")", "with", "the", "title", "and", "style", "class", "attributes", ".", "It", "also", "encloses", "a", "content", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L394-L402
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserCommand.java
ParserCommand.compileCommit
private Statement compileCommit() { boolean chain = false; read(); readIfThis(Tokens.WORK); if (token.tokenType == Tokens.AND) { read(); if (token.tokenType == Tokens.NO) { read(); } else { chain = true; } readThis(Tokens.CHAIN); } String sql = getLastPart(); Object[] args = new Object[]{ Boolean.valueOf(chain) }; Statement cs = new StatementSession(StatementTypes.COMMIT_WORK, args); return cs; }
java
private Statement compileCommit() { boolean chain = false; read(); readIfThis(Tokens.WORK); if (token.tokenType == Tokens.AND) { read(); if (token.tokenType == Tokens.NO) { read(); } else { chain = true; } readThis(Tokens.CHAIN); } String sql = getLastPart(); Object[] args = new Object[]{ Boolean.valueOf(chain) }; Statement cs = new StatementSession(StatementTypes.COMMIT_WORK, args); return cs; }
[ "private", "Statement", "compileCommit", "(", ")", "{", "boolean", "chain", "=", "false", ";", "read", "(", ")", ";", "readIfThis", "(", "Tokens", ".", "WORK", ")", ";", "if", "(", "token", ".", "tokenType", "==", "Tokens", ".", "AND", ")", "{", "rea...
Responsible for handling the execution of COMMIT [WORK] @throws HsqlException
[ "Responsible", "for", "handling", "the", "execution", "of", "COMMIT", "[", "WORK", "]" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserCommand.java#L1098-L1122
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java
DirectoryServiceClient.getACL
public ACL getACL(AuthScheme scheme, String id){ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.GetACL); GetACLProtocol p = new GetACLProtocol(scheme, id); Response resp = connection.submitRequest(header, p, null); return ((GetACLResponse) resp).getAcl(); }
java
public ACL getACL(AuthScheme scheme, String id){ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.GetACL); GetACLProtocol p = new GetACLProtocol(scheme, id); Response resp = connection.submitRequest(header, p, null); return ((GetACLResponse) resp).getAcl(); }
[ "public", "ACL", "getACL", "(", "AuthScheme", "scheme", ",", "String", "id", ")", "{", "ProtocolHeader", "header", "=", "new", "ProtocolHeader", "(", ")", ";", "header", ".", "setType", "(", "ProtocolType", ".", "GetACL", ")", ";", "GetACLProtocol", "p", "...
Get the ACL. @param scheme the AuthScheme. @param id the identity. @return the ACL.
[ "Get", "the", "ACL", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L333-L341
aws/aws-sdk-java
aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/TrainingJob.java
TrainingJob.withHyperParameters
public TrainingJob withHyperParameters(java.util.Map<String, String> hyperParameters) { setHyperParameters(hyperParameters); return this; }
java
public TrainingJob withHyperParameters(java.util.Map<String, String> hyperParameters) { setHyperParameters(hyperParameters); return this; }
[ "public", "TrainingJob", "withHyperParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "hyperParameters", ")", "{", "setHyperParameters", "(", "hyperParameters", ")", ";", "return", "this", ";", "}" ]
<p> Algorithm-specific parameters. </p> @param hyperParameters Algorithm-specific parameters. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Algorithm", "-", "specific", "parameters", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/TrainingJob.java#L1831-L1834
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/SimpleDeploymentDescription.java
SimpleDeploymentDescription.of
public static SimpleDeploymentDescription of(final String name, @SuppressWarnings("TypeMayBeWeakened") final Set<String> serverGroups) { final SimpleDeploymentDescription result = of(name); if (serverGroups != null) { result.addServerGroups(serverGroups); } return result; }
java
public static SimpleDeploymentDescription of(final String name, @SuppressWarnings("TypeMayBeWeakened") final Set<String> serverGroups) { final SimpleDeploymentDescription result = of(name); if (serverGroups != null) { result.addServerGroups(serverGroups); } return result; }
[ "public", "static", "SimpleDeploymentDescription", "of", "(", "final", "String", "name", ",", "@", "SuppressWarnings", "(", "\"TypeMayBeWeakened\"", ")", "final", "Set", "<", "String", ">", "serverGroups", ")", "{", "final", "SimpleDeploymentDescription", "result", ...
Creates a simple deployment description. @param name the name for the deployment @param serverGroups the server groups @return the deployment description
[ "Creates", "a", "simple", "deployment", "description", "." ]
train
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/SimpleDeploymentDescription.java#L64-L70
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java
StrSubstitutor.resolveVariable
protected String resolveVariable(final String variableName, final StrBuilder buf, final int startPos, final int endPos) { final StrLookup<?> resolver = getVariableResolver(); if (resolver == null) { return null; } return resolver.lookup(variableName); }
java
protected String resolveVariable(final String variableName, final StrBuilder buf, final int startPos, final int endPos) { final StrLookup<?> resolver = getVariableResolver(); if (resolver == null) { return null; } return resolver.lookup(variableName); }
[ "protected", "String", "resolveVariable", "(", "final", "String", "variableName", ",", "final", "StrBuilder", "buf", ",", "final", "int", "startPos", ",", "final", "int", "endPos", ")", "{", "final", "StrLookup", "<", "?", ">", "resolver", "=", "getVariableRes...
Internal method that resolves the value of a variable. <p> Most users of this class do not need to call this method. This method is called automatically by the substitution process. <p> Writers of subclasses can override this method if they need to alter how each substitution occurs. The method is passed the variable's name and must return the corresponding value. This implementation uses the {@link #getVariableResolver()} with the variable's name as the key. @param variableName the name of the variable, not null @param buf the buffer where the substitution is occurring, not null @param startPos the start position of the variable including the prefix, valid @param endPos the end position of the variable including the suffix, valid @return the variable's value or <b>null</b> if the variable is unknown
[ "Internal", "method", "that", "resolves", "the", "value", "of", "a", "variable", ".", "<p", ">", "Most", "users", "of", "this", "class", "do", "not", "need", "to", "call", "this", "method", ".", "This", "method", "is", "called", "automatically", "by", "t...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java#L932-L938
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSClient.java
DFSClient.recoverLease
boolean recoverLease(String src, boolean discardLastBlock) throws IOException { checkOpen(); // We remove the file from local lease checker. Usually it is already been // removed by the client but we want to be extra safe. leasechecker.remove(src); if (this.namenodeProtocolProxy == null) { return versionBasedRecoverLease(src); } return methodBasedRecoverLease(src, discardLastBlock); }
java
boolean recoverLease(String src, boolean discardLastBlock) throws IOException { checkOpen(); // We remove the file from local lease checker. Usually it is already been // removed by the client but we want to be extra safe. leasechecker.remove(src); if (this.namenodeProtocolProxy == null) { return versionBasedRecoverLease(src); } return methodBasedRecoverLease(src, discardLastBlock); }
[ "boolean", "recoverLease", "(", "String", "src", ",", "boolean", "discardLastBlock", ")", "throws", "IOException", "{", "checkOpen", "(", ")", ";", "// We remove the file from local lease checker. Usually it is already been", "// removed by the client but we want to be extra safe."...
Recover a file's lease @param src a file's path @return if lease recovery completes @throws IOException
[ "Recover", "a", "file", "s", "lease" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java#L1189-L1199
groupon/odo
proxyui/src/main/java/com/groupon/odo/controllers/ServerMappingController.java
ServerMappingController.updateDestRedirectUrl
@RequestMapping(value = "api/edit/server/{id}/dest", method = RequestMethod.POST) public @ResponseBody ServerRedirect updateDestRedirectUrl(Model model, @PathVariable int id, String destUrl) throws Exception { ServerRedirectService.getInstance().setDestinationUrl(destUrl, id); return ServerRedirectService.getInstance().getRedirect(id); }
java
@RequestMapping(value = "api/edit/server/{id}/dest", method = RequestMethod.POST) public @ResponseBody ServerRedirect updateDestRedirectUrl(Model model, @PathVariable int id, String destUrl) throws Exception { ServerRedirectService.getInstance().setDestinationUrl(destUrl, id); return ServerRedirectService.getInstance().getRedirect(id); }
[ "@", "RequestMapping", "(", "value", "=", "\"api/edit/server/{id}/dest\"", ",", "method", "=", "RequestMethod", ".", "POST", ")", "public", "@", "ResponseBody", "ServerRedirect", "updateDestRedirectUrl", "(", "Model", "model", ",", "@", "PathVariable", "int", "id", ...
Updates the dest URL in the server redirects @param model @param id @param destUrl @return @throws Exception
[ "Updates", "the", "dest", "URL", "in", "the", "server", "redirects" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyui/src/main/java/com/groupon/odo/controllers/ServerMappingController.java#L304-L310
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/metadata/index/IndexMgr.java
IndexMgr.createIndex
public void createIndex(String idxName, String tblName, List<String> fldNames, IndexType idxType, Transaction tx) { // Add the index infos to the index catalog RecordFile rf = idxTi.open(tx, true); rf.insert(); rf.setVal(ICAT_IDXNAME, new VarcharConstant(idxName)); rf.setVal(ICAT_TBLNAME, new VarcharConstant(tblName)); rf.setVal(ICAT_IDXTYPE, new IntegerConstant(idxType.toInteger())); rf.close(); // Add the field names to the key catalog rf = keyTi.open(tx, true); for (String fldName : fldNames) { rf.insert(); rf.setVal(KCAT_IDXNAME, new VarcharConstant(idxName)); rf.setVal(KCAT_KEYNAME, new VarcharConstant(fldName)); rf.close(); } updateCache(new IndexInfo(idxName, tblName, fldNames, idxType)); }
java
public void createIndex(String idxName, String tblName, List<String> fldNames, IndexType idxType, Transaction tx) { // Add the index infos to the index catalog RecordFile rf = idxTi.open(tx, true); rf.insert(); rf.setVal(ICAT_IDXNAME, new VarcharConstant(idxName)); rf.setVal(ICAT_TBLNAME, new VarcharConstant(tblName)); rf.setVal(ICAT_IDXTYPE, new IntegerConstant(idxType.toInteger())); rf.close(); // Add the field names to the key catalog rf = keyTi.open(tx, true); for (String fldName : fldNames) { rf.insert(); rf.setVal(KCAT_IDXNAME, new VarcharConstant(idxName)); rf.setVal(KCAT_KEYNAME, new VarcharConstant(fldName)); rf.close(); } updateCache(new IndexInfo(idxName, tblName, fldNames, idxType)); }
[ "public", "void", "createIndex", "(", "String", "idxName", ",", "String", "tblName", ",", "List", "<", "String", ">", "fldNames", ",", "IndexType", "idxType", ",", "Transaction", "tx", ")", "{", "// Add the index infos to the index catalog\r", "RecordFile", "rf", ...
Creates an index of the specified type for the specified field. A unique ID is assigned to this index, and its information is stored in the idxcat table. @param idxName the name of the index @param tblName the name of the indexed table @param fldNames the name of the indexed field @param idxType the index type of the indexed field @param tx the calling transaction
[ "Creates", "an", "index", "of", "the", "specified", "type", "for", "the", "specified", "field", ".", "A", "unique", "ID", "is", "assigned", "to", "this", "index", "and", "its", "information", "is", "stored", "in", "the", "idxcat", "table", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/index/IndexMgr.java#L132-L153
matthewhorridge/owlapi-gwt
owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/util/OWLAPIPreconditions.java
OWLAPIPreconditions.checkNotNull
@Nonnull public static <T> T checkNotNull(T object, @Nonnull String message) { if (object == null) { throw new NullPointerException(message); } return object; }
java
@Nonnull public static <T> T checkNotNull(T object, @Nonnull String message) { if (object == null) { throw new NullPointerException(message); } return object; }
[ "@", "Nonnull", "public", "static", "<", "T", ">", "T", "checkNotNull", "(", "T", "object", ",", "@", "Nonnull", "String", "message", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "message", ")", ";...
check for null and throw NullPointerException if null @param object reference to check @param message message for the illegal argument exception @param <T> reference type @return the input reference if not null @throws NullPointerException if object is null
[ "check", "for", "null", "and", "throw", "NullPointerException", "if", "null" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/util/OWLAPIPreconditions.java#L95-L101
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/tools/ApiBuilder.java
ApiBuilder.getUrlFromProps
private static String getUrlFromProps(Map<String, String> properties) throws RottenTomatoesException { if (properties.containsKey(PROPERTY_URL) && StringUtils.isNotBlank(properties.get(PROPERTY_URL))) { String url = properties.get(PROPERTY_URL); // If we have the ID, then we need to replace the "{movie-id}" in the URL if (properties.containsKey(PROPERTY_ID) && StringUtils.isNotBlank(properties.get(PROPERTY_ID))) { url = url.replace(MOVIE_ID, String.valueOf(properties.get(PROPERTY_ID))); // We don't need this property anymore properties.remove(PROPERTY_ID); } // We don't need this property anymore properties.remove(PROPERTY_URL); return url; } else { throw new RottenTomatoesException(ApiExceptionType.INVALID_URL, "No URL specified"); } }
java
private static String getUrlFromProps(Map<String, String> properties) throws RottenTomatoesException { if (properties.containsKey(PROPERTY_URL) && StringUtils.isNotBlank(properties.get(PROPERTY_URL))) { String url = properties.get(PROPERTY_URL); // If we have the ID, then we need to replace the "{movie-id}" in the URL if (properties.containsKey(PROPERTY_ID) && StringUtils.isNotBlank(properties.get(PROPERTY_ID))) { url = url.replace(MOVIE_ID, String.valueOf(properties.get(PROPERTY_ID))); // We don't need this property anymore properties.remove(PROPERTY_ID); } // We don't need this property anymore properties.remove(PROPERTY_URL); return url; } else { throw new RottenTomatoesException(ApiExceptionType.INVALID_URL, "No URL specified"); } }
[ "private", "static", "String", "getUrlFromProps", "(", "Map", "<", "String", ",", "String", ">", "properties", ")", "throws", "RottenTomatoesException", "{", "if", "(", "properties", ".", "containsKey", "(", "PROPERTY_URL", ")", "&&", "StringUtils", ".", "isNotB...
Get and process the URL from the properties map @param properties @return The processed URL @throws RottenTomatoesException
[ "Get", "and", "process", "the", "URL", "from", "the", "properties", "map" ]
train
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/tools/ApiBuilder.java#L99-L115
paypal/SeLion
server/src/main/java/com/paypal/selion/grid/servlets/SauceServlet.java
SauceServlet.registerVirtualSauceNodeToGrid
private synchronized void registerVirtualSauceNodeToGrid(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // Redirecting to login page if session is not found if (req.getSession(false) == null) { resp.sendRedirect(LoginServlet.class.getSimpleName()); return; } String respMsg = "Sauce node already registered."; if (registered) { ServletHelper.respondAsHtmlWithMessage(resp, formatForHtmlTemplate(respMsg)); LOGGER.info(respMsg); return; } HttpClientFactory httpClientFactory = new HttpClientFactory(); respMsg = "Sauce node registration failed. Please refer to the log file for failure details."; try { final int port = getRegistry().getHub().getConfiguration().port; final URL registration = new URL("http://localhost:" + port + "/grid/register"); BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", registration.toExternalForm()); request.setEntity(new StringEntity(getRegistrationRequestEntity())); HttpHost host = new HttpHost(registration.getHost(), registration.getPort()); HttpClient client = httpClientFactory.getHttpClient(); HttpResponse response = client.execute(host, request); if (response.getStatusLine().getStatusCode() == HttpServletResponse.SC_OK) { respMsg = "Sauce node registered successfully."; registered = true; } } catch (IOException | GridConfigurationException e) { // We catch the GridConfigurationException here to fail // gracefully // TODO Consider retrying on failure LOGGER.log(Level.WARNING, "Unable to register sauce node: ", e); } finally { httpClientFactory.close(); } LOGGER.info(respMsg); ServletHelper.respondAsHtmlWithMessage(resp, formatForHtmlTemplate(respMsg)); }
java
private synchronized void registerVirtualSauceNodeToGrid(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // Redirecting to login page if session is not found if (req.getSession(false) == null) { resp.sendRedirect(LoginServlet.class.getSimpleName()); return; } String respMsg = "Sauce node already registered."; if (registered) { ServletHelper.respondAsHtmlWithMessage(resp, formatForHtmlTemplate(respMsg)); LOGGER.info(respMsg); return; } HttpClientFactory httpClientFactory = new HttpClientFactory(); respMsg = "Sauce node registration failed. Please refer to the log file for failure details."; try { final int port = getRegistry().getHub().getConfiguration().port; final URL registration = new URL("http://localhost:" + port + "/grid/register"); BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", registration.toExternalForm()); request.setEntity(new StringEntity(getRegistrationRequestEntity())); HttpHost host = new HttpHost(registration.getHost(), registration.getPort()); HttpClient client = httpClientFactory.getHttpClient(); HttpResponse response = client.execute(host, request); if (response.getStatusLine().getStatusCode() == HttpServletResponse.SC_OK) { respMsg = "Sauce node registered successfully."; registered = true; } } catch (IOException | GridConfigurationException e) { // We catch the GridConfigurationException here to fail // gracefully // TODO Consider retrying on failure LOGGER.log(Level.WARNING, "Unable to register sauce node: ", e); } finally { httpClientFactory.close(); } LOGGER.info(respMsg); ServletHelper.respondAsHtmlWithMessage(resp, formatForHtmlTemplate(respMsg)); }
[ "private", "synchronized", "void", "registerVirtualSauceNodeToGrid", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "// Redirecting to login page if session is not found", "if", "(", "req", "."...
/* A helper method that takes care of registering a virtual node to the hub.
[ "/", "*", "A", "helper", "method", "that", "takes", "care", "of", "registering", "a", "virtual", "node", "to", "the", "hub", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/grid/servlets/SauceServlet.java#L123-L165
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java
HttpFields.put
public void put(String name, List<String> list) { remove(name); for (String v : list) if (v != null) add(name, v); }
java
public void put(String name, List<String> list) { remove(name); for (String v : list) if (v != null) add(name, v); }
[ "public", "void", "put", "(", "String", "name", ",", "List", "<", "String", ">", "list", ")", "{", "remove", "(", "name", ")", ";", "for", "(", "String", "v", ":", "list", ")", "if", "(", "v", "!=", "null", ")", "add", "(", "name", ",", "v", ...
Set a field. @param name the name of the field @param list the List value of the field. If null the field is cleared.
[ "Set", "a", "field", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java#L532-L537
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java
DateFunctions.datePartMillis
public static Expression datePartMillis(String expression, DatePartExt part) { return datePartMillis(x(expression), part); }
java
public static Expression datePartMillis(String expression, DatePartExt part) { return datePartMillis(x(expression), part); }
[ "public", "static", "Expression", "datePartMillis", "(", "String", "expression", ",", "DatePartExt", "part", ")", "{", "return", "datePartMillis", "(", "x", "(", "expression", ")", ",", "part", ")", ";", "}" ]
Returned expression results in Date part as an integer. The date expression is a number representing UNIX milliseconds, and part is a {@link DatePartExt}.
[ "Returned", "expression", "results", "in", "Date", "part", "as", "an", "integer", ".", "The", "date", "expression", "is", "a", "number", "representing", "UNIX", "milliseconds", "and", "part", "is", "a", "{" ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L148-L150
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.matrixToPinhole
public static <C extends CameraPinhole>C matrixToPinhole(FMatrixRMaj K , int width , int height , C output ) { return (C)ImplPerspectiveOps_F32.matrixToPinhole(K, width, height, output); }
java
public static <C extends CameraPinhole>C matrixToPinhole(FMatrixRMaj K , int width , int height , C output ) { return (C)ImplPerspectiveOps_F32.matrixToPinhole(K, width, height, output); }
[ "public", "static", "<", "C", "extends", "CameraPinhole", ">", "C", "matrixToPinhole", "(", "FMatrixRMaj", "K", ",", "int", "width", ",", "int", "height", ",", "C", "output", ")", "{", "return", "(", "C", ")", "ImplPerspectiveOps_F32", ".", "matrixToPinhole"...
Converts a calibration matrix into intrinsic parameters @param K Camera calibration matrix. @param width Image width in pixels @param height Image height in pixels @param output (Output) Where the intrinsic parameter are written to. If null then a new instance is declared. @return camera parameters
[ "Converts", "a", "calibration", "matrix", "into", "intrinsic", "parameters" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L311-L314
apache/reef
lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/storage/StorageKeyCloudBlobProvider.java
StorageKeyCloudBlobProvider.generateSharedAccessSignature
@Override public URI generateSharedAccessSignature(final CloudBlob cloudBlob, final SharedAccessBlobPolicy policy) throws IOException { try { final String sas = cloudBlob.generateSharedAccessSignature(policy, null); final String uri = cloudBlob.getStorageUri().getPrimaryUri().toString(); return new URI(uri + "?" + sas); } catch (StorageException | InvalidKeyException | URISyntaxException e) { throw new IOException("Failed to generated a Shared Access Signature.", e); } }
java
@Override public URI generateSharedAccessSignature(final CloudBlob cloudBlob, final SharedAccessBlobPolicy policy) throws IOException { try { final String sas = cloudBlob.generateSharedAccessSignature(policy, null); final String uri = cloudBlob.getStorageUri().getPrimaryUri().toString(); return new URI(uri + "?" + sas); } catch (StorageException | InvalidKeyException | URISyntaxException e) { throw new IOException("Failed to generated a Shared Access Signature.", e); } }
[ "@", "Override", "public", "URI", "generateSharedAccessSignature", "(", "final", "CloudBlob", "cloudBlob", ",", "final", "SharedAccessBlobPolicy", "policy", ")", "throws", "IOException", "{", "try", "{", "final", "String", "sas", "=", "cloudBlob", ".", "generateShar...
Generates a Shared Access Key URI for the given {@link CloudBlob}. @param cloudBlob cloud blob to create a Shared Access Key URI for. @param policy an instance of {@link SharedAccessBlobPolicy} that specifies permissions and signature's validity time period. @return a Shared Access Key URI for the given {@link CloudBlob}. @throws IOException
[ "Generates", "a", "Shared", "Access", "Key", "URI", "for", "the", "given", "{" ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/storage/StorageKeyCloudBlobProvider.java#L81-L91
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java
TimeoutImpl.runSyncOnNewThread
public void runSyncOnNewThread(Thread newThread) { lock.writeLock().lock(); try { if (this.timeoutTask == null) { throw new IllegalStateException(Tr.formatMessage(tc, "internal.error.CWMFT4999E")); } stop(); this.stopped = false; long remaining = check(); Runnable timeoutTask = () -> { newThread.interrupt(); }; start(timeoutTask, remaining); } finally { lock.writeLock().unlock(); } }
java
public void runSyncOnNewThread(Thread newThread) { lock.writeLock().lock(); try { if (this.timeoutTask == null) { throw new IllegalStateException(Tr.formatMessage(tc, "internal.error.CWMFT4999E")); } stop(); this.stopped = false; long remaining = check(); Runnable timeoutTask = () -> { newThread.interrupt(); }; start(timeoutTask, remaining); } finally { lock.writeLock().unlock(); } }
[ "public", "void", "runSyncOnNewThread", "(", "Thread", "newThread", ")", "{", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "this", ".", "timeoutTask", "==", "null", ")", "{", "throw", "new", "IllegalStateExceptio...
Restart the timer on a new thread in synchronous mode. <p> In this mode, a timeout only causes the thread to be interrupted, it does not directly set the result of the QueuedFuture. <p> This is needed when doing Retries or Fallback on an async thread. If the result is set directly, then we have no opportunity to handle the exception.
[ "Restart", "the", "timer", "on", "a", "new", "thread", "in", "synchronous", "mode", ".", "<p", ">", "In", "this", "mode", "a", "timeout", "only", "causes", "the", "thread", "to", "be", "interrupted", "it", "does", "not", "directly", "set", "the", "result...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/TimeoutImpl.java#L218-L236
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
HttpContext.executePostRequest
protected <T> Optional<T> executePostRequest(URI uri, Object obj, GenericType<T> returnType) { return executePostRequest(uri, obj, null, returnType); }
java
protected <T> Optional<T> executePostRequest(URI uri, Object obj, GenericType<T> returnType) { return executePostRequest(uri, obj, null, returnType); }
[ "protected", "<", "T", ">", "Optional", "<", "T", ">", "executePostRequest", "(", "URI", "uri", ",", "Object", "obj", ",", "GenericType", "<", "T", ">", "returnType", ")", "{", "return", "executePostRequest", "(", "uri", ",", "obj", ",", "null", ",", "...
Execute a POST request with a return object. @param <T> The type parameter used for the return object @param uri The URI to call @param obj The object to use for the POST @param returnType The type to marshall the result back into @return The return type
[ "Execute", "a", "POST", "request", "with", "a", "return", "object", "." ]
train
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L447-L450
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/publisher/BaseDataPublisher.java
BaseDataPublisher.getMergedMetadataForPartitionAndBranch
private String getMergedMetadataForPartitionAndBranch(String partitionId, int branchId) { String mergedMd = null; MetadataMerger<String> mergerForBranch = metadataMergers.get(new PartitionIdentifier(partitionId, branchId)); if (mergerForBranch != null) { mergedMd = mergerForBranch.getMergedMetadata(); if (mergedMd == null) { LOG.warn("Metadata merger for branch {} returned null - bug in merger?", branchId); } } return mergedMd; }
java
private String getMergedMetadataForPartitionAndBranch(String partitionId, int branchId) { String mergedMd = null; MetadataMerger<String> mergerForBranch = metadataMergers.get(new PartitionIdentifier(partitionId, branchId)); if (mergerForBranch != null) { mergedMd = mergerForBranch.getMergedMetadata(); if (mergedMd == null) { LOG.warn("Metadata merger for branch {} returned null - bug in merger?", branchId); } } return mergedMd; }
[ "private", "String", "getMergedMetadataForPartitionAndBranch", "(", "String", "partitionId", ",", "int", "branchId", ")", "{", "String", "mergedMd", "=", "null", ";", "MetadataMerger", "<", "String", ">", "mergerForBranch", "=", "metadataMergers", ".", "get", "(", ...
/* Get the merged metadata given a workunit state and branch id. This method assumes all intermediate metadata has already been passed to the MetadataMerger. If metadata mergers are not configured, instead return the metadata from job config that was passed in by the user.
[ "/", "*", "Get", "the", "merged", "metadata", "given", "a", "workunit", "state", "and", "branch", "id", ".", "This", "method", "assumes", "all", "intermediate", "metadata", "has", "already", "been", "passed", "to", "the", "MetadataMerger", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/publisher/BaseDataPublisher.java#L755-L766
JM-Lab/utils-java8
src/main/java/kr/jm/utils/collections/JMTimeSeries.java
JMTimeSeries.getOrPutGetNew
public V getOrPutGetNew(Long timestamp, Supplier<V> newSupplier) { return JMMap.getOrPutGetNew(this.timeSeriesMap, buildKeyTimestamp(timestamp), newSupplier); }
java
public V getOrPutGetNew(Long timestamp, Supplier<V> newSupplier) { return JMMap.getOrPutGetNew(this.timeSeriesMap, buildKeyTimestamp(timestamp), newSupplier); }
[ "public", "V", "getOrPutGetNew", "(", "Long", "timestamp", ",", "Supplier", "<", "V", ">", "newSupplier", ")", "{", "return", "JMMap", ".", "getOrPutGetNew", "(", "this", ".", "timeSeriesMap", ",", "buildKeyTimestamp", "(", "timestamp", ")", ",", "newSupplier"...
Gets or put get new. @param timestamp the timestamp @param newSupplier the new supplier @return the or put get new
[ "Gets", "or", "put", "get", "new", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/collections/JMTimeSeries.java#L78-L81
SeleniumHQ/fluent-selenium
java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java
FluentSelect.selectByValue
public FluentSelect selectByValue(final String value) { executeAndWrapReThrowIfNeeded(new SelectByValue(value), Context.singular(context, "selectByValue", null, value), true); return new FluentSelect(super.delegate, currentElement.getFound(), this.context, monitor, booleanInsteadOfNotFoundException); }
java
public FluentSelect selectByValue(final String value) { executeAndWrapReThrowIfNeeded(new SelectByValue(value), Context.singular(context, "selectByValue", null, value), true); return new FluentSelect(super.delegate, currentElement.getFound(), this.context, monitor, booleanInsteadOfNotFoundException); }
[ "public", "FluentSelect", "selectByValue", "(", "final", "String", "value", ")", "{", "executeAndWrapReThrowIfNeeded", "(", "new", "SelectByValue", "(", "value", ")", ",", "Context", ".", "singular", "(", "context", ",", "\"selectByValue\"", ",", "null", ",", "v...
<p> Select all options that have a value matching the argument. That is, when given "foo" this would select an option like: </p> &lt;option value="foo"&gt;Bar&lt;/option&gt; @param value The value to match against
[ "<p", ">", "Select", "all", "options", "that", "have", "a", "value", "matching", "the", "argument", ".", "That", "is", "when", "given", "foo", "this", "would", "select", "an", "option", "like", ":", "<", "/", "p", ">", "&lt", ";", "option", "value", ...
train
https://github.com/SeleniumHQ/fluent-selenium/blob/fcb171471a7d1abb2800bcbca21b3ae3e6c12472/java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java#L113-L116
svenkubiak/mangooio-mongodb-extension
src/main/java/de/svenkubiak/mangooio/mongodb/MongoDB.java
MongoDB.findById
public <T extends Object> T findById(Object id, Class<T> clazz) { Preconditions.checkNotNull(clazz, "Tryed to find an object by id, but given class is null"); Preconditions.checkNotNull(id, "Tryed to find an object by id, but given id is null"); return this.datastore.get(clazz, (id instanceof ObjectId) ? id : new ObjectId(String.valueOf(id))); }
java
public <T extends Object> T findById(Object id, Class<T> clazz) { Preconditions.checkNotNull(clazz, "Tryed to find an object by id, but given class is null"); Preconditions.checkNotNull(id, "Tryed to find an object by id, but given id is null"); return this.datastore.get(clazz, (id instanceof ObjectId) ? id : new ObjectId(String.valueOf(id))); }
[ "public", "<", "T", "extends", "Object", ">", "T", "findById", "(", "Object", "id", ",", "Class", "<", "T", ">", "clazz", ")", "{", "Preconditions", ".", "checkNotNull", "(", "clazz", ",", "\"Tryed to find an object by id, but given class is null\"", ")", ";", ...
Retrieves a mapped Morphia object from MongoDB. If the id is not of type ObjectId, it will be converted to ObjectId @param id The id of the object @param clazz The mapped Morphia class @param <T> JavaDoc requires this - please ignore @return The requested class from MongoDB or null if none found
[ "Retrieves", "a", "mapped", "Morphia", "object", "from", "MongoDB", ".", "If", "the", "id", "is", "not", "of", "type", "ObjectId", "it", "will", "be", "converted", "to", "ObjectId" ]
train
https://github.com/svenkubiak/mangooio-mongodb-extension/blob/4a281b63c20cdbb4b82c4c0d100726ec464bfa12/src/main/java/de/svenkubiak/mangooio/mongodb/MongoDB.java#L128-L133
morimekta/utils
io-util/src/main/java/net/morimekta/util/io/IOUtils.java
IOUtils.skipUntil
public static boolean skipUntil(InputStream in, byte separator) throws IOException { int r; while((r = in.read()) >= 0) { if(((byte) r) == separator) { return true; } } return false; }
java
public static boolean skipUntil(InputStream in, byte separator) throws IOException { int r; while((r = in.read()) >= 0) { if(((byte) r) == separator) { return true; } } return false; }
[ "public", "static", "boolean", "skipUntil", "(", "InputStream", "in", ",", "byte", "separator", ")", "throws", "IOException", "{", "int", "r", ";", "while", "(", "(", "r", "=", "in", ".", "read", "(", ")", ")", ">=", "0", ")", "{", "if", "(", "(", ...
Skip all bytes in stream until (and including) given byte is found. @param in Input stream to read from. @param separator Byte to skip until. @return True iff the separator was encountered. @throws IOException if unable to read from stream.
[ "Skip", "all", "bytes", "in", "stream", "until", "(", "and", "including", ")", "given", "byte", "is", "found", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/io/IOUtils.java#L101-L107
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/error/SingleError.java
SingleError.equalsLinkedException
@OverrideOnDemand protected boolean equalsLinkedException (@Nullable final Throwable t1, @Nullable final Throwable t2) { if (EqualsHelper.identityEqual (t1, t2)) return true; if (t1 == null || t2 == null) return false; return t1.getClass ().equals (t2.getClass ()) && EqualsHelper.equals (t1.getMessage (), t2.getMessage ()); }
java
@OverrideOnDemand protected boolean equalsLinkedException (@Nullable final Throwable t1, @Nullable final Throwable t2) { if (EqualsHelper.identityEqual (t1, t2)) return true; if (t1 == null || t2 == null) return false; return t1.getClass ().equals (t2.getClass ()) && EqualsHelper.equals (t1.getMessage (), t2.getMessage ()); }
[ "@", "OverrideOnDemand", "protected", "boolean", "equalsLinkedException", "(", "@", "Nullable", "final", "Throwable", "t1", ",", "@", "Nullable", "final", "Throwable", "t2", ")", "{", "if", "(", "EqualsHelper", ".", "identityEqual", "(", "t1", ",", "t2", ")", ...
Overridable implementation of Throwable for the Linked exception field. This can be overridden to implement a different algorithm. This is customizable because there is no default way of comparing Exceptions in Java. If you override this method you must also override {@link #hashCodeLinkedException(HashCodeGenerator, Throwable)}! @param t1 First Throwable. May be <code>null</code>. @param t2 Second Throwable. May be <code>null</code>. @return <code>true</code> if they are equals (or both null)
[ "Overridable", "implementation", "of", "Throwable", "for", "the", "Linked", "exception", "field", ".", "This", "can", "be", "overridden", "to", "implement", "a", "different", "algorithm", ".", "This", "is", "customizable", "because", "there", "is", "no", "defaul...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/error/SingleError.java#L126-L134
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java
RenameFileExtensions.forceToMoveFile
public static boolean forceToMoveFile(final File srcFile, final File destinationFile) throws IOException, FileIsADirectoryException { boolean moved = RenameFileExtensions.renameFile(srcFile, destinationFile, true); return moved; }
java
public static boolean forceToMoveFile(final File srcFile, final File destinationFile) throws IOException, FileIsADirectoryException { boolean moved = RenameFileExtensions.renameFile(srcFile, destinationFile, true); return moved; }
[ "public", "static", "boolean", "forceToMoveFile", "(", "final", "File", "srcFile", ",", "final", "File", "destinationFile", ")", "throws", "IOException", ",", "FileIsADirectoryException", "{", "boolean", "moved", "=", "RenameFileExtensions", ".", "renameFile", "(", ...
Moves the given source file to the given destination file. @param srcFile The source file. @param destinationFile The destination file. @return true if the file was moved otherwise false. @throws IOException Signals that an I/O exception has occurred. @throws FileIsADirectoryException the file is A directory exception
[ "Moves", "the", "given", "source", "file", "to", "the", "given", "destination", "file", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java#L246-L251
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/ManagementResources.java
ManagementResources.setAdministratorPrivilege
@PUT @Path("/administratorprivilege") @Produces(MediaType.APPLICATION_JSON) @Description("Grants administrative privileges.") public Response setAdministratorPrivilege(@Context HttpServletRequest req, @FormParam("username") String userName, @FormParam("privileged") boolean privileged) { if (userName == null || userName.isEmpty()) { throw new IllegalArgumentException("User name cannot be null or empty."); } validatePrivilegedUser(req); PrincipalUser user = userService.findUserByUsername(userName); if (user == null) { throw new WebApplicationException("User does not exist.", Status.NOT_FOUND); } managementService.setAdministratorPrivilege(user, privileged); return Response.status(Status.OK).build(); }
java
@PUT @Path("/administratorprivilege") @Produces(MediaType.APPLICATION_JSON) @Description("Grants administrative privileges.") public Response setAdministratorPrivilege(@Context HttpServletRequest req, @FormParam("username") String userName, @FormParam("privileged") boolean privileged) { if (userName == null || userName.isEmpty()) { throw new IllegalArgumentException("User name cannot be null or empty."); } validatePrivilegedUser(req); PrincipalUser user = userService.findUserByUsername(userName); if (user == null) { throw new WebApplicationException("User does not exist.", Status.NOT_FOUND); } managementService.setAdministratorPrivilege(user, privileged); return Response.status(Status.OK).build(); }
[ "@", "PUT", "@", "Path", "(", "\"/administratorprivilege\"", ")", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Description", "(", "\"Grants administrative privileges.\"", ")", "public", "Response", "setAdministratorPrivilege", "(", "@", "Cont...
Updates the admin privileges for the user. @param req The HTTP request. @param userName Name of the user whom the admin privileges will be updated. Cannot be null or empty. @param privileged boolean variable indicating admin privileges. @return Response object indicating whether the operation was successful or not. @throws IllegalArgumentException Throws IllegalArgument exception when the input is not valid. @throws WebApplicationException Throws this exception if the user does not exist or the user is not authorized to carry out this operation.
[ "Updates", "the", "admin", "privileges", "for", "the", "user", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/ManagementResources.java#L84-L103
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.beginRedeploy
public OperationStatusResponseInner beginRedeploy(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) { return beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().single().body(); }
java
public OperationStatusResponseInner beginRedeploy(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) { return beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().single().body(); }
[ "public", "OperationStatusResponseInner", "beginRedeploy", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ",", "List", "<", "String", ">", "instanceIds", ")", "{", "return", "beginRedeployWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmS...
Redeploy one or more virtual machines in a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @param instanceIds The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatusResponseInner object if successful.
[ "Redeploy", "one", "or", "more", "virtual", "machines", "in", "a", "VM", "scale", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetsInner.java#L3097-L3099
elki-project/elki
elki-classification/src/main/java/de/lmu/ifi/dbs/elki/evaluation/classification/holdout/AbstractHoldout.java
AbstractHoldout.allClassLabels
public static ArrayList<ClassLabel> allClassLabels(MultipleObjectsBundle bundle) { int col = findClassLabelColumn(bundle); // TODO: automatically infer class labels? if(col < 0) { throw new AbortException("No class label found (try using ClassLabelFilter)."); } return allClassLabels(bundle, col); }
java
public static ArrayList<ClassLabel> allClassLabels(MultipleObjectsBundle bundle) { int col = findClassLabelColumn(bundle); // TODO: automatically infer class labels? if(col < 0) { throw new AbortException("No class label found (try using ClassLabelFilter)."); } return allClassLabels(bundle, col); }
[ "public", "static", "ArrayList", "<", "ClassLabel", ">", "allClassLabels", "(", "MultipleObjectsBundle", "bundle", ")", "{", "int", "col", "=", "findClassLabelColumn", "(", "bundle", ")", ";", "// TODO: automatically infer class labels?", "if", "(", "col", "<", "0",...
Get an array of all class labels in a given data set. @param bundle Bundle @return Class labels.
[ "Get", "an", "array", "of", "all", "class", "labels", "in", "a", "given", "data", "set", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-classification/src/main/java/de/lmu/ifi/dbs/elki/evaluation/classification/holdout/AbstractHoldout.java#L87-L94
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java
ChatController.handleNoLocalConversation
Observable<ChatResult> handleNoLocalConversation(String conversationId) { return checkState().flatMap(client -> client.service().messaging().getConversation(conversationId) .flatMap(result -> { if (result.isSuccessful() && result.getResult() != null) { return persistenceController.upsertConversation(ChatConversation.builder().populate(result.getResult(), result.getETag()).build()) .map(success -> new ChatResult(success, success ? null : new ChatResult.Error(0, "External store reported failure.", "Error when inserting conversation "+conversationId))); } else { return Observable.fromCallable(() -> adapter.adaptResult(result)); } })); }
java
Observable<ChatResult> handleNoLocalConversation(String conversationId) { return checkState().flatMap(client -> client.service().messaging().getConversation(conversationId) .flatMap(result -> { if (result.isSuccessful() && result.getResult() != null) { return persistenceController.upsertConversation(ChatConversation.builder().populate(result.getResult(), result.getETag()).build()) .map(success -> new ChatResult(success, success ? null : new ChatResult.Error(0, "External store reported failure.", "Error when inserting conversation "+conversationId))); } else { return Observable.fromCallable(() -> adapter.adaptResult(result)); } })); }
[ "Observable", "<", "ChatResult", ">", "handleNoLocalConversation", "(", "String", "conversationId", ")", "{", "return", "checkState", "(", ")", ".", "flatMap", "(", "client", "->", "client", ".", "service", "(", ")", ".", "messaging", "(", ")", ".", "getConv...
When SDK detects missing conversation it makes query in services and saves in the saves locally. @param conversationId Unique identifier of an conversation. @return Observable to handle missing local conversation data.
[ "When", "SDK", "detects", "missing", "conversation", "it", "makes", "query", "in", "services", "and", "saves", "in", "the", "saves", "locally", "." ]
train
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java#L245-L256
threerings/nenya
core/src/main/java/com/threerings/util/KeyTranslatorImpl.java
KeyTranslatorImpl.addPressCommand
public void addPressCommand (int keyCode, String command, int rate) { addPressCommand(keyCode, command, rate, DEFAULT_REPEAT_DELAY); }
java
public void addPressCommand (int keyCode, String command, int rate) { addPressCommand(keyCode, command, rate, DEFAULT_REPEAT_DELAY); }
[ "public", "void", "addPressCommand", "(", "int", "keyCode", ",", "String", "command", ",", "int", "rate", ")", "{", "addPressCommand", "(", "keyCode", ",", "command", ",", "rate", ",", "DEFAULT_REPEAT_DELAY", ")", ";", "}" ]
Adds a mapping from a key press to an action command string that will auto-repeat at the specified repeat rate. Overwrites any existing mapping and repeat rate that may have already been registered. @param rate the number of times each second that the key press should be repeated while the key is down, or <code>0</code> to disable auto-repeat for the key.
[ "Adds", "a", "mapping", "from", "a", "key", "press", "to", "an", "action", "command", "string", "that", "will", "auto", "-", "repeat", "at", "the", "specified", "repeat", "rate", ".", "Overwrites", "any", "existing", "mapping", "and", "repeat", "rate", "th...
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyTranslatorImpl.java#L55-L58
js-lib-com/dom
src/main/java/js/dom/w3c/DocumentImpl.java
DocumentImpl.buildAttrXPath
String buildAttrXPath(String name, String... value) { StringBuilder sb = new StringBuilder(); sb.append("//*[@"); sb.append(name); if (value.length == 1) { sb.append("='"); sb.append(value[0]); sb.append("'"); } sb.append("]"); return sb.toString(); }
java
String buildAttrXPath(String name, String... value) { StringBuilder sb = new StringBuilder(); sb.append("//*[@"); sb.append(name); if (value.length == 1) { sb.append("='"); sb.append(value[0]); sb.append("'"); } sb.append("]"); return sb.toString(); }
[ "String", "buildAttrXPath", "(", "String", "name", ",", "String", "...", "value", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"//*[@\"", ")", ";", "sb", ".", "append", "(", "name", ")", ";", ...
Build XPath expression for elements with attribute name and optional value. @param name attribute name, @param value optional attribute value. @return XPath expression.
[ "Build", "XPath", "expression", "for", "elements", "with", "attribute", "name", "and", "optional", "value", "." ]
train
https://github.com/js-lib-com/dom/blob/8c7cd7c802977f210674dec7c2a8f61e8de05b63/src/main/java/js/dom/w3c/DocumentImpl.java#L382-L393
phax/ph-oton
ph-oton-app/src/main/java/com/helger/photon/app/url/LinkHelper.java
LinkHelper.getURLWithServerAndContext
@Nonnull public static SimpleURL getURLWithServerAndContext (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final String sHRef) { return new SimpleURL (getURIWithServerAndContext (aRequestScope, sHRef)); }
java
@Nonnull public static SimpleURL getURLWithServerAndContext (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final String sHRef) { return new SimpleURL (getURIWithServerAndContext (aRequestScope, sHRef)); }
[ "@", "Nonnull", "public", "static", "SimpleURL", "getURLWithServerAndContext", "(", "@", "Nonnull", "final", "IRequestWebScopeWithoutResponse", "aRequestScope", ",", "@", "Nonnull", "final", "String", "sHRef", ")", "{", "return", "new", "SimpleURL", "(", "getURIWithSe...
Prefix the passed href with the absolute server + context path in case the passed href has no protocol yet. @param aRequestScope The request web scope to be used. Required for cookie-less handling. May not be <code>null</code>. @param sHRef The href to be extended. @return Either the original href if already absolute or <code>http://servername:8123/webapp-context/<i>href</i></code> otherwise.
[ "Prefix", "the", "passed", "href", "with", "the", "absolute", "server", "+", "context", "path", "in", "case", "the", "passed", "href", "has", "no", "protocol", "yet", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-app/src/main/java/com/helger/photon/app/url/LinkHelper.java#L305-L310
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
ExceptionSoftening.findMethod
@Nullable private static Method findMethod(JavaClass cls, String methodName, String methodSig) { Method[] methods = cls.getMethods(); for (Method method : methods) { if (method.getName().equals(methodName) && method.getSignature().equals(methodSig)) { return method; } } return null; }
java
@Nullable private static Method findMethod(JavaClass cls, String methodName, String methodSig) { Method[] methods = cls.getMethods(); for (Method method : methods) { if (method.getName().equals(methodName) && method.getSignature().equals(methodSig)) { return method; } } return null; }
[ "@", "Nullable", "private", "static", "Method", "findMethod", "(", "JavaClass", "cls", ",", "String", "methodName", ",", "String", "methodSig", ")", "{", "Method", "[", "]", "methods", "=", "cls", ".", "getMethods", "(", ")", ";", "for", "(", "Method", "...
finds a method that matches the name and signature in the given class @param cls the class to look in @param methodName the name to look for @param methodSig the signature to look for @return the method or null
[ "finds", "a", "method", "that", "matches", "the", "name", "and", "signature", "in", "the", "given", "class" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java#L430-L439
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/UsersApi.java
UsersApi.supervisorRemoteOperation
public ApiSuccessResponse supervisorRemoteOperation(String operationName, String dbid) throws ApiException { ApiResponse<ApiSuccessResponse> resp = supervisorRemoteOperationWithHttpInfo(operationName, dbid); return resp.getData(); }
java
public ApiSuccessResponse supervisorRemoteOperation(String operationName, String dbid) throws ApiException { ApiResponse<ApiSuccessResponse> resp = supervisorRemoteOperationWithHttpInfo(operationName, dbid); return resp.getData(); }
[ "public", "ApiSuccessResponse", "supervisorRemoteOperation", "(", "String", "operationName", ",", "String", "dbid", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "supervisorRemoteOperationWithHttpInfo", "(", "operationName",...
Logout user remotely for supervisors @param operationName Name of state to change to (required) @param dbid The dbid of the agent. (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Logout", "user", "remotely", "for", "supervisors" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UsersApi.java#L442-L445
phax/ph-commons
ph-json/src/main/java/com/helger/json/serialize/JsonReader.java
JsonReader.readFromStream
@Nullable public static IJson readFromStream (@Nonnull final InputStream aIS, @Nonnull final Charset aFallbackCharset) { return readFromStream (aIS, aFallbackCharset, null); }
java
@Nullable public static IJson readFromStream (@Nonnull final InputStream aIS, @Nonnull final Charset aFallbackCharset) { return readFromStream (aIS, aFallbackCharset, null); }
[ "@", "Nullable", "public", "static", "IJson", "readFromStream", "(", "@", "Nonnull", "final", "InputStream", "aIS", ",", "@", "Nonnull", "final", "Charset", "aFallbackCharset", ")", "{", "return", "readFromStream", "(", "aIS", ",", "aFallbackCharset", ",", "null...
Read the Json from the passed {@link InputStream}. @param aIS The input stream to use. May not be <code>null</code>. @param aFallbackCharset The charset to be used if no BOM is present. May not be <code>null</code>. @return <code>null</code> if reading failed, the Json declarations otherwise.
[ "Read", "the", "Json", "from", "the", "passed", "{", "@link", "InputStream", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-json/src/main/java/com/helger/json/serialize/JsonReader.java#L656-L660
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/taskmanager/TaskManagerService.java
TaskManagerService.waitForTaskStatus
private TaskRecord waitForTaskStatus(Tenant tenant, Task task, Predicate<TaskStatus> pred) { TaskRecord taskRecord = null; while (true) { Iterator<DColumn> colIter = DBService.instance(tenant).getAllColumns(TaskManagerService.TASKS_STORE_NAME, task.getTaskID()).iterator(); if (!colIter.hasNext()) { taskRecord = storeTaskRecord(tenant, task); } else { taskRecord = buildTaskRecord(task.getTaskID(), colIter); } if (pred.test(taskRecord.getStatus())) { break; } try { Thread.sleep(TASK_CHECK_MILLIS); } catch (InterruptedException e) { } }; return taskRecord; }
java
private TaskRecord waitForTaskStatus(Tenant tenant, Task task, Predicate<TaskStatus> pred) { TaskRecord taskRecord = null; while (true) { Iterator<DColumn> colIter = DBService.instance(tenant).getAllColumns(TaskManagerService.TASKS_STORE_NAME, task.getTaskID()).iterator(); if (!colIter.hasNext()) { taskRecord = storeTaskRecord(tenant, task); } else { taskRecord = buildTaskRecord(task.getTaskID(), colIter); } if (pred.test(taskRecord.getStatus())) { break; } try { Thread.sleep(TASK_CHECK_MILLIS); } catch (InterruptedException e) { } }; return taskRecord; }
[ "private", "TaskRecord", "waitForTaskStatus", "(", "Tenant", "tenant", ",", "Task", "task", ",", "Predicate", "<", "TaskStatus", ">", "pred", ")", "{", "TaskRecord", "taskRecord", "=", "null", ";", "while", "(", "true", ")", "{", "Iterator", "<", "DColumn", ...
latest status record. If it has never run, a never-run task record is stored.
[ "latest", "status", "record", ".", "If", "it", "has", "never", "run", "a", "never", "-", "run", "task", "record", "is", "stored", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/taskmanager/TaskManagerService.java#L285-L301
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/utils/ThreadLocalProxyCopyOnWriteArrayList.java
ThreadLocalProxyCopyOnWriteArrayList.removeRange
private void removeRange(int fromIndex, int toIndex) { final ReentrantLock lock = this.lock; lock.lock(); try { Object[] elements = getArray(); int len = elements.length; if (fromIndex < 0 || toIndex > len || toIndex < fromIndex) throw new IndexOutOfBoundsException(); int newlen = len - (toIndex - fromIndex); int numMoved = len - toIndex; if (numMoved == 0) setArray(Arrays.copyOf(elements, newlen)); else { Object[] newElements = new Object[newlen]; System.arraycopy(elements, 0, newElements, 0, fromIndex); System.arraycopy(elements, toIndex, newElements, fromIndex, numMoved); setArray(newElements); } } finally { lock.unlock(); } }
java
private void removeRange(int fromIndex, int toIndex) { final ReentrantLock lock = this.lock; lock.lock(); try { Object[] elements = getArray(); int len = elements.length; if (fromIndex < 0 || toIndex > len || toIndex < fromIndex) throw new IndexOutOfBoundsException(); int newlen = len - (toIndex - fromIndex); int numMoved = len - toIndex; if (numMoved == 0) setArray(Arrays.copyOf(elements, newlen)); else { Object[] newElements = new Object[newlen]; System.arraycopy(elements, 0, newElements, 0, fromIndex); System.arraycopy(elements, toIndex, newElements, fromIndex, numMoved); setArray(newElements); } } finally { lock.unlock(); } }
[ "private", "void", "removeRange", "(", "int", "fromIndex", ",", "int", "toIndex", ")", "{", "final", "ReentrantLock", "lock", "=", "this", ".", "lock", ";", "lock", ".", "lock", "(", ")", ";", "try", "{", "Object", "[", "]", "elements", "=", "getArray"...
Removes from this list all of the elements whose index is between <tt>fromIndex</tt>, inclusive, and <tt>toIndex</tt>, exclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the list by <tt>(toIndex - fromIndex)</tt> elements. (If <tt>toIndex==fromIndex</tt>, this operation has no effect.) @param fromIndex index of first element to be removed @param toIndex index after last element to be removed @throws IndexOutOfBoundsException if fromIndex or toIndex out of range ({@code{fromIndex < 0 || toIndex > size() || toIndex < fromIndex})
[ "Removes", "from", "this", "list", "all", "of", "the", "elements", "whose", "index", "is", "between", "<tt", ">", "fromIndex<", "/", "tt", ">", "inclusive", "and", "<tt", ">", "toIndex<", "/", "tt", ">", "exclusive", ".", "Shifts", "any", "succeeding", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/utils/ThreadLocalProxyCopyOnWriteArrayList.java#L496-L519
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzleResultSet.java
DrizzleResultSet.getObject
public Object getObject(final String columnLabel, final Map<String, Class<?>> map) throws SQLException { //TODO: implement this throw SQLExceptionMapper.getFeatureNotSupportedException("Type map getting is not supported"); }
java
public Object getObject(final String columnLabel, final Map<String, Class<?>> map) throws SQLException { //TODO: implement this throw SQLExceptionMapper.getFeatureNotSupportedException("Type map getting is not supported"); }
[ "public", "Object", "getObject", "(", "final", "String", "columnLabel", ",", "final", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "map", ")", "throws", "SQLException", "{", "//TODO: implement this", "throw", "SQLExceptionMapper", ".", "getFeatureNotS...
According to the JDBC4 spec, this is only required for UDT's, and since drizzle does not support UDTs, this method ignores the map parameter <p/> Retrieves the value of the designated column in the current row of this <code>ResultSet</code> object as an <code>Object</code> in the Java programming language. If the value is an SQL <code>NULL</code>, the driver returns a Java <code>null</code>. This method uses the specified <code>Map</code> object for custom mapping if appropriate. @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column @param map a <code>java.util.Map</code> object that contains the mapping from SQL type names to classes in the Java programming language @return an <code>Object</code> representing the SQL value in the specified column @throws java.sql.SQLException if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set @throws java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support this method @since 1.2
[ "According", "to", "the", "JDBC4", "spec", "this", "is", "only", "required", "for", "UDT", "s", "and", "since", "drizzle", "does", "not", "support", "UDTs", "this", "method", "ignores", "the", "map", "parameter", "<p", "/", ">", "Retrieves", "the", "value"...
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzleResultSet.java#L1990-L1993
line/armeria
core/src/main/java/com/linecorp/armeria/server/AbstractVirtualHostBuilder.java
AbstractVirtualHostBuilder.annotatedService
public B annotatedService(String pathPrefix, Object service, Iterable<?> exceptionHandlersAndConverters) { return annotatedService(pathPrefix, service, Function.identity(), requireNonNull(exceptionHandlersAndConverters, "exceptionHandlersAndConverters")); }
java
public B annotatedService(String pathPrefix, Object service, Iterable<?> exceptionHandlersAndConverters) { return annotatedService(pathPrefix, service, Function.identity(), requireNonNull(exceptionHandlersAndConverters, "exceptionHandlersAndConverters")); }
[ "public", "B", "annotatedService", "(", "String", "pathPrefix", ",", "Object", "service", ",", "Iterable", "<", "?", ">", "exceptionHandlersAndConverters", ")", "{", "return", "annotatedService", "(", "pathPrefix", ",", "service", ",", "Function", ".", "identity",...
Binds the specified annotated service object under the specified path prefix. @param exceptionHandlersAndConverters an iterable object of {@link ExceptionHandlerFunction}, {@link RequestConverterFunction} and/or {@link ResponseConverterFunction}
[ "Binds", "the", "specified", "annotated", "service", "object", "under", "the", "specified", "path", "prefix", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/AbstractVirtualHostBuilder.java#L475-L480
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/config/ssl/yoko/SSLSubsystemFactory.java
SSLSubsystemFactory.isAnySecureTransportAddressAvailable
@SuppressWarnings("unchecked") private boolean isAnySecureTransportAddressAvailable(Map<String, Object> extraConfig) { Map<String, List<TransportAddress>> addrMap = (Map<String, List<TransportAddress>>) extraConfig.get(ADDR_KEY); if (addrMap != null) { Set<String> sslAliases = addrMap.keySet(); return sslAliases.size() != 1; } return true; }
java
@SuppressWarnings("unchecked") private boolean isAnySecureTransportAddressAvailable(Map<String, Object> extraConfig) { Map<String, List<TransportAddress>> addrMap = (Map<String, List<TransportAddress>>) extraConfig.get(ADDR_KEY); if (addrMap != null) { Set<String> sslAliases = addrMap.keySet(); return sslAliases.size() != 1; } return true; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "boolean", "isAnySecureTransportAddressAvailable", "(", "Map", "<", "String", ",", "Object", ">", "extraConfig", ")", "{", "Map", "<", "String", ",", "List", "<", "TransportAddress", ">", ">", "addrM...
/* On a server, the address map will only contain a "null" entry if there are only unsecured transport addresses. A client container will not have an address map, so check for its existence and assume there are secured transport addresses when an address map is not found.
[ "/", "*", "On", "a", "server", "the", "address", "map", "will", "only", "contain", "a", "null", "entry", "if", "there", "are", "only", "unsecured", "transport", "addresses", ".", "A", "client", "container", "will", "not", "have", "an", "address", "map", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/config/ssl/yoko/SSLSubsystemFactory.java#L87-L95
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/visitclass/AnnotationVisitor.java
AnnotationVisitor.visitAnnotation
public void visitAnnotation(@DottedClassName String annotationClass, Map<String, ElementValue> map, boolean runtimeVisible) { if (DEBUG) { System.out.println("Annotation: " + annotationClass); for (Map.Entry<String, ElementValue> e : map.entrySet()) { System.out.println(" " + e.getKey()); System.out.println(" -> " + e.getValue()); } } }
java
public void visitAnnotation(@DottedClassName String annotationClass, Map<String, ElementValue> map, boolean runtimeVisible) { if (DEBUG) { System.out.println("Annotation: " + annotationClass); for (Map.Entry<String, ElementValue> e : map.entrySet()) { System.out.println(" " + e.getKey()); System.out.println(" -> " + e.getValue()); } } }
[ "public", "void", "visitAnnotation", "(", "@", "DottedClassName", "String", "annotationClass", ",", "Map", "<", "String", ",", "ElementValue", ">", "map", ",", "boolean", "runtimeVisible", ")", "{", "if", "(", "DEBUG", ")", "{", "System", ".", "out", ".", ...
Visit annotation on a class, field or method @param annotationClass class of annotation @param map map from names to values @param runtimeVisible true if annotation is runtime visible
[ "Visit", "annotation", "on", "a", "class", "field", "or", "method" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/visitclass/AnnotationVisitor.java#L60-L68
xm-online/xm-commons
xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/XmGroovyExecutionStrategy.java
XmGroovyExecutionStrategy.onWithoutAroundScript
private Object onWithoutAroundScript(UrlLepResourceKey compositeResourceKey, Map<XmLepResourceSubType, UrlLepResourceKey> atomicResourceKeys, LepMethod method, LepManagerService managerService, Supplier<GroovyScriptRunner> resourceExecutorSupplier) throws LepInvocationCauseException { Object target = method.getTarget(); // Call BEFORE script if it exists executeBeforeIfExists(atomicResourceKeys, method, managerService, resourceExecutorSupplier); MethodResultProcessor methodResultProcessor; if (atomicResourceKeys.containsKey(TENANT)) { // Call TENANT script if it exists methodResultProcessor = executeLepScript(atomicResourceKeys, method, managerService, resourceExecutorSupplier, TENANT); } else if (atomicResourceKeys.containsKey(DEFAULT)) { // Call DEFAULT script if it exists methodResultProcessor = executeLepScript(atomicResourceKeys, method, managerService, resourceExecutorSupplier, DEFAULT); } else { // Call method on target object methodResultProcessor = executeLepTargetMethod(compositeResourceKey, method, target); } // Call AFTER script if it exists methodResultProcessor = executeAfterScriptIfExists(atomicResourceKeys, method, managerService, resourceExecutorSupplier, methodResultProcessor); return methodResultProcessor.processResult(); }
java
private Object onWithoutAroundScript(UrlLepResourceKey compositeResourceKey, Map<XmLepResourceSubType, UrlLepResourceKey> atomicResourceKeys, LepMethod method, LepManagerService managerService, Supplier<GroovyScriptRunner> resourceExecutorSupplier) throws LepInvocationCauseException { Object target = method.getTarget(); // Call BEFORE script if it exists executeBeforeIfExists(atomicResourceKeys, method, managerService, resourceExecutorSupplier); MethodResultProcessor methodResultProcessor; if (atomicResourceKeys.containsKey(TENANT)) { // Call TENANT script if it exists methodResultProcessor = executeLepScript(atomicResourceKeys, method, managerService, resourceExecutorSupplier, TENANT); } else if (atomicResourceKeys.containsKey(DEFAULT)) { // Call DEFAULT script if it exists methodResultProcessor = executeLepScript(atomicResourceKeys, method, managerService, resourceExecutorSupplier, DEFAULT); } else { // Call method on target object methodResultProcessor = executeLepTargetMethod(compositeResourceKey, method, target); } // Call AFTER script if it exists methodResultProcessor = executeAfterScriptIfExists(atomicResourceKeys, method, managerService, resourceExecutorSupplier, methodResultProcessor); return methodResultProcessor.processResult(); }
[ "private", "Object", "onWithoutAroundScript", "(", "UrlLepResourceKey", "compositeResourceKey", ",", "Map", "<", "XmLepResourceSubType", ",", "UrlLepResourceKey", ">", "atomicResourceKeys", ",", "LepMethod", "method", ",", "LepManagerService", "managerService", ",", "Suppli...
BEFORE and/or TENANT and/or DEFAULT and/or AFTER script call case
[ "BEFORE", "and", "/", "or", "TENANT", "and", "/", "or", "DEFAULT", "and", "/", "or", "AFTER", "script", "call", "case" ]
train
https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/XmGroovyExecutionStrategy.java#L141-L176
bazaarvoice/emodb
web/src/main/java/com/bazaarvoice/emodb/web/report/db/EmoTableAllTablesReportDAO.java
EmoTableAllTablesReportDAO.getReportMetadata
@Override public TableReportMetadata getReportMetadata(String reportId) { checkNotNull(reportId, "reportId"); final String reportTable = getTableName(reportId); Map<String, Object> metadata; try { metadata = _dataStore.get(reportTable, REPORT_METADATA_KEY); } catch (UnknownTableException e) { // The table is only unknown if the report doesn't exist throw new ReportNotFoundException(reportId); } if (Intrinsic.isDeleted(metadata)) { throw new ReportNotFoundException(reportId); } Date startTime = JsonHelper.parseTimestamp((String) metadata.get("startTime")); Date completeTime = null; if (metadata.containsKey("completeTime")) { completeTime = JsonHelper.parseTimestamp((String) metadata.get("completeTime")); } Boolean success = (Boolean) metadata.get("success"); List<String> placements; Object placementMap = metadata.get("placements"); if (placementMap != null) { placements = ImmutableList.copyOf( JsonHelper.convert(placementMap, new TypeReference<Map<String, Object>>() {}).keySet()); } else { placements = ImmutableList.of(); } return new TableReportMetadata(reportId, startTime, completeTime, success, placements); }
java
@Override public TableReportMetadata getReportMetadata(String reportId) { checkNotNull(reportId, "reportId"); final String reportTable = getTableName(reportId); Map<String, Object> metadata; try { metadata = _dataStore.get(reportTable, REPORT_METADATA_KEY); } catch (UnknownTableException e) { // The table is only unknown if the report doesn't exist throw new ReportNotFoundException(reportId); } if (Intrinsic.isDeleted(metadata)) { throw new ReportNotFoundException(reportId); } Date startTime = JsonHelper.parseTimestamp((String) metadata.get("startTime")); Date completeTime = null; if (metadata.containsKey("completeTime")) { completeTime = JsonHelper.parseTimestamp((String) metadata.get("completeTime")); } Boolean success = (Boolean) metadata.get("success"); List<String> placements; Object placementMap = metadata.get("placements"); if (placementMap != null) { placements = ImmutableList.copyOf( JsonHelper.convert(placementMap, new TypeReference<Map<String, Object>>() {}).keySet()); } else { placements = ImmutableList.of(); } return new TableReportMetadata(reportId, startTime, completeTime, success, placements); }
[ "@", "Override", "public", "TableReportMetadata", "getReportMetadata", "(", "String", "reportId", ")", "{", "checkNotNull", "(", "reportId", ",", "\"reportId\"", ")", ";", "final", "String", "reportTable", "=", "getTableName", "(", "reportId", ")", ";", "Map", "...
Returns the table data for a given report. The caller can optionally return a partial report with ony the requested tables.
[ "Returns", "the", "table", "data", "for", "a", "given", "report", ".", "The", "caller", "can", "optionally", "return", "a", "partial", "report", "with", "ony", "the", "requested", "tables", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/report/db/EmoTableAllTablesReportDAO.java#L164-L199
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/quasinewton/LineSearchFletcher86.java
LineSearchFletcher86.interpolate
protected double interpolate( double boundA , double boundB ) { double alphaNew; // interpolate minimum for rapid convergence if( Double.isNaN(gp) ) { alphaNew = SearchInterpolate.quadratic(fprev, gprev, stprev, fp, stp); } else { alphaNew = SearchInterpolate.cubic2(fprev, gprev, stprev, fp, gp, stp); if( Double.isNaN(alphaNew)) alphaNew = SearchInterpolate.quadratic(fprev, gprev, stprev, fp, stp); } // order the bound double l,u; if( boundA < boundB ) { l=boundA;u=boundB; } else { l=boundB;u=boundA; } // enforce min/max allowed values if( alphaNew < l ) alphaNew = l; else if( alphaNew > u ) alphaNew = u; return alphaNew; }
java
protected double interpolate( double boundA , double boundB ) { double alphaNew; // interpolate minimum for rapid convergence if( Double.isNaN(gp) ) { alphaNew = SearchInterpolate.quadratic(fprev, gprev, stprev, fp, stp); } else { alphaNew = SearchInterpolate.cubic2(fprev, gprev, stprev, fp, gp, stp); if( Double.isNaN(alphaNew)) alphaNew = SearchInterpolate.quadratic(fprev, gprev, stprev, fp, stp); } // order the bound double l,u; if( boundA < boundB ) { l=boundA;u=boundB; } else { l=boundB;u=boundA; } // enforce min/max allowed values if( alphaNew < l ) alphaNew = l; else if( alphaNew > u ) alphaNew = u; return alphaNew; }
[ "protected", "double", "interpolate", "(", "double", "boundA", ",", "double", "boundB", ")", "{", "double", "alphaNew", ";", "// interpolate minimum for rapid convergence", "if", "(", "Double", ".", "isNaN", "(", "gp", ")", ")", "{", "alphaNew", "=", "SearchInte...
Use either quadratic of cubic interpolation to guess the minimum.
[ "Use", "either", "quadratic", "of", "cubic", "interpolation", "to", "guess", "the", "minimum", "." ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/quasinewton/LineSearchFletcher86.java#L351-L379
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java
EntityCapsManager.addDiscoverInfoByNode
static void addDiscoverInfoByNode(String nodeVer, DiscoverInfo info) { CAPS_CACHE.put(nodeVer, info); if (persistentCache != null) persistentCache.addDiscoverInfoByNodePersistent(nodeVer, info); }
java
static void addDiscoverInfoByNode(String nodeVer, DiscoverInfo info) { CAPS_CACHE.put(nodeVer, info); if (persistentCache != null) persistentCache.addDiscoverInfoByNodePersistent(nodeVer, info); }
[ "static", "void", "addDiscoverInfoByNode", "(", "String", "nodeVer", ",", "DiscoverInfo", "info", ")", "{", "CAPS_CACHE", ".", "put", "(", "nodeVer", ",", "info", ")", ";", "if", "(", "persistentCache", "!=", "null", ")", "persistentCache", ".", "addDiscoverIn...
Add DiscoverInfo to the database. @param nodeVer The node and verification String (e.g. "http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w="). @param info DiscoverInfo for the specified node.
[ "Add", "DiscoverInfo", "to", "the", "database", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java#L183-L188
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/AzureFirewallsInner.java
AzureFirewallsInner.beginDelete
public void beginDelete(String resourceGroupName, String azureFirewallName) { beginDeleteWithServiceResponseAsync(resourceGroupName, azureFirewallName).toBlocking().single().body(); }
java
public void beginDelete(String resourceGroupName, String azureFirewallName) { beginDeleteWithServiceResponseAsync(resourceGroupName, azureFirewallName).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "azureFirewallName", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "azureFirewallName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", "...
Deletes the specified Azure Firewall. @param resourceGroupName The name of the resource group. @param azureFirewallName The name of the Azure Firewall. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "the", "specified", "Azure", "Firewall", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/AzureFirewallsInner.java#L180-L182
googleads/googleads-java-lib
examples/adwords_axis/src/main/java/adwords/axis/v201809/misc/UploadImageAsset.java
UploadImageAsset.runExample
public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session) throws IOException { // Get the AssetService. AssetServiceInterface assetService = adWordsServices.get(session, AssetServiceInterface.class); // Create the image asset. ImageAsset image = new ImageAsset(); // Optional: Provide a unique friendly name to identify your asset. If you specify the assetName // field, then both the asset name and the image being uploaded should be unique, and should not // match another ACTIVE asset in this customer account. // image.setAssetName("Jupiter Trip #" + System.currentTimeMillis()); image.setImageData( com.google.api.ads.common.lib.utils.Media.getMediaDataFromUrl("https://goo.gl/3b9Wfh")); // Create the operation. AssetOperation operation = new AssetOperation(); operation.setOperator(Operator.ADD); operation.setOperand(image); // Create the asset. AssetReturnValue result = assetService.mutate(new AssetOperation[] {operation}); // Display the results. if (result != null && result.getValue() != null && result.getValue().length > 0) { Asset newAsset = result.getValue(0); System.out.printf( "Image asset with ID %d and name '%s' was created.%n", newAsset.getAssetId(), newAsset.getAssetName()); } else { System.out.println("No image asset was created."); } }
java
public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session) throws IOException { // Get the AssetService. AssetServiceInterface assetService = adWordsServices.get(session, AssetServiceInterface.class); // Create the image asset. ImageAsset image = new ImageAsset(); // Optional: Provide a unique friendly name to identify your asset. If you specify the assetName // field, then both the asset name and the image being uploaded should be unique, and should not // match another ACTIVE asset in this customer account. // image.setAssetName("Jupiter Trip #" + System.currentTimeMillis()); image.setImageData( com.google.api.ads.common.lib.utils.Media.getMediaDataFromUrl("https://goo.gl/3b9Wfh")); // Create the operation. AssetOperation operation = new AssetOperation(); operation.setOperator(Operator.ADD); operation.setOperand(image); // Create the asset. AssetReturnValue result = assetService.mutate(new AssetOperation[] {operation}); // Display the results. if (result != null && result.getValue() != null && result.getValue().length > 0) { Asset newAsset = result.getValue(0); System.out.printf( "Image asset with ID %d and name '%s' was created.%n", newAsset.getAssetId(), newAsset.getAssetName()); } else { System.out.println("No image asset was created."); } }
[ "public", "static", "void", "runExample", "(", "AdWordsServicesInterface", "adWordsServices", ",", "AdWordsSession", "session", ")", "throws", "IOException", "{", "// Get the AssetService.", "AssetServiceInterface", "assetService", "=", "adWordsServices", ".", "get", "(", ...
Runs the example. @param adWordsServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors. @throws IOException if unable to get media data from the URL.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/misc/UploadImageAsset.java#L114-L145
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newParseException
public static ParseException newParseException(Throwable cause, String message, Object... args) { return new ParseException(format(message, args), cause); }
java
public static ParseException newParseException(Throwable cause, String message, Object... args) { return new ParseException(format(message, args), cause); }
[ "public", "static", "ParseException", "newParseException", "(", "Throwable", "cause", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "new", "ParseException", "(", "format", "(", "message", ",", "args", ")", ",", "cause", ")", ";"...
Constructs and initializes a new {@link ParseException} with the given {@link Throwable cause} and {@link String message} formatted with the given {@link Object[] arguments}. @param cause {@link Throwable} identified as the reason this {@link ParseException} was thrown. @param message {@link String} describing the {@link ParseException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link ParseException} with the given {@link Throwable cause} and {@link String message}. @see org.cp.elements.text.ParseException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "ParseException", "}", "with", "the", "given", "{", "@link", "Throwable", "cause", "}", "and", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object", ...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L745-L747
contentful/contentful-management.java
src/main/java/com/contentful/java/cma/model/CMAEntry.java
CMAEntry.setFields
public CMAEntry setFields(LinkedHashMap<String, LinkedHashMap<String, Object>> fields) { this.fields = fields; return this; }
java
public CMAEntry setFields(LinkedHashMap<String, LinkedHashMap<String, Object>> fields) { this.fields = fields; return this; }
[ "public", "CMAEntry", "setFields", "(", "LinkedHashMap", "<", "String", ",", "LinkedHashMap", "<", "String", ",", "Object", ">", ">", "fields", ")", "{", "this", ".", "fields", "=", "fields", ";", "return", "this", ";", "}" ]
Sets a map of fields for this Entry. @param fields the fields to be set @return this {@code CMAEntry} instance
[ "Sets", "a", "map", "of", "fields", "for", "this", "Entry", "." ]
train
https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/model/CMAEntry.java#L149-L152
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java
DefaultComparisonFormatter.appendComment
protected void appendComment(StringBuilder sb, Comment aNode) { sb.append("<!--") .append(aNode.getNodeValue()) .append("-->"); }
java
protected void appendComment(StringBuilder sb, Comment aNode) { sb.append("<!--") .append(aNode.getNodeValue()) .append("-->"); }
[ "protected", "void", "appendComment", "(", "StringBuilder", "sb", ",", "Comment", "aNode", ")", "{", "sb", ".", "append", "(", "\"<!--\"", ")", ".", "append", "(", "aNode", ".", "getNodeValue", "(", ")", ")", ".", "append", "(", "\"-->\"", ")", ";", "}...
Formats a comment for {@link #getShortString}. @param sb the builder to append to @param aNode the comment @since XMLUnit 2.4.0
[ "Formats", "a", "comment", "for", "{", "@link", "#getShortString", "}", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java#L263-L267
mongodb/stitch-android-sdk
core/sdk/src/main/java/com/mongodb/stitch/core/auth/providers/userapikey/internal/CoreUserApiKeyAuthProviderClient.java
CoreUserApiKeyAuthProviderClient.createApiKeyInternal
protected UserApiKey createApiKeyInternal(final String name) { final StitchAuthDocRequest.Builder reqBuilder = new StitchAuthDocRequest.Builder(); reqBuilder .withMethod(Method.POST) .withPath(this.getBaseRoute()) .withDocument(new Document(ApiKeyFields.NAME, name)) .withRefreshToken(); return getRequestClient().doAuthenticatedRequest( reqBuilder.build(), new UserApiKeyDecoder() ); }
java
protected UserApiKey createApiKeyInternal(final String name) { final StitchAuthDocRequest.Builder reqBuilder = new StitchAuthDocRequest.Builder(); reqBuilder .withMethod(Method.POST) .withPath(this.getBaseRoute()) .withDocument(new Document(ApiKeyFields.NAME, name)) .withRefreshToken(); return getRequestClient().doAuthenticatedRequest( reqBuilder.build(), new UserApiKeyDecoder() ); }
[ "protected", "UserApiKey", "createApiKeyInternal", "(", "final", "String", "name", ")", "{", "final", "StitchAuthDocRequest", ".", "Builder", "reqBuilder", "=", "new", "StitchAuthDocRequest", ".", "Builder", "(", ")", ";", "reqBuilder", ".", "withMethod", "(", "Me...
Creates a user API key that can be used to authenticate as the current user. @param name The name of the API key to be created @return the created API key.
[ "Creates", "a", "user", "API", "key", "that", "can", "be", "used", "to", "authenticate", "as", "the", "current", "user", "." ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/sdk/src/main/java/com/mongodb/stitch/core/auth/providers/userapikey/internal/CoreUserApiKeyAuthProviderClient.java#L54-L65
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/stmt/runner/SQLRunner.java
SQLRunner.executeUpdates
private void executeUpdates() throws EFapsException { ConnectionResource con = null; try { con = Context.getThreadContext().getConnectionResource(); for (final Entry<SQLTable, AbstractSQLInsertUpdate<?>> entry : updatemap.entrySet()) { ((SQLUpdate) entry.getValue()).execute(con); } } catch (final SQLException e) { throw new EFapsException(SQLRunner.class, "executeOneCompleteStmt", e); } }
java
private void executeUpdates() throws EFapsException { ConnectionResource con = null; try { con = Context.getThreadContext().getConnectionResource(); for (final Entry<SQLTable, AbstractSQLInsertUpdate<?>> entry : updatemap.entrySet()) { ((SQLUpdate) entry.getValue()).execute(con); } } catch (final SQLException e) { throw new EFapsException(SQLRunner.class, "executeOneCompleteStmt", e); } }
[ "private", "void", "executeUpdates", "(", ")", "throws", "EFapsException", "{", "ConnectionResource", "con", "=", "null", ";", "try", "{", "con", "=", "Context", ".", "getThreadContext", "(", ")", ".", "getConnectionResource", "(", ")", ";", "for", "(", "fin...
Execute the update. @throws EFapsException the e faps exception
[ "Execute", "the", "update", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/stmt/runner/SQLRunner.java#L508-L520
HsiangLeekwok/hlklib
hlklib/src/main/java/com/hlk/hlklib/lib/datetimepicker/TimeFragment.java
TimeFragment.newInstance
public static final TimeFragment newInstance(int theme, int hour, int minute, boolean isClientSpecified24HourTime, boolean is24HourTime) { TimeFragment f = new TimeFragment(); Bundle b = new Bundle(); b.putInt("theme", theme); b.putInt("hour", hour); b.putInt("minute", minute); b.putBoolean("isClientSpecified24HourTime", isClientSpecified24HourTime); b.putBoolean("is24HourTime", is24HourTime); f.setArguments(b); return f; }
java
public static final TimeFragment newInstance(int theme, int hour, int minute, boolean isClientSpecified24HourTime, boolean is24HourTime) { TimeFragment f = new TimeFragment(); Bundle b = new Bundle(); b.putInt("theme", theme); b.putInt("hour", hour); b.putInt("minute", minute); b.putBoolean("isClientSpecified24HourTime", isClientSpecified24HourTime); b.putBoolean("is24HourTime", is24HourTime); f.setArguments(b); return f; }
[ "public", "static", "final", "TimeFragment", "newInstance", "(", "int", "theme", ",", "int", "hour", ",", "int", "minute", ",", "boolean", "isClientSpecified24HourTime", ",", "boolean", "is24HourTime", ")", "{", "TimeFragment", "f", "=", "new", "TimeFragment", "...
Return an instance of TimeFragment with its bundle filled with the constructor arguments. The values in the bundle are retrieved in {@link #onCreateView()} below to properly initialize the TimePicker. @param theme @param hour @param minute @param isClientSpecified24HourTime @param is24HourTime @return
[ "Return", "an", "instance", "of", "TimeFragment", "with", "its", "bundle", "filled", "with", "the", "constructor", "arguments", ".", "The", "values", "in", "the", "bundle", "are", "retrieved", "in", "{", "@link", "#onCreateView", "()", "}", "below", "to", "p...
train
https://github.com/HsiangLeekwok/hlklib/blob/b122f6dcab7cec60c8e5455e0c31613d08bec6ad/hlklib/src/main/java/com/hlk/hlklib/lib/datetimepicker/TimeFragment.java#L71-L83
sebastiangraf/treetank
interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/StorageManager.java
StorageManager.createResource
public static boolean createResource(String name, AbstractModule module) throws StorageAlreadyExistsException, TTException { File file = new File(ROOT_PATH); File storageFile = new File(STORAGE_PATH); if (!file.exists() || !storageFile.exists()) { file.mkdirs(); StorageConfiguration configuration = new StorageConfiguration(storageFile); // Creating and opening the storage. // Making it ready for usage. Storage.truncateStorage(configuration); Storage.createStorage(configuration); } IStorage storage = Storage.openStorage(storageFile); Injector injector = Guice.createInjector(module); IBackendFactory backend = injector.getInstance(IBackendFactory.class); IRevisioning revision = injector.getInstance(IRevisioning.class); Properties props = StandardSettings.getProps(storageFile.getAbsolutePath(), name); ResourceConfiguration mResourceConfig = new ResourceConfiguration(props, backend, revision, new FileDataFactory(), new FilelistenerMetaDataFactory()); storage.createResource(mResourceConfig); return true; }
java
public static boolean createResource(String name, AbstractModule module) throws StorageAlreadyExistsException, TTException { File file = new File(ROOT_PATH); File storageFile = new File(STORAGE_PATH); if (!file.exists() || !storageFile.exists()) { file.mkdirs(); StorageConfiguration configuration = new StorageConfiguration(storageFile); // Creating and opening the storage. // Making it ready for usage. Storage.truncateStorage(configuration); Storage.createStorage(configuration); } IStorage storage = Storage.openStorage(storageFile); Injector injector = Guice.createInjector(module); IBackendFactory backend = injector.getInstance(IBackendFactory.class); IRevisioning revision = injector.getInstance(IRevisioning.class); Properties props = StandardSettings.getProps(storageFile.getAbsolutePath(), name); ResourceConfiguration mResourceConfig = new ResourceConfiguration(props, backend, revision, new FileDataFactory(), new FilelistenerMetaDataFactory()); storage.createResource(mResourceConfig); return true; }
[ "public", "static", "boolean", "createResource", "(", "String", "name", ",", "AbstractModule", "module", ")", "throws", "StorageAlreadyExistsException", ",", "TTException", "{", "File", "file", "=", "new", "File", "(", "ROOT_PATH", ")", ";", "File", "storageFile",...
Create a new storage with the given name and backend. @param name @param module @return true if successful @throws StorageAlreadyExistsException @throws TTException
[ "Create", "a", "new", "storage", "with", "the", "given", "name", "and", "backend", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/StorageManager.java#L60-L91
mikepenz/FastAdapter
library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/RangeSelectorHelper.java
RangeSelectorHelper.withSavedInstanceState
public RangeSelectorHelper withSavedInstanceState(Bundle savedInstanceState, String prefix) { if (savedInstanceState != null && savedInstanceState.containsKey(BUNDLE_LAST_LONG_PRESS + prefix)) mLastLongPressIndex = savedInstanceState.getInt(BUNDLE_LAST_LONG_PRESS + prefix); return this; }
java
public RangeSelectorHelper withSavedInstanceState(Bundle savedInstanceState, String prefix) { if (savedInstanceState != null && savedInstanceState.containsKey(BUNDLE_LAST_LONG_PRESS + prefix)) mLastLongPressIndex = savedInstanceState.getInt(BUNDLE_LAST_LONG_PRESS + prefix); return this; }
[ "public", "RangeSelectorHelper", "withSavedInstanceState", "(", "Bundle", "savedInstanceState", ",", "String", "prefix", ")", "{", "if", "(", "savedInstanceState", "!=", "null", "&&", "savedInstanceState", ".", "containsKey", "(", "BUNDLE_LAST_LONG_PRESS", "+", "prefix"...
restore the index of the last long pressed index IMPORTANT! Call this method only after all items where added to the adapters again. Otherwise it may select wrong items! @param savedInstanceState If the activity is being re-initialized after previously being shut down then this Bundle contains the data it most recently supplied in Note: Otherwise it is null. @param prefix a prefix added to the savedInstance key so we can store multiple states @return this
[ "restore", "the", "index", "of", "the", "last", "long", "pressed", "index", "IMPORTANT!", "Call", "this", "method", "only", "after", "all", "items", "where", "added", "to", "the", "adapters", "again", ".", "Otherwise", "it", "may", "select", "wrong", "items!...
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/RangeSelectorHelper.java#L214-L218
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCSSGenerator.java
AbstractCSSGenerator.rewriteUrl
protected String rewriteUrl(GeneratorContext context, String content) throws IOException { JawrConfig jawrConfig = context.getConfig(); CssImageUrlRewriter rewriter = new CssImageUrlRewriter(jawrConfig); String bundlePath = PathNormalizer.joinPaths(jawrConfig.getServletMapping(), ResourceGenerator.CSS_DEBUGPATH); StringBuffer result = rewriter.rewriteUrl(context.getPath(), bundlePath, content); return result.toString(); }
java
protected String rewriteUrl(GeneratorContext context, String content) throws IOException { JawrConfig jawrConfig = context.getConfig(); CssImageUrlRewriter rewriter = new CssImageUrlRewriter(jawrConfig); String bundlePath = PathNormalizer.joinPaths(jawrConfig.getServletMapping(), ResourceGenerator.CSS_DEBUGPATH); StringBuffer result = rewriter.rewriteUrl(context.getPath(), bundlePath, content); return result.toString(); }
[ "protected", "String", "rewriteUrl", "(", "GeneratorContext", "context", ",", "String", "content", ")", "throws", "IOException", "{", "JawrConfig", "jawrConfig", "=", "context", ".", "getConfig", "(", ")", ";", "CssImageUrlRewriter", "rewriter", "=", "new", "CssIm...
Rewrite the URL for debug mode @param context the generator context @param content the content @return the rewritten content @throws IOException if IOException occurs
[ "Rewrite", "the", "URL", "for", "debug", "mode" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCSSGenerator.java#L102-L110
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/RepositoryFileApi.java
RepositoryFileApi.deleteFile
@Deprecated public void deleteFile(String filePath, Integer projectId, String branchName, String commitMessage) throws GitLabApiException { deleteFile(projectId, filePath, branchName, commitMessage); }
java
@Deprecated public void deleteFile(String filePath, Integer projectId, String branchName, String commitMessage) throws GitLabApiException { deleteFile(projectId, filePath, branchName, commitMessage); }
[ "@", "Deprecated", "public", "void", "deleteFile", "(", "String", "filePath", ",", "Integer", "projectId", ",", "String", "branchName", ",", "String", "commitMessage", ")", "throws", "GitLabApiException", "{", "deleteFile", "(", "projectId", ",", "filePath", ",", ...
Delete existing file in repository <pre><code>GitLab Endpoint: DELETE /projects/:id/repository/files</code></pre> file_path (required) - Full path to file. Ex. lib/class.rb branch_name (required) - The name of branch commit_message (required) - Commit message @param filePath full path to new file. Ex. lib/class.rb @param projectId the project ID @param branchName the name of branch @param commitMessage the commit message @throws GitLabApiException if any exception occurs @deprecated Will be removed in version 5.0, replaced by {@link #deleteFile(Object, String, String, String)}
[ "Delete", "existing", "file", "in", "repository" ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryFileApi.java#L352-L355
betfair/cougar
cougar-framework/cougar-zipkin-common/src/main/java/com/betfair/cougar/modules/zipkin/impl/ZipkinEmitter.java
ZipkinEmitter.emitAnnotation
public void emitAnnotation(@Nonnull ZipkinData zipkinData, @Nonnull String key, short value) { ZipkinAnnotationsStore store = prepareEmission(zipkinData, key).addAnnotation(key, value); emitAnnotations(store); }
java
public void emitAnnotation(@Nonnull ZipkinData zipkinData, @Nonnull String key, short value) { ZipkinAnnotationsStore store = prepareEmission(zipkinData, key).addAnnotation(key, value); emitAnnotations(store); }
[ "public", "void", "emitAnnotation", "(", "@", "Nonnull", "ZipkinData", "zipkinData", ",", "@", "Nonnull", "String", "key", ",", "short", "value", ")", "{", "ZipkinAnnotationsStore", "store", "=", "prepareEmission", "(", "zipkinData", ",", "key", ")", ".", "add...
Emits a single (binary) short annotation to Zipkin. @param zipkinData Zipkin request data @param key The annotation key @param value The annotation value
[ "Emits", "a", "single", "(", "binary", ")", "short", "annotation", "to", "Zipkin", "." ]
train
https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-framework/cougar-zipkin-common/src/main/java/com/betfair/cougar/modules/zipkin/impl/ZipkinEmitter.java#L191-L194
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java
DistributedQueue.putMulti
public boolean putMulti(MultiItem<T> items, int maxWait, TimeUnit unit) throws Exception { checkState(); String path = makeItemPath(); return internalPut(null, items, path, maxWait, unit); }
java
public boolean putMulti(MultiItem<T> items, int maxWait, TimeUnit unit) throws Exception { checkState(); String path = makeItemPath(); return internalPut(null, items, path, maxWait, unit); }
[ "public", "boolean", "putMulti", "(", "MultiItem", "<", "T", ">", "items", ",", "int", "maxWait", ",", "TimeUnit", "unit", ")", "throws", "Exception", "{", "checkState", "(", ")", ";", "String", "path", "=", "makeItemPath", "(", ")", ";", "return", "inte...
Same as {@link #putMulti(MultiItem)} but allows a maximum wait time if an upper bound was set via {@link QueueBuilder#maxItems}. @param items items to add @param maxWait maximum wait @param unit wait unit @return true if items was added, false if timed out @throws Exception
[ "Same", "as", "{", "@link", "#putMulti", "(", "MultiItem", ")", "}", "but", "allows", "a", "maximum", "wait", "time", "if", "an", "upper", "bound", "was", "set", "via", "{", "@link", "QueueBuilder#maxItems", "}", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java#L348-L354
ThreeTen/threetenbp
src/main/java/org/threeten/bp/LocalDateTime.java
LocalDateTime.plus
@Override public LocalDateTime plus(long amountToAdd, TemporalUnit unit) { if (unit instanceof ChronoUnit) { ChronoUnit f = (ChronoUnit) unit; switch (f) { case NANOS: return plusNanos(amountToAdd); case MICROS: return plusDays(amountToAdd / MICROS_PER_DAY).plusNanos((amountToAdd % MICROS_PER_DAY) * 1000); case MILLIS: return plusDays(amountToAdd / MILLIS_PER_DAY).plusNanos((amountToAdd % MILLIS_PER_DAY) * 1000000); case SECONDS: return plusSeconds(amountToAdd); case MINUTES: return plusMinutes(amountToAdd); case HOURS: return plusHours(amountToAdd); case HALF_DAYS: return plusDays(amountToAdd / 256).plusHours((amountToAdd % 256) * 12); // no overflow (256 is multiple of 2) } return with(date.plus(amountToAdd, unit), time); } return unit.addTo(this, amountToAdd); }
java
@Override public LocalDateTime plus(long amountToAdd, TemporalUnit unit) { if (unit instanceof ChronoUnit) { ChronoUnit f = (ChronoUnit) unit; switch (f) { case NANOS: return plusNanos(amountToAdd); case MICROS: return plusDays(amountToAdd / MICROS_PER_DAY).plusNanos((amountToAdd % MICROS_PER_DAY) * 1000); case MILLIS: return plusDays(amountToAdd / MILLIS_PER_DAY).plusNanos((amountToAdd % MILLIS_PER_DAY) * 1000000); case SECONDS: return plusSeconds(amountToAdd); case MINUTES: return plusMinutes(amountToAdd); case HOURS: return plusHours(amountToAdd); case HALF_DAYS: return plusDays(amountToAdd / 256).plusHours((amountToAdd % 256) * 12); // no overflow (256 is multiple of 2) } return with(date.plus(amountToAdd, unit), time); } return unit.addTo(this, amountToAdd); }
[ "@", "Override", "public", "LocalDateTime", "plus", "(", "long", "amountToAdd", ",", "TemporalUnit", "unit", ")", "{", "if", "(", "unit", "instanceof", "ChronoUnit", ")", "{", "ChronoUnit", "f", "=", "(", "ChronoUnit", ")", "unit", ";", "switch", "(", "f",...
Returns a copy of this date-time with the specified period added. <p> This method returns a new date-time based on this date-time with the specified period added. This can be used to add any period that is defined by a unit, for example to add years, months or days. The unit is responsible for the details of the calculation, including the resolution of any edge cases in the calculation. <p> This instance is immutable and unaffected by this method call. @param amountToAdd the amount of the unit to add to the result, may be negative @param unit the unit of the period to add, not null @return a {@code LocalDateTime} based on this date-time with the specified period added, not null @throws DateTimeException if the unit cannot be added to this type
[ "Returns", "a", "copy", "of", "this", "date", "-", "time", "with", "the", "specified", "period", "added", ".", "<p", ">", "This", "method", "returns", "a", "new", "date", "-", "time", "based", "on", "this", "date", "-", "time", "with", "the", "specifie...
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/LocalDateTime.java#L1034-L1050
deeplearning4j/deeplearning4j
datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java
NativeImageLoader.asMatrix
private INDArray asMatrix(BytePointer bytes, long length) throws IOException { PIXA pixa; pixa = pixaReadMemMultipageTiff(bytes, length); INDArray data; INDArray currentD; INDArrayIndex[] index = null; switch (this.multiPageMode) { case MINIBATCH: data = Nd4j.create(pixa.n(), 1, pixa.pix(0).h(), pixa.pix(0).w()); break; case CHANNELS: data = Nd4j.create(1, pixa.n(), pixa.pix(0).h(), pixa.pix(0).w()); break; case FIRST: data = Nd4j.create(1, 1, pixa.pix(0).h(), pixa.pix(0).w()); PIX pix = pixa.pix(0); currentD = asMatrix(convert(pix)); pixDestroy(pix); index = new INDArrayIndex[]{NDArrayIndex.point(0), NDArrayIndex.point(0),NDArrayIndex.all(),NDArrayIndex.all()}; data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all())); return data; default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode); } for (int i = 0; i < pixa.n(); i++) { PIX pix = pixa.pix(i); currentD = asMatrix(convert(pix)); pixDestroy(pix); //TODO to change when 16-bit image is supported switch (this.multiPageMode) { case MINIBATCH: index = new INDArrayIndex[]{NDArrayIndex.point(i), NDArrayIndex.all(),NDArrayIndex.all(),NDArrayIndex.all()}; break; case CHANNELS: index = new INDArrayIndex[]{NDArrayIndex.all(), NDArrayIndex.point(i),NDArrayIndex.all(),NDArrayIndex.all()}; break; default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode); } data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all())); } return data; }
java
private INDArray asMatrix(BytePointer bytes, long length) throws IOException { PIXA pixa; pixa = pixaReadMemMultipageTiff(bytes, length); INDArray data; INDArray currentD; INDArrayIndex[] index = null; switch (this.multiPageMode) { case MINIBATCH: data = Nd4j.create(pixa.n(), 1, pixa.pix(0).h(), pixa.pix(0).w()); break; case CHANNELS: data = Nd4j.create(1, pixa.n(), pixa.pix(0).h(), pixa.pix(0).w()); break; case FIRST: data = Nd4j.create(1, 1, pixa.pix(0).h(), pixa.pix(0).w()); PIX pix = pixa.pix(0); currentD = asMatrix(convert(pix)); pixDestroy(pix); index = new INDArrayIndex[]{NDArrayIndex.point(0), NDArrayIndex.point(0),NDArrayIndex.all(),NDArrayIndex.all()}; data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all())); return data; default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode); } for (int i = 0; i < pixa.n(); i++) { PIX pix = pixa.pix(i); currentD = asMatrix(convert(pix)); pixDestroy(pix); //TODO to change when 16-bit image is supported switch (this.multiPageMode) { case MINIBATCH: index = new INDArrayIndex[]{NDArrayIndex.point(i), NDArrayIndex.all(),NDArrayIndex.all(),NDArrayIndex.all()}; break; case CHANNELS: index = new INDArrayIndex[]{NDArrayIndex.all(), NDArrayIndex.point(i),NDArrayIndex.all(),NDArrayIndex.all()}; break; default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode); } data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all())); } return data; }
[ "private", "INDArray", "asMatrix", "(", "BytePointer", "bytes", ",", "long", "length", ")", "throws", "IOException", "{", "PIXA", "pixa", ";", "pixa", "=", "pixaReadMemMultipageTiff", "(", "bytes", ",", "length", ")", ";", "INDArray", "data", ";", "INDArray", ...
Read multipage tiff and load into INDArray @param bytes @return INDArray @throws IOException
[ "Read", "multipage", "tiff", "and", "load", "into", "INDArray" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java#L819-L860
alkacon/opencms-core
src/org/opencms/ui/apps/scheduler/CmsJobTable.java
CmsJobTable.onItemClick
@SuppressWarnings("unchecked") void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) { if (!event.isCtrlKey() && !event.isShiftKey()) { changeValueIfNotMultiSelect(itemId); // don't interfere with multi-selection using control key if (event.getButton().equals(MouseButton.RIGHT) || (propertyId == null)) { Set<String> jobIds = new HashSet<String>(); for (CmsJobBean job : (Set<CmsJobBean>)getValue()) { jobIds.add(job.getJob().getId()); } m_menu.setEntries(getMenuEntries(), jobIds); m_menu.openForTable(event, itemId, propertyId, this); } else if (event.getButton().equals(MouseButton.LEFT) && TableProperty.className.toString().equals(propertyId)) { String jobId = ((Set<CmsJobBean>)getValue()).iterator().next().getJob().getId(); m_manager.defaultAction(jobId); } } }
java
@SuppressWarnings("unchecked") void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) { if (!event.isCtrlKey() && !event.isShiftKey()) { changeValueIfNotMultiSelect(itemId); // don't interfere with multi-selection using control key if (event.getButton().equals(MouseButton.RIGHT) || (propertyId == null)) { Set<String> jobIds = new HashSet<String>(); for (CmsJobBean job : (Set<CmsJobBean>)getValue()) { jobIds.add(job.getJob().getId()); } m_menu.setEntries(getMenuEntries(), jobIds); m_menu.openForTable(event, itemId, propertyId, this); } else if (event.getButton().equals(MouseButton.LEFT) && TableProperty.className.toString().equals(propertyId)) { String jobId = ((Set<CmsJobBean>)getValue()).iterator().next().getJob().getId(); m_manager.defaultAction(jobId); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "void", "onItemClick", "(", "MouseEvents", ".", "ClickEvent", "event", ",", "Object", "itemId", ",", "Object", "propertyId", ")", "{", "if", "(", "!", "event", ".", "isCtrlKey", "(", ")", "&&", "!", "even...
Handles the table item clicks, including clicks on images inside of a table item.<p> @param event the click event @param itemId of the clicked row @param propertyId column id
[ "Handles", "the", "table", "item", "clicks", "including", "clicks", "on", "images", "inside", "of", "a", "table", "item", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/scheduler/CmsJobTable.java#L646-L666
openwms/org.openwms
org.openwms.core.util/src/main/java/org/openwms/core/aop/FireAfterTransactionAspect.java
FireAfterTransactionAspect.fireEvent
public void fireEvent(Object publisher, FireAfterTransaction events) throws RuntimeException { try { for (int i = 0; i < events.events().length; i++) { Class<? extends EventObject> event = events.events()[i]; if (ApplicationEvent.class.isAssignableFrom(event)) { ctx.publishEvent((ApplicationEvent) event.getConstructor(Object.class).newInstance(publisher)); } } } catch (Exception e) { throw new RuntimeException(e); } }
java
public void fireEvent(Object publisher, FireAfterTransaction events) throws RuntimeException { try { for (int i = 0; i < events.events().length; i++) { Class<? extends EventObject> event = events.events()[i]; if (ApplicationEvent.class.isAssignableFrom(event)) { ctx.publishEvent((ApplicationEvent) event.getConstructor(Object.class).newInstance(publisher)); } } } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "void", "fireEvent", "(", "Object", "publisher", ",", "FireAfterTransaction", "events", ")", "throws", "RuntimeException", "{", "try", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "events", ".", "events", "(", ")", ".", "length", ";", ...
Only {@link ApplicationEvent}s are created and published over Springs {@link ApplicationContext}. @param publisher The instance that is publishing the event @param events A list of event classes to fire @throws RuntimeException Any exception is re-thrown
[ "Only", "{", "@link", "ApplicationEvent", "}", "s", "are", "created", "and", "published", "over", "Springs", "{", "@link", "ApplicationContext", "}", "." ]
train
https://github.com/openwms/org.openwms/blob/b24a95c5d09a7ec3c723d7e107d1cb0039d06a7e/org.openwms.core.util/src/main/java/org/openwms/core/aop/FireAfterTransactionAspect.java#L73-L84
akarnokd/akarnokd-xml
src/main/java/hu/akarnokd/xml/XSerializables.java
XSerializables.storeList
public static XElement storeList(String container, String item, Iterable<? extends XSerializable> source) { XElement result = new XElement(container); for (XSerializable e : source) { e.save(result.add(item)); } return result; }
java
public static XElement storeList(String container, String item, Iterable<? extends XSerializable> source) { XElement result = new XElement(container); for (XSerializable e : source) { e.save(result.add(item)); } return result; }
[ "public", "static", "XElement", "storeList", "(", "String", "container", ",", "String", "item", ",", "Iterable", "<", "?", "extends", "XSerializable", ">", "source", ")", "{", "XElement", "result", "=", "new", "XElement", "(", "container", ")", ";", "for", ...
Create an XElement with the given name and items stored from the source sequence. @param container the container name @param item the item name @param source the source of items @return the list in XElement
[ "Create", "an", "XElement", "with", "the", "given", "name", "and", "items", "stored", "from", "the", "source", "sequence", "." ]
train
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XSerializables.java#L92-L98
momokan/LWJGFont
src/main/java/net/chocolapod/lwjgfont/LWJGFont.java
LWJGFont.drawParagraph
public final void drawParagraph(String text, float dstX, float dstY, float dstZ, float paragraphWidth) throws IOException { this.drawParagraph(text, dstX, dstY, dstZ, paragraphWidth, ALIGN.LEGT); }
java
public final void drawParagraph(String text, float dstX, float dstY, float dstZ, float paragraphWidth) throws IOException { this.drawParagraph(text, dstX, dstY, dstZ, paragraphWidth, ALIGN.LEGT); }
[ "public", "final", "void", "drawParagraph", "(", "String", "text", ",", "float", "dstX", ",", "float", "dstY", ",", "float", "dstZ", ",", "float", "paragraphWidth", ")", "throws", "IOException", "{", "this", ".", "drawParagraph", "(", "text", ",", "dstX", ...
Draws the paragraph given by the specified string, using this font instance's current color.<br> if the specified string protrudes from paragraphWidth, protruded substring is auto wrapped with left align.<br> Note that the specified destination coordinates is a left point of the rendered string's baseline. @param text the string to be drawn. @param dstX the x coordinate to render the string. @param dstY the y coordinate to render the string. @param dstZ the z coordinate to render the string. @param paragraphWidth the max width to draw the paragraph. @throws IOException Indicates a failure to read font images as textures.
[ "Draws", "the", "paragraph", "given", "by", "the", "specified", "string", "using", "this", "font", "instance", "s", "current", "color", ".", "<br", ">", "if", "the", "specified", "string", "protrudes", "from", "paragraphWidth", "protruded", "substring", "is", ...
train
https://github.com/momokan/LWJGFont/blob/f2d6138b73d84a7e2c1271bae25b4c76488d9ec2/src/main/java/net/chocolapod/lwjgfont/LWJGFont.java#L171-L173
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSchemaInterpreterImpl.java
JSchemaInterpreterImpl.getMessageMap
static public MessageMap getMessageMap(JSchema sfs, int[] choices) throws JMFUninitializedAccessException { BigInteger multiChoice = MessageMap.getMultiChoice(choices, sfs); return getMessageMap(sfs, multiChoice); }
java
static public MessageMap getMessageMap(JSchema sfs, int[] choices) throws JMFUninitializedAccessException { BigInteger multiChoice = MessageMap.getMultiChoice(choices, sfs); return getMessageMap(sfs, multiChoice); }
[ "static", "public", "MessageMap", "getMessageMap", "(", "JSchema", "sfs", ",", "int", "[", "]", "choices", ")", "throws", "JMFUninitializedAccessException", "{", "BigInteger", "multiChoice", "=", "MessageMap", ".", "getMultiChoice", "(", "choices", ",", "sfs", ")"...
Method to retrieve (and possibly construct) the MessageMap for a particular combination of choices.
[ "Method", "to", "retrieve", "(", "and", "possibly", "construct", ")", "the", "MessageMap", "for", "a", "particular", "combination", "of", "choices", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSchemaInterpreterImpl.java#L133-L136
indeedeng/util
util-core/src/main/java/com/indeed/util/core/io/Closeables2.java
Closeables2.forIterable2
public static <C extends Closeable, T extends Iterable<C>> Closeable forIterable2( @Nonnull final Logger log, @Nonnull final Iterable<T> closeables ) { return new Closeable() { public void close() throws IOException { closeAll(log, Iterables.transform(closeables, new Function<T, Closeable>() { public Closeable apply(final @Nullable T input) { if (input == null) { return new Closeable() { public void close() throws IOException {} }; } else { return forIterable(log, input); } } })); } }; }
java
public static <C extends Closeable, T extends Iterable<C>> Closeable forIterable2( @Nonnull final Logger log, @Nonnull final Iterable<T> closeables ) { return new Closeable() { public void close() throws IOException { closeAll(log, Iterables.transform(closeables, new Function<T, Closeable>() { public Closeable apply(final @Nullable T input) { if (input == null) { return new Closeable() { public void close() throws IOException {} }; } else { return forIterable(log, input); } } })); } }; }
[ "public", "static", "<", "C", "extends", "Closeable", ",", "T", "extends", "Iterable", "<", "C", ">", ">", "Closeable", "forIterable2", "(", "@", "Nonnull", "final", "Logger", "log", ",", "@", "Nonnull", "final", "Iterable", "<", "T", ">", "closeables", ...
Create a composite {@link Closeable} that will close all the wrapped {@code closeables} references. The {@link Closeable#close()} method will perform a safe close of all wrapped Closeable objects. This is needed since successive calls of the {@link #closeAll(Logger, Closeable...)} method is not exception safe without an extra layer of try / finally. This method iterates the provided {@code Iterable<? extends Iterable<? extends Closeable>>} and closes all subsequent Closeable objects. @param log The logger to write error messages out to. @param closeables An iterator over iterable Closeables. @param <C> A class that implements the {@link Closeable} interface. @param <T> An iterable collection that contains {@link Closeable} objects. @return A composite closeable that wraps all underlying {@code closeables}.
[ "Create", "a", "composite", "{", "@link", "Closeable", "}", "that", "will", "close", "all", "the", "wrapped", "{", "@code", "closeables", "}", "references", ".", "The", "{", "@link", "Closeable#close", "()", "}", "method", "will", "perform", "a", "safe", "...
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/io/Closeables2.java#L139-L158
javagl/CommonUI
src/main/java/de/javagl/common/ui/JTables.java
JTables.adjustColumnWidths
public static void adjustColumnWidths(JTable table, int maxWidth) { final int safety = 20; for (int c = 0; c < table.getColumnCount(); c++) { TableColumn column = table.getColumnModel().getColumn(c); TableCellRenderer headerRenderer = column.getHeaderRenderer(); if (headerRenderer == null) { headerRenderer = table.getTableHeader().getDefaultRenderer(); } Component headerComponent = headerRenderer.getTableCellRendererComponent( table, column.getHeaderValue(), false, false, 0, 0); int width = headerComponent.getPreferredSize().width; for (int r = 0; r < table.getRowCount(); r++) { TableCellRenderer cellRenderer = table.getCellRenderer(r, c); Component cellComponent = cellRenderer.getTableCellRendererComponent( table, table.getValueAt(r, c), false, false, r, c); Dimension d = cellComponent.getPreferredSize(); //System.out.println( // "Preferred is "+d.width+" for "+cellComponent); width = Math.max(width, d.width); } column.setPreferredWidth(Math.min(maxWidth, width + safety)); } }
java
public static void adjustColumnWidths(JTable table, int maxWidth) { final int safety = 20; for (int c = 0; c < table.getColumnCount(); c++) { TableColumn column = table.getColumnModel().getColumn(c); TableCellRenderer headerRenderer = column.getHeaderRenderer(); if (headerRenderer == null) { headerRenderer = table.getTableHeader().getDefaultRenderer(); } Component headerComponent = headerRenderer.getTableCellRendererComponent( table, column.getHeaderValue(), false, false, 0, 0); int width = headerComponent.getPreferredSize().width; for (int r = 0; r < table.getRowCount(); r++) { TableCellRenderer cellRenderer = table.getCellRenderer(r, c); Component cellComponent = cellRenderer.getTableCellRendererComponent( table, table.getValueAt(r, c), false, false, r, c); Dimension d = cellComponent.getPreferredSize(); //System.out.println( // "Preferred is "+d.width+" for "+cellComponent); width = Math.max(width, d.width); } column.setPreferredWidth(Math.min(maxWidth, width + safety)); } }
[ "public", "static", "void", "adjustColumnWidths", "(", "JTable", "table", ",", "int", "maxWidth", ")", "{", "final", "int", "safety", "=", "20", ";", "for", "(", "int", "c", "=", "0", ";", "c", "<", "table", ".", "getColumnCount", "(", ")", ";", "c",...
Adjust the preferred widths of the columns of the given table depending on the contents of the cells and headers. @param table The table to adjust @param maxWidth The maximum width a column may have
[ "Adjust", "the", "preferred", "widths", "of", "the", "columns", "of", "the", "given", "table", "depending", "on", "the", "contents", "of", "the", "cells", "and", "headers", "." ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/JTables.java#L51-L81
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaSetupArgument
@Deprecated public static int cudaSetupArgument(Pointer arg, long size, long offset) { return checkResult(cudaSetupArgumentNative(arg, size, offset)); }
java
@Deprecated public static int cudaSetupArgument(Pointer arg, long size, long offset) { return checkResult(cudaSetupArgumentNative(arg, size, offset)); }
[ "@", "Deprecated", "public", "static", "int", "cudaSetupArgument", "(", "Pointer", "arg", ",", "long", "size", ",", "long", "offset", ")", "{", "return", "checkResult", "(", "cudaSetupArgumentNative", "(", "arg", ",", "size", ",", "offset", ")", ")", ";", ...
[C++ API] Configure a device launch <pre> template < class T > cudaError_t cudaSetupArgument ( T arg, size_t offset ) [inline] </pre> <div> <p>[C++ API] Configure a device launch Pushes <tt>size</tt> bytes of the argument pointed to by <tt>arg</tt> at <tt>offset</tt> bytes from the start of the parameter passing area, which starts at offset 0. The arguments are stored in the top of the execution stack. cudaSetupArgument() must be preceded by a call to cudaConfigureCall(). </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param arg Argument to push for a kernel launch @param size Size of argument @param offset Offset in argument stack to push new arg @param arg Argument to push for a kernel launch @param offset Offset in argument stack to push new arg @return cudaSuccess @see JCuda#cudaConfigureCall @see JCuda#cudaFuncGetAttributes @see JCuda#cudaLaunch @see JCuda#cudaSetDoubleForDevice @see JCuda#cudaSetDoubleForHost @see JCuda#cudaSetupArgument @deprecated This function is deprecated as of CUDA 7.0
[ "[", "C", "++", "API", "]", "Configure", "a", "device", "launch" ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L10270-L10274
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
CacheableWorkspaceDataManager.registerListener
private void registerListener(final ChangesLogWrapper logWrapper, TransactionableResourceManager txResourceManager) throws RepositoryException { try { // Why calling the listeners non tx aware has been done like this: // 1. If we call them in the commit phase and we use Arjuna with ISPN, we get: // ActionStatus.COMMITTING > is not in a valid state to be invoking cache operations on. // at org.infinispan.interceptors.TxInterceptor.enlist(TxInterceptor.java:195) // at org.infinispan.interceptors.TxInterceptor.enlistReadAndInvokeNext(TxInterceptor.java:167) // at org.infinispan.interceptors.TxInterceptor.visitGetKeyValueCommand(TxInterceptor.java:162) // at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:64) // This is due to the fact that ISPN enlist the cache even for a read access and enlistments are not // allowed in the commit phase // 2. If we call them in the commit phase, we use Arjuna with ISPN and we suspend the current tx, // we get deadlocks because we try to acquire locks on cache entries that have been locked by the main tx. // 3. If we call them in the afterComplete, we use JOTM with ISPN and we suspend and resume the current tx, we get: // jotm: resume: Invalid Transaction Status:STATUS_COMMITTED (Current.java, line 743) // javax.transaction.InvalidTransactionException: Invalid resume org.objectweb.jotm.TransactionImpl // at org.objectweb.jotm.Current.resume(Current.java:744) // This is due to the fact that it is not allowed to resume a tx when its status is STATUS_COMMITED txResourceManager.addListener(new TransactionableResourceManagerListener() { public void onCommit(boolean onePhase) throws Exception { } public void onAfterCompletion(int status) throws Exception { if (status == Status.STATUS_COMMITTED) { // Since the tx is successfully committed we can call components non tx aware // The listeners will need to be executed outside the current tx so we suspend // the current tx we can face enlistment issues on product like ISPN transactionManager.suspend(); SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>() { public Void run() { notifySaveItems(logWrapper.getChangesLog(), false); return null; } }); // Since the resume method could cause issue with some TM at this stage, we don't resume the tx } } public void onAbort() throws Exception { } }); } catch (Exception e) { throw new RepositoryException("The listener for the components not tx aware could not be added", e); } }
java
private void registerListener(final ChangesLogWrapper logWrapper, TransactionableResourceManager txResourceManager) throws RepositoryException { try { // Why calling the listeners non tx aware has been done like this: // 1. If we call them in the commit phase and we use Arjuna with ISPN, we get: // ActionStatus.COMMITTING > is not in a valid state to be invoking cache operations on. // at org.infinispan.interceptors.TxInterceptor.enlist(TxInterceptor.java:195) // at org.infinispan.interceptors.TxInterceptor.enlistReadAndInvokeNext(TxInterceptor.java:167) // at org.infinispan.interceptors.TxInterceptor.visitGetKeyValueCommand(TxInterceptor.java:162) // at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:64) // This is due to the fact that ISPN enlist the cache even for a read access and enlistments are not // allowed in the commit phase // 2. If we call them in the commit phase, we use Arjuna with ISPN and we suspend the current tx, // we get deadlocks because we try to acquire locks on cache entries that have been locked by the main tx. // 3. If we call them in the afterComplete, we use JOTM with ISPN and we suspend and resume the current tx, we get: // jotm: resume: Invalid Transaction Status:STATUS_COMMITTED (Current.java, line 743) // javax.transaction.InvalidTransactionException: Invalid resume org.objectweb.jotm.TransactionImpl // at org.objectweb.jotm.Current.resume(Current.java:744) // This is due to the fact that it is not allowed to resume a tx when its status is STATUS_COMMITED txResourceManager.addListener(new TransactionableResourceManagerListener() { public void onCommit(boolean onePhase) throws Exception { } public void onAfterCompletion(int status) throws Exception { if (status == Status.STATUS_COMMITTED) { // Since the tx is successfully committed we can call components non tx aware // The listeners will need to be executed outside the current tx so we suspend // the current tx we can face enlistment issues on product like ISPN transactionManager.suspend(); SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>() { public Void run() { notifySaveItems(logWrapper.getChangesLog(), false); return null; } }); // Since the resume method could cause issue with some TM at this stage, we don't resume the tx } } public void onAbort() throws Exception { } }); } catch (Exception e) { throw new RepositoryException("The listener for the components not tx aware could not be added", e); } }
[ "private", "void", "registerListener", "(", "final", "ChangesLogWrapper", "logWrapper", ",", "TransactionableResourceManager", "txResourceManager", ")", "throws", "RepositoryException", "{", "try", "{", "// Why calling the listeners non tx aware has been done like this:", "// 1. If...
This will allow to notify listeners that are not TxAware once the Tx is committed @param logWrapper @throws RepositoryException if any error occurs
[ "This", "will", "allow", "to", "notify", "listeners", "that", "are", "not", "TxAware", "once", "the", "Tx", "is", "committed" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1210-L1269
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/MessageSourceFieldFaceSource.java
MessageSourceFieldFaceSource.getMessage
protected String getMessage(String contextId, String fieldPath, String[] faceDescriptorProperties, String defaultValue) { String[] keys = getMessageKeys(contextId, fieldPath, faceDescriptorProperties); try { return getMessageSourceAccessor().getMessage(new DefaultMessageSourceResolvable(keys, null, defaultValue)); } catch (NoSuchMessageException e) { if (log.isDebugEnabled()) { log.debug(e.getMessage()); } return null; } }
java
protected String getMessage(String contextId, String fieldPath, String[] faceDescriptorProperties, String defaultValue) { String[] keys = getMessageKeys(contextId, fieldPath, faceDescriptorProperties); try { return getMessageSourceAccessor().getMessage(new DefaultMessageSourceResolvable(keys, null, defaultValue)); } catch (NoSuchMessageException e) { if (log.isDebugEnabled()) { log.debug(e.getMessage()); } return null; } }
[ "protected", "String", "getMessage", "(", "String", "contextId", ",", "String", "fieldPath", ",", "String", "[", "]", "faceDescriptorProperties", ",", "String", "defaultValue", ")", "{", "String", "[", "]", "keys", "=", "getMessageKeys", "(", "contextId", ",", ...
Returns the value of the required property of the FieldFace. Delegates to the getMessageKeys for the message key generation strategy.
[ "Returns", "the", "value", "of", "the", "required", "property", "of", "the", "FieldFace", ".", "Delegates", "to", "the", "getMessageKeys", "for", "the", "message", "key", "generation", "strategy", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/MessageSourceFieldFaceSource.java#L122-L133
alexvasilkov/GestureViews
library/src/main/java/com/alexvasilkov/gestures/Settings.java
Settings.setOverscrollDistance
public Settings setOverscrollDistance(float distanceX, float distanceY) { if (distanceX < 0f || distanceY < 0f) { throw new IllegalArgumentException("Overscroll distance cannot be < 0"); } overscrollDistanceX = distanceX; overscrollDistanceY = distanceY; return this; }
java
public Settings setOverscrollDistance(float distanceX, float distanceY) { if (distanceX < 0f || distanceY < 0f) { throw new IllegalArgumentException("Overscroll distance cannot be < 0"); } overscrollDistanceX = distanceX; overscrollDistanceY = distanceY; return this; }
[ "public", "Settings", "setOverscrollDistance", "(", "float", "distanceX", ",", "float", "distanceY", ")", "{", "if", "(", "distanceX", "<", "0f", "||", "distanceY", "<", "0f", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Overscroll distance cannot...
Setting overscroll distance in pixels. User will be able to "over scroll" up to this distance. Cannot be &lt; 0. <p> Default value is 0. @param distanceX Horizontal overscroll distance in pixels @param distanceY Vertical overscroll distance in pixels @return Current settings object for calls chaining
[ "Setting", "overscroll", "distance", "in", "pixels", ".", "User", "will", "be", "able", "to", "over", "scroll", "up", "to", "this", "distance", ".", "Cannot", "be", "&lt", ";", "0", ".", "<p", ">", "Default", "value", "is", "0", "." ]
train
https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/Settings.java#L331-L338
alkacon/opencms-core
src/org/opencms/ui/login/CmsPasswordForm.java
CmsPasswordForm.setErrorOldPassword
public void setErrorOldPassword(UserError error, String style) { m_oldPasswordField.setComponentError(error); m_oldPasswordStyle.setStyle(style); }
java
public void setErrorOldPassword(UserError error, String style) { m_oldPasswordField.setComponentError(error); m_oldPasswordStyle.setStyle(style); }
[ "public", "void", "setErrorOldPassword", "(", "UserError", "error", ",", "String", "style", ")", "{", "m_oldPasswordField", ".", "setComponentError", "(", "error", ")", ";", "m_oldPasswordStyle", ".", "setStyle", "(", "style", ")", ";", "}" ]
Sets the old password error.<p> @param error the error @param style the style class
[ "Sets", "the", "old", "password", "error", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/login/CmsPasswordForm.java#L206-L210
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/cache/CacheArgumentServices.java
CacheArgumentServices.computeArgPart
public String computeArgPart(String[] keys, List<String> jsonArgs, List<String> paramNames) { if (keys.length == 0) { return ""; } else if (Constants.Cache.USE_ALL_ARGUMENTS.equals(keys[0])) { return Arrays.toString(jsonArgs.toArray(new String[jsonArgs.size()])); } else { return computeSpecifiedArgPart(keys, jsonArgs, paramNames); } }
java
public String computeArgPart(String[] keys, List<String> jsonArgs, List<String> paramNames) { if (keys.length == 0) { return ""; } else if (Constants.Cache.USE_ALL_ARGUMENTS.equals(keys[0])) { return Arrays.toString(jsonArgs.toArray(new String[jsonArgs.size()])); } else { return computeSpecifiedArgPart(keys, jsonArgs, paramNames); } }
[ "public", "String", "computeArgPart", "(", "String", "[", "]", "keys", ",", "List", "<", "String", ">", "jsonArgs", ",", "List", "<", "String", ">", "paramNames", ")", "{", "if", "(", "keys", ".", "length", "==", "0", ")", "{", "return", "\"\"", ";",...
Compute the part of cache key that depends of arguments @param keys : key from annotation @param jsonArgs : actual args @param paramNames : parameter name of concern method @return
[ "Compute", "the", "part", "of", "cache", "key", "that", "depends", "of", "arguments" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/cache/CacheArgumentServices.java#L38-L46
elki-project/elki
addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java
XSplitter.generateDistributionsAndSurfaceSums
private double generateDistributionsAndSurfaceSums(int minEntries, int maxEntries, int[] entriesByLB, int[] entriesByUB) { // the old variant is minimally slower // double surfaceSum = 0; // for(int limit = minEntries; limit <= maxEntries; limit++) { // HyperBoundingBox mbr1 = mbr(entriesByLB, 0, limit); // HyperBoundingBox mbr2 = mbr(entriesByLB, limit, entriesByLB.length); // surfaceSum += mbr1.perimeter() + mbr2.perimeter(); // mbr1 = mbr(entriesByUB, 0, limit); // mbr2 = mbr(entriesByUB, limit, entriesByUB.length); // surfaceSum += mbr1.perimeter() + mbr2.perimeter(); // } // return surfaceSum; int dim = tree.getDimensionality(); // get surface sum for lower-bound sorting double surfaceSum = getSurfaceSums4Sorting(minEntries, maxEntries, entriesByLB, dim); // get surface sum for upper-bound sorting surfaceSum += getSurfaceSums4Sorting(minEntries, maxEntries, entriesByUB, dim); return surfaceSum; }
java
private double generateDistributionsAndSurfaceSums(int minEntries, int maxEntries, int[] entriesByLB, int[] entriesByUB) { // the old variant is minimally slower // double surfaceSum = 0; // for(int limit = minEntries; limit <= maxEntries; limit++) { // HyperBoundingBox mbr1 = mbr(entriesByLB, 0, limit); // HyperBoundingBox mbr2 = mbr(entriesByLB, limit, entriesByLB.length); // surfaceSum += mbr1.perimeter() + mbr2.perimeter(); // mbr1 = mbr(entriesByUB, 0, limit); // mbr2 = mbr(entriesByUB, limit, entriesByUB.length); // surfaceSum += mbr1.perimeter() + mbr2.perimeter(); // } // return surfaceSum; int dim = tree.getDimensionality(); // get surface sum for lower-bound sorting double surfaceSum = getSurfaceSums4Sorting(minEntries, maxEntries, entriesByLB, dim); // get surface sum for upper-bound sorting surfaceSum += getSurfaceSums4Sorting(minEntries, maxEntries, entriesByUB, dim); return surfaceSum; }
[ "private", "double", "generateDistributionsAndSurfaceSums", "(", "int", "minEntries", ",", "int", "maxEntries", ",", "int", "[", "]", "entriesByLB", ",", "int", "[", "]", "entriesByUB", ")", "{", "// the old variant is minimally slower", "// double surfaceSum = 0;", "//...
Generates both sets of <code>(maxEntries - minEntries + 1)</code> distributions of the first <code>minEntries</code> entries together with the next <code>0</code> to <code>maxEntries - minEntries</code> entries for each of the orderings in <code>entriesByLB</code> and <code>entriesByUB</code>. <br> For all distributions, the sums of the two resulting MBRs' surfaces are calculated and the overall sum is returned. @param minEntries minimally allowed subgroup size @param maxEntries maximally allowed subgroup size; if <code>&lt; node.getNumEntries()</code>, ONLY the first half ( <code>[minEntries,maxEntries]</code>) of the possible partitions is calculated @param entriesByLB entries sorted by lower bound value of some dimension @param entriesByUB entries sorted by upper bound value of some dimension @return the sum of all resulting MBRs' surface sums of the partitions ranging in <code>{minEntries, ..., maxEntries</code> in both of the input orderings
[ "Generates", "both", "sets", "of", "<code", ">", "(", "maxEntries", "-", "minEntries", "+", "1", ")", "<", "/", "code", ">", "distributions", "of", "the", "first", "<code", ">", "minEntries<", "/", "code", ">", "entries", "together", "with", "the", "next...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java#L110-L128
googleads/googleads-java-lib
modules/ads_lib_axis/src/main/java/com/google/api/ads/common/lib/soap/axis/HttpHandler.java
HttpHandler.createHttpRequest
private HttpRequest createHttpRequest(MessageContext msgContext) throws SOAPException, IOException { Message requestMessage = Preconditions.checkNotNull( msgContext.getRequestMessage(), "Null request message on message context"); // Construct the output stream. String contentType = requestMessage.getContentType(msgContext.getSOAPConstants()); ByteArrayOutputStream bos = new ByteArrayOutputStream(BUFFER_SIZE); if (msgContext.isPropertyTrue(HTTPConstants.MC_GZIP_REQUEST)) { logger.debug("Compressing request"); try (GZIPOutputStream gzipOs = new GZIPOutputStream(bos, BUFFER_SIZE)) { requestMessage.writeTo(gzipOs); } } else { logger.debug("Not compressing request"); requestMessage.writeTo(bos); } HttpRequest httpRequest = requestFactory.buildPostRequest( new GenericUrl(msgContext.getStrProp(MessageContext.TRANS_URL)), new ByteArrayContent(contentType, bos.toByteArray())); int timeoutMillis = msgContext.getTimeout(); if (timeoutMillis >= 0) { logger.debug("Setting read and connect timeout to {} millis", timeoutMillis); // These are not the same, but MessageContext has only one definition of timeout. httpRequest.setReadTimeout(timeoutMillis); httpRequest.setConnectTimeout(timeoutMillis); } // Copy the request headers from the message context to the post request. setHttpRequestHeaders(msgContext, httpRequest); return httpRequest; }
java
private HttpRequest createHttpRequest(MessageContext msgContext) throws SOAPException, IOException { Message requestMessage = Preconditions.checkNotNull( msgContext.getRequestMessage(), "Null request message on message context"); // Construct the output stream. String contentType = requestMessage.getContentType(msgContext.getSOAPConstants()); ByteArrayOutputStream bos = new ByteArrayOutputStream(BUFFER_SIZE); if (msgContext.isPropertyTrue(HTTPConstants.MC_GZIP_REQUEST)) { logger.debug("Compressing request"); try (GZIPOutputStream gzipOs = new GZIPOutputStream(bos, BUFFER_SIZE)) { requestMessage.writeTo(gzipOs); } } else { logger.debug("Not compressing request"); requestMessage.writeTo(bos); } HttpRequest httpRequest = requestFactory.buildPostRequest( new GenericUrl(msgContext.getStrProp(MessageContext.TRANS_URL)), new ByteArrayContent(contentType, bos.toByteArray())); int timeoutMillis = msgContext.getTimeout(); if (timeoutMillis >= 0) { logger.debug("Setting read and connect timeout to {} millis", timeoutMillis); // These are not the same, but MessageContext has only one definition of timeout. httpRequest.setReadTimeout(timeoutMillis); httpRequest.setConnectTimeout(timeoutMillis); } // Copy the request headers from the message context to the post request. setHttpRequestHeaders(msgContext, httpRequest); return httpRequest; }
[ "private", "HttpRequest", "createHttpRequest", "(", "MessageContext", "msgContext", ")", "throws", "SOAPException", ",", "IOException", "{", "Message", "requestMessage", "=", "Preconditions", ".", "checkNotNull", "(", "msgContext", ".", "getRequestMessage", "(", ")", ...
Creates an HTTP request based on the message context. @param msgContext the Axis message context @return a new {@link HttpRequest} with content and headers populated
[ "Creates", "an", "HTTP", "request", "based", "on", "the", "message", "context", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib_axis/src/main/java/com/google/api/ads/common/lib/soap/axis/HttpHandler.java#L114-L151
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/WindowUtils.java
WindowUtils.createAncestorListener
private static AncestorListener createAncestorListener(JComponent component, final WindowListener windowListener) { final WeakReference<JComponent> weakReference = new WeakReference<JComponent>(component); return new AncestorListener() { public void ancestorAdded(AncestorEvent event) { // TODO if the WeakReference's object is null, remove the // WeakReference as an AncestorListener. Window window = weakReference.get() == null ? null : SwingUtilities.getWindowAncestor(weakReference.get()); if (window != null) { window.removeWindowListener(windowListener); window.addWindowListener(windowListener); } } public void ancestorRemoved(AncestorEvent event) { Window window = weakReference.get() == null ? null : SwingUtilities.getWindowAncestor(weakReference.get()); if (window != null) { window.removeWindowListener(windowListener); } } public void ancestorMoved(AncestorEvent event) { // no implementation. } }; }
java
private static AncestorListener createAncestorListener(JComponent component, final WindowListener windowListener) { final WeakReference<JComponent> weakReference = new WeakReference<JComponent>(component); return new AncestorListener() { public void ancestorAdded(AncestorEvent event) { // TODO if the WeakReference's object is null, remove the // WeakReference as an AncestorListener. Window window = weakReference.get() == null ? null : SwingUtilities.getWindowAncestor(weakReference.get()); if (window != null) { window.removeWindowListener(windowListener); window.addWindowListener(windowListener); } } public void ancestorRemoved(AncestorEvent event) { Window window = weakReference.get() == null ? null : SwingUtilities.getWindowAncestor(weakReference.get()); if (window != null) { window.removeWindowListener(windowListener); } } public void ancestorMoved(AncestorEvent event) { // no implementation. } }; }
[ "private", "static", "AncestorListener", "createAncestorListener", "(", "JComponent", "component", ",", "final", "WindowListener", "windowListener", ")", "{", "final", "WeakReference", "<", "JComponent", ">", "weakReference", "=", "new", "WeakReference", "<", "JComponen...
Create the ancestor listener. @param component the component. @param windowListener the listener. @return the weak referenced listener.
[ "Create", "the", "ancestor", "listener", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/WindowUtils.java#L246-L273
rapidpro/expressions
java/src/main/java/io/rapidpro/expressions/dates/DateParser.java
DateParser.yearFrom2Digits
protected static int yearFrom2Digits(int shortYear, int currentYear) { if (shortYear < 100) { shortYear += currentYear - (currentYear % 100); if (Math.abs(shortYear - currentYear) >= 50) { if (shortYear < currentYear) { return shortYear + 100; } else { return shortYear - 100; } } } return shortYear; }
java
protected static int yearFrom2Digits(int shortYear, int currentYear) { if (shortYear < 100) { shortYear += currentYear - (currentYear % 100); if (Math.abs(shortYear - currentYear) >= 50) { if (shortYear < currentYear) { return shortYear + 100; } else { return shortYear - 100; } } } return shortYear; }
[ "protected", "static", "int", "yearFrom2Digits", "(", "int", "shortYear", ",", "int", "currentYear", ")", "{", "if", "(", "shortYear", "<", "100", ")", "{", "shortYear", "+=", "currentYear", "-", "(", "currentYear", "%", "100", ")", ";", "if", "(", "Math...
Converts a relative 2-digit year to an absolute 4-digit year @param shortYear the relative year @return the absolute year
[ "Converts", "a", "relative", "2", "-", "digit", "year", "to", "an", "absolute", "4", "-", "digit", "year" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/dates/DateParser.java#L369-L381
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/statement/ddl/DDLStatement.java
DDLStatement.isDDL
public static boolean isDDL(final TokenType primaryTokenType, final TokenType secondaryTokenType) { return PRIMARY_STATEMENT_PREFIX.contains(primaryTokenType) && !NOT_SECONDARY_STATEMENT_PREFIX.contains(secondaryTokenType); }
java
public static boolean isDDL(final TokenType primaryTokenType, final TokenType secondaryTokenType) { return PRIMARY_STATEMENT_PREFIX.contains(primaryTokenType) && !NOT_SECONDARY_STATEMENT_PREFIX.contains(secondaryTokenType); }
[ "public", "static", "boolean", "isDDL", "(", "final", "TokenType", "primaryTokenType", ",", "final", "TokenType", "secondaryTokenType", ")", "{", "return", "PRIMARY_STATEMENT_PREFIX", ".", "contains", "(", "primaryTokenType", ")", "&&", "!", "NOT_SECONDARY_STATEMENT_PRE...
Is DDL statement. @param primaryTokenType primary token type @param secondaryTokenType secondary token type @return is DDL or not
[ "Is", "DDL", "statement", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/statement/ddl/DDLStatement.java#L51-L53
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Maybe.java
Maybe.flatMap
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <R> Maybe<R> flatMap( Function<? super T, ? extends MaybeSource<? extends R>> onSuccessMapper, Function<? super Throwable, ? extends MaybeSource<? extends R>> onErrorMapper, Callable<? extends MaybeSource<? extends R>> onCompleteSupplier) { ObjectHelper.requireNonNull(onSuccessMapper, "onSuccessMapper is null"); ObjectHelper.requireNonNull(onErrorMapper, "onErrorMapper is null"); ObjectHelper.requireNonNull(onCompleteSupplier, "onCompleteSupplier is null"); return RxJavaPlugins.onAssembly(new MaybeFlatMapNotification<T, R>(this, onSuccessMapper, onErrorMapper, onCompleteSupplier)); }
java
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <R> Maybe<R> flatMap( Function<? super T, ? extends MaybeSource<? extends R>> onSuccessMapper, Function<? super Throwable, ? extends MaybeSource<? extends R>> onErrorMapper, Callable<? extends MaybeSource<? extends R>> onCompleteSupplier) { ObjectHelper.requireNonNull(onSuccessMapper, "onSuccessMapper is null"); ObjectHelper.requireNonNull(onErrorMapper, "onErrorMapper is null"); ObjectHelper.requireNonNull(onCompleteSupplier, "onCompleteSupplier is null"); return RxJavaPlugins.onAssembly(new MaybeFlatMapNotification<T, R>(this, onSuccessMapper, onErrorMapper, onCompleteSupplier)); }
[ "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "final", "<", "R", ">", "Maybe", "<", "R", ">", "flatMap", "(", "Function", "<", "?", "super", "T", ",", "?", "extends", "MaybeSource", "<", "?", "exte...
Maps the onSuccess, onError or onComplete signals of this Maybe into MaybeSource and emits that MaybeSource's signals. <p> <img width="640" height="354" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Maybe.flatMap.mmm.png" alt=""> <dl> <dt><b>Scheduler:</b></dt> <dd>{@code flatMap} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param <R> the result type @param onSuccessMapper a function that returns a MaybeSource to merge for the onSuccess item emitted by this Maybe @param onErrorMapper a function that returns a MaybeSource to merge for an onError notification from this Maybe @param onCompleteSupplier a function that returns a MaybeSource to merge for an onComplete notification this Maybe @return the new Maybe instance @see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a>
[ "Maps", "the", "onSuccess", "onError", "or", "onComplete", "signals", "of", "this", "Maybe", "into", "MaybeSource", "and", "emits", "that", "MaybeSource", "s", "signals", ".", "<p", ">", "<img", "width", "=", "640", "height", "=", "354", "src", "=", "https...
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Maybe.java#L2928-L2938
jenkinsci/jenkins
core/src/main/java/jenkins/util/xml/XMLUtils.java
XMLUtils.getValue
public static String getValue(String xpath, Document document) throws XPathExpressionException { XPath xPathProcessor = XPathFactory.newInstance().newXPath(); return xPathProcessor.compile(xpath).evaluate(document); }
java
public static String getValue(String xpath, Document document) throws XPathExpressionException { XPath xPathProcessor = XPathFactory.newInstance().newXPath(); return xPathProcessor.compile(xpath).evaluate(document); }
[ "public", "static", "String", "getValue", "(", "String", "xpath", ",", "Document", "document", ")", "throws", "XPathExpressionException", "{", "XPath", "xPathProcessor", "=", "XPathFactory", ".", "newInstance", "(", ")", ".", "newXPath", "(", ")", ";", "return",...
The a "value" from an XML file using XPath. @param xpath The XPath expression to select the value. @param document The document from which the value is to be extracted. @return The data value. An empty {@link String} is returned when the expression does not evaluate to anything in the document. @throws XPathExpressionException Invalid XPath expression. @since 2.0
[ "The", "a", "value", "from", "an", "XML", "file", "using", "XPath", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/xml/XMLUtils.java#L193-L196
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.leftShift
public static Path leftShift(Path self, byte[] bytes) throws IOException { append(self, bytes); return self; }
java
public static Path leftShift(Path self, byte[] bytes) throws IOException { append(self, bytes); return self; }
[ "public", "static", "Path", "leftShift", "(", "Path", "self", ",", "byte", "[", "]", "bytes", ")", "throws", "IOException", "{", "append", "(", "self", ",", "bytes", ")", ";", "return", "self", ";", "}" ]
Write bytes to a Path. @param self a Path @param bytes the byte array to append to the end of the Path @return the original file @throws java.io.IOException if an IOException occurs. @since 2.3.0
[ "Write", "bytes", "to", "a", "Path", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L506-L509
liyiorg/weixin-popular
src/main/java/weixin/popular/util/SignatureUtil.java
SignatureUtil.generateSign
public static String generateSign(Map<String, String> map,String paternerKey){ return generateSign(map, null, paternerKey); }
java
public static String generateSign(Map<String, String> map,String paternerKey){ return generateSign(map, null, paternerKey); }
[ "public", "static", "String", "generateSign", "(", "Map", "<", "String", ",", "String", ">", "map", ",", "String", "paternerKey", ")", "{", "return", "generateSign", "(", "map", ",", "null", ",", "paternerKey", ")", ";", "}" ]
生成sign HMAC-SHA256 或 MD5 签名 @param map map @param paternerKey paternerKey @return sign
[ "生成sign", "HMAC", "-", "SHA256", "或", "MD5", "签名" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/SignatureUtil.java#L24-L26
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/layout/LayoutFactory.java
LayoutFactory.mixInHash
private long mixInHash(long hash, StorableInfo<?> info, LayoutOptions options, int multiplier) { hash = mixInHash(hash, info.getStorableType().getName(), multiplier); hash = mixInHash(hash, options, multiplier); for (StorableProperty<?> property : info.getAllProperties().values()) { if (!property.isJoin()) { hash = mixInHash(hash, property, multiplier); } } return hash; }
java
private long mixInHash(long hash, StorableInfo<?> info, LayoutOptions options, int multiplier) { hash = mixInHash(hash, info.getStorableType().getName(), multiplier); hash = mixInHash(hash, options, multiplier); for (StorableProperty<?> property : info.getAllProperties().values()) { if (!property.isJoin()) { hash = mixInHash(hash, property, multiplier); } } return hash; }
[ "private", "long", "mixInHash", "(", "long", "hash", ",", "StorableInfo", "<", "?", ">", "info", ",", "LayoutOptions", "options", ",", "int", "multiplier", ")", "{", "hash", "=", "mixInHash", "(", "hash", ",", "info", ".", "getStorableType", "(", ")", "....
Creates a long hash code that attempts to mix in all relevant layout elements.
[ "Creates", "a", "long", "hash", "code", "that", "attempts", "to", "mix", "in", "all", "relevant", "layout", "elements", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/layout/LayoutFactory.java#L482-L494
geomajas/geomajas-project-client-gwt2
plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/map/mapcontrolpanel/MapControlPanelPresenterImpl.java
MapControlPanelPresenterImpl.addLayer
protected boolean addLayer(Layer layer) { int index = getLayerIndex(layer); if (index < 0) { view.add(new LayerControlPanel(mapPresenter, layer, disableToggleOutOfRange)); return true; } return false; }
java
protected boolean addLayer(Layer layer) { int index = getLayerIndex(layer); if (index < 0) { view.add(new LayerControlPanel(mapPresenter, layer, disableToggleOutOfRange)); return true; } return false; }
[ "protected", "boolean", "addLayer", "(", "Layer", "layer", ")", "{", "int", "index", "=", "getLayerIndex", "(", "layer", ")", ";", "if", "(", "index", "<", "0", ")", "{", "view", ".", "add", "(", "new", "LayerControlPanel", "(", "mapPresenter", ",", "l...
Add a layer to the legend drop down panel. @param layer The layer who's legend to add to the drop down panel. @return success or not.
[ "Add", "a", "layer", "to", "the", "legend", "drop", "down", "panel", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/map/mapcontrolpanel/MapControlPanelPresenterImpl.java#L65-L73
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientHandler.java
PartitionRequestClientHandler.exceptionCaught
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (cause instanceof TransportException) { notifyAllChannelsOfErrorAndClose(cause); } else { final SocketAddress remoteAddr = ctx.channel().remoteAddress(); final TransportException tex; // Improve on the connection reset by peer error message if (cause instanceof IOException && cause.getMessage().equals("Connection reset by peer")) { tex = new RemoteTransportException( "Lost connection to task manager '" + remoteAddr + "'. This indicates " + "that the remote task manager was lost.", remoteAddr, cause); } else { SocketAddress localAddr = ctx.channel().localAddress(); tex = new LocalTransportException( String.format("%s (connection to '%s')", cause.getMessage(), remoteAddr), localAddr, cause); } notifyAllChannelsOfErrorAndClose(tex); } }
java
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (cause instanceof TransportException) { notifyAllChannelsOfErrorAndClose(cause); } else { final SocketAddress remoteAddr = ctx.channel().remoteAddress(); final TransportException tex; // Improve on the connection reset by peer error message if (cause instanceof IOException && cause.getMessage().equals("Connection reset by peer")) { tex = new RemoteTransportException( "Lost connection to task manager '" + remoteAddr + "'. This indicates " + "that the remote task manager was lost.", remoteAddr, cause); } else { SocketAddress localAddr = ctx.channel().localAddress(); tex = new LocalTransportException( String.format("%s (connection to '%s')", cause.getMessage(), remoteAddr), localAddr, cause); } notifyAllChannelsOfErrorAndClose(tex); } }
[ "@", "Override", "public", "void", "exceptionCaught", "(", "ChannelHandlerContext", "ctx", ",", "Throwable", "cause", ")", "throws", "Exception", "{", "if", "(", "cause", "instanceof", "TransportException", ")", "{", "notifyAllChannelsOfErrorAndClose", "(", "cause", ...
Called on exceptions in the client handler pipeline. <p> Remote exceptions are received as regular payload.
[ "Called", "on", "exceptions", "in", "the", "client", "handler", "pipeline", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientHandler.java#L145-L174
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/controller/AbstractSnappingController.java
AbstractSnappingController.activateSnapping
public void activateSnapping(List<SnappingRuleInfo> rules, SnapMode mode) { if (rules != null) { snapper = new Snapper(mapWidget.getMapModel(), rules, mode); snappingActive = true; } }
java
public void activateSnapping(List<SnappingRuleInfo> rules, SnapMode mode) { if (rules != null) { snapper = new Snapper(mapWidget.getMapModel(), rules, mode); snappingActive = true; } }
[ "public", "void", "activateSnapping", "(", "List", "<", "SnappingRuleInfo", ">", "rules", ",", "SnapMode", "mode", ")", "{", "if", "(", "rules", "!=", "null", ")", "{", "snapper", "=", "new", "Snapper", "(", "mapWidget", ".", "getMapModel", "(", ")", ","...
Activate snapping on this controller. When snapping is activated, the methods "getScreenPosition" and "getWorldPosition" (to ask the position of an event), will return snapped positions. @param rules A list of <code>SnappingRuleInfo</code>s. These determine to what layers to snap, using what distances and what algorithms. @param mode The snapper mode. Either the snapper considers all geometries equal, or it tries to snap to intersecting geometries before snapping to other geometries. Basically: <ul> <li>SnapMode.MODE_ALL_GEOMTRIES_EQUAL</li> <li>SnapMode.MODE_PRIORITY_TO_INTERSECTING_GEOMETRIES</li> </ul>
[ "Activate", "snapping", "on", "this", "controller", ".", "When", "snapping", "is", "activated", "the", "methods", "getScreenPosition", "and", "getWorldPosition", "(", "to", "ask", "the", "position", "of", "an", "event", ")", "will", "return", "snapped", "positio...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/AbstractSnappingController.java#L77-L82
akarnokd/akarnokd-xml
src/main/java/hu/akarnokd/xml/XElement.java
XElement.visit
public void visit(boolean depthFirst, Consumer<? super XElement> action) { Deque<XElement> queue = new LinkedList<>(); queue.add(this); while (!queue.isEmpty()) { XElement x = queue.removeFirst(); action.accept(x); if (depthFirst) { ListIterator<XElement> li = x.children.listIterator(x.children.size()); while (li.hasPrevious()) { queue.addFirst(li.previous()); } } else { for (XElement c : x.children) { queue.addLast(c); } } } }
java
public void visit(boolean depthFirst, Consumer<? super XElement> action) { Deque<XElement> queue = new LinkedList<>(); queue.add(this); while (!queue.isEmpty()) { XElement x = queue.removeFirst(); action.accept(x); if (depthFirst) { ListIterator<XElement> li = x.children.listIterator(x.children.size()); while (li.hasPrevious()) { queue.addFirst(li.previous()); } } else { for (XElement c : x.children) { queue.addLast(c); } } } }
[ "public", "void", "visit", "(", "boolean", "depthFirst", ",", "Consumer", "<", "?", "super", "XElement", ">", "action", ")", "{", "Deque", "<", "XElement", ">", "queue", "=", "new", "LinkedList", "<>", "(", ")", ";", "queue", ".", "add", "(", "this", ...
Iterate through the elements of this XElement and invoke the action for each. @param depthFirst do a depth first search? @param action the action to invoke, non-null
[ "Iterate", "through", "the", "elements", "of", "this", "XElement", "and", "invoke", "the", "action", "for", "each", "." ]
train
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XElement.java#L784-L801
Azure/azure-sdk-for-java
mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ConfigurationsInner.java
ConfigurationsInner.createOrUpdateAsync
public Observable<ConfigurationInner> createOrUpdateAsync(String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, configurationName, parameters).map(new Func1<ServiceResponse<ConfigurationInner>, ConfigurationInner>() { @Override public ConfigurationInner call(ServiceResponse<ConfigurationInner> response) { return response.body(); } }); }
java
public Observable<ConfigurationInner> createOrUpdateAsync(String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, configurationName, parameters).map(new Func1<ServiceResponse<ConfigurationInner>, ConfigurationInner>() { @Override public ConfigurationInner call(ServiceResponse<ConfigurationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ConfigurationInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "configurationName", ",", "ConfigurationInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceRespons...
Updates a configuration of a server. @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 configurationName The name of the server configuration. @param parameters The required parameters for updating a server configuration. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "a", "configuration", "of", "a", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ConfigurationsInner.java#L117-L124
facebookarchive/hadoop-20
src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/LoadGenerator.java
LoadGenerator.genFile
private void genFile(Path file, long fileSize) throws IOException { long startTime = System.currentTimeMillis(); FSDataOutputStream out = fs.create(file, true, getConf().getInt("io.file.buffer.size", 4096), (short)getConf().getInt("dfs.replication", 3), fs.getDefaultBlockSize()); executionTime[CREATE] += (System.currentTimeMillis()-startTime); totalNumOfOps[CREATE]++; for (long i=0; i<fileSize; i++) { out.writeByte('a'); } startTime = System.currentTimeMillis(); out.close(); executionTime[WRITE_CLOSE] += (System.currentTimeMillis()-startTime); totalNumOfOps[WRITE_CLOSE]++; }
java
private void genFile(Path file, long fileSize) throws IOException { long startTime = System.currentTimeMillis(); FSDataOutputStream out = fs.create(file, true, getConf().getInt("io.file.buffer.size", 4096), (short)getConf().getInt("dfs.replication", 3), fs.getDefaultBlockSize()); executionTime[CREATE] += (System.currentTimeMillis()-startTime); totalNumOfOps[CREATE]++; for (long i=0; i<fileSize; i++) { out.writeByte('a'); } startTime = System.currentTimeMillis(); out.close(); executionTime[WRITE_CLOSE] += (System.currentTimeMillis()-startTime); totalNumOfOps[WRITE_CLOSE]++; }
[ "private", "void", "genFile", "(", "Path", "file", ",", "long", "fileSize", ")", "throws", "IOException", "{", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "FSDataOutputStream", "out", "=", "fs", ".", "create", "(", "file", ...
Create a file with a length of <code>fileSize</code>. The file is filled with 'a'.
[ "Create", "a", "file", "with", "a", "length", "of", "<code", ">", "fileSize<", "/", "code", ">", ".", "The", "file", "is", "filled", "with", "a", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/LoadGenerator.java#L440-L456
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImagesInner.java
ImagesInner.beginCreateOrUpdateAsync
public Observable<ImageInner> beginCreateOrUpdateAsync(String resourceGroupName, String imageName, ImageInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).map(new Func1<ServiceResponse<ImageInner>, ImageInner>() { @Override public ImageInner call(ServiceResponse<ImageInner> response) { return response.body(); } }); }
java
public Observable<ImageInner> beginCreateOrUpdateAsync(String resourceGroupName, String imageName, ImageInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).map(new Func1<ServiceResponse<ImageInner>, ImageInner>() { @Override public ImageInner call(ServiceResponse<ImageInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ImageInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "imageName", ",", "ImageInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "...
Create or update an image. @param resourceGroupName The name of the resource group. @param imageName The name of the image. @param parameters Parameters supplied to the Create Image operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ImageInner object
[ "Create", "or", "update", "an", "image", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImagesInner.java#L220-L227
ops4j/org.ops4j.pax.exam2
core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/reactors/ReactorManager.java
ReactorManager.addConfigurationsToReactor
private void addConfigurationsToReactor(Class<?> testClass, Object testClassInstance) throws IllegalAccessException, InvocationTargetException { numConfigurations = 0; Method[] methods = testClass.getMethods(); for (Method m : methods) { if (isConfiguration(m)) { // consider as option, so prepare that one: reactor.addConfiguration(((Option[]) m.invoke(testClassInstance))); numConfigurations++; } } failOnUnusedConfiguration(testClass.getDeclaredMethods()); }
java
private void addConfigurationsToReactor(Class<?> testClass, Object testClassInstance) throws IllegalAccessException, InvocationTargetException { numConfigurations = 0; Method[] methods = testClass.getMethods(); for (Method m : methods) { if (isConfiguration(m)) { // consider as option, so prepare that one: reactor.addConfiguration(((Option[]) m.invoke(testClassInstance))); numConfigurations++; } } failOnUnusedConfiguration(testClass.getDeclaredMethods()); }
[ "private", "void", "addConfigurationsToReactor", "(", "Class", "<", "?", ">", "testClass", ",", "Object", "testClassInstance", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", "{", "numConfigurations", "=", "0", ";", "Method", "[", "]", "me...
Scans the current test class for declared or inherited {@code @Configuration} methods and invokes them, adding the returned configuration to the reactor. @param testClass test class @param testClassInstance instance of test class @throws IllegalAccessException when configuration method is not public @throws InvocationTargetException when configuration method cannot be invoked
[ "Scans", "the", "current", "test", "class", "for", "declared", "or", "inherited", "{", "@code", "@Configuration", "}", "methods", "and", "invokes", "them", "adding", "the", "returned", "configuration", "to", "the", "reactor", "." ]
train
https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/reactors/ReactorManager.java#L228-L240
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/passport/AbstractHBCIPassport.java
AbstractHBCIPassport.getLowlevelJobResultNames
public List<String> getLowlevelJobResultNames(String gvname) { if (gvname == null || gvname.length() == 0) throw new InvalidArgumentException(HBCIUtils.getLocMsg("EXCMSG_EMPTY_JOBNAME")); String version = getSupportedLowlevelJobs().get(gvname); if (version == null) throw new HBCI_Exception("*** lowlevel job " + gvname + " not supported"); return getGVResultNames(syntaxDocument, gvname, version); }
java
public List<String> getLowlevelJobResultNames(String gvname) { if (gvname == null || gvname.length() == 0) throw new InvalidArgumentException(HBCIUtils.getLocMsg("EXCMSG_EMPTY_JOBNAME")); String version = getSupportedLowlevelJobs().get(gvname); if (version == null) throw new HBCI_Exception("*** lowlevel job " + gvname + " not supported"); return getGVResultNames(syntaxDocument, gvname, version); }
[ "public", "List", "<", "String", ">", "getLowlevelJobResultNames", "(", "String", "gvname", ")", "{", "if", "(", "gvname", "==", "null", "||", "gvname", ".", "length", "(", ")", "==", "0", ")", "throw", "new", "InvalidArgumentException", "(", "HBCIUtils", ...
<p>Gibt eine Liste mit Strings zurück, welche Bezeichnungen für die einzelnen Rückgabedaten eines Lowlevel-Jobs darstellen. Jedem {@link org.kapott.hbci.GV.AbstractHBCIJob} ist ein Result-Objekt zugeordnet, welches die Rückgabedaten und Statusinformationen zu dem jeweiligen Job enthält (kann mit {@link org.kapott.hbci.GV.AbstractHBCIJob#getJobResult()} ermittelt werden). Bei den meisten Highlevel-Jobs handelt es sich dabei um bereits aufbereitete Daten (Kontoauszüge werden z.B. nicht in dem ursprünglichen SWIFT-Format zurückgegeben, sondern bereits als fertig geparste Buchungseinträge).</p> <p>Bei Lowlevel-Jobs gibt es diese Aufbereitung der Daten nicht. Statt dessen müssen die Daten manuell aus der Antwortnachricht extrahiert und interpretiert werden. Die einzelnen Datenelemente der Antwortnachricht werden in einem Properties-Objekt bereitgestellt. Jeder Eintrag darin enthält den Namen und den Wert eines Datenelementes aus der Antwortnachricht.</p> <p>Die Methode <code>getLowlevelJobResultNames()</code> gibt nun alle gültigen Namen zurück, für welche in dem Result-Objekt Daten gespeichert sein können. Ob für ein Datenelement tatsächlich ein Wert in dem Result-Objekt existiert, wird damit nicht bestimmt, da einzelne Datenelemente optional sind.</p> <p>Mit dem Tool {@link org.kapott.hbci.tools.ShowLowlevelGVRs} kann offline eine Liste aller Job-Result-Datenelemente erzeugt werden.</p> <p>Zur Beschreibung von High- und Lowlevel-Jobs siehe auch die Dokumentation im Package <code>org.kapott.hbci.GV</code>.</p> @param gvname Lowlevelname des Geschäftsvorfalls, für den die Namen der Rückgabedaten benötigt werden. @return Liste aller möglichen Property-Keys, für die im Result-Objekt eines Lowlevel-Jobs Werte vorhanden sein könnten
[ "<p", ">", "Gibt", "eine", "Liste", "mit", "Strings", "zurück", "welche", "Bezeichnungen", "für", "die", "einzelnen", "Rückgabedaten", "eines", "Lowlevel", "-", "Jobs", "darstellen", ".", "Jedem", "{", "@link", "org", ".", "kapott", ".", "hbci", ".", "GV", ...
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/passport/AbstractHBCIPassport.java#L465-L474
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java
EnvironmentsInner.updateAsync
public Observable<EnvironmentInner> updateAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, EnvironmentFragment environment) { return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment).map(new Func1<ServiceResponse<EnvironmentInner>, EnvironmentInner>() { @Override public EnvironmentInner call(ServiceResponse<EnvironmentInner> response) { return response.body(); } }); }
java
public Observable<EnvironmentInner> updateAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, EnvironmentFragment environment) { return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment).map(new Func1<ServiceResponse<EnvironmentInner>, EnvironmentInner>() { @Override public EnvironmentInner call(ServiceResponse<EnvironmentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EnvironmentInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "String", "environmentName", ",", "EnvironmentFragment", "en...
Modify properties of environments. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @param environment Represents an environment instance @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EnvironmentInner object
[ "Modify", "properties", "of", "environments", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L992-L999
jroyalty/jglm
src/main/java/com/hackoeur/jglm/support/Precision.java
Precision.compareTo
public static int compareTo(final double x, final double y, final int maxUlps) { if (equals(x, y, maxUlps)) { return 0; } else if (x < y) { return -1; } return 1; }
java
public static int compareTo(final double x, final double y, final int maxUlps) { if (equals(x, y, maxUlps)) { return 0; } else if (x < y) { return -1; } return 1; }
[ "public", "static", "int", "compareTo", "(", "final", "double", "x", ",", "final", "double", "y", ",", "final", "int", "maxUlps", ")", "{", "if", "(", "equals", "(", "x", ",", "y", ",", "maxUlps", ")", ")", "{", "return", "0", ";", "}", "else", "...
Compares two numbers given some amount of allowed error. Two float numbers are considered equal if there are {@code (maxUlps - 1)} (or fewer) floating point numbers between them, i.e. two adjacent floating point numbers are considered equal. Adapted from <a href="http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm"> Bruce Dawson</a> @param x first value @param y second value @param maxUlps {@code (maxUlps - 1)} is the number of floating point values between {@code x} and {@code y}. @return <ul><li>0 if {@link #equals(double, double, int) equals(x, y, maxUlps)}</li> <li>&lt; 0 if !{@link #equals(double, double, int) equals(x, y, maxUlps)} &amp;&amp; x &lt; y</li> <li>> 0 if !{@link #equals(double, double, int) equals(x, y, maxUlps)} &amp;&amp; x > y</li></ul>
[ "Compares", "two", "numbers", "given", "some", "amount", "of", "allowed", "error", ".", "Two", "float", "numbers", "are", "considered", "equal", "if", "there", "are", "{", "@code", "(", "maxUlps", "-", "1", ")", "}", "(", "or", "fewer", ")", "floating", ...
train
https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/Precision.java#L117-L124
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/StandardResponsesApi.java
StandardResponsesApi.reportStandareResponseUsage
public ApiSuccessResponse reportStandareResponseUsage(String id, ReportStandareResponseUsageData reportStandareResponseUsageData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = reportStandareResponseUsageWithHttpInfo(id, reportStandareResponseUsageData); return resp.getData(); }
java
public ApiSuccessResponse reportStandareResponseUsage(String id, ReportStandareResponseUsageData reportStandareResponseUsageData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = reportStandareResponseUsageWithHttpInfo(id, reportStandareResponseUsageData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "reportStandareResponseUsage", "(", "String", "id", ",", "ReportStandareResponseUsageData", "reportStandareResponseUsageData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "reportStandareResponse...
Specifies Usage of a Standard Response for an interaction. @param id id of the Standard Response (required) @param reportStandareResponseUsageData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Specifies", "Usage", "of", "a", "Standard", "Response", "for", "an", "interaction", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/StandardResponsesApi.java#L1280-L1283
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/validation/beanvalidation/SheetBeanValidator.java
SheetBeanValidator.validate
@Override public void validate(final Object targetObj, final SheetBindingErrors<?> errors, final Class<?>... groups) { ArgUtils.notNull(targetObj, "targetObj"); ArgUtils.notNull(errors, "errors"); processConstraintViolation(getTargetValidator().validate(targetObj, groups), errors); }
java
@Override public void validate(final Object targetObj, final SheetBindingErrors<?> errors, final Class<?>... groups) { ArgUtils.notNull(targetObj, "targetObj"); ArgUtils.notNull(errors, "errors"); processConstraintViolation(getTargetValidator().validate(targetObj, groups), errors); }
[ "@", "Override", "public", "void", "validate", "(", "final", "Object", "targetObj", ",", "final", "SheetBindingErrors", "<", "?", ">", "errors", ",", "final", "Class", "<", "?", ">", "...", "groups", ")", "{", "ArgUtils", ".", "notNull", "(", "targetObj", ...
グループを指定して検証を実行する。 @param targetObj 検証対象のオブジェクト。 @param errors エラーオブジェクト @param groups BeanValiationのグループのクラス
[ "グループを指定して検証を実行する。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/beanvalidation/SheetBeanValidator.java#L88-L96
apereo/cas
support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/Saml10ObjectBuilder.java
Saml10ObjectBuilder.newSubject
public Subject newSubject(final String identifier, final String confirmationMethod) { val confirmation = newSamlObject(SubjectConfirmation.class); val method = newSamlObject(ConfirmationMethod.class); method.setConfirmationMethod(confirmationMethod); confirmation.getConfirmationMethods().add(method); val nameIdentifier = newSamlObject(NameIdentifier.class); nameIdentifier.setValue(identifier); val subject = newSamlObject(Subject.class); subject.setNameIdentifier(nameIdentifier); subject.setSubjectConfirmation(confirmation); return subject; }
java
public Subject newSubject(final String identifier, final String confirmationMethod) { val confirmation = newSamlObject(SubjectConfirmation.class); val method = newSamlObject(ConfirmationMethod.class); method.setConfirmationMethod(confirmationMethod); confirmation.getConfirmationMethods().add(method); val nameIdentifier = newSamlObject(NameIdentifier.class); nameIdentifier.setValue(identifier); val subject = newSamlObject(Subject.class); subject.setNameIdentifier(nameIdentifier); subject.setSubjectConfirmation(confirmation); return subject; }
[ "public", "Subject", "newSubject", "(", "final", "String", "identifier", ",", "final", "String", "confirmationMethod", ")", "{", "val", "confirmation", "=", "newSamlObject", "(", "SubjectConfirmation", ".", "class", ")", ";", "val", "method", "=", "newSamlObject",...
New subject element with given confirmation method. @param identifier the identifier @param confirmationMethod the confirmation method @return the subject
[ "New", "subject", "element", "with", "given", "confirmation", "method", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/Saml10ObjectBuilder.java#L209-L220