repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
landawn/AbacusUtil
src/com/landawn/abacus/util/FileSystemUtil.java
FileSystemUtil.freeSpaceWindows
long freeSpaceWindows(String path, final long timeout) throws IOException { path = FilenameUtil.normalize(path, false); if (path.length() > 0 && path.charAt(0) != '"') { path = "\"" + path + "\""; } // build and run the 'dir' command final String[] cmdAttribs = new String[] { "cmd.exe", "/C", "dir /a /-c " + path }; // read in the output of the command to an ArrayList final List<String> lines = performCommand(cmdAttribs, Integer.MAX_VALUE, timeout); // now iterate over the lines we just read and find the LAST // non-empty line (the free space bytes should be in the last element // of the ArrayList anyway, but this will ensure it works even if it's // not, still assuming it is on the last non-blank line) for (int i = lines.size() - 1; i >= 0; i--) { final String line = lines.get(i); if (line.length() > 0) { return parseDir(line, path); } } // all lines are blank throw new IOException("Command line 'dir /-c' did not return any info " + "for path '" + path + "'"); }
java
long freeSpaceWindows(String path, final long timeout) throws IOException { path = FilenameUtil.normalize(path, false); if (path.length() > 0 && path.charAt(0) != '"') { path = "\"" + path + "\""; } // build and run the 'dir' command final String[] cmdAttribs = new String[] { "cmd.exe", "/C", "dir /a /-c " + path }; // read in the output of the command to an ArrayList final List<String> lines = performCommand(cmdAttribs, Integer.MAX_VALUE, timeout); // now iterate over the lines we just read and find the LAST // non-empty line (the free space bytes should be in the last element // of the ArrayList anyway, but this will ensure it works even if it's // not, still assuming it is on the last non-blank line) for (int i = lines.size() - 1; i >= 0; i--) { final String line = lines.get(i); if (line.length() > 0) { return parseDir(line, path); } } // all lines are blank throw new IOException("Command line 'dir /-c' did not return any info " + "for path '" + path + "'"); }
[ "long", "freeSpaceWindows", "(", "String", "path", ",", "final", "long", "timeout", ")", "throws", "IOException", "{", "path", "=", "FilenameUtil", ".", "normalize", "(", "path", ",", "false", ")", ";", "if", "(", "path", ".", "length", "(", ")", ">", ...
Find free space on the Windows platform using the 'dir' command. @param path the path to get free space for, including the colon @param timeout The timeout amount in milliseconds or no timeout if the value is zero or less @return the amount of free drive space on the drive @throws IOException if an error occurs
[ "Find", "free", "space", "on", "the", "Windows", "platform", "using", "the", "dir", "command", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/FileSystemUtil.java#L248-L272
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java
DiagnosticsInner.getHostingEnvironmentDetectorResponse
public DetectorResponseInner getHostingEnvironmentDetectorResponse(String resourceGroupName, String name, String detectorName) { return getHostingEnvironmentDetectorResponseWithServiceResponseAsync(resourceGroupName, name, detectorName).toBlocking().single().body(); }
java
public DetectorResponseInner getHostingEnvironmentDetectorResponse(String resourceGroupName, String name, String detectorName) { return getHostingEnvironmentDetectorResponseWithServiceResponseAsync(resourceGroupName, name, detectorName).toBlocking().single().body(); }
[ "public", "DetectorResponseInner", "getHostingEnvironmentDetectorResponse", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "detectorName", ")", "{", "return", "getHostingEnvironmentDetectorResponseWithServiceResponseAsync", "(", "resourceGroupName", ","...
Get Hosting Environment Detector Response. Get Hosting Environment Detector Response. @param resourceGroupName Name of the resource group to which the resource belongs. @param name App Service Environment Name @param detectorName Detector Resource Name @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 DetectorResponseInner object if successful.
[ "Get", "Hosting", "Environment", "Detector", "Response", ".", "Get", "Hosting", "Environment", "Detector", "Response", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java#L336-L338
meertensinstituut/mtas
src/main/java/mtas/analysis/parser/MtasBasicParser.java
MtasBasicParser.addAndEncodeValue
private String addAndEncodeValue(String originalValue, String newValue, boolean encode) { return addAndEncode(originalValue, null, newValue, encode); }
java
private String addAndEncodeValue(String originalValue, String newValue, boolean encode) { return addAndEncode(originalValue, null, newValue, encode); }
[ "private", "String", "addAndEncodeValue", "(", "String", "originalValue", ",", "String", "newValue", ",", "boolean", "encode", ")", "{", "return", "addAndEncode", "(", "originalValue", ",", "null", ",", "newValue", ",", "encode", ")", ";", "}" ]
Adds the and encode value. @param originalValue the original value @param newValue the new value @param encode the encode @return the string
[ "Adds", "the", "and", "encode", "value", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/analysis/parser/MtasBasicParser.java#L1031-L1034
kaazing/gateway
resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/uri/URIUtils.java
URIUtils.getCanonicalURI
public static String getCanonicalURI(String uriString, boolean canonicalizePath) { if ((uriString != null) && !"".equals(uriString)) { return getCanonicalizedURI(uriString, canonicalizePath); } return null; }
java
public static String getCanonicalURI(String uriString, boolean canonicalizePath) { if ((uriString != null) && !"".equals(uriString)) { return getCanonicalizedURI(uriString, canonicalizePath); } return null; }
[ "public", "static", "String", "getCanonicalURI", "(", "String", "uriString", ",", "boolean", "canonicalizePath", ")", "{", "if", "(", "(", "uriString", "!=", "null", ")", "&&", "!", "\"\"", ".", "equals", "(", "uriString", ")", ")", "{", "return", "getCano...
Create a canonical URI from a given URI. A canonical URI is a URI with:<ul> <li>the host part of the authority lower-case since URI semantics dictate that hostnames are case insensitive <li>(optionally, NOT appropriate for Origin headers) the path part set to "/" if there was no path in the input URI (this conforms to the WebSocket and HTTP protocol specifications and avoids us having to do special handling for path throughout the server code). </ul> @param uriString the URI to canonicalize, in string form @param canonicalizePath if true, append trailing '/' when missing @return a URI with the host part of the authority lower-case and (optionally) trailing / added, or null if the uri is null @throws IllegalArgumentException if the uriString is not valid syntax
[ "Create", "a", "canonical", "URI", "from", "a", "given", "URI", ".", "A", "canonical", "URI", "is", "a", "URI", "with", ":", "<ul", ">", "<li", ">", "the", "host", "part", "of", "the", "authority", "lower", "-", "case", "since", "URI", "semantics", "...
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/uri/URIUtils.java#L641-L646
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_module_POST
public OvhTask serviceName_module_POST(String serviceName, String adminName, String adminPassword, OvhDependencyType[] dependencies, String domain, net.minidev.ovh.api.hosting.web.module.OvhLanguageEnum language, Long moduleId, String path) throws IOException { String qPath = "/hosting/web/{serviceName}/module"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "adminName", adminName); addBody(o, "adminPassword", adminPassword); addBody(o, "dependencies", dependencies); addBody(o, "domain", domain); addBody(o, "language", language); addBody(o, "moduleId", moduleId); addBody(o, "path", path); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_module_POST(String serviceName, String adminName, String adminPassword, OvhDependencyType[] dependencies, String domain, net.minidev.ovh.api.hosting.web.module.OvhLanguageEnum language, Long moduleId, String path) throws IOException { String qPath = "/hosting/web/{serviceName}/module"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "adminName", adminName); addBody(o, "adminPassword", adminPassword); addBody(o, "dependencies", dependencies); addBody(o, "domain", domain); addBody(o, "language", language); addBody(o, "moduleId", moduleId); addBody(o, "path", path); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_module_POST", "(", "String", "serviceName", ",", "String", "adminName", ",", "String", "adminPassword", ",", "OvhDependencyType", "[", "]", "dependencies", ",", "String", "domain", ",", "net", ".", "minidev", ".", "ovh", ".", "a...
Install a new module REST: POST /hosting/web/{serviceName}/module @param language [required] The language to set to your module @param adminName [required] The login for the admin account (may be a standard string or your email) @param adminPassword [required] The password for the admin account (at least 8 characters) @param path [required] Where to install the module, relative to your home directory @param moduleId [required] ID of the module you want to install @param dependencies [required] The dependencies that we have to configure on your module. A dependency can be a standard database (like MySQL or PostgreSQL) or a key-value store (like Redis or Memcached) for example @param domain [required] On which domain the module has to be available (it can be a multidomain or a subdomain) - if not set, the module will be available on your serviceName domain @param serviceName [required] The internal name of your hosting
[ "Install", "a", "new", "module" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1652-L1665
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java
AbstractManagedType.isListAttribute
private boolean isListAttribute(PluralAttribute<? super X, ?, ?> attribute) { return attribute != null && attribute.getCollectionType().equals(CollectionType.LIST); }
java
private boolean isListAttribute(PluralAttribute<? super X, ?, ?> attribute) { return attribute != null && attribute.getCollectionType().equals(CollectionType.LIST); }
[ "private", "boolean", "isListAttribute", "(", "PluralAttribute", "<", "?", "super", "X", ",", "?", ",", "?", ">", "attribute", ")", "{", "return", "attribute", "!=", "null", "&&", "attribute", ".", "getCollectionType", "(", ")", ".", "equals", "(", "Collec...
Checks if is list attribute. @param attribute the attribute @return true, if is list attribute
[ "Checks", "if", "is", "list", "attribute", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L1039-L1042
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/SlotProfile.java
SlotProfile.noLocality
public static SlotProfile noLocality(ResourceProfile resourceProfile) { return new SlotProfile(resourceProfile, Collections.emptyList(), Collections.emptyList()); }
java
public static SlotProfile noLocality(ResourceProfile resourceProfile) { return new SlotProfile(resourceProfile, Collections.emptyList(), Collections.emptyList()); }
[ "public", "static", "SlotProfile", "noLocality", "(", "ResourceProfile", "resourceProfile", ")", "{", "return", "new", "SlotProfile", "(", "resourceProfile", ",", "Collections", ".", "emptyList", "(", ")", ",", "Collections", ".", "emptyList", "(", ")", ")", ";"...
Returns a slot profile for the given resource profile, without any locality requirements.
[ "Returns", "a", "slot", "profile", "for", "the", "given", "resource", "profile", "without", "any", "locality", "requirements", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/SlotProfile.java#L121-L123
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/Client/MalmoModClient.java
MalmoModClient.setUpExtraKeys
private void setUpExtraKeys(GameSettings settings) { // Create extra key bindings here and pass them to the KeyManager. ArrayList<InternalKey> extraKeys = new ArrayList<InternalKey>(); // Create a key binding to toggle between player and Malmo control: extraKeys.add(new InternalKey("key.toggleMalmo", 28, "key.categories.malmo") // 28 is the keycode for enter. { @Override public void onPressed() { InputType it = (inputType != InputType.AI) ? InputType.AI : InputType.HUMAN; System.out.println("Toggling control between human and AI - now " + it); setInputType(it); super.onPressed(); } }); extraKeys.add(new InternalKey("key.handyTestHook", 22, "key.categories.malmo") { @Override public void onPressed() { // Use this if you want to test some code with a handy key press try { CraftingHelper.dumpRecipes("recipe_dump.txt"); } catch (IOException e) { e.printStackTrace(); } } }); this.keyManager = new KeyManager(settings, extraKeys); }
java
private void setUpExtraKeys(GameSettings settings) { // Create extra key bindings here and pass them to the KeyManager. ArrayList<InternalKey> extraKeys = new ArrayList<InternalKey>(); // Create a key binding to toggle between player and Malmo control: extraKeys.add(new InternalKey("key.toggleMalmo", 28, "key.categories.malmo") // 28 is the keycode for enter. { @Override public void onPressed() { InputType it = (inputType != InputType.AI) ? InputType.AI : InputType.HUMAN; System.out.println("Toggling control between human and AI - now " + it); setInputType(it); super.onPressed(); } }); extraKeys.add(new InternalKey("key.handyTestHook", 22, "key.categories.malmo") { @Override public void onPressed() { // Use this if you want to test some code with a handy key press try { CraftingHelper.dumpRecipes("recipe_dump.txt"); } catch (IOException e) { e.printStackTrace(); } } }); this.keyManager = new KeyManager(settings, extraKeys); }
[ "private", "void", "setUpExtraKeys", "(", "GameSettings", "settings", ")", "{", "// Create extra key bindings here and pass them to the KeyManager.", "ArrayList", "<", "InternalKey", ">", "extraKeys", "=", "new", "ArrayList", "<", "InternalKey", ">", "(", ")", ";", "// ...
Set up some handy extra keys: @param settings Minecraft's original GameSettings object
[ "Set", "up", "some", "handy", "extra", "keys", ":" ]
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Client/MalmoModClient.java#L159-L193
javagl/Common
src/main/java/de/javagl/common/xml/XmlUtils.java
XmlUtils.createTextNode
public static Node createTextNode(String tagName, Object contents) { Document d = XmlUtils.getDefaultDocument(); Element node = d.createElement(tagName); node.appendChild(d.createTextNode(String.valueOf(contents))); return node; }
java
public static Node createTextNode(String tagName, Object contents) { Document d = XmlUtils.getDefaultDocument(); Element node = d.createElement(tagName); node.appendChild(d.createTextNode(String.valueOf(contents))); return node; }
[ "public", "static", "Node", "createTextNode", "(", "String", "tagName", ",", "Object", "contents", ")", "{", "Document", "d", "=", "XmlUtils", ".", "getDefaultDocument", "(", ")", ";", "Element", "node", "=", "d", ".", "createElement", "(", "tagName", ")", ...
Creates an XML node from the {@link #getDefaultDocument() default document} whose only child is a text node that contains the string representation of the given object @param tagName The tag name for the node @param contents The object whose string representation will be the contents of the text node @return The node
[ "Creates", "an", "XML", "node", "from", "the", "{", "@link", "#getDefaultDocument", "()", "default", "document", "}", "whose", "only", "child", "is", "a", "text", "node", "that", "contains", "the", "string", "representation", "of", "the", "given", "object" ]
train
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/xml/XmlUtils.java#L275-L281
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java
RealConnection.createTunnel
private Request createTunnel(int readTimeout, int writeTimeout, Request tunnelRequest, HttpUrl url) throws IOException { // Make an SSL Tunnel on the first message pair of each SSL + proxy connection. String requestLine = "CONNECT " + Util.hostHeader(url, true) + " HTTP/1.1"; while (true) { Http1ExchangeCodec tunnelCodec = new Http1ExchangeCodec(null, null, source, sink); source.timeout().timeout(readTimeout, MILLISECONDS); sink.timeout().timeout(writeTimeout, MILLISECONDS); tunnelCodec.writeRequest(tunnelRequest.headers(), requestLine); tunnelCodec.finishRequest(); Response response = tunnelCodec.readResponseHeaders(false) .request(tunnelRequest) .build(); tunnelCodec.skipConnectBody(response); switch (response.code()) { case HTTP_OK: // Assume the server won't send a TLS ServerHello until we send a TLS ClientHello. If // that happens, then we will have buffered bytes that are needed by the SSLSocket! // This check is imperfect: it doesn't tell us whether a handshake will succeed, just // that it will almost certainly fail because the proxy has sent unexpected data. if (!source.getBuffer().exhausted() || !sink.buffer().exhausted()) { throw new IOException("TLS tunnel buffered too many bytes!"); } return null; case HTTP_PROXY_AUTH: tunnelRequest = route.address().proxyAuthenticator().authenticate(route, response); if (tunnelRequest == null) throw new IOException("Failed to authenticate with proxy"); if ("close".equalsIgnoreCase(response.header("Connection"))) { return tunnelRequest; } break; default: throw new IOException( "Unexpected response code for CONNECT: " + response.code()); } } }
java
private Request createTunnel(int readTimeout, int writeTimeout, Request tunnelRequest, HttpUrl url) throws IOException { // Make an SSL Tunnel on the first message pair of each SSL + proxy connection. String requestLine = "CONNECT " + Util.hostHeader(url, true) + " HTTP/1.1"; while (true) { Http1ExchangeCodec tunnelCodec = new Http1ExchangeCodec(null, null, source, sink); source.timeout().timeout(readTimeout, MILLISECONDS); sink.timeout().timeout(writeTimeout, MILLISECONDS); tunnelCodec.writeRequest(tunnelRequest.headers(), requestLine); tunnelCodec.finishRequest(); Response response = tunnelCodec.readResponseHeaders(false) .request(tunnelRequest) .build(); tunnelCodec.skipConnectBody(response); switch (response.code()) { case HTTP_OK: // Assume the server won't send a TLS ServerHello until we send a TLS ClientHello. If // that happens, then we will have buffered bytes that are needed by the SSLSocket! // This check is imperfect: it doesn't tell us whether a handshake will succeed, just // that it will almost certainly fail because the proxy has sent unexpected data. if (!source.getBuffer().exhausted() || !sink.buffer().exhausted()) { throw new IOException("TLS tunnel buffered too many bytes!"); } return null; case HTTP_PROXY_AUTH: tunnelRequest = route.address().proxyAuthenticator().authenticate(route, response); if (tunnelRequest == null) throw new IOException("Failed to authenticate with proxy"); if ("close".equalsIgnoreCase(response.header("Connection"))) { return tunnelRequest; } break; default: throw new IOException( "Unexpected response code for CONNECT: " + response.code()); } } }
[ "private", "Request", "createTunnel", "(", "int", "readTimeout", ",", "int", "writeTimeout", ",", "Request", "tunnelRequest", ",", "HttpUrl", "url", ")", "throws", "IOException", "{", "// Make an SSL Tunnel on the first message pair of each SSL + proxy connection.", "String",...
To make an HTTPS connection over an HTTP proxy, send an unencrypted CONNECT request to create the proxy connection. This may need to be retried if the proxy requires authorization.
[ "To", "make", "an", "HTTPS", "connection", "over", "an", "HTTP", "proxy", "send", "an", "unencrypted", "CONNECT", "request", "to", "create", "the", "proxy", "connection", ".", "This", "may", "need", "to", "be", "retried", "if", "the", "proxy", "requires", ...
train
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java#L391-L431
VoltDB/voltdb
src/frontend/org/voltdb/client/exampleutils/ClientConnection.java
ClientConnection.executeAsync
public boolean executeAsync(ProcedureCallback callback, String procedure, Object... parameters) throws Exception { return this.Client.callProcedure(new TrackingCallback(this, procedure, callback), procedure, parameters); }
java
public boolean executeAsync(ProcedureCallback callback, String procedure, Object... parameters) throws Exception { return this.Client.callProcedure(new TrackingCallback(this, procedure, callback), procedure, parameters); }
[ "public", "boolean", "executeAsync", "(", "ProcedureCallback", "callback", ",", "String", "procedure", ",", "Object", "...", "parameters", ")", "throws", "Exception", "{", "return", "this", ".", "Client", ".", "callProcedure", "(", "new", "TrackingCallback", "(", ...
Executes a procedure asynchronously, then calls the provided user callback with the server response upon completion. @param callback the user-specified callback to call with the server response upon execution completion. @param procedure the name of the procedure to call. @param parameters the list of parameters to pass to the procedure. @return the result of the submission false if the client connection was terminated and unable to post the request to the server, true otherwise.
[ "Executes", "a", "procedure", "asynchronously", "then", "calls", "the", "provided", "user", "callback", "with", "the", "server", "response", "upon", "completion", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/exampleutils/ClientConnection.java#L207-L210
openengsb-labs/labs-endtoend
core/src/main/java/org/openengsb/labs/endtoend/util/MavenConfigurationHelper.java
MavenConfigurationHelper.getMavenHome
public static File getMavenHome() throws Exception { final String command; switch (OS.current()) { case LINUX: case MAC: command = "mvn"; break; case WINDOWS: command = "mvn.bat"; break; default: throw new IllegalStateException("invalid o/s"); } String pathVar = System.getenv("PATH"); String[] pathArray = pathVar.split(File.pathSeparator); for (String path : pathArray) { File file = new File(path, command); if (file.exists() && file.isFile() && file.canExecute()) { /** unwrap symbolic links */ File exec = file.getCanonicalFile(); /** assume ${maven.home}/bin/exec convention */ File home = exec.getParentFile().getParentFile(); return home; } } throw new IllegalStateException("Maven home not found."); }
java
public static File getMavenHome() throws Exception { final String command; switch (OS.current()) { case LINUX: case MAC: command = "mvn"; break; case WINDOWS: command = "mvn.bat"; break; default: throw new IllegalStateException("invalid o/s"); } String pathVar = System.getenv("PATH"); String[] pathArray = pathVar.split(File.pathSeparator); for (String path : pathArray) { File file = new File(path, command); if (file.exists() && file.isFile() && file.canExecute()) { /** unwrap symbolic links */ File exec = file.getCanonicalFile(); /** assume ${maven.home}/bin/exec convention */ File home = exec.getParentFile().getParentFile(); return home; } } throw new IllegalStateException("Maven home not found."); }
[ "public", "static", "File", "getMavenHome", "(", ")", "throws", "Exception", "{", "final", "String", "command", ";", "switch", "(", "OS", ".", "current", "(", ")", ")", "{", "case", "LINUX", ":", "case", "MAC", ":", "command", "=", "\"mvn\"", ";", "bre...
Discover maven home from executable on PATH, using conventions.
[ "Discover", "maven", "home", "from", "executable", "on", "PATH", "using", "conventions", "." ]
train
https://github.com/openengsb-labs/labs-endtoend/blob/5604227b47cd9f45f1757256ca0fd0ddf5ac5871/core/src/main/java/org/openengsb/labs/endtoend/util/MavenConfigurationHelper.java#L39-L65
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/beans/ELTools.java
ELTools.readAnnotations
public static Annotation[] readAnnotations(UIComponent p_component) { ValueExpression valueExpression = p_component.getValueExpression("value"); if (valueExpression != null && valueExpression.getExpressionString() != null && valueExpression.getExpressionString().length()>0) { return readAnnotations(valueExpression, p_component); } return null; }
java
public static Annotation[] readAnnotations(UIComponent p_component) { ValueExpression valueExpression = p_component.getValueExpression("value"); if (valueExpression != null && valueExpression.getExpressionString() != null && valueExpression.getExpressionString().length()>0) { return readAnnotations(valueExpression, p_component); } return null; }
[ "public", "static", "Annotation", "[", "]", "readAnnotations", "(", "UIComponent", "p_component", ")", "{", "ValueExpression", "valueExpression", "=", "p_component", ".", "getValueExpression", "(", "\"value\"", ")", ";", "if", "(", "valueExpression", "!=", "null", ...
Which annotations are given to an object displayed by a JSF component? @param p_component the component @return null if there are no annotations, or if they cannot be accessed
[ "Which", "annotations", "are", "given", "to", "an", "object", "displayed", "by", "a", "JSF", "component?" ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/beans/ELTools.java#L412-L418
kite-sdk/kite
kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/avro/example/UserProfileExample.java
UserProfileExample.registerSchemas
private void registerSchemas(Configuration conf, SchemaManager schemaManager) throws InterruptedException { HBaseAdmin admin; try { // Construct an HBaseAdmin object (required by schema tool), and delete it // if it exists so we start fresh. admin = new HBaseAdmin(conf); if (admin.tableExists("kite_example_user_profiles")) { admin.disableTable("kite_example_user_profiles"); admin.deleteTable("kite_example_user_profiles"); } } catch (IOException e) { throw new RuntimeException(e); } // Use the SchemaTool to create the schemas that are in the example-models // directory, and create the table and column families required by those // schemas. SchemaTool tool = new SchemaTool(admin, schemaManager); tool.createOrMigrateSchemaDirectory("classpath:example-models", true); }
java
private void registerSchemas(Configuration conf, SchemaManager schemaManager) throws InterruptedException { HBaseAdmin admin; try { // Construct an HBaseAdmin object (required by schema tool), and delete it // if it exists so we start fresh. admin = new HBaseAdmin(conf); if (admin.tableExists("kite_example_user_profiles")) { admin.disableTable("kite_example_user_profiles"); admin.deleteTable("kite_example_user_profiles"); } } catch (IOException e) { throw new RuntimeException(e); } // Use the SchemaTool to create the schemas that are in the example-models // directory, and create the table and column families required by those // schemas. SchemaTool tool = new SchemaTool(admin, schemaManager); tool.createOrMigrateSchemaDirectory("classpath:example-models", true); }
[ "private", "void", "registerSchemas", "(", "Configuration", "conf", ",", "SchemaManager", "schemaManager", ")", "throws", "InterruptedException", "{", "HBaseAdmin", "admin", ";", "try", "{", "// Construct an HBaseAdmin object (required by schema tool), and delete it", "// if it...
Uses SchemaTool to register the required schemas and create the required tables. @param conf The HBaseConfiguration. @param schemaManager The schema manager SchemaTool needs to create the schemas.
[ "Uses", "SchemaTool", "to", "register", "the", "required", "schemas", "and", "create", "the", "required", "tables", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/avro/example/UserProfileExample.java#L275-L294
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java
MSPDIWriter.writeExceptions9
private void writeExceptions9(List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList, List<ProjectCalendarException> exceptions) { for (ProjectCalendarException exception : exceptions) { boolean working = exception.getWorking(); Project.Calendars.Calendar.WeekDays.WeekDay day = m_factory.createProjectCalendarsCalendarWeekDaysWeekDay(); dayList.add(day); day.setDayType(BIGINTEGER_ZERO); day.setDayWorking(Boolean.valueOf(working)); Project.Calendars.Calendar.WeekDays.WeekDay.TimePeriod period = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayTimePeriod(); day.setTimePeriod(period); period.setFromDate(exception.getFromDate()); period.setToDate(exception.getToDate()); if (working) { Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimes(); day.setWorkingTimes(times); List<Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime> timesList = times.getWorkingTime(); for (DateRange range : exception) { Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimesWorkingTime(); timesList.add(time); time.setFromTime(range.getStart()); time.setToTime(range.getEnd()); } } } }
java
private void writeExceptions9(List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList, List<ProjectCalendarException> exceptions) { for (ProjectCalendarException exception : exceptions) { boolean working = exception.getWorking(); Project.Calendars.Calendar.WeekDays.WeekDay day = m_factory.createProjectCalendarsCalendarWeekDaysWeekDay(); dayList.add(day); day.setDayType(BIGINTEGER_ZERO); day.setDayWorking(Boolean.valueOf(working)); Project.Calendars.Calendar.WeekDays.WeekDay.TimePeriod period = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayTimePeriod(); day.setTimePeriod(period); period.setFromDate(exception.getFromDate()); period.setToDate(exception.getToDate()); if (working) { Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimes(); day.setWorkingTimes(times); List<Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime> timesList = times.getWorkingTime(); for (DateRange range : exception) { Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimesWorkingTime(); timesList.add(time); time.setFromTime(range.getStart()); time.setToTime(range.getEnd()); } } } }
[ "private", "void", "writeExceptions9", "(", "List", "<", "Project", ".", "Calendars", ".", "Calendar", ".", "WeekDays", ".", "WeekDay", ">", "dayList", ",", "List", "<", "ProjectCalendarException", ">", "exceptions", ")", "{", "for", "(", "ProjectCalendarExcepti...
Write exceptions in the format used by MSPDI files prior to Project 2007. @param dayList list of calendar days @param exceptions list of exceptions
[ "Write", "exceptions", "in", "the", "format", "used", "by", "MSPDI", "files", "prior", "to", "Project", "2007", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L488-L520
structurizr/java
structurizr-core/src/com/structurizr/model/ContainerInstance.java
ContainerInstance.addHealthCheck
@Nonnull public HttpHealthCheck addHealthCheck(String name, String url, int interval, long timeout) { if (name == null || name.trim().length() == 0) { throw new IllegalArgumentException("The name must not be null or empty."); } if (url == null || url.trim().length() == 0) { throw new IllegalArgumentException("The URL must not be null or empty."); } if (!Url.isUrl(url)) { throw new IllegalArgumentException(url + " is not a valid URL."); } if (interval < 0) { throw new IllegalArgumentException("The polling interval must be zero or a positive integer."); } if (timeout < 0) { throw new IllegalArgumentException("The timeout must be zero or a positive integer."); } HttpHealthCheck healthCheck = new HttpHealthCheck(name, url, interval, timeout); healthChecks.add(healthCheck); return healthCheck; }
java
@Nonnull public HttpHealthCheck addHealthCheck(String name, String url, int interval, long timeout) { if (name == null || name.trim().length() == 0) { throw new IllegalArgumentException("The name must not be null or empty."); } if (url == null || url.trim().length() == 0) { throw new IllegalArgumentException("The URL must not be null or empty."); } if (!Url.isUrl(url)) { throw new IllegalArgumentException(url + " is not a valid URL."); } if (interval < 0) { throw new IllegalArgumentException("The polling interval must be zero or a positive integer."); } if (timeout < 0) { throw new IllegalArgumentException("The timeout must be zero or a positive integer."); } HttpHealthCheck healthCheck = new HttpHealthCheck(name, url, interval, timeout); healthChecks.add(healthCheck); return healthCheck; }
[ "@", "Nonnull", "public", "HttpHealthCheck", "addHealthCheck", "(", "String", "name", ",", "String", "url", ",", "int", "interval", ",", "long", "timeout", ")", "{", "if", "(", "name", "==", "null", "||", "name", ".", "trim", "(", ")", ".", "length", "...
Adds a new health check. @param name the name of the health check @param url the URL of the health check @param interval the polling interval, in seconds @param timeout the timeout, in milliseconds @return a HttpHealthCheck instance representing the health check that has been added @throws IllegalArgumentException if the name is empty, the URL is not a well-formed URL, or the interval/timeout is not zero/a positive integer
[ "Adds", "a", "new", "health", "check", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/ContainerInstance.java#L145-L171
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java
TreeScanner.visitUnionType
@Override public R visitUnionType(UnionTypeTree node, P p) { return scan(node.getTypeAlternatives(), p); }
java
@Override public R visitUnionType(UnionTypeTree node, P p) { return scan(node.getTypeAlternatives(), p); }
[ "@", "Override", "public", "R", "visitUnionType", "(", "UnionTypeTree", "node", ",", "P", "p", ")", "{", "return", "scan", "(", "node", ".", "getTypeAlternatives", "(", ")", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java#L766-L769
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java
CareWebShellEx.registerMenu
public ElementMenuItem registerMenu(String path, String action) { ElementMenuItem menu = getElement(path, getDesktop().getMenubar(), ElementMenuItem.class); menu.setAction(action); return menu; }
java
public ElementMenuItem registerMenu(String path, String action) { ElementMenuItem menu = getElement(path, getDesktop().getMenubar(), ElementMenuItem.class); menu.setAction(action); return menu; }
[ "public", "ElementMenuItem", "registerMenu", "(", "String", "path", ",", "String", "action", ")", "{", "ElementMenuItem", "menu", "=", "getElement", "(", "path", ",", "getDesktop", "(", ")", ".", "getMenubar", "(", ")", ",", "ElementMenuItem", ".", "class", ...
Register a menu. @param path Path for the menu. @param action Associated action for the menu. @return Created menu.
[ "Register", "a", "menu", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java#L216-L220
sstrickx/yahoofinance-api
src/main/java/yahoofinance/YahooFinance.java
YahooFinance.get
public static Stock get(String symbol, Calendar from, Calendar to, Interval interval) throws IOException { Map<String, Stock> result = YahooFinance.getQuotes(symbol, from, to, interval); return result.get(symbol.toUpperCase()); }
java
public static Stock get(String symbol, Calendar from, Calendar to, Interval interval) throws IOException { Map<String, Stock> result = YahooFinance.getQuotes(symbol, from, to, interval); return result.get(symbol.toUpperCase()); }
[ "public", "static", "Stock", "get", "(", "String", "symbol", ",", "Calendar", "from", ",", "Calendar", "to", ",", "Interval", "interval", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "Stock", ">", "result", "=", "YahooFinance", ".", "getQu...
Sends a request with the historical quotes included starting from the specified {@link Calendar} date until the specified Calendar date (to) at the specified interval. Returns null if the data can't be retrieved from Yahoo Finance. @param symbol the symbol of the stock for which you want to retrieve information @param from start date of the historical data @param to end date of the historical data @param interval the interval of the included historical data @return a {@link Stock} object containing the requested information @throws java.io.IOException when there's a connection problem
[ "Sends", "a", "request", "with", "the", "historical", "quotes", "included", "starting", "from", "the", "specified", "{", "@link", "Calendar", "}", "date", "until", "the", "specified", "Calendar", "date", "(", "to", ")", "at", "the", "specified", "interval", ...
train
https://github.com/sstrickx/yahoofinance-api/blob/2766ba52fc5cccf9b4da5c06423d68059cf0a6e6/src/main/java/yahoofinance/YahooFinance.java#L178-L181
molgenis/molgenis
molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java
PostgreSqlQueryGenerator.isDistinctSelectRequired
private static <E extends Entity> boolean isDistinctSelectRequired( EntityType entityType, Query<E> q) { return isDistinctSelectRequiredRec(entityType, q.getRules()); }
java
private static <E extends Entity> boolean isDistinctSelectRequired( EntityType entityType, Query<E> q) { return isDistinctSelectRequiredRec(entityType, q.getRules()); }
[ "private", "static", "<", "E", "extends", "Entity", ">", "boolean", "isDistinctSelectRequired", "(", "EntityType", "entityType", ",", "Query", "<", "E", ">", "q", ")", "{", "return", "isDistinctSelectRequiredRec", "(", "entityType", ",", "q", ".", "getRules", ...
Determines whether a distinct select is required based on a given query. @param entityType entity meta data @param q query @param <E> entity type @return <code>true</code> if a distinct select is required for SQL queries based on the given query @throws UnknownAttributeException if query field refers to an attribute that does not exist in entity meta
[ "Determines", "whether", "a", "distinct", "select", "is", "required", "based", "on", "a", "given", "query", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java#L511-L514
RestComm/media-core
control/mgcp/src/main/java/org/restcomm/media/core/control/mgcp/call/MgcpCall.java
MgcpCall.removeConnection
public boolean removeConnection(String endpointId, int connectionId) { boolean removed = this.entries.remove(endpointId, connectionId); if (removed && log.isDebugEnabled()) { int left = this.entries.get(endpointId).size(); log.debug("Call " + getCallIdHex() + " unregistered connection " + Integer.toHexString(connectionId) + " from endpoint " + endpointId + ". Connection count: " + left); } return removed; }
java
public boolean removeConnection(String endpointId, int connectionId) { boolean removed = this.entries.remove(endpointId, connectionId); if (removed && log.isDebugEnabled()) { int left = this.entries.get(endpointId).size(); log.debug("Call " + getCallIdHex() + " unregistered connection " + Integer.toHexString(connectionId) + " from endpoint " + endpointId + ". Connection count: " + left); } return removed; }
[ "public", "boolean", "removeConnection", "(", "String", "endpointId", ",", "int", "connectionId", ")", "{", "boolean", "removed", "=", "this", ".", "entries", ".", "remove", "(", "endpointId", ",", "connectionId", ")", ";", "if", "(", "removed", "&&", "log",...
Unregisters a connection from the call. @param endpointId The identifier of the endpoint that owns the connection. @param connectionId The connection identifier. @return Returns <code>true</code> if connection was removed successfully. Returns <code>false</code> otherwise.
[ "Unregisters", "a", "connection", "from", "the", "call", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/control/mgcp/src/main/java/org/restcomm/media/core/control/mgcp/call/MgcpCall.java#L122-L129
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsm.java
XsdAsm.generateClassFromElement
void generateClassFromElement(XsdElement element, String apiName){ XsdAsmElements.generateClassFromElement(interfaceGenerator, createdAttributes, element, apiName); }
java
void generateClassFromElement(XsdElement element, String apiName){ XsdAsmElements.generateClassFromElement(interfaceGenerator, createdAttributes, element, apiName); }
[ "void", "generateClassFromElement", "(", "XsdElement", "element", ",", "String", "apiName", ")", "{", "XsdAsmElements", ".", "generateClassFromElement", "(", "interfaceGenerator", ",", "createdAttributes", ",", "element", ",", "apiName", ")", ";", "}" ]
Generates an element class based on the received {@link XsdElement} object. @param element The {@link XsdElement} containing information needed for the class creation. @param apiName The name of the resulting fluent interface.
[ "Generates", "an", "element", "class", "based", "on", "the", "received", "{" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsm.java#L74-L76
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java
MethodBuilder.getInstance
public static MethodBuilder getInstance(Context context, TypeElement typeElement, MethodWriter writer) { return new MethodBuilder(context, typeElement, writer); }
java
public static MethodBuilder getInstance(Context context, TypeElement typeElement, MethodWriter writer) { return new MethodBuilder(context, typeElement, writer); }
[ "public", "static", "MethodBuilder", "getInstance", "(", "Context", "context", ",", "TypeElement", "typeElement", ",", "MethodWriter", "writer", ")", "{", "return", "new", "MethodBuilder", "(", "context", ",", "typeElement", ",", "writer", ")", ";", "}" ]
Construct a new MethodBuilder. @param context the build context. @param typeElement the class whoses members are being documented. @param writer the doclet specific writer. @return an instance of a MethodBuilder.
[ "Construct", "a", "new", "MethodBuilder", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java#L111-L114
jenkinsci/favorite-plugin
src/main/java/hudson/plugins/favorite/Favorites.java
Favorites.isFavorite
public static boolean isFavorite(@Nonnull User user, @Nonnull Item item) { FavoriteUserProperty fup = user.getProperty(FavoriteUserProperty.class); return fup != null && fup.isJobFavorite(item.getFullName()); }
java
public static boolean isFavorite(@Nonnull User user, @Nonnull Item item) { FavoriteUserProperty fup = user.getProperty(FavoriteUserProperty.class); return fup != null && fup.isJobFavorite(item.getFullName()); }
[ "public", "static", "boolean", "isFavorite", "(", "@", "Nonnull", "User", "user", ",", "@", "Nonnull", "Item", "item", ")", "{", "FavoriteUserProperty", "fup", "=", "user", ".", "getProperty", "(", "FavoriteUserProperty", ".", "class", ")", ";", "return", "f...
Check if the item is favorited @param user to check @param item to check @return favorite state
[ "Check", "if", "the", "item", "is", "favorited" ]
train
https://github.com/jenkinsci/favorite-plugin/blob/4ce9b195b4d888190fe12c92d546d64f22728c22/src/main/java/hudson/plugins/favorite/Favorites.java#L43-L46
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
OpenCensusUtils.recordMessageEvent
@VisibleForTesting static void recordMessageEvent(Span span, long size, Type eventType) { Preconditions.checkArgument(span != null, "span should not be null."); if (size < 0) { size = 0; } MessageEvent event = MessageEvent.builder(eventType, idGenerator.getAndIncrement()) .setUncompressedMessageSize(size) .build(); span.addMessageEvent(event); }
java
@VisibleForTesting static void recordMessageEvent(Span span, long size, Type eventType) { Preconditions.checkArgument(span != null, "span should not be null."); if (size < 0) { size = 0; } MessageEvent event = MessageEvent.builder(eventType, idGenerator.getAndIncrement()) .setUncompressedMessageSize(size) .build(); span.addMessageEvent(event); }
[ "@", "VisibleForTesting", "static", "void", "recordMessageEvent", "(", "Span", "span", ",", "long", "size", ",", "Type", "eventType", ")", "{", "Preconditions", ".", "checkArgument", "(", "span", "!=", "null", ",", "\"span should not be null.\"", ")", ";", "if",...
Records a message event of a certain {@link MessageEvent.Type}. This method is package protected since {@link MessageEvent} might be deprecated in future releases. @param span The {@code span} in which the event occurs. @param size Size of the message. @param eventType The {@code NetworkEvent.Type} of the message event.
[ "Records", "a", "message", "event", "of", "a", "certain", "{", "@link", "MessageEvent", ".", "Type", "}", ".", "This", "method", "is", "package", "protected", "since", "{", "@link", "MessageEvent", "}", "might", "be", "deprecated", "in", "future", "releases"...
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java#L212-L223
grails/grails-core
grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java
GrailsASTUtils.wrapMethodBodyInTryCatchDebugStatements
public static void wrapMethodBodyInTryCatchDebugStatements(MethodNode methodNode) { BlockStatement code = (BlockStatement) methodNode.getCode(); BlockStatement newCode = new BlockStatement(); TryCatchStatement tryCatchStatement = new TryCatchStatement(code, new BlockStatement()); newCode.addStatement(tryCatchStatement); methodNode.setCode(newCode); BlockStatement catchBlock = new BlockStatement(); ArgumentListExpression logArguments = new ArgumentListExpression(); logArguments.addExpression(new BinaryExpression(new ConstantExpression("Error initializing class: "),Token.newSymbol(Types.PLUS, 0, 0),new VariableExpression("e"))); logArguments.addExpression(new VariableExpression("e")); catchBlock.addStatement(new ExpressionStatement(new MethodCallExpression(new VariableExpression("log"), "error", logArguments))); tryCatchStatement.addCatch(new CatchStatement(new Parameter(new ClassNode(Throwable.class), "e"),catchBlock)); }
java
public static void wrapMethodBodyInTryCatchDebugStatements(MethodNode methodNode) { BlockStatement code = (BlockStatement) methodNode.getCode(); BlockStatement newCode = new BlockStatement(); TryCatchStatement tryCatchStatement = new TryCatchStatement(code, new BlockStatement()); newCode.addStatement(tryCatchStatement); methodNode.setCode(newCode); BlockStatement catchBlock = new BlockStatement(); ArgumentListExpression logArguments = new ArgumentListExpression(); logArguments.addExpression(new BinaryExpression(new ConstantExpression("Error initializing class: "),Token.newSymbol(Types.PLUS, 0, 0),new VariableExpression("e"))); logArguments.addExpression(new VariableExpression("e")); catchBlock.addStatement(new ExpressionStatement(new MethodCallExpression(new VariableExpression("log"), "error", logArguments))); tryCatchStatement.addCatch(new CatchStatement(new Parameter(new ClassNode(Throwable.class), "e"),catchBlock)); }
[ "public", "static", "void", "wrapMethodBodyInTryCatchDebugStatements", "(", "MethodNode", "methodNode", ")", "{", "BlockStatement", "code", "=", "(", "BlockStatement", ")", "methodNode", ".", "getCode", "(", ")", ";", "BlockStatement", "newCode", "=", "new", "BlockS...
Wraps a method body in try / catch logic that catches any errors and logs an error, but does not rethrow! @param methodNode The method node
[ "Wraps", "a", "method", "body", "in", "try", "/", "catch", "logic", "that", "catches", "any", "errors", "and", "logs", "an", "error", "but", "does", "not", "rethrow!" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L1003-L1015
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsUserTable.java
CmsUserTable.getStatus
String getStatus(CmsUser user, boolean disabled, boolean newUser) { if (disabled) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_DISABLED_0); } if (newUser) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_INACTIVE_0); } if (OpenCms.getLoginManager().isUserTempDisabled(user.getName())) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_UNLOCK_USER_STATUS_0); } if (isUserPasswordReset(user)) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_PASSWORT_RESET_0); } return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_ACTIVE_0); }
java
String getStatus(CmsUser user, boolean disabled, boolean newUser) { if (disabled) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_DISABLED_0); } if (newUser) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_INACTIVE_0); } if (OpenCms.getLoginManager().isUserTempDisabled(user.getName())) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_UNLOCK_USER_STATUS_0); } if (isUserPasswordReset(user)) { return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_PASSWORT_RESET_0); } return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_ACTIVE_0); }
[ "String", "getStatus", "(", "CmsUser", "user", ",", "boolean", "disabled", ",", "boolean", "newUser", ")", "{", "if", "(", "disabled", ")", "{", "return", "CmsVaadinUtils", ".", "getMessageText", "(", "Messages", ".", "GUI_USERMANAGEMENT_USER_DISABLED_0", ")", "...
Returns status message. @param user CmsUser @param disabled boolean @param newUser boolean @return String
[ "Returns", "status", "message", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsUserTable.java#L1351-L1366
ow2-chameleon/fuchsia
bases/knx/calimero/src/main/java/tuwien/auto/calimero/xml/XMLFactory.java
XMLFactory.createXMLWriter
public XMLWriter createXMLWriter(String systemID) throws KNXMLException { final XMLWriter w = (XMLWriter) create(DEFAULT_WRITER); final EntityResolver res = (EntityResolver) create(DEFAULT_RESOLVER); final OutputStream os = res.resolveOutput(systemID); try { w.setOutput(new OutputStreamWriter(os, "UTF-8"), true); return w; } catch (final UnsupportedEncodingException e) { try { os.close(); } catch (final IOException ignore) {} throw new KNXMLException("encoding UTF-8 unknown"); } }
java
public XMLWriter createXMLWriter(String systemID) throws KNXMLException { final XMLWriter w = (XMLWriter) create(DEFAULT_WRITER); final EntityResolver res = (EntityResolver) create(DEFAULT_RESOLVER); final OutputStream os = res.resolveOutput(systemID); try { w.setOutput(new OutputStreamWriter(os, "UTF-8"), true); return w; } catch (final UnsupportedEncodingException e) { try { os.close(); } catch (final IOException ignore) {} throw new KNXMLException("encoding UTF-8 unknown"); } }
[ "public", "XMLWriter", "createXMLWriter", "(", "String", "systemID", ")", "throws", "KNXMLException", "{", "final", "XMLWriter", "w", "=", "(", "XMLWriter", ")", "create", "(", "DEFAULT_WRITER", ")", ";", "final", "EntityResolver", "res", "=", "(", "EntityResolv...
Creates a {@link XMLWriter} to write into the XML resource located by the specified identifier. <p> @param systemID location identifier of the XML resource @return XML writer @throws KNXMLException if creation of the writer failed or XML resource can't be resolved
[ "Creates", "a", "{", "@link", "XMLWriter", "}", "to", "write", "into", "the", "XML", "resource", "located", "by", "the", "specified", "identifier", ".", "<p", ">" ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/xml/XMLFactory.java#L145-L161
derari/cthul
objects/src/main/java/org/cthul/objects/reflection/Signatures.java
Signatures.candidateMethods
public static Method[] candidateMethods(Class<?> clazz, String name, Object[] args) { return candidateMethods(collectMethods(clazz, name), args); }
java
public static Method[] candidateMethods(Class<?> clazz, String name, Object[] args) { return candidateMethods(collectMethods(clazz, name), args); }
[ "public", "static", "Method", "[", "]", "candidateMethods", "(", "Class", "<", "?", ">", "clazz", ",", "String", "name", ",", "Object", "[", "]", "args", ")", "{", "return", "candidateMethods", "(", "collectMethods", "(", "clazz", ",", "name", ")", ",", ...
Finds the best equally-matching methods for the given arguments. @param clazz @param name @param args @return methods
[ "Finds", "the", "best", "equally", "-", "matching", "methods", "for", "the", "given", "arguments", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/reflection/Signatures.java#L176-L178
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/modelselection/Validator.java
Validator.validate
public VM validate(Iterator<Split> dataSplits, TrainingParameters trainingParameters) { AbstractModeler modeler = MLBuilder.create(trainingParameters, configuration); List<VM> validationMetricsList = new LinkedList<>(); while (dataSplits.hasNext()) { Split s = dataSplits.next(); Dataframe trainData = s.getTrain(); Dataframe testData = s.getTest(); modeler.fit(trainData); trainData.close(); modeler.predict(testData); VM entrySample = ValidationMetrics.newInstance(vmClass, testData); testData.close(); validationMetricsList.add(entrySample); } modeler.close(); VM avgValidationMetrics = ValidationMetrics.newInstance(vmClass, validationMetricsList); return avgValidationMetrics; }
java
public VM validate(Iterator<Split> dataSplits, TrainingParameters trainingParameters) { AbstractModeler modeler = MLBuilder.create(trainingParameters, configuration); List<VM> validationMetricsList = new LinkedList<>(); while (dataSplits.hasNext()) { Split s = dataSplits.next(); Dataframe trainData = s.getTrain(); Dataframe testData = s.getTest(); modeler.fit(trainData); trainData.close(); modeler.predict(testData); VM entrySample = ValidationMetrics.newInstance(vmClass, testData); testData.close(); validationMetricsList.add(entrySample); } modeler.close(); VM avgValidationMetrics = ValidationMetrics.newInstance(vmClass, validationMetricsList); return avgValidationMetrics; }
[ "public", "VM", "validate", "(", "Iterator", "<", "Split", ">", "dataSplits", ",", "TrainingParameters", "trainingParameters", ")", "{", "AbstractModeler", "modeler", "=", "MLBuilder", ".", "create", "(", "trainingParameters", ",", "configuration", ")", ";", "List...
Estimates the average validation metrics on the provided data splits. @param dataSplits @param trainingParameters @return
[ "Estimates", "the", "average", "validation", "metrics", "on", "the", "provided", "data", "splits", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/modelselection/Validator.java#L58-L81
alkacon/opencms-core
src/org/opencms/main/CmsSessionManager.java
CmsSessionManager.sendBroadcast
public void sendBroadcast(CmsObject cms, String message, String sessionId, boolean repeat) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(message)) { // don't broadcast empty messages return; } // send the broadcast only to the selected session CmsSessionInfo sessionInfo = m_sessionStorageProvider.get(new CmsUUID(sessionId)); if (sessionInfo != null) { // double check for concurrent modification sessionInfo.getBroadcastQueue().add( new CmsBroadcast(cms.getRequestContext().getCurrentUser(), message, repeat)); } }
java
public void sendBroadcast(CmsObject cms, String message, String sessionId, boolean repeat) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(message)) { // don't broadcast empty messages return; } // send the broadcast only to the selected session CmsSessionInfo sessionInfo = m_sessionStorageProvider.get(new CmsUUID(sessionId)); if (sessionInfo != null) { // double check for concurrent modification sessionInfo.getBroadcastQueue().add( new CmsBroadcast(cms.getRequestContext().getCurrentUser(), message, repeat)); } }
[ "public", "void", "sendBroadcast", "(", "CmsObject", "cms", ",", "String", "message", ",", "String", "sessionId", ",", "boolean", "repeat", ")", "{", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "message", ")", ")", "{", "// don't broadcast e...
Sends a broadcast to the specified user session.<p> @param cms the OpenCms user context of the user sending the broadcast @param message the message to broadcast @param sessionId the OpenCms session uuid target (receiver) of the broadcast @param repeat repeat this message
[ "Sends", "a", "broadcast", "to", "the", "specified", "user", "session", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsSessionManager.java#L392-L406
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/AbstractDataDictionaryParser.java
AbstractDataDictionaryParser.parseMappingDefinitions
private void parseMappingDefinitions(BeanDefinitionBuilder builder, Element element) { HashMap<String, String> mappings = new HashMap<String, String>(); for (Element matcher : DomUtils.getChildElementsByTagName(element, "mapping")) { mappings.put(matcher.getAttribute("path"), matcher.getAttribute("value")); } if (!mappings.isEmpty()) { builder.addPropertyValue("mappings", mappings); } }
java
private void parseMappingDefinitions(BeanDefinitionBuilder builder, Element element) { HashMap<String, String> mappings = new HashMap<String, String>(); for (Element matcher : DomUtils.getChildElementsByTagName(element, "mapping")) { mappings.put(matcher.getAttribute("path"), matcher.getAttribute("value")); } if (!mappings.isEmpty()) { builder.addPropertyValue("mappings", mappings); } }
[ "private", "void", "parseMappingDefinitions", "(", "BeanDefinitionBuilder", "builder", ",", "Element", "element", ")", "{", "HashMap", "<", "String", ",", "String", ">", "mappings", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "fo...
Parses all mapping definitions and adds those to the bean definition builder as property value. @param builder the target bean definition builder. @param element the source element.
[ "Parses", "all", "mapping", "definitions", "and", "adds", "those", "to", "the", "bean", "definition", "builder", "as", "property", "value", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/AbstractDataDictionaryParser.java#L67-L76
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.getStatistics
public static synchronized Statistics getStatistics(String scheme, Class<? extends FileSystem> cls) { Statistics result = statisticsTable.get(cls); if (result == null) { result = new Statistics(scheme); statisticsTable.put(cls, result); } return result; }
java
public static synchronized Statistics getStatistics(String scheme, Class<? extends FileSystem> cls) { Statistics result = statisticsTable.get(cls); if (result == null) { result = new Statistics(scheme); statisticsTable.put(cls, result); } return result; }
[ "public", "static", "synchronized", "Statistics", "getStatistics", "(", "String", "scheme", ",", "Class", "<", "?", "extends", "FileSystem", ">", "cls", ")", "{", "Statistics", "result", "=", "statisticsTable", ".", "get", "(", "cls", ")", ";", "if", "(", ...
Get the statistics for a particular file system @param cls the class to lookup @return a statistics object
[ "Get", "the", "statistics", "for", "a", "particular", "file", "system" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L2429-L2437
JakeWharton/ActionBarSherlock
actionbarsherlock/src/com/actionbarsherlock/internal/ResourcesCompat.java
ResourcesCompat.getResources_getInteger
public static int getResources_getInteger(Context context, int id) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { return context.getResources().getInteger(id); } DisplayMetrics metrics = context.getResources().getDisplayMetrics(); float widthDp = metrics.widthPixels / metrics.density; if (id == R.integer.abs__max_action_buttons) { if (widthDp >= 600) { return 5; //values-w600dp } if (widthDp >= 500) { return 4; //values-w500dp } if (widthDp >= 360) { return 3; //values-w360dp } return 2; //values } throw new IllegalArgumentException("Unknown integer resource ID " + id); }
java
public static int getResources_getInteger(Context context, int id) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { return context.getResources().getInteger(id); } DisplayMetrics metrics = context.getResources().getDisplayMetrics(); float widthDp = metrics.widthPixels / metrics.density; if (id == R.integer.abs__max_action_buttons) { if (widthDp >= 600) { return 5; //values-w600dp } if (widthDp >= 500) { return 4; //values-w500dp } if (widthDp >= 360) { return 3; //values-w360dp } return 2; //values } throw new IllegalArgumentException("Unknown integer resource ID " + id); }
[ "public", "static", "int", "getResources_getInteger", "(", "Context", "context", ",", "int", "id", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB_MR2", ")", "{", "return", "context", ".", ...
Support implementation of {@code getResources().getInteger()} that we can use to simulate filtering based on width qualifiers on pre-3.2. @param context Context to load integers from on 3.2+ and to fetch the display metrics. @param id Id of integer to load. @return Associated integer value as reflected by the current display metrics.
[ "Support", "implementation", "of", "{", "@code", "getResources", "()", ".", "getInteger", "()", "}", "that", "we", "can", "use", "to", "simulate", "filtering", "based", "on", "width", "qualifiers", "on", "pre", "-", "3", ".", "2", "." ]
train
https://github.com/JakeWharton/ActionBarSherlock/blob/2c71339e756bcc0b1424c4525680549ba3a2dc97/actionbarsherlock/src/com/actionbarsherlock/internal/ResourcesCompat.java#L80-L102
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.serviceName_virtualNumbers_number_jobs_id_GET
public OvhVirtualNumberJob serviceName_virtualNumbers_number_jobs_id_GET(String serviceName, String number, Long id) throws IOException { String qPath = "/sms/{serviceName}/virtualNumbers/{number}/jobs/{id}"; StringBuilder sb = path(qPath, serviceName, number, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVirtualNumberJob.class); }
java
public OvhVirtualNumberJob serviceName_virtualNumbers_number_jobs_id_GET(String serviceName, String number, Long id) throws IOException { String qPath = "/sms/{serviceName}/virtualNumbers/{number}/jobs/{id}"; StringBuilder sb = path(qPath, serviceName, number, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVirtualNumberJob.class); }
[ "public", "OvhVirtualNumberJob", "serviceName_virtualNumbers_number_jobs_id_GET", "(", "String", "serviceName", ",", "String", "number", ",", "Long", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/{serviceName}/virtualNumbers/{number}/jobs/{id}\"", "...
Get this object properties REST: GET /sms/{serviceName}/virtualNumbers/{number}/jobs/{id} @param serviceName [required] The internal name of your SMS offer @param number [required] The virtual number @param id [required] Id of the object
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L253-L258
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFolder.java
BoxApiFolder.getMoveRequest
public BoxRequestsFolder.UpdateFolder getMoveRequest(String id, String parentId) { BoxRequestsFolder.UpdateFolder request = new BoxRequestsFolder.UpdateFolder(id, getFolderInfoUrl(id), mSession) .setParentId(parentId); return request; }
java
public BoxRequestsFolder.UpdateFolder getMoveRequest(String id, String parentId) { BoxRequestsFolder.UpdateFolder request = new BoxRequestsFolder.UpdateFolder(id, getFolderInfoUrl(id), mSession) .setParentId(parentId); return request; }
[ "public", "BoxRequestsFolder", ".", "UpdateFolder", "getMoveRequest", "(", "String", "id", ",", "String", "parentId", ")", "{", "BoxRequestsFolder", ".", "UpdateFolder", "request", "=", "new", "BoxRequestsFolder", ".", "UpdateFolder", "(", "id", ",", "getFolderInfoU...
Gets a request that moves a folder to another folder @param id id of folder to move @param parentId id of parent folder to move folder into @return request to move a folder
[ "Gets", "a", "request", "that", "moves", "a", "folder", "to", "another", "folder" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFolder.java#L157-L161
sockeqwe/SwipeBack
library/src/com/hannesdorfmann/swipeback/SwipeBack.java
SwipeBack.setContentView
public SwipeBack setContentView(View view, LayoutParams params) { switch (mDragMode) { case SwipeBack.DRAG_CONTENT: mContentContainer.removeAllViews(); mContentContainer.addView(view, params); break; case SwipeBack.DRAG_WINDOW: // mActivity can be null if inflated from xml, so retrieve activity // if (mActivity == null) { // mActivity = (Activity) getContext(); // } mActivity.setContentView(view, params); break; } return this; }
java
public SwipeBack setContentView(View view, LayoutParams params) { switch (mDragMode) { case SwipeBack.DRAG_CONTENT: mContentContainer.removeAllViews(); mContentContainer.addView(view, params); break; case SwipeBack.DRAG_WINDOW: // mActivity can be null if inflated from xml, so retrieve activity // if (mActivity == null) { // mActivity = (Activity) getContext(); // } mActivity.setContentView(view, params); break; } return this; }
[ "public", "SwipeBack", "setContentView", "(", "View", "view", ",", "LayoutParams", "params", ")", "{", "switch", "(", "mDragMode", ")", "{", "case", "SwipeBack", ".", "DRAG_CONTENT", ":", "mContentContainer", ".", "removeAllViews", "(", ")", ";", "mContentContai...
Set the content to an explicit view. @param view The desired content to display. @param params Layout parameters for the view.
[ "Set", "the", "content", "to", "an", "explicit", "view", "." ]
train
https://github.com/sockeqwe/SwipeBack/blob/09ed11f48e930ed47fd4f07ad1c786fc9fff3c48/library/src/com/hannesdorfmann/swipeback/SwipeBack.java#L1454-L1473
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.ortho2DLH
public Matrix4f ortho2DLH(float left, float right, float bottom, float top, Matrix4f dest) { if ((properties & PROPERTY_IDENTITY) != 0) return dest.setOrtho2DLH(left, right, bottom, top); return ortho2DLHGeneric(left, right, bottom, top, dest); }
java
public Matrix4f ortho2DLH(float left, float right, float bottom, float top, Matrix4f dest) { if ((properties & PROPERTY_IDENTITY) != 0) return dest.setOrtho2DLH(left, right, bottom, top); return ortho2DLHGeneric(left, right, bottom, top, dest); }
[ "public", "Matrix4f", "ortho2DLH", "(", "float", "left", ",", "float", "right", ",", "float", "bottom", ",", "float", "top", ",", "Matrix4f", "dest", ")", "{", "if", "(", "(", "properties", "&", "PROPERTY_IDENTITY", ")", "!=", "0", ")", "return", "dest",...
Apply an orthographic projection transformation for a left-handed coordinate system to this matrix and store the result in <code>dest</code>. <p> This method is equivalent to calling {@link #orthoLH(float, float, float, float, float, float, Matrix4f) orthoLH()} with <code>zNear=-1</code> and <code>zFar=+1</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrtho2DLH(float, float, float, float) setOrthoLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #orthoLH(float, float, float, float, float, float, Matrix4f) @see #setOrtho2DLH(float, float, float, float) @param left the distance from the center to the left frustum edge @param right the distance from the center to the right frustum edge @param bottom the distance from the center to the bottom frustum edge @param top the distance from the center to the top frustum edge @param dest will hold the result @return dest
[ "Apply", "an", "orthographic", "projection", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "to", "this", "matrix", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", ".", "<p", ">", "This", "metho...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L7901-L7905
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java
PathOverrideService.intArrayContains
public static boolean intArrayContains(int[] array, int numToCheck) { for (int i = 0; i < array.length; i++) { if (array[i] == numToCheck) { return true; } } return false; }
java
public static boolean intArrayContains(int[] array, int numToCheck) { for (int i = 0; i < array.length; i++) { if (array[i] == numToCheck) { return true; } } return false; }
[ "public", "static", "boolean", "intArrayContains", "(", "int", "[", "]", "array", ",", "int", "numToCheck", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "if", "(", "array", "[", "i",...
a simple contains helper method, checks if array contains a numToCheck @param array array of ints @param numToCheck value to find @return True if found, false otherwise
[ "a", "simple", "contains", "helper", "method", "checks", "if", "array", "contains", "a", "numToCheck" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L310-L317
tomdcc/sham
sham-core/src/main/java/org/shamdata/text/SpewGenerator.java
SpewGenerator.nextLine
public String nextLine(Map<String,Object> extraClasses) { return mainClass.render(null, preprocessExtraClasses(extraClasses)); }
java
public String nextLine(Map<String,Object> extraClasses) { return mainClass.render(null, preprocessExtraClasses(extraClasses)); }
[ "public", "String", "nextLine", "(", "Map", "<", "String", ",", "Object", ">", "extraClasses", ")", "{", "return", "mainClass", ".", "render", "(", "null", ",", "preprocessExtraClasses", "(", "extraClasses", ")", ")", ";", "}" ]
Returns a random line of text, driven by the underlying spew file and the given classes. For example, to drive a spew file but add some parameters to it, call this method with the class names as the map keys, and the Strings that you'd like substituted as the values. @param extraClasses the extra classes to use @return a random line of text
[ "Returns", "a", "random", "line", "of", "text", "driven", "by", "the", "underlying", "spew", "file", "and", "the", "given", "classes", ".", "For", "example", "to", "drive", "a", "spew", "file", "but", "add", "some", "parameters", "to", "it", "call", "thi...
train
https://github.com/tomdcc/sham/blob/33ede5e7130888736d6c84368e16a56e9e31e033/sham-core/src/main/java/org/shamdata/text/SpewGenerator.java#L45-L47
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/carts/CartItemUrl.java
CartItemUrl.updateCartItemQuantityUrl
public static MozuUrl updateCartItemQuantityUrl(String cartItemId, Integer quantity, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/carts/current/items/{cartItemId}/{quantity}?responseFields={responseFields}"); formatter.formatUrl("cartItemId", cartItemId); formatter.formatUrl("quantity", quantity); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateCartItemQuantityUrl(String cartItemId, Integer quantity, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/carts/current/items/{cartItemId}/{quantity}?responseFields={responseFields}"); formatter.formatUrl("cartItemId", cartItemId); formatter.formatUrl("quantity", quantity); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateCartItemQuantityUrl", "(", "String", "cartItemId", ",", "Integer", "quantity", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/carts/current/items/{cartItemId}/{q...
Get Resource Url for UpdateCartItemQuantity @param cartItemId Identifier of the cart item to delete. @param quantity The number of cart items in the shopper's active cart. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateCartItemQuantity" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/carts/CartItemUrl.java#L73-L80
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java
DateFormatSymbols.setYearNames
public void setYearNames(String[] yearNames, int context, int width) { if (context == FORMAT && width == ABBREVIATED) { shortYearNames = duplicate(yearNames); } }
java
public void setYearNames(String[] yearNames, int context, int width) { if (context == FORMAT && width == ABBREVIATED) { shortYearNames = duplicate(yearNames); } }
[ "public", "void", "setYearNames", "(", "String", "[", "]", "yearNames", ",", "int", "context", ",", "int", "width", ")", "{", "if", "(", "context", "==", "FORMAT", "&&", "width", "==", "ABBREVIATED", ")", "{", "shortYearNames", "=", "duplicate", "(", "ye...
Sets cyclic year name strings, for example: "jia-zi", "yi-chou", etc. @param yearNames The new cyclic year name strings. @param context The usage context: FORMAT, STANDALONE (currently only FORMAT is supported). @param width The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported).
[ "Sets", "cyclic", "year", "name", "strings", "for", "example", ":", "jia", "-", "zi", "yi", "-", "chou", "etc", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java#L1120-L1124
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java
ConfigUtils.emptyIfNotPresent
public static String emptyIfNotPresent(Config config, String path) { return getString(config, path, StringUtils.EMPTY); }
java
public static String emptyIfNotPresent(Config config, String path) { return getString(config, path, StringUtils.EMPTY); }
[ "public", "static", "String", "emptyIfNotPresent", "(", "Config", "config", ",", "String", "path", ")", "{", "return", "getString", "(", "config", ",", "path", ",", "StringUtils", ".", "EMPTY", ")", ";", "}" ]
Return string value at <code>path</code> if <code>config</code> has path. If not return an empty string @param config in which the path may be present @param path key to look for in the config object @return string value at <code>path</code> if <code>config</code> has path. If not return an empty string
[ "Return", "string", "value", "at", "<code", ">", "path<", "/", "code", ">", "if", "<code", ">", "config<", "/", "code", ">", "has", "path", ".", "If", "not", "return", "an", "empty", "string" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java#L311-L313
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java
PredictionsImpl.predictImageWithServiceResponseAsync
public Observable<ServiceResponse<ImagePrediction>> predictImageWithServiceResponseAsync(UUID projectId, byte[] imageData, PredictImageOptionalParameter predictImageOptionalParameter) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (imageData == null) { throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final UUID iterationId = predictImageOptionalParameter != null ? predictImageOptionalParameter.iterationId() : null; final String application = predictImageOptionalParameter != null ? predictImageOptionalParameter.application() : null; return predictImageWithServiceResponseAsync(projectId, imageData, iterationId, application); }
java
public Observable<ServiceResponse<ImagePrediction>> predictImageWithServiceResponseAsync(UUID projectId, byte[] imageData, PredictImageOptionalParameter predictImageOptionalParameter) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (imageData == null) { throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final UUID iterationId = predictImageOptionalParameter != null ? predictImageOptionalParameter.iterationId() : null; final String application = predictImageOptionalParameter != null ? predictImageOptionalParameter.application() : null; return predictImageWithServiceResponseAsync(projectId, imageData, iterationId, application); }
[ "public", "Observable", "<", "ServiceResponse", "<", "ImagePrediction", ">", ">", "predictImageWithServiceResponseAsync", "(", "UUID", "projectId", ",", "byte", "[", "]", "imageData", ",", "PredictImageOptionalParameter", "predictImageOptionalParameter", ")", "{", "if", ...
Predict an image and saves the result. @param projectId The project id @param imageData the InputStream value @param predictImageOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ImagePrediction object
[ "Predict", "an", "image", "and", "saves", "the", "result", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java#L492-L506
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/JobmanagerInfoServlet.java
JobmanagerInfoServlet.writeJsonForArchive
private void writeJsonForArchive(PrintWriter wrt, List<RecentJobEvent> jobs) { wrt.write("["); // sort jobs by time Collections.sort(jobs, new Comparator<RecentJobEvent>() { @Override public int compare(RecentJobEvent o1, RecentJobEvent o2) { if(o1.getTimestamp() < o2.getTimestamp()) { return 1; } else { return -1; } } }); // Loop Jobs for (int i = 0; i < jobs.size(); i++) { RecentJobEvent jobEvent = jobs.get(i); //Serialize job to json wrt.write("{"); wrt.write("\"jobid\": \"" + jobEvent.getJobID() + "\","); wrt.write("\"jobname\": \"" + jobEvent.getJobName()+"\","); wrt.write("\"status\": \""+ jobEvent.getJobStatus() + "\","); wrt.write("\"time\": " + jobEvent.getTimestamp()); wrt.write("}"); //Write seperator between json objects if(i != jobs.size() - 1) { wrt.write(","); } } wrt.write("]"); }
java
private void writeJsonForArchive(PrintWriter wrt, List<RecentJobEvent> jobs) { wrt.write("["); // sort jobs by time Collections.sort(jobs, new Comparator<RecentJobEvent>() { @Override public int compare(RecentJobEvent o1, RecentJobEvent o2) { if(o1.getTimestamp() < o2.getTimestamp()) { return 1; } else { return -1; } } }); // Loop Jobs for (int i = 0; i < jobs.size(); i++) { RecentJobEvent jobEvent = jobs.get(i); //Serialize job to json wrt.write("{"); wrt.write("\"jobid\": \"" + jobEvent.getJobID() + "\","); wrt.write("\"jobname\": \"" + jobEvent.getJobName()+"\","); wrt.write("\"status\": \""+ jobEvent.getJobStatus() + "\","); wrt.write("\"time\": " + jobEvent.getTimestamp()); wrt.write("}"); //Write seperator between json objects if(i != jobs.size() - 1) { wrt.write(","); } } wrt.write("]"); }
[ "private", "void", "writeJsonForArchive", "(", "PrintWriter", "wrt", ",", "List", "<", "RecentJobEvent", ">", "jobs", ")", "{", "wrt", ".", "write", "(", "\"[\"", ")", ";", "// sort jobs by time", "Collections", ".", "sort", "(", "jobs", ",", "new", "Compara...
Writes Json with a list of currently archived jobs, sorted by time @param wrt @param jobs
[ "Writes", "Json", "with", "a", "list", "of", "currently", "archived", "jobs", "sorted", "by", "time" ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/JobmanagerInfoServlet.java#L180-L217
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsInner.java
ApplicationsInner.beginCreateAsync
public Observable<ApplicationInner> beginCreateAsync(String resourceGroupName, String clusterName, String applicationName, ApplicationInner parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, clusterName, applicationName, parameters).map(new Func1<ServiceResponse<ApplicationInner>, ApplicationInner>() { @Override public ApplicationInner call(ServiceResponse<ApplicationInner> response) { return response.body(); } }); }
java
public Observable<ApplicationInner> beginCreateAsync(String resourceGroupName, String clusterName, String applicationName, ApplicationInner parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, clusterName, applicationName, parameters).map(new Func1<ServiceResponse<ApplicationInner>, ApplicationInner>() { @Override public ApplicationInner call(ServiceResponse<ApplicationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ApplicationInner", ">", "beginCreateAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "applicationName", ",", "ApplicationInner", "parameters", ")", "{", "return", "beginCreateWithServiceResponseAsync", ...
Creates applications for the HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param applicationName The constant value for the application name. @param parameters The application create request. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationInner object
[ "Creates", "applications", "for", "the", "HDInsight", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsInner.java#L435-L442
json-path/JsonPath
json-path/src/main/java/com/jayway/jsonpath/JsonPath.java
JsonPath.read
@SuppressWarnings({"unchecked"}) public static <T> T read(InputStream jsonInputStream, String jsonPath, Predicate... filters) throws IOException { return new ParseContextImpl().parse(jsonInputStream).read(jsonPath, filters); }
java
@SuppressWarnings({"unchecked"}) public static <T> T read(InputStream jsonInputStream, String jsonPath, Predicate... filters) throws IOException { return new ParseContextImpl().parse(jsonInputStream).read(jsonPath, filters); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", "}", ")", "public", "static", "<", "T", ">", "T", "read", "(", "InputStream", "jsonInputStream", ",", "String", "jsonPath", ",", "Predicate", "...", "filters", ")", "throws", "IOException", "{", "return", "...
Creates a new JsonPath and applies it to the provided Json object @param jsonInputStream json input stream @param jsonPath the json path @param filters filters to be applied to the filter place holders [?] in the path @param <T> expected return type @return list of objects matched by the given path
[ "Creates", "a", "new", "JsonPath", "and", "applies", "it", "to", "the", "provided", "Json", "object" ]
train
https://github.com/json-path/JsonPath/blob/5a09489c3252b74bbf81992aadb3073be59c04f9/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java#L540-L543
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/UsersApi.java
UsersApi.getUsers
public ApiSuccessResponse getUsers(String searchTerm, BigDecimal groupId, String sort, String sortBy, BigDecimal limit, BigDecimal offset, String channels) throws ApiException { ApiResponse<ApiSuccessResponse> resp = getUsersWithHttpInfo(searchTerm, groupId, sort, sortBy, limit, offset, channels); return resp.getData(); }
java
public ApiSuccessResponse getUsers(String searchTerm, BigDecimal groupId, String sort, String sortBy, BigDecimal limit, BigDecimal offset, String channels) throws ApiException { ApiResponse<ApiSuccessResponse> resp = getUsersWithHttpInfo(searchTerm, groupId, sort, sortBy, limit, offset, channels); return resp.getData(); }
[ "public", "ApiSuccessResponse", "getUsers", "(", "String", "searchTerm", ",", "BigDecimal", "groupId", ",", "String", "sort", ",", "String", "sortBy", ",", "BigDecimal", "limit", ",", "BigDecimal", "offset", ",", "String", "channels", ")", "throws", "ApiException"...
Search for users. Search for users with the specified filters. @param searchTerm The text to search. (optional) @param groupId The ID of the group where the user belongs. (optional) @param sort The sort order, either &#x60;asc&#x60; (ascending) or &#x60;desc&#x60; (descending). The default is &#x60;asc&#x60;. (optional) @param sortBy The sort order by criteria, either comma-separated list of criteria. Possible ccriteria &#39;firstName&#39;, &#39;lastName&#39;, &#39;userName&#39;. The default is &#x60;firstName,lastName&#x60;. (optional) @param limit Number of results to return. The default value is 100. (optional) @param offset The offset to start from in the results. The default value is 0. (optional) @param channels List of restricted channel, either comma-separated list of channels. If channels is not defined all available channels are returned. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Search", "for", "users", ".", "Search", "for", "users", "with", "the", "specified", "filters", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UsersApi.java#L152-L155
camunda/camunda-bpm-platform
engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/registry/ActivitiStateHandlerRegistry.java
ActivitiStateHandlerRegistry.findRegistrationForProcessAndState
public ActivitiStateHandlerRegistration findRegistrationForProcessAndState(String processName, String stateName) { ActivitiStateHandlerRegistration r = null; String key = registrationKey(processName, stateName); Collection<ActivitiStateHandlerRegistration> rs = this.findRegistrationsForProcessAndState( processName, stateName); for (ActivitiStateHandlerRegistration sr : rs) { String kName = registrationKey(sr.getProcessName(), sr.getStateName()); if (key.equalsIgnoreCase(kName)) { r = sr; break; } } for (ActivitiStateHandlerRegistration sr : rs) { String kName = registrationKey(null, sr.getStateName()); if (key.equalsIgnoreCase(kName)) { r = sr; break; } } if ((r == null) && (rs.size() > 0)) { r = rs.iterator().next(); } return r; }
java
public ActivitiStateHandlerRegistration findRegistrationForProcessAndState(String processName, String stateName) { ActivitiStateHandlerRegistration r = null; String key = registrationKey(processName, stateName); Collection<ActivitiStateHandlerRegistration> rs = this.findRegistrationsForProcessAndState( processName, stateName); for (ActivitiStateHandlerRegistration sr : rs) { String kName = registrationKey(sr.getProcessName(), sr.getStateName()); if (key.equalsIgnoreCase(kName)) { r = sr; break; } } for (ActivitiStateHandlerRegistration sr : rs) { String kName = registrationKey(null, sr.getStateName()); if (key.equalsIgnoreCase(kName)) { r = sr; break; } } if ((r == null) && (rs.size() > 0)) { r = rs.iterator().next(); } return r; }
[ "public", "ActivitiStateHandlerRegistration", "findRegistrationForProcessAndState", "(", "String", "processName", ",", "String", "stateName", ")", "{", "ActivitiStateHandlerRegistration", "r", "=", "null", ";", "String", "key", "=", "registrationKey", "(", "processName", ...
this scours the registry looking for candidate registrations that match a given process name and/ or state nanme @param processName the name of the process @param stateName the name of the state @return an unambiguous {@link org.camunda.bpm.engine.test.spring.components.registry.ActivitiStateHandlerRegistry} or null
[ "this", "scours", "the", "registry", "looking", "for", "candidate", "registrations", "that", "match", "a", "given", "process", "name", "and", "/", "or", "state", "nanme" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/registry/ActivitiStateHandlerRegistry.java#L123-L153
baneizalfe/PullToDismissPager
PullToDismissPager/src/main/java/com/mrbug/pulltodismisspager/PullToDismissPager.java
PullToDismissPager.expandPanel
public boolean expandPanel(float mSlideOffset) { if (mSlideableView == null || mSlideState == SlideState.EXPANDED) return false; mSlideableView.setVisibility(View.VISIBLE); return expandPanel(mSlideableView, 0, mSlideOffset); }
java
public boolean expandPanel(float mSlideOffset) { if (mSlideableView == null || mSlideState == SlideState.EXPANDED) return false; mSlideableView.setVisibility(View.VISIBLE); return expandPanel(mSlideableView, 0, mSlideOffset); }
[ "public", "boolean", "expandPanel", "(", "float", "mSlideOffset", ")", "{", "if", "(", "mSlideableView", "==", "null", "||", "mSlideState", "==", "SlideState", ".", "EXPANDED", ")", "return", "false", ";", "mSlideableView", ".", "setVisibility", "(", "View", "...
Partially expand the sliding panel up to a specific offset @param mSlideOffset Value between 0 and 1, where 0 is completely expanded. @return true if the pane was slideable and is now expanded/in the process of expanding
[ "Partially", "expand", "the", "sliding", "panel", "up", "to", "a", "specific", "offset" ]
train
https://github.com/baneizalfe/PullToDismissPager/blob/14b12725f8ab9274b2499432d85e1b8b2b1850a5/PullToDismissPager/src/main/java/com/mrbug/pulltodismisspager/PullToDismissPager.java#L736-L740
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.eqProperty
public PropertyConstraint eqProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, EqualTo.instance(), otherPropertyName); }
java
public PropertyConstraint eqProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, EqualTo.instance(), otherPropertyName); }
[ "public", "PropertyConstraint", "eqProperty", "(", "String", "propertyName", ",", "String", "otherPropertyName", ")", "{", "return", "valueProperties", "(", "propertyName", ",", "EqualTo", ".", "instance", "(", ")", ",", "otherPropertyName", ")", ";", "}" ]
Apply a "equal to" constraint to two bean properties. @param propertyName The first property @param otherPropertyName The other property @return The constraint
[ "Apply", "a", "equal", "to", "constraint", "to", "two", "bean", "properties", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L842-L844
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java
WritableUtils.readEnum
public static <T extends Enum<T>> T readEnum(DataInput in, Class<T> enumType) throws IOException { return T.valueOf(enumType, Text.readString(in)); }
java
public static <T extends Enum<T>> T readEnum(DataInput in, Class<T> enumType) throws IOException { return T.valueOf(enumType, Text.readString(in)); }
[ "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", ">", "T", "readEnum", "(", "DataInput", "in", ",", "Class", "<", "T", ">", "enumType", ")", "throws", "IOException", "{", "return", "T", ".", "valueOf", "(", "enumType", ",", "Text", "."...
Read an Enum value from DataInput, Enums are read and written using String values. @param <T> Enum type @param in DataInput to read from @param enumType Class type of Enum @return Enum represented by String read from DataInput @throws IOException
[ "Read", "an", "Enum", "value", "from", "DataInput", "Enums", "are", "read", "and", "written", "using", "String", "values", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java#L370-L372
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/sql/dal/describe/DescribeParserFactory.java
DescribeParserFactory.newInstance
public static AbstractDescribeParser newInstance(final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine) { switch (dbType) { case H2: case MySQL: return new MySQLDescribeParser(shardingRule, lexerEngine); default: throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType)); } }
java
public static AbstractDescribeParser newInstance(final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine) { switch (dbType) { case H2: case MySQL: return new MySQLDescribeParser(shardingRule, lexerEngine); default: throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType)); } }
[ "public", "static", "AbstractDescribeParser", "newInstance", "(", "final", "DatabaseType", "dbType", ",", "final", "ShardingRule", "shardingRule", ",", "final", "LexerEngine", "lexerEngine", ")", "{", "switch", "(", "dbType", ")", "{", "case", "H2", ":", "case", ...
Create describe parser instance. @param dbType database type @param shardingRule databases and tables sharding rule @param lexerEngine lexical analysis engine. @return describe parser instance
[ "Create", "describe", "parser", "instance", "." ]
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/old/parser/sql/dal/describe/DescribeParserFactory.java#L43-L51
xvik/guice-persist-orient
src/main/java/ru/vyarus/guice/persist/orient/repository/command/ext/listen/ListenParamExtension.java
ListenParamExtension.resolveListenerGeneric
private Class<?> resolveListenerGeneric(final MethodGenericsContext generics, final Class listenerType, final int position) { // TO BE IMPROVED here must be correct resolution of RequiresRecordConversion generic, but it requires // some improvements in generics-resolver // In most cases even this simplified implementation will work if (RequiresRecordConversion.class.isAssignableFrom(listenerType) && listenerType.getTypeParameters().length > 0) { try { // questionable assumption that the first generic is a target type, but will work in most cases return generics.resolveGenericOf(generics.currentMethod().getGenericParameterTypes()[position]); } catch (Exception ex) { // never happen throw new IllegalStateException("Parameter generic resolution failed", ex); } } return Object.class; }
java
private Class<?> resolveListenerGeneric(final MethodGenericsContext generics, final Class listenerType, final int position) { // TO BE IMPROVED here must be correct resolution of RequiresRecordConversion generic, but it requires // some improvements in generics-resolver // In most cases even this simplified implementation will work if (RequiresRecordConversion.class.isAssignableFrom(listenerType) && listenerType.getTypeParameters().length > 0) { try { // questionable assumption that the first generic is a target type, but will work in most cases return generics.resolveGenericOf(generics.currentMethod().getGenericParameterTypes()[position]); } catch (Exception ex) { // never happen throw new IllegalStateException("Parameter generic resolution failed", ex); } } return Object.class; }
[ "private", "Class", "<", "?", ">", "resolveListenerGeneric", "(", "final", "MethodGenericsContext", "generics", ",", "final", "Class", "listenerType", ",", "final", "int", "position", ")", "{", "// TO BE IMPROVED here must be correct resolution of RequiresRecordConversion gen...
Resolve generic specified directly in listener parameter (e.g. {@code QueryListener<Model>}). It would be useful if, for some reason, correct type could not be resolved from listener instance (in most cases it would be possible). @param generics repository method generics context @param listenerType type of specified listener @param position listener parameter position @return resolved generic or Object
[ "Resolve", "generic", "specified", "directly", "in", "listener", "parameter", "(", "e", ".", "g", ".", "{", "@code", "QueryListener<Model", ">", "}", ")", ".", "It", "would", "be", "useful", "if", "for", "some", "reason", "correct", "type", "could", "not",...
train
https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/repository/command/ext/listen/ListenParamExtension.java#L121-L137
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnGatewaysInner.java
P2sVpnGatewaysInner.createOrUpdate
public P2SVpnGatewayInner createOrUpdate(String resourceGroupName, String gatewayName, P2SVpnGatewayInner p2SVpnGatewayParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, p2SVpnGatewayParameters).toBlocking().last().body(); }
java
public P2SVpnGatewayInner createOrUpdate(String resourceGroupName, String gatewayName, P2SVpnGatewayInner p2SVpnGatewayParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, p2SVpnGatewayParameters).toBlocking().last().body(); }
[ "public", "P2SVpnGatewayInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "gatewayName", ",", "P2SVpnGatewayInner", "p2SVpnGatewayParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "gatewayName", ...
Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. @param resourceGroupName The resource group name of the P2SVpnGateway. @param gatewayName The name of the gateway. @param p2SVpnGatewayParameters Parameters supplied to create or Update a virtual wan p2s vpn gateway. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the P2SVpnGatewayInner object if successful.
[ "Creates", "a", "virtual", "wan", "p2s", "vpn", "gateway", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "gateway", "." ]
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/P2sVpnGatewaysInner.java#L223-L225
anotheria/moskito
moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/stats/GenericStats.java
GenericStats.getStatValueAsDouble
public double getStatValueAsDouble(T metric, String interval) { StatValue statValue = getMonitoredStatValue(metric); if (metric.isRateMetric()) { //check for DEFAULT can be removed when same check removed from statValueImpl if("default".equals(interval)) { interval = DefaultIntervals.ONE_MINUTE.getName(); } double result = statValue.getValueAsLong(interval); long duration = IntervalRegistry.getInstance().getInterval(interval).getLength(); if (duration > 0) result /= duration; return result; } return statValue.getValueAsDouble(interval); }
java
public double getStatValueAsDouble(T metric, String interval) { StatValue statValue = getMonitoredStatValue(metric); if (metric.isRateMetric()) { //check for DEFAULT can be removed when same check removed from statValueImpl if("default".equals(interval)) { interval = DefaultIntervals.ONE_MINUTE.getName(); } double result = statValue.getValueAsLong(interval); long duration = IntervalRegistry.getInstance().getInterval(interval).getLength(); if (duration > 0) result /= duration; return result; } return statValue.getValueAsDouble(interval); }
[ "public", "double", "getStatValueAsDouble", "(", "T", "metric", ",", "String", "interval", ")", "{", "StatValue", "statValue", "=", "getMonitoredStatValue", "(", "metric", ")", ";", "if", "(", "metric", ".", "isRateMetric", "(", ")", ")", "{", "//check for DEF...
Get value of provided metric for the given interval as double value. @param metric metric which value we wanna get @param interval the name of the Interval or <code>null</code> to get the absolute value @return the current value
[ "Get", "value", "of", "provided", "metric", "for", "the", "given", "interval", "as", "double", "value", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/stats/GenericStats.java#L204-L218
timehop/sticky-headers-recyclerview
library/src/main/java/com/timehop/stickyheadersrecyclerview/calculation/DimensionCalculator.java
DimensionCalculator.initMarginRect
private void initMarginRect(Rect marginRect, MarginLayoutParams marginLayoutParams) { marginRect.set( marginLayoutParams.leftMargin, marginLayoutParams.topMargin, marginLayoutParams.rightMargin, marginLayoutParams.bottomMargin ); }
java
private void initMarginRect(Rect marginRect, MarginLayoutParams marginLayoutParams) { marginRect.set( marginLayoutParams.leftMargin, marginLayoutParams.topMargin, marginLayoutParams.rightMargin, marginLayoutParams.bottomMargin ); }
[ "private", "void", "initMarginRect", "(", "Rect", "marginRect", ",", "MarginLayoutParams", "marginLayoutParams", ")", "{", "marginRect", ".", "set", "(", "marginLayoutParams", ".", "leftMargin", ",", "marginLayoutParams", ".", "topMargin", ",", "marginLayoutParams", "...
Converts {@link MarginLayoutParams} into a representative {@link Rect}. @param marginRect Rect to be initialized with margins coordinates, where {@link MarginLayoutParams#leftMargin} is equivalent to {@link Rect#left}, etc. @param marginLayoutParams margins to populate the Rect with
[ "Converts", "{", "@link", "MarginLayoutParams", "}", "into", "a", "representative", "{", "@link", "Rect", "}", "." ]
train
https://github.com/timehop/sticky-headers-recyclerview/blob/f5a9e9b8f5d96734e20439b0a41381865fa52fb7/library/src/main/java/com/timehop/stickyheadersrecyclerview/calculation/DimensionCalculator.java#L39-L46
h2oai/h2o-3
h2o-core/src/main/java/water/parser/Parser.java
Parser.readOneFile
private StreamInfo readOneFile(final InputStream is, final StreamParseWriter dout, InputStream bvs, StreamParseWriter nextChunk, int zidx, int fileIndex) throws IOException { int cidx = 0; StreamData din = new StreamData(is); // only check header for 2nd file onward since guess setup is already done on first file. if ((fileIndex > 0) && (!checkFileNHeader(is, dout, din, cidx))) // cidx should be the actual column index return new StreamInfo(zidx, nextChunk); // header is bad, quit now int streamAvailable = is.available(); while (streamAvailable > 0) { parseChunk(cidx++, din, nextChunk); // cidx here actually goes and get the right column chunk. streamAvailable = is.available(); // Can (also!) rollover to the next input chunk int xidx = bvs.read(null, 0, 0); // Back-channel read of chunk index if (xidx > zidx) { // Advanced chunk index of underlying ByteVec stream? zidx = xidx; // Record advancing of chunk nextChunk.close(); // Match output chunks to input zipfile chunks if (dout != nextChunk) { dout.reduce(nextChunk); if (_jobKey != null && _jobKey.get().stop_requested()) break; } nextChunk = nextChunk.nextChunk(); } } parseChunk(cidx, din, nextChunk); return new StreamInfo(zidx, nextChunk); }
java
private StreamInfo readOneFile(final InputStream is, final StreamParseWriter dout, InputStream bvs, StreamParseWriter nextChunk, int zidx, int fileIndex) throws IOException { int cidx = 0; StreamData din = new StreamData(is); // only check header for 2nd file onward since guess setup is already done on first file. if ((fileIndex > 0) && (!checkFileNHeader(is, dout, din, cidx))) // cidx should be the actual column index return new StreamInfo(zidx, nextChunk); // header is bad, quit now int streamAvailable = is.available(); while (streamAvailable > 0) { parseChunk(cidx++, din, nextChunk); // cidx here actually goes and get the right column chunk. streamAvailable = is.available(); // Can (also!) rollover to the next input chunk int xidx = bvs.read(null, 0, 0); // Back-channel read of chunk index if (xidx > zidx) { // Advanced chunk index of underlying ByteVec stream? zidx = xidx; // Record advancing of chunk nextChunk.close(); // Match output chunks to input zipfile chunks if (dout != nextChunk) { dout.reduce(nextChunk); if (_jobKey != null && _jobKey.get().stop_requested()) break; } nextChunk = nextChunk.nextChunk(); } } parseChunk(cidx, din, nextChunk); return new StreamInfo(zidx, nextChunk); }
[ "private", "StreamInfo", "readOneFile", "(", "final", "InputStream", "is", ",", "final", "StreamParseWriter", "dout", ",", "InputStream", "bvs", ",", "StreamParseWriter", "nextChunk", ",", "int", "zidx", ",", "int", "fileIndex", ")", "throws", "IOException", "{", ...
This method reads in one zip file. Before reading the file, it will check if the current file has the same number of columns and separator type as the previous files it has parssed. If they do not match, no file will be parsed in this case. @param is @param dout @param bvs @param nextChunk @param zidx @return @throws IOException
[ "This", "method", "reads", "in", "one", "zip", "file", ".", "Before", "reading", "the", "file", "it", "will", "check", "if", "the", "current", "file", "has", "the", "same", "number", "of", "columns", "and", "separator", "type", "as", "the", "previous", "...
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/parser/Parser.java#L193-L217
jmchilton/galaxy-bootstrap
src/main/java/com/github/jmchilton/galaxybootstrap/DownloadProperties.java
DownloadProperties.forGalaxyCentral
@Deprecated public static DownloadProperties forGalaxyCentral(final File destination, String revision) { return new DownloadProperties(GALAXY_CENTRAL_REPOSITORY_URL, BRANCH_DEFAULT, revision, destination); }
java
@Deprecated public static DownloadProperties forGalaxyCentral(final File destination, String revision) { return new DownloadProperties(GALAXY_CENTRAL_REPOSITORY_URL, BRANCH_DEFAULT, revision, destination); }
[ "@", "Deprecated", "public", "static", "DownloadProperties", "forGalaxyCentral", "(", "final", "File", "destination", ",", "String", "revision", ")", "{", "return", "new", "DownloadProperties", "(", "GALAXY_CENTRAL_REPOSITORY_URL", ",", "BRANCH_DEFAULT", ",", "revision"...
Builds a new DownloadProperties for downloading Galaxy from galaxy-central. @param destination The destination directory to store Galaxy, null if a directory should be chosen by default. @param revision The revision to use for Galaxy. @return A new DownloadProperties for downloading Galaxy from galaxy-central.
[ "Builds", "a", "new", "DownloadProperties", "for", "downloading", "Galaxy", "from", "galaxy", "-", "central", "." ]
train
https://github.com/jmchilton/galaxy-bootstrap/blob/4a899f5e6ec0c9f6f4b9b21d5a0320e5925ec649/src/main/java/com/github/jmchilton/galaxybootstrap/DownloadProperties.java#L349-L352
korpling/ANNIS
annis-libgui/src/main/java/annis/libgui/Helper.java
Helper.getAnnisAsyncWebResource
public static AsyncWebResource getAnnisAsyncWebResource() { // get URI used by the application String uri = (String) VaadinSession.getCurrent().getAttribute( KEY_WEB_SERVICE_URL); // if already authentificated the REST client is set as the "user" property AnnisUser user = getUser(); return getAnnisAsyncWebResource(uri, user); }
java
public static AsyncWebResource getAnnisAsyncWebResource() { // get URI used by the application String uri = (String) VaadinSession.getCurrent().getAttribute( KEY_WEB_SERVICE_URL); // if already authentificated the REST client is set as the "user" property AnnisUser user = getUser(); return getAnnisAsyncWebResource(uri, user); }
[ "public", "static", "AsyncWebResource", "getAnnisAsyncWebResource", "(", ")", "{", "// get URI used by the application", "String", "uri", "=", "(", "String", ")", "VaadinSession", ".", "getCurrent", "(", ")", ".", "getAttribute", "(", "KEY_WEB_SERVICE_URL", ")", ";", ...
Gets or creates an asynchronous web resource to the ANNIS service. This is a convenience wrapper to {@link #getAnnisWebResource(java.lang.String, annis.security.AnnisUser) } that does not need any arguments @return A reference to the ANNIS service root resource.
[ "Gets", "or", "creates", "an", "asynchronous", "web", "resource", "to", "the", "ANNIS", "service", "." ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-libgui/src/main/java/annis/libgui/Helper.java#L351-L361
LearnLib/automatalib
commons/util/src/main/java/net/automatalib/commons/util/process/ProcessUtil.java
ProcessUtil.invokeProcess
public static int invokeProcess(String[] commandLine, Reader input, Consumer<String> consumer) throws IOException, InterruptedException { return invokeProcess(commandLine, input, new DelegatingConsumer(consumer)); }
java
public static int invokeProcess(String[] commandLine, Reader input, Consumer<String> consumer) throws IOException, InterruptedException { return invokeProcess(commandLine, input, new DelegatingConsumer(consumer)); }
[ "public", "static", "int", "invokeProcess", "(", "String", "[", "]", "commandLine", ",", "Reader", "input", ",", "Consumer", "<", "String", ">", "consumer", ")", "throws", "IOException", ",", "InterruptedException", "{", "return", "invokeProcess", "(", "commandL...
Runs the given set of command line arguments as a system process and returns the exit value of the spawned process. Additionally allows to supply an input stream to the invoked program. Outputs of the process (both normal and error) are passed to the {@code consumer}. @param commandLine the list of command line arguments to run @param input the input passed to the program @param consumer the consumer for the program's output @return the exit code of the process @throws IOException if an exception occurred while reading the process' outputs, or writing the process' inputs @throws InterruptedException if an exception occurred during process exception
[ "Runs", "the", "given", "set", "of", "command", "line", "arguments", "as", "a", "system", "process", "and", "returns", "the", "exit", "value", "of", "the", "spawned", "process", ".", "Additionally", "allows", "to", "supply", "an", "input", "stream", "to", ...
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/process/ProcessUtil.java#L122-L125
mgm-tp/jfunk
jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptContext.java
ScriptContext.copyFormEntry
@Cmd public void copyFormEntry(final String srcDataSetKey, final String srcKey, final String destDataSetKey, final String destKey) { Map<String, DataSet> currentDataSets = dataSourceProvider.get().getCurrentDataSets(); DataSet srcDataSet = currentDataSets.get(srcDataSetKey); DataSet destDataSet = currentDataSets.get(destDataSetKey); destDataSet.setFixedValue(destKey, srcDataSet.getValue(srcKey)); }
java
@Cmd public void copyFormEntry(final String srcDataSetKey, final String srcKey, final String destDataSetKey, final String destKey) { Map<String, DataSet> currentDataSets = dataSourceProvider.get().getCurrentDataSets(); DataSet srcDataSet = currentDataSets.get(srcDataSetKey); DataSet destDataSet = currentDataSets.get(destDataSetKey); destDataSet.setFixedValue(destKey, srcDataSet.getValue(srcKey)); }
[ "@", "Cmd", "public", "void", "copyFormEntry", "(", "final", "String", "srcDataSetKey", ",", "final", "String", "srcKey", ",", "final", "String", "destDataSetKey", ",", "final", "String", "destKey", ")", "{", "Map", "<", "String", ",", "DataSet", ">", "curre...
Copies a {@link DataSet} entry from one {@link DataSet} to another. @param srcDataSetKey the source data set key @param srcKey the source entry key @param destDataSetKey the destination data set key @param destKey the destination entry key
[ "Copies", "a", "{", "@link", "DataSet", "}", "entry", "from", "one", "{", "@link", "DataSet", "}", "to", "another", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptContext.java#L254-L260
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java
TypeExtractor.registerFactory
private static void registerFactory(Type t, Class<? extends TypeInfoFactory> factory) { Preconditions.checkNotNull(t, "Type parameter must not be null."); Preconditions.checkNotNull(factory, "Factory parameter must not be null."); if (!TypeInfoFactory.class.isAssignableFrom(factory)) { throw new IllegalArgumentException("Class is not a TypeInfoFactory."); } if (registeredTypeInfoFactories.containsKey(t)) { throw new InvalidTypesException("A TypeInfoFactory for type '" + t + "' is already registered."); } registeredTypeInfoFactories.put(t, factory); }
java
private static void registerFactory(Type t, Class<? extends TypeInfoFactory> factory) { Preconditions.checkNotNull(t, "Type parameter must not be null."); Preconditions.checkNotNull(factory, "Factory parameter must not be null."); if (!TypeInfoFactory.class.isAssignableFrom(factory)) { throw new IllegalArgumentException("Class is not a TypeInfoFactory."); } if (registeredTypeInfoFactories.containsKey(t)) { throw new InvalidTypesException("A TypeInfoFactory for type '" + t + "' is already registered."); } registeredTypeInfoFactories.put(t, factory); }
[ "private", "static", "void", "registerFactory", "(", "Type", "t", ",", "Class", "<", "?", "extends", "TypeInfoFactory", ">", "factory", ")", "{", "Preconditions", ".", "checkNotNull", "(", "t", ",", "\"Type parameter must not be null.\"", ")", ";", "Preconditions"...
Registers a type information factory globally for a certain type. Every following type extraction operation will use the provided factory for this type. The factory will have highest precedence for this type. In a hierarchy of types the registered factory has higher precedence than annotations at the same level but lower precedence than factories defined down the hierarchy. @param t type for which a new factory is registered @param factory type information factory that will produce {@link TypeInformation}
[ "Registers", "a", "type", "information", "factory", "globally", "for", "a", "certain", "type", ".", "Every", "following", "type", "extraction", "operation", "will", "use", "the", "provided", "factory", "for", "this", "type", ".", "The", "factory", "will", "hav...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L149-L160
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getCertificateIssuer
public IssuerBundle getCertificateIssuer(String vaultBaseUrl, String issuerName) { return getCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName).toBlocking().single().body(); }
java
public IssuerBundle getCertificateIssuer(String vaultBaseUrl, String issuerName) { return getCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName).toBlocking().single().body(); }
[ "public", "IssuerBundle", "getCertificateIssuer", "(", "String", "vaultBaseUrl", ",", "String", "issuerName", ")", "{", "return", "getCertificateIssuerWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "issuerName", ")", ".", "toBlocking", "(", ")", ".", "single", "...
Lists the specified certificate issuer. The GetCertificateIssuer operation returns the specified certificate issuer resources in the specified key vault. This operation requires the certificates/manageissuers/getissuers permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param issuerName The name of the issuer. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the IssuerBundle object if successful.
[ "Lists", "the", "specified", "certificate", "issuer", ".", "The", "GetCertificateIssuer", "operation", "returns", "the", "specified", "certificate", "issuer", "resources", "in", "the", "specified", "key", "vault", ".", "This", "operation", "requires", "the", "certif...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6312-L6314
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator._generate
protected void _generate(SarlAgent agent, IExtraLanguageGeneratorContext context) { final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(agent); final PyAppendable appendable = createAppendable(jvmType, context); final List<JvmTypeReference> superTypes; if (agent.getExtends() != null) { superTypes = Collections.singletonList(agent.getExtends()); } else { superTypes = Collections.singletonList(getTypeReferences().getTypeForName(Agent.class, agent)); } final String qualifiedName = this.qualifiedNameProvider.getFullyQualifiedName(agent).toString(); if (generateTypeDeclaration( qualifiedName, agent.getName(), agent.isAbstract(), superTypes, getTypeBuilder().getDocumentation(agent), true, agent.getMembers(), appendable, context, (it, context2) -> { generateGuardEvaluators(qualifiedName, it, context2); })) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(agent); writeFile(name, appendable, context); } }
java
protected void _generate(SarlAgent agent, IExtraLanguageGeneratorContext context) { final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(agent); final PyAppendable appendable = createAppendable(jvmType, context); final List<JvmTypeReference> superTypes; if (agent.getExtends() != null) { superTypes = Collections.singletonList(agent.getExtends()); } else { superTypes = Collections.singletonList(getTypeReferences().getTypeForName(Agent.class, agent)); } final String qualifiedName = this.qualifiedNameProvider.getFullyQualifiedName(agent).toString(); if (generateTypeDeclaration( qualifiedName, agent.getName(), agent.isAbstract(), superTypes, getTypeBuilder().getDocumentation(agent), true, agent.getMembers(), appendable, context, (it, context2) -> { generateGuardEvaluators(qualifiedName, it, context2); })) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(agent); writeFile(name, appendable, context); } }
[ "protected", "void", "_generate", "(", "SarlAgent", "agent", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "final", "JvmDeclaredType", "jvmType", "=", "getJvmModelAssociations", "(", ")", ".", "getInferredType", "(", "agent", ")", ";", "final", "PyAppe...
Generate the given object. @param agent the agent. @param context the context.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L769-L790
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
ClassDocImpl.findConstructor
public ConstructorDoc findConstructor(String constrName, String[] paramTypes) { Names names = tsym.name.table.names; for (Scope.Entry e = tsym.members().lookup(names.fromString("<init>")); e.scope != null; e = e.next()) { if (e.sym.kind == Kinds.MTH) { if (hasParameterTypes((MethodSymbol)e.sym, paramTypes)) { return env.getConstructorDoc((MethodSymbol)e.sym); } } } //###(gj) As a temporary measure until type variables are better //### handled, try again without the parameter types. //### This will often find the right constructor, and occassionally //### find the wrong one. //if (paramTypes != null) { // return findConstructor(constrName, null); //} return null; }
java
public ConstructorDoc findConstructor(String constrName, String[] paramTypes) { Names names = tsym.name.table.names; for (Scope.Entry e = tsym.members().lookup(names.fromString("<init>")); e.scope != null; e = e.next()) { if (e.sym.kind == Kinds.MTH) { if (hasParameterTypes((MethodSymbol)e.sym, paramTypes)) { return env.getConstructorDoc((MethodSymbol)e.sym); } } } //###(gj) As a temporary measure until type variables are better //### handled, try again without the parameter types. //### This will often find the right constructor, and occassionally //### find the wrong one. //if (paramTypes != null) { // return findConstructor(constrName, null); //} return null; }
[ "public", "ConstructorDoc", "findConstructor", "(", "String", "constrName", ",", "String", "[", "]", "paramTypes", ")", "{", "Names", "names", "=", "tsym", ".", "name", ".", "table", ".", "names", ";", "for", "(", "Scope", ".", "Entry", "e", "=", "tsym",...
Find constructor in this class. @param constrName the unqualified name to search for. @param paramTypes the array of Strings for constructor parameters. @return the first ConstructorDocImpl which matches, null if not found.
[ "Find", "constructor", "in", "this", "class", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java#L1001-L1021
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java
JMElasticsearchIndex.upsertData
public UpdateResponse upsertData(String jsonSource, String index, String type, String id) { return upsertQuery(buildPrepareUpsert(index, type, id, jsonSource)); }
java
public UpdateResponse upsertData(String jsonSource, String index, String type, String id) { return upsertQuery(buildPrepareUpsert(index, type, id, jsonSource)); }
[ "public", "UpdateResponse", "upsertData", "(", "String", "jsonSource", ",", "String", "index", ",", "String", "type", ",", "String", "id", ")", "{", "return", "upsertQuery", "(", "buildPrepareUpsert", "(", "index", ",", "type", ",", "id", ",", "jsonSource", ...
Upsert data update response. @param jsonSource the json source @param index the index @param type the type @param id the id @return the update response
[ "Upsert", "data", "update", "response", "." ]
train
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java#L146-L149
lamydev/Android-Notification
core/src/zemin/notification/NotificationEntry.java
NotificationEntry.addAction
public void addAction(int icon, CharSequence title, Action.OnActionListener listener, ComponentName activity, ComponentName service, String broadcast, Bundle extra) { addAction(new Action(icon, title, listener, activity, service, broadcast, extra)); }
java
public void addAction(int icon, CharSequence title, Action.OnActionListener listener, ComponentName activity, ComponentName service, String broadcast, Bundle extra) { addAction(new Action(icon, title, listener, activity, service, broadcast, extra)); }
[ "public", "void", "addAction", "(", "int", "icon", ",", "CharSequence", "title", ",", "Action", ".", "OnActionListener", "listener", ",", "ComponentName", "activity", ",", "ComponentName", "service", ",", "String", "broadcast", ",", "Bundle", "extra", ")", "{", ...
Add a action to this notification. Actions are typically displayed as a button adjacent to the notification content. @see android.app.Notification#addAction @param icon @param title @param listener @param activity The activity to be started. @param service The service to be started. @param broadcast The broadcast to be sent. @param extra
[ "Add", "a", "action", "to", "this", "notification", ".", "Actions", "are", "typically", "displayed", "as", "a", "button", "adjacent", "to", "the", "notification", "content", "." ]
train
https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationEntry.java#L557-L561
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/ConnectApi.java
ConnectApi.getEventLog
public ConnectLog getEventLog(String accountId, String logId, ConnectApi.GetEventLogOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling getEventLog"); } // verify the required parameter 'logId' is set if (logId == null) { throw new ApiException(400, "Missing the required parameter 'logId' when calling getEventLog"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/connect/logs/{logId}".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "logId" + "\\}", apiClient.escapeString(logId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "additional_info", options.additionalInfo)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<ConnectLog> localVarReturnType = new GenericType<ConnectLog>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
java
public ConnectLog getEventLog(String accountId, String logId, ConnectApi.GetEventLogOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling getEventLog"); } // verify the required parameter 'logId' is set if (logId == null) { throw new ApiException(400, "Missing the required parameter 'logId' when calling getEventLog"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/connect/logs/{logId}".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "logId" + "\\}", apiClient.escapeString(logId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "additional_info", options.additionalInfo)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<ConnectLog> localVarReturnType = new GenericType<ConnectLog>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
[ "public", "ConnectLog", "getEventLog", "(", "String", "accountId", ",", "String", "logId", ",", "ConnectApi", ".", "GetEventLogOptions", "options", ")", "throws", "ApiException", "{", "Object", "localVarPostBody", "=", "\"{}\"", ";", "// verify the required parameter 'a...
Get the specified Connect log entry. Retrieves the specified Connect log entry for your account. ###### Note: The &#x60;enableLog&#x60; setting in the Connect configuration must be set to true to enable logging. If logging is not enabled, then no log entries are recorded. @param accountId The external account number (int) or account ID Guid. (required) @param logId The ID of the connect log entry (required) @param options for modifying the method behavior. @return ConnectLog @throws ApiException if fails to make API call
[ "Get", "the", "specified", "Connect", "log", "entry", ".", "Retrieves", "the", "specified", "Connect", "log", "entry", "for", "your", "account", ".", "######", "Note", ":", "The", "&#x60", ";", "enableLog&#x60", ";", "setting", "in", "the", "Connect", "confi...
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/ConnectApi.java#L362-L404
alkacon/opencms-core
src-gwt/org/opencms/ui/client/CmsSitemapExtensionConnector.java
CmsSitemapExtensionConnector.openPageCopyDialog
public void openPageCopyDialog(String structureId, AsyncCallback<String> callback) { String callId = "" + CALL_COUNTER++; m_callbacks.put(callId, callback); getRpcProxy(I_CmsSitemapServerRpc.class).openPageCopyDialog(callId, "" + structureId); }
java
public void openPageCopyDialog(String structureId, AsyncCallback<String> callback) { String callId = "" + CALL_COUNTER++; m_callbacks.put(callId, callback); getRpcProxy(I_CmsSitemapServerRpc.class).openPageCopyDialog(callId, "" + structureId); }
[ "public", "void", "openPageCopyDialog", "(", "String", "structureId", ",", "AsyncCallback", "<", "String", ">", "callback", ")", "{", "String", "callId", "=", "\"\"", "+", "CALL_COUNTER", "++", ";", "m_callbacks", ".", "put", "(", "callId", ",", "callback", ...
Opens the page copy dialog.<p> @param structureId the structure id of the resource for which to open the dialog @param callback the callback to call with the result when the dialog has finished
[ "Opens", "the", "page", "copy", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ui/client/CmsSitemapExtensionConnector.java#L111-L117
stephanenicolas/robospice
robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/notifier/SpiceServiceListenerNotifier.java
SpiceServiceListenerNotifier.notifyObserversOfRequestNotFound
public void notifyObserversOfRequestNotFound(CachedSpiceRequest<?> request) { RequestProcessingContext requestProcessingContext = new RequestProcessingContext(); requestProcessingContext.setExecutionThread(Thread.currentThread()); post(new RequestNotFoundNotifier(request, spiceServiceListenerList, requestProcessingContext)); }
java
public void notifyObserversOfRequestNotFound(CachedSpiceRequest<?> request) { RequestProcessingContext requestProcessingContext = new RequestProcessingContext(); requestProcessingContext.setExecutionThread(Thread.currentThread()); post(new RequestNotFoundNotifier(request, spiceServiceListenerList, requestProcessingContext)); }
[ "public", "void", "notifyObserversOfRequestNotFound", "(", "CachedSpiceRequest", "<", "?", ">", "request", ")", "{", "RequestProcessingContext", "requestProcessingContext", "=", "new", "RequestProcessingContext", "(", ")", ";", "requestProcessingContext", ".", "setExecution...
Inform the observers of a request. The observers can optionally observe the new request if required. @param request the request that couldn't be aggregated to another request.
[ "Inform", "the", "observers", "of", "a", "request", ".", "The", "observers", "can", "optionally", "observe", "the", "new", "request", "if", "required", "." ]
train
https://github.com/stephanenicolas/robospice/blob/8bffde88b3534a961a13cab72a8f07a755f0a0fe/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/notifier/SpiceServiceListenerNotifier.java#L56-L60
sebastiangraf/perfidix
src/main/java/org/perfidix/element/BenchmarkExecutor.java
BenchmarkExecutor.executeBench
public void executeBench(final Object objToExecute, final Object... args) { final double[] meterResults = new double[METERS_TO_BENCH.size()]; final Method meth = element.getMethodToBench(); int meterIndex1 = 0; int meterIndex2 = 0; for (final AbstractMeter meter : METERS_TO_BENCH) { meterResults[meterIndex1] = meter.getValue(); meterIndex1++; } final PerfidixMethodInvocationException res = invokeMethod(objToExecute, Bench.class, meth, args); for (final AbstractMeter meter : METERS_TO_BENCH) { meterResults[meterIndex2] = meter.getValue() - meterResults[meterIndex2]; meterIndex2++; } if (res == null) { meterIndex1 = 0; for (final AbstractMeter meter : METERS_TO_BENCH) { BENCHRES.addData(element, meter, meterResults[meterIndex1]); meterIndex1++; } } else { BENCHRES.addException(res); } }
java
public void executeBench(final Object objToExecute, final Object... args) { final double[] meterResults = new double[METERS_TO_BENCH.size()]; final Method meth = element.getMethodToBench(); int meterIndex1 = 0; int meterIndex2 = 0; for (final AbstractMeter meter : METERS_TO_BENCH) { meterResults[meterIndex1] = meter.getValue(); meterIndex1++; } final PerfidixMethodInvocationException res = invokeMethod(objToExecute, Bench.class, meth, args); for (final AbstractMeter meter : METERS_TO_BENCH) { meterResults[meterIndex2] = meter.getValue() - meterResults[meterIndex2]; meterIndex2++; } if (res == null) { meterIndex1 = 0; for (final AbstractMeter meter : METERS_TO_BENCH) { BENCHRES.addData(element, meter, meterResults[meterIndex1]); meterIndex1++; } } else { BENCHRES.addException(res); } }
[ "public", "void", "executeBench", "(", "final", "Object", "objToExecute", ",", "final", "Object", "...", "args", ")", "{", "final", "double", "[", "]", "meterResults", "=", "new", "double", "[", "METERS_TO_BENCH", ".", "size", "(", ")", "]", ";", "final", ...
Execution of bench method. All data is stored corresponding to the meters. @param objToExecute the instance of the benchclass where the method should be executed with. @param args arguments for the method to execure
[ "Execution", "of", "bench", "method", ".", "All", "data", "is", "stored", "corresponding", "to", "the", "meters", "." ]
train
https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/element/BenchmarkExecutor.java#L226-L256
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalTransform.java
CrystalTransform.getTranslScrewComponent
public static Vector3d getTranslScrewComponent(Matrix4d m) { int foldType = SpaceGroup.getRotAxisType(m); // For reference see: // http://www.crystallography.fr/mathcryst/pdf/Gargnano/Aroyo_Gargnano_1.pdf Vector3d transl = null; Matrix3d W = new Matrix3d(m.m00,m.m01,m.m02, m.m10,m.m11,m.m12, m.m20,m.m21,m.m22); if (foldType>=0) { // the Y matrix: Y = W^k-1 + W^k-2 ... + W + I ; with k the fold type Matrix3d Y = new Matrix3d(1,0,0, 0,1,0, 0,0,1); Matrix3d Wk = new Matrix3d(1,0,0, 0,1,0, 0,0,1); for (int k=0;k<foldType;k++) { Wk.mul(W); // k=0 Wk=W, k=1 Wk=W^2, k=2 Wk=W^3, ... k=foldType-1, Wk=W^foldType if (k!=foldType-1) Y.add(Wk); } transl = new Vector3d(m.m03, m.m13, m.m23); Y.transform(transl); transl.scale(1.0/foldType); } else { if (foldType==-2) { // there are glide planes only in -2 Matrix3d Y = new Matrix3d(1,0,0, 0,1,0, 0,0,1); Y.add(W); transl = new Vector3d(m.m03, m.m13, m.m23); Y.transform(transl); transl.scale(1.0/2.0); } else { // for -1, -3, -4 and -6 there's nothing to do: fill with 0s transl = new Vector3d(0,0,0); } } return transl; }
java
public static Vector3d getTranslScrewComponent(Matrix4d m) { int foldType = SpaceGroup.getRotAxisType(m); // For reference see: // http://www.crystallography.fr/mathcryst/pdf/Gargnano/Aroyo_Gargnano_1.pdf Vector3d transl = null; Matrix3d W = new Matrix3d(m.m00,m.m01,m.m02, m.m10,m.m11,m.m12, m.m20,m.m21,m.m22); if (foldType>=0) { // the Y matrix: Y = W^k-1 + W^k-2 ... + W + I ; with k the fold type Matrix3d Y = new Matrix3d(1,0,0, 0,1,0, 0,0,1); Matrix3d Wk = new Matrix3d(1,0,0, 0,1,0, 0,0,1); for (int k=0;k<foldType;k++) { Wk.mul(W); // k=0 Wk=W, k=1 Wk=W^2, k=2 Wk=W^3, ... k=foldType-1, Wk=W^foldType if (k!=foldType-1) Y.add(Wk); } transl = new Vector3d(m.m03, m.m13, m.m23); Y.transform(transl); transl.scale(1.0/foldType); } else { if (foldType==-2) { // there are glide planes only in -2 Matrix3d Y = new Matrix3d(1,0,0, 0,1,0, 0,0,1); Y.add(W); transl = new Vector3d(m.m03, m.m13, m.m23); Y.transform(transl); transl.scale(1.0/2.0); } else { // for -1, -3, -4 and -6 there's nothing to do: fill with 0s transl = new Vector3d(0,0,0); } } return transl; }
[ "public", "static", "Vector3d", "getTranslScrewComponent", "(", "Matrix4d", "m", ")", "{", "int", "foldType", "=", "SpaceGroup", ".", "getRotAxisType", "(", "m", ")", ";", "// For reference see:", "// http://www.crystallography.fr/mathcryst/pdf/Gargnano/Aroyo_Gargnano_1.pdf",...
Given a transformation matrix containing a rotation and translation returns the screw component of the rotation. See http://www.crystallography.fr/mathcryst/pdf/Gargnano/Aroyo_Gargnano_1.pdf @param m @return
[ "Given", "a", "transformation", "matrix", "containing", "a", "rotation", "and", "translation", "returns", "the", "screw", "component", "of", "the", "rotation", ".", "See", "http", ":", "//", "www", ".", "crystallography", ".", "fr", "/", "mathcryst", "/", "p...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalTransform.java#L464-L509
BlueBrain/bluima
modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/maxent/AbstractDataIndexer.java
AbstractDataIndexer.toIndexedStringArray
protected static String[] toIndexedStringArray(TObjectIntHashMap labelToIndexMap) { final String[] array = new String[labelToIndexMap.size()]; labelToIndexMap.forEachEntry(new TObjectIntProcedure() { public boolean execute(Object str, int index) { array[index] = (String)str; return true; } }); return array; }
java
protected static String[] toIndexedStringArray(TObjectIntHashMap labelToIndexMap) { final String[] array = new String[labelToIndexMap.size()]; labelToIndexMap.forEachEntry(new TObjectIntProcedure() { public boolean execute(Object str, int index) { array[index] = (String)str; return true; } }); return array; }
[ "protected", "static", "String", "[", "]", "toIndexedStringArray", "(", "TObjectIntHashMap", "labelToIndexMap", ")", "{", "final", "String", "[", "]", "array", "=", "new", "String", "[", "labelToIndexMap", ".", "size", "(", ")", "]", ";", "labelToIndexMap", "....
Utility method for creating a String[] array from a map whose keys are labels (Strings) to be stored in the array and whose values are the indices (Integers) at which the corresponding labels should be inserted. @param labelToIndexMap a <code>TObjectIntHashMap</code> value @return a <code>String[]</code> value @since maxent 1.2.6
[ "Utility", "method", "for", "creating", "a", "String", "[]", "array", "from", "a", "map", "whose", "keys", "are", "labels", "(", "Strings", ")", "to", "be", "stored", "in", "the", "array", "and", "whose", "values", "are", "the", "indices", "(", "Integers...
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/maxent/AbstractDataIndexer.java#L124-L133
Impetus/Kundera
src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBClient.java
KuduDBClient.addPrimaryKeyToRow
private void addPrimaryKeyToRow(PartialRow row, EmbeddableType embeddable, Field[] fields, MetamodelImpl metaModel, Object key) { for (Field f : fields) { if (!ReflectUtils.isTransientOrStatic(f)) { Object value = PropertyAccessorHelper.getObject(key, f); if (f.getType().isAnnotationPresent(Embeddable.class)) { // nested addPrimaryKeyToRow(row, (EmbeddableType) metaModel.embeddable(f.getType()), f.getType().getDeclaredFields(), metaModel, value); } else { Attribute attribute = embeddable.getAttribute(f.getName()); Type type = KuduDBValidationClassMapper.getValidTypeForClass(f.getType()); KuduDBDataHandler.addToRow(row, ((AbstractAttribute) attribute).getJPAColumnName(), value, type); } } } }
java
private void addPrimaryKeyToRow(PartialRow row, EmbeddableType embeddable, Field[] fields, MetamodelImpl metaModel, Object key) { for (Field f : fields) { if (!ReflectUtils.isTransientOrStatic(f)) { Object value = PropertyAccessorHelper.getObject(key, f); if (f.getType().isAnnotationPresent(Embeddable.class)) { // nested addPrimaryKeyToRow(row, (EmbeddableType) metaModel.embeddable(f.getType()), f.getType().getDeclaredFields(), metaModel, value); } else { Attribute attribute = embeddable.getAttribute(f.getName()); Type type = KuduDBValidationClassMapper.getValidTypeForClass(f.getType()); KuduDBDataHandler.addToRow(row, ((AbstractAttribute) attribute).getJPAColumnName(), value, type); } } } }
[ "private", "void", "addPrimaryKeyToRow", "(", "PartialRow", "row", ",", "EmbeddableType", "embeddable", ",", "Field", "[", "]", "fields", ",", "MetamodelImpl", "metaModel", ",", "Object", "key", ")", "{", "for", "(", "Field", "f", ":", "fields", ")", "{", ...
Adds the primary key to row. @param row the row @param embeddable the embeddable @param fields the fields @param metaModel the meta model @param key the key
[ "Adds", "the", "primary", "key", "to", "row", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBClient.java#L822-L846
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/IndexWriter.java
IndexWriter.groupByBucket
CompletableFuture<Collection<BucketUpdate.Builder>> groupByBucket(DirectSegmentAccess segment, Collection<BucketUpdate.KeyUpdate> keyUpdates, TimeoutTimer timer) { val updatesByHash = keyUpdates.stream() .collect(Collectors.groupingBy(k -> this.hasher.hash(k.getKey()))); return locateBuckets(segment, updatesByHash.keySet(), timer) .thenApplyAsync(buckets -> { val result = new HashMap<TableBucket, BucketUpdate.Builder>(); buckets.forEach((keyHash, bucket) -> { // Add the bucket to the result and record this Key as a "new" key in it. BucketUpdate.Builder bu = result.computeIfAbsent(bucket, BucketUpdate::forBucket); updatesByHash.get(keyHash).forEach(bu::withKeyUpdate); }); return result.values(); }, this.executor); }
java
CompletableFuture<Collection<BucketUpdate.Builder>> groupByBucket(DirectSegmentAccess segment, Collection<BucketUpdate.KeyUpdate> keyUpdates, TimeoutTimer timer) { val updatesByHash = keyUpdates.stream() .collect(Collectors.groupingBy(k -> this.hasher.hash(k.getKey()))); return locateBuckets(segment, updatesByHash.keySet(), timer) .thenApplyAsync(buckets -> { val result = new HashMap<TableBucket, BucketUpdate.Builder>(); buckets.forEach((keyHash, bucket) -> { // Add the bucket to the result and record this Key as a "new" key in it. BucketUpdate.Builder bu = result.computeIfAbsent(bucket, BucketUpdate::forBucket); updatesByHash.get(keyHash).forEach(bu::withKeyUpdate); }); return result.values(); }, this.executor); }
[ "CompletableFuture", "<", "Collection", "<", "BucketUpdate", ".", "Builder", ">", ">", "groupByBucket", "(", "DirectSegmentAccess", "segment", ",", "Collection", "<", "BucketUpdate", ".", "KeyUpdate", ">", "keyUpdates", ",", "TimeoutTimer", "timer", ")", "{", "val...
Groups the given {@link BucketUpdate.KeyUpdate} instances by their associated buckets. @param segment The Segment to read from. @param keyUpdates A Collection of {@link BucketUpdate.KeyUpdate} instances to index. @param timer Timer for the operation. @return A CompletableFuture that, when completed, will contain the a collection of {@link BucketUpdate.Builder}s.
[ "Groups", "the", "given", "{", "@link", "BucketUpdate", ".", "KeyUpdate", "}", "instances", "by", "their", "associated", "buckets", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/IndexWriter.java#L73-L88
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/QueryAtomContainerCreator.java
QueryAtomContainerCreator.createAnyAtomAnyBondContainer
public static QueryAtomContainer createAnyAtomAnyBondContainer(IAtomContainer container, boolean aromaticity) { if (aromaticity) return QueryAtomContainer.create(container, Expr.Type.IS_AROMATIC); else return QueryAtomContainer.create(container); }
java
public static QueryAtomContainer createAnyAtomAnyBondContainer(IAtomContainer container, boolean aromaticity) { if (aromaticity) return QueryAtomContainer.create(container, Expr.Type.IS_AROMATIC); else return QueryAtomContainer.create(container); }
[ "public", "static", "QueryAtomContainer", "createAnyAtomAnyBondContainer", "(", "IAtomContainer", "container", ",", "boolean", "aromaticity", ")", "{", "if", "(", "aromaticity", ")", "return", "QueryAtomContainer", ".", "create", "(", "container", ",", "Expr", ".", ...
Creates a QueryAtomContainer with the following settings: <pre> // aromaticity = true QueryAtomContainer.create(container, Expr.Type.IS_AROMATIC); // aromaticity = false QueryAtomContainer.create(container); </pre> @param container The AtomContainer that stands as model @param aromaticity option flag @return The new QueryAtomContainer created from container.
[ "Creates", "a", "QueryAtomContainer", "with", "the", "following", "settings", ":" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/QueryAtomContainerCreator.java#L176-L181
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/file/Page.java
Page.setVal
public synchronized void setVal(int offset, Constant val) { byte[] byteval = val.asBytes(); // Append the size of value if it is not fixed size if (!val.getType().isFixedSize()) { // check the field capacity and value size if (offset + ByteHelper.INT_SIZE + byteval.length > BLOCK_SIZE) throw new BufferOverflowException(); byte[] sizeBytes = ByteHelper.toBytes(byteval.length); contents.put(offset, sizeBytes); offset += sizeBytes.length; } // Put bytes contents.put(offset, byteval); }
java
public synchronized void setVal(int offset, Constant val) { byte[] byteval = val.asBytes(); // Append the size of value if it is not fixed size if (!val.getType().isFixedSize()) { // check the field capacity and value size if (offset + ByteHelper.INT_SIZE + byteval.length > BLOCK_SIZE) throw new BufferOverflowException(); byte[] sizeBytes = ByteHelper.toBytes(byteval.length); contents.put(offset, sizeBytes); offset += sizeBytes.length; } // Put bytes contents.put(offset, byteval); }
[ "public", "synchronized", "void", "setVal", "(", "int", "offset", ",", "Constant", "val", ")", "{", "byte", "[", "]", "byteval", "=", "val", ".", "asBytes", "(", ")", ";", "// Append the size of value if it is not fixed size\r", "if", "(", "!", "val", ".", "...
Writes a constant value to the specified offset on the page. @param offset the byte offset within the page @param val the constant value to be written to the page
[ "Writes", "a", "constant", "value", "to", "the", "specified", "offset", "on", "the", "page", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/file/Page.java#L179-L195
apache/flink
flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java
ClusterClient.getAccumulators
public Map<String, OptionalFailure<Object>> getAccumulators(JobID jobID) throws Exception { return getAccumulators(jobID, ClassLoader.getSystemClassLoader()); }
java
public Map<String, OptionalFailure<Object>> getAccumulators(JobID jobID) throws Exception { return getAccumulators(jobID, ClassLoader.getSystemClassLoader()); }
[ "public", "Map", "<", "String", ",", "OptionalFailure", "<", "Object", ">", ">", "getAccumulators", "(", "JobID", "jobID", ")", "throws", "Exception", "{", "return", "getAccumulators", "(", "jobID", ",", "ClassLoader", ".", "getSystemClassLoader", "(", ")", ")...
Requests and returns the accumulators for the given job identifier. Accumulators can be requested while a is running or after it has finished. The default class loader is used to deserialize the incoming accumulator results. @param jobID The job identifier of a job. @return A Map containing the accumulator's name and its value.
[ "Requests", "and", "returns", "the", "accumulators", "for", "the", "given", "job", "identifier", ".", "Accumulators", "can", "be", "requested", "while", "a", "is", "running", "or", "after", "it", "has", "finished", ".", "The", "default", "class", "loader", "...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java#L397-L399
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/pricelists/PriceListEntryUrl.java
PriceListEntryUrl.deletePriceListEntryUrl
public static MozuUrl deletePriceListEntryUrl(String currencyCode, String priceListCode, String productCode, DateTime startDate) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/pricelists/{priceListCode}/entries/{productCode}/{currencyCode}?startDate={startDate}"); formatter.formatUrl("currencyCode", currencyCode); formatter.formatUrl("priceListCode", priceListCode); formatter.formatUrl("productCode", productCode); formatter.formatUrl("startDate", startDate); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl deletePriceListEntryUrl(String currencyCode, String priceListCode, String productCode, DateTime startDate) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/pricelists/{priceListCode}/entries/{productCode}/{currencyCode}?startDate={startDate}"); formatter.formatUrl("currencyCode", currencyCode); formatter.formatUrl("priceListCode", priceListCode); formatter.formatUrl("productCode", productCode); formatter.formatUrl("startDate", startDate); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "deletePriceListEntryUrl", "(", "String", "currencyCode", ",", "String", "priceListCode", ",", "String", "productCode", ",", "DateTime", "startDate", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerc...
Get Resource Url for DeletePriceListEntry @param currencyCode The three character ISO currency code, such as USD for US Dollars. @param priceListCode The code of the specified price list associated with the price list entry. @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. @param startDate The start date of the price list entry. @return String Resource Url
[ "Get", "Resource", "Url", "for", "DeletePriceListEntry" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/pricelists/PriceListEntryUrl.java#L100-L108
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/XmlFixture.java
XmlFixture.registerPrefixForNamespace
public void registerPrefixForNamespace(String prefix, String namespace) { getEnvironment().registerNamespace(prefix, getUrl(namespace)); }
java
public void registerPrefixForNamespace(String prefix, String namespace) { getEnvironment().registerNamespace(prefix, getUrl(namespace)); }
[ "public", "void", "registerPrefixForNamespace", "(", "String", "prefix", ",", "String", "namespace", ")", "{", "getEnvironment", "(", ")", ".", "registerNamespace", "(", "prefix", ",", "getUrl", "(", "namespace", ")", ")", ";", "}" ]
Register a prefix to use in XPath expressions. @param prefix prefix to be used in xPath expressions. @param namespace XML namespace the prefix should point to.
[ "Register", "a", "prefix", "to", "use", "in", "XPath", "expressions", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/XmlFixture.java#L52-L54
cdk/cdk
descriptor/signature/src/main/java/org/openscience/cdk/signature/MoleculeSignature.java
MoleculeSignature.fromSignatureString
public static IAtomContainer fromSignatureString(String signatureString, IChemObjectBuilder coBuilder) { ColoredTree tree = AtomSignature.parse(signatureString); MoleculeFromSignatureBuilder builder = new MoleculeFromSignatureBuilder(coBuilder); builder.makeFromColoredTree(tree); return builder.getAtomContainer(); }
java
public static IAtomContainer fromSignatureString(String signatureString, IChemObjectBuilder coBuilder) { ColoredTree tree = AtomSignature.parse(signatureString); MoleculeFromSignatureBuilder builder = new MoleculeFromSignatureBuilder(coBuilder); builder.makeFromColoredTree(tree); return builder.getAtomContainer(); }
[ "public", "static", "IAtomContainer", "fromSignatureString", "(", "String", "signatureString", ",", "IChemObjectBuilder", "coBuilder", ")", "{", "ColoredTree", "tree", "=", "AtomSignature", ".", "parse", "(", "signatureString", ")", ";", "MoleculeFromSignatureBuilder", ...
Builder for molecules (rather, for atom containers) from signature strings. @param signatureString the signature string to use @param coBuilder {@link IChemObjectBuilder} to build the returned atom container from @return an atom container
[ "Builder", "for", "molecules", "(", "rather", "for", "atom", "containers", ")", "from", "signature", "strings", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/signature/src/main/java/org/openscience/cdk/signature/MoleculeSignature.java#L179-L184
houbb/log-integration
src/main/java/com/github/houbb/log/integration/adaptors/jdbc/ConnectionLogger.java
ConnectionLogger.newInstance
public static Connection newInstance(Connection conn, Log statementLog, int queryStack) { InvocationHandler handler = new ConnectionLogger(conn, statementLog, queryStack); ClassLoader cl = Connection.class.getClassLoader(); return (Connection) Proxy.newProxyInstance(cl, new Class[]{Connection.class}, handler); }
java
public static Connection newInstance(Connection conn, Log statementLog, int queryStack) { InvocationHandler handler = new ConnectionLogger(conn, statementLog, queryStack); ClassLoader cl = Connection.class.getClassLoader(); return (Connection) Proxy.newProxyInstance(cl, new Class[]{Connection.class}, handler); }
[ "public", "static", "Connection", "newInstance", "(", "Connection", "conn", ",", "Log", "statementLog", ",", "int", "queryStack", ")", "{", "InvocationHandler", "handler", "=", "new", "ConnectionLogger", "(", "conn", ",", "statementLog", ",", "queryStack", ")", ...
/* Creates a logging version of a connection @param conn - the original connection @return - the connection with logging
[ "/", "*", "Creates", "a", "logging", "version", "of", "a", "connection" ]
train
https://github.com/houbb/log-integration/blob/c5e979719aec12a02f7d22b24b04b6fbb1789ca5/src/main/java/com/github/houbb/log/integration/adaptors/jdbc/ConnectionLogger.java#L81-L85
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateTime.java
DateTime.isIn
public boolean isIn(Date beginDate, Date endDate) { long beginMills = beginDate.getTime(); long endMills = endDate.getTime(); long thisMills = this.getTime(); return thisMills >= Math.min(beginMills, endMills) && thisMills <= Math.max(beginMills, endMills); }
java
public boolean isIn(Date beginDate, Date endDate) { long beginMills = beginDate.getTime(); long endMills = endDate.getTime(); long thisMills = this.getTime(); return thisMills >= Math.min(beginMills, endMills) && thisMills <= Math.max(beginMills, endMills); }
[ "public", "boolean", "isIn", "(", "Date", "beginDate", ",", "Date", "endDate", ")", "{", "long", "beginMills", "=", "beginDate", ".", "getTime", "(", ")", ";", "long", "endMills", "=", "endDate", ".", "getTime", "(", ")", ";", "long", "thisMills", "=", ...
当前日期是否在日期指定范围内<br> 起始日期和结束日期可以互换 @param beginDate 起始日期 @param endDate 结束日期 @return 是否在范围内 @since 3.0.8
[ "当前日期是否在日期指定范围内<br", ">", "起始日期和结束日期可以互换" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateTime.java#L622-L628
voldemort/voldemort
src/java/voldemort/client/rebalance/task/RebalanceTask.java
RebalanceTask.logPermitStatus
protected void logPermitStatus(int nodeId, String prefix) { String durationString = ""; if(permitAcquisitionTimeMs >= 0) { long durationMs = System.currentTimeMillis() - permitAcquisitionTimeMs; permitAcquisitionTimeMs = -1; durationString = " in " + TimeUnit.MILLISECONDS.toSeconds(durationMs) + " seconds."; } taskLog(prefix + nodeId + durationString); }
java
protected void logPermitStatus(int nodeId, String prefix) { String durationString = ""; if(permitAcquisitionTimeMs >= 0) { long durationMs = System.currentTimeMillis() - permitAcquisitionTimeMs; permitAcquisitionTimeMs = -1; durationString = " in " + TimeUnit.MILLISECONDS.toSeconds(durationMs) + " seconds."; } taskLog(prefix + nodeId + durationString); }
[ "protected", "void", "logPermitStatus", "(", "int", "nodeId", ",", "String", "prefix", ")", "{", "String", "durationString", "=", "\"\"", ";", "if", "(", "permitAcquisitionTimeMs", ">=", "0", ")", "{", "long", "durationMs", "=", "System", ".", "currentTimeMill...
Helper method to pretty print progress and timing info. @param nodeId node ID for which donor permit is required
[ "Helper", "method", "to", "pretty", "print", "progress", "and", "timing", "info", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/task/RebalanceTask.java#L131-L139
sababado/CircularView
library/src/main/java/com/sababado/circularview/CircularViewObject.java
CircularViewObject.distanceFromCenter
public double distanceFromCenter(final float x, final float y) { return Math.sqrt(Math.pow(x - this.x, 2) + Math.pow(y - this.y, 2)); }
java
public double distanceFromCenter(final float x, final float y) { return Math.sqrt(Math.pow(x - this.x, 2) + Math.pow(y - this.y, 2)); }
[ "public", "double", "distanceFromCenter", "(", "final", "float", "x", ",", "final", "float", "y", ")", "{", "return", "Math", ".", "sqrt", "(", "Math", ".", "pow", "(", "x", "-", "this", ".", "x", ",", "2", ")", "+", "Math", ".", "pow", "(", "y",...
Get the distance from the given point to the center of this object. @param x X coordinate. @param y Y coordinate. @return Distance from the given point to the center of this object.
[ "Get", "the", "distance", "from", "the", "given", "point", "to", "the", "center", "of", "this", "object", "." ]
train
https://github.com/sababado/CircularView/blob/c9ab818d063bcc0796183616f8a82166a9b80aac/library/src/main/java/com/sababado/circularview/CircularViewObject.java#L153-L155
jbundle/jbundle
main/db/src/main/java/org/jbundle/main/user/db/UserInfo.java
UserInfo.addPropertyListeners
public void addPropertyListeners() { BaseField fldProperties = this.getField(PropertiesRecord.PROPERTIES); if (fldProperties.getListener(CopyConvertersHandler.class) != null) return; this.addPropertiesFieldBehavior(this.getField(UserInfo.FRAMES), DBParams.FRAMES); this.addPropertiesFieldBehavior(this.getField(UserInfo.JAVA), DBParams.JAVA); this.addPropertiesFieldBehavior(this.getField(UserInfo.HOME), DBParams.HOME); this.addPropertiesFieldBehavior(this.getField(UserInfo.MENU), DBParams.MENU); this.addPropertiesFieldBehavior(this.getField(UserInfo.BANNERS), DBParams.BANNERS); this.addPropertiesFieldBehavior(this.getField(UserInfo.TRAILERS), DBParams.TRAILERS); this.addPropertiesFieldBehavior(this.getField(UserInfo.MENUBARS), DBParams.MENUBARS); this.addPropertiesFieldBehavior(this.getField(UserInfo.LOGOS), DBParams.LOGOS); this.addPropertiesFieldBehavior(this.getField(UserInfo.NAV_MENUS), DBParams.NAVMENUS); this.addPropertiesFieldBehavior(this.getField(UserInfo.MENU_DESC), DBParams.MENUDESC); this.addPropertiesFieldBehavior(this.getField(UserInfo.HELP_PAGE), MenuConstants.USER_HELP_DISPLAY); this.addPropertiesFieldBehavior(this.getField(UserInfo.LANGUAGE), DBParams.LANGUAGE); Record recContactType = ((ReferenceField)this.getField(UserInfo.CONTACT_TYPE_ID)).getReferenceRecord(); this.getField(UserInfo.CONTACT_TYPE_ID).addListener(new ReadSecondaryHandler(recContactType)); BaseField fldContactTypeCode = recContactType.getField(ContactType.CODE); CopyConvertersHandler listener = new CopyConvertersHandler(new PropertiesConverter(fldProperties, DBParams.CONTACT_TYPE), fldContactTypeCode); this.getField(UserInfo.CONTACT_TYPE_ID).addListener(listener); listener.setRespondsToMode(DBConstants.INIT_MOVE, false); listener.setRespondsToMode(DBConstants.READ_MOVE, false); this.addPropertiesFieldBehavior(this.getField(UserInfo.CONTACT_TYPE_ID), DBParams.CONTACT_TYPE + DBParams.ID); this.addPropertiesFieldBehavior(this.getField(UserInfo.CONTACT_ID), DBParams.CONTACT_ID); }
java
public void addPropertyListeners() { BaseField fldProperties = this.getField(PropertiesRecord.PROPERTIES); if (fldProperties.getListener(CopyConvertersHandler.class) != null) return; this.addPropertiesFieldBehavior(this.getField(UserInfo.FRAMES), DBParams.FRAMES); this.addPropertiesFieldBehavior(this.getField(UserInfo.JAVA), DBParams.JAVA); this.addPropertiesFieldBehavior(this.getField(UserInfo.HOME), DBParams.HOME); this.addPropertiesFieldBehavior(this.getField(UserInfo.MENU), DBParams.MENU); this.addPropertiesFieldBehavior(this.getField(UserInfo.BANNERS), DBParams.BANNERS); this.addPropertiesFieldBehavior(this.getField(UserInfo.TRAILERS), DBParams.TRAILERS); this.addPropertiesFieldBehavior(this.getField(UserInfo.MENUBARS), DBParams.MENUBARS); this.addPropertiesFieldBehavior(this.getField(UserInfo.LOGOS), DBParams.LOGOS); this.addPropertiesFieldBehavior(this.getField(UserInfo.NAV_MENUS), DBParams.NAVMENUS); this.addPropertiesFieldBehavior(this.getField(UserInfo.MENU_DESC), DBParams.MENUDESC); this.addPropertiesFieldBehavior(this.getField(UserInfo.HELP_PAGE), MenuConstants.USER_HELP_DISPLAY); this.addPropertiesFieldBehavior(this.getField(UserInfo.LANGUAGE), DBParams.LANGUAGE); Record recContactType = ((ReferenceField)this.getField(UserInfo.CONTACT_TYPE_ID)).getReferenceRecord(); this.getField(UserInfo.CONTACT_TYPE_ID).addListener(new ReadSecondaryHandler(recContactType)); BaseField fldContactTypeCode = recContactType.getField(ContactType.CODE); CopyConvertersHandler listener = new CopyConvertersHandler(new PropertiesConverter(fldProperties, DBParams.CONTACT_TYPE), fldContactTypeCode); this.getField(UserInfo.CONTACT_TYPE_ID).addListener(listener); listener.setRespondsToMode(DBConstants.INIT_MOVE, false); listener.setRespondsToMode(DBConstants.READ_MOVE, false); this.addPropertiesFieldBehavior(this.getField(UserInfo.CONTACT_TYPE_ID), DBParams.CONTACT_TYPE + DBParams.ID); this.addPropertiesFieldBehavior(this.getField(UserInfo.CONTACT_ID), DBParams.CONTACT_ID); }
[ "public", "void", "addPropertyListeners", "(", ")", "{", "BaseField", "fldProperties", "=", "this", ".", "getField", "(", "PropertiesRecord", ".", "PROPERTIES", ")", ";", "if", "(", "fldProperties", ".", "getListener", "(", "CopyConvertersHandler", ".", "class", ...
Add The listeners to sync the property field with the virtual fields.
[ "Add", "The", "listeners", "to", "sync", "the", "property", "field", "with", "the", "virtual", "fields", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/user/db/UserInfo.java#L309-L338
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java
NodeVector.pushPair
public final void pushPair(int v1, int v2) { if (null == m_map) { m_map = new int[m_blocksize]; m_mapSize = m_blocksize; } else { if ((m_firstFree + 2) >= m_mapSize) { m_mapSize += m_blocksize; int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree); m_map = newMap; } } m_map[m_firstFree] = v1; m_map[m_firstFree + 1] = v2; m_firstFree += 2; }
java
public final void pushPair(int v1, int v2) { if (null == m_map) { m_map = new int[m_blocksize]; m_mapSize = m_blocksize; } else { if ((m_firstFree + 2) >= m_mapSize) { m_mapSize += m_blocksize; int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree); m_map = newMap; } } m_map[m_firstFree] = v1; m_map[m_firstFree + 1] = v2; m_firstFree += 2; }
[ "public", "final", "void", "pushPair", "(", "int", "v1", ",", "int", "v2", ")", "{", "if", "(", "null", "==", "m_map", ")", "{", "m_map", "=", "new", "int", "[", "m_blocksize", "]", ";", "m_mapSize", "=", "m_blocksize", ";", "}", "else", "{", "if",...
Push a pair of nodes into the stack. Special purpose method for TransformerImpl, pushElemTemplateElement. Performance critical. @param v1 First node to add to vector @param v2 Second node to add to vector
[ "Push", "a", "pair", "of", "nodes", "into", "the", "stack", ".", "Special", "purpose", "method", "for", "TransformerImpl", "pushElemTemplateElement", ".", "Performance", "critical", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java#L244-L269
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterHeartbeatManager.java
ClusterHeartbeatManager.logIfConnectionToEndpointIsMissing
private void logIfConnectionToEndpointIsMissing(long now, Member member) { long heartbeatTime = heartbeatFailureDetector.lastHeartbeat(member); if ((now - heartbeatTime) >= heartbeatIntervalMillis * HEART_BEAT_INTERVAL_FACTOR) { Connection conn = node.getEndpointManager(MEMBER).getOrConnect(member.getAddress()); if (conn == null || !conn.isAlive()) { logger.warning("This node does not have a connection to " + member); } } }
java
private void logIfConnectionToEndpointIsMissing(long now, Member member) { long heartbeatTime = heartbeatFailureDetector.lastHeartbeat(member); if ((now - heartbeatTime) >= heartbeatIntervalMillis * HEART_BEAT_INTERVAL_FACTOR) { Connection conn = node.getEndpointManager(MEMBER).getOrConnect(member.getAddress()); if (conn == null || !conn.isAlive()) { logger.warning("This node does not have a connection to " + member); } } }
[ "private", "void", "logIfConnectionToEndpointIsMissing", "(", "long", "now", ",", "Member", "member", ")", "{", "long", "heartbeatTime", "=", "heartbeatFailureDetector", ".", "lastHeartbeat", "(", "member", ")", ";", "if", "(", "(", "now", "-", "heartbeatTime", ...
Logs a warning if the {@code member} hasn't sent a heartbeat in {@link #HEART_BEAT_INTERVAL_FACTOR} heartbeat intervals and there is no live connection to the member
[ "Logs", "a", "warning", "if", "the", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterHeartbeatManager.java#L634-L642
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/util/StringUtilities.java
StringUtilities.getWildcardMatcher
public static Matcher getWildcardMatcher(String str, String expr, boolean whole) { expr = expr.replaceAll("\\?",".?"); expr = expr.replaceAll("\\*",".*?"); if(whole) expr = "^"+expr+"$"; Pattern pattern = Pattern.compile(expr/*, Pattern.DOTALL*/); return pattern.matcher(str); }
java
public static Matcher getWildcardMatcher(String str, String expr, boolean whole) { expr = expr.replaceAll("\\?",".?"); expr = expr.replaceAll("\\*",".*?"); if(whole) expr = "^"+expr+"$"; Pattern pattern = Pattern.compile(expr/*, Pattern.DOTALL*/); return pattern.matcher(str); }
[ "public", "static", "Matcher", "getWildcardMatcher", "(", "String", "str", ",", "String", "expr", ",", "boolean", "whole", ")", "{", "expr", "=", "expr", ".", "replaceAll", "(", "\"\\\\?\"", ",", "\".?\"", ")", ";", "expr", "=", "expr", ".", "replaceAll", ...
Returns <CODE>true</CODE> if the given string matches the given regular expression. @param str The string against which the expression is to be matched @param expr The regular expression to match with the input string @param whole Indicates that a whole word match is required @return An object giving the results of the search (or null if no match found)
[ "Returns", "<CODE", ">", "true<", "/", "CODE", ">", "if", "the", "given", "string", "matches", "the", "given", "regular", "expression", "." ]
train
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/StringUtilities.java#L318-L326
spring-cloud/spring-cloud-contract
spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/util/ContractVerifierUtil.java
ContractVerifierUtil.valueFromXPath
public static String valueFromXPath(Document parsedXml, String path) { XPath xPath = XPathFactory.newInstance().newXPath(); try { return xPath.evaluate(path, parsedXml.getDocumentElement()); } catch (XPathExpressionException exception) { LOG.error("Incorrect xpath provided: " + path, exception); throw new IllegalArgumentException(); } }
java
public static String valueFromXPath(Document parsedXml, String path) { XPath xPath = XPathFactory.newInstance().newXPath(); try { return xPath.evaluate(path, parsedXml.getDocumentElement()); } catch (XPathExpressionException exception) { LOG.error("Incorrect xpath provided: " + path, exception); throw new IllegalArgumentException(); } }
[ "public", "static", "String", "valueFromXPath", "(", "Document", "parsedXml", ",", "String", "path", ")", "{", "XPath", "xPath", "=", "XPathFactory", ".", "newInstance", "(", ")", ".", "newXPath", "(", ")", ";", "try", "{", "return", "xPath", ".", "evaluat...
Helper method to retrieve XML node value with provided xPath. @param parsedXml - a {@link Document} object with parsed XML content @param path - the xPath expression to retrieve the value with @return {@link String} value of the XML node @since 2.1.0
[ "Helper", "method", "to", "retrieve", "XML", "node", "value", "with", "provided", "xPath", "." ]
train
https://github.com/spring-cloud/spring-cloud-contract/blob/857da51950a87b393286e3bb1b2208c420c01087/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/util/ContractVerifierUtil.java#L78-L87
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/FeaturesImpl.java
FeaturesImpl.getPhraseListAsync
public Observable<PhraseListFeatureInfo> getPhraseListAsync(UUID appId, String versionId, int phraselistId) { return getPhraseListWithServiceResponseAsync(appId, versionId, phraselistId).map(new Func1<ServiceResponse<PhraseListFeatureInfo>, PhraseListFeatureInfo>() { @Override public PhraseListFeatureInfo call(ServiceResponse<PhraseListFeatureInfo> response) { return response.body(); } }); }
java
public Observable<PhraseListFeatureInfo> getPhraseListAsync(UUID appId, String versionId, int phraselistId) { return getPhraseListWithServiceResponseAsync(appId, versionId, phraselistId).map(new Func1<ServiceResponse<PhraseListFeatureInfo>, PhraseListFeatureInfo>() { @Override public PhraseListFeatureInfo call(ServiceResponse<PhraseListFeatureInfo> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PhraseListFeatureInfo", ">", "getPhraseListAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "int", "phraselistId", ")", "{", "return", "getPhraseListWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "phraselist...
Gets phraselist feature info. @param appId The application ID. @param versionId The version ID. @param phraselistId The ID of the feature to be retrieved. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PhraseListFeatureInfo object
[ "Gets", "phraselist", "feature", "info", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/FeaturesImpl.java#L583-L590
google/error-prone-javac
src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java
SimpleElementVisitor9.visitModule
@Override public R visitModule(ModuleElement e, P p) { return defaultAction(e, p); }
java
@Override public R visitModule(ModuleElement e, P p) { return defaultAction(e, p); }
[ "@", "Override", "public", "R", "visitModule", "(", "ModuleElement", "e", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "e", ",", "p", ")", ";", "}" ]
Visits a {@code ModuleElement} by calling {@code defaultAction}. @param e the element to visit @param p a visitor-specified parameter @return the result of {@code defaultAction}
[ "Visits", "a", "{", "@code", "ModuleElement", "}", "by", "calling", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java#L104-L107
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/memento/FileMemento.java
FileMemento.restore
public Object restore(String savePoint, Class<?> objClass) { String location = whereIs(savePoint, objClass); Object cacheObject = CacheFarm.getCache().get(location); if(cacheObject != null) return cacheObject; cacheObject = IO.deserialize(new File(location)); CacheFarm.getCache().put(location, cacheObject); return cacheObject; }
java
public Object restore(String savePoint, Class<?> objClass) { String location = whereIs(savePoint, objClass); Object cacheObject = CacheFarm.getCache().get(location); if(cacheObject != null) return cacheObject; cacheObject = IO.deserialize(new File(location)); CacheFarm.getCache().put(location, cacheObject); return cacheObject; }
[ "public", "Object", "restore", "(", "String", "savePoint", ",", "Class", "<", "?", ">", "objClass", ")", "{", "String", "location", "=", "whereIs", "(", "savePoint", ",", "objClass", ")", ";", "Object", "cacheObject", "=", "CacheFarm", ".", "getCache", "("...
Retrieve the de-serialized object @param savePoint the save point @param objClass the object class @return the object the object
[ "Retrieve", "the", "de", "-", "serialized", "object" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/memento/FileMemento.java#L33-L45
passwordmaker/java-passwordmaker-lib
src/main/java/org/daveware/passwordmaker/Database.java
Database.findParent
private Account findParent(Account parent, Account account) { if (parent == null || account == null) return null; // Does this parent contain the child account? if (parent.getChildren().contains(account)) return parent; // Recurse through the children for (Account child : parent.getChildren()) { Account theOne = findParent(child, account); if (theOne != null) return theOne; } return null; }
java
private Account findParent(Account parent, Account account) { if (parent == null || account == null) return null; // Does this parent contain the child account? if (parent.getChildren().contains(account)) return parent; // Recurse through the children for (Account child : parent.getChildren()) { Account theOne = findParent(child, account); if (theOne != null) return theOne; } return null; }
[ "private", "Account", "findParent", "(", "Account", "parent", ",", "Account", "account", ")", "{", "if", "(", "parent", "==", "null", "||", "account", "==", "null", ")", "return", "null", ";", "// Does this parent contain the child account?", "if", "(", "parent"...
Internal routine to locate a parent (recursive, don't loop your trees!). @param parent The parent to start searching with. @param account The account to find the parent of. @return The parent account, else null if not found.
[ "Internal", "routine", "to", "locate", "a", "parent", "(", "recursive", "don", "t", "loop", "your", "trees!", ")", "." ]
train
https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/Database.java#L443-L459
Stratio/cassandra-lucene-index
plugin/src/main/java/com/stratio/cassandra/lucene/search/sort/SimpleSortField.java
SimpleSortField.sortField
@Override public org.apache.lucene.search.SortField sortField(Schema schema) { if (field.equalsIgnoreCase("score")) { return FIELD_SCORE; } Mapper mapper = schema.mapper(field); if (mapper == null) { throw new IndexException("No mapper found for sortFields field '{}'", field); } else if (!mapper.docValues) { throw new IndexException("Field '{}' does not support sorting", field); } else { return mapper.sortField(field, reverse); } }
java
@Override public org.apache.lucene.search.SortField sortField(Schema schema) { if (field.equalsIgnoreCase("score")) { return FIELD_SCORE; } Mapper mapper = schema.mapper(field); if (mapper == null) { throw new IndexException("No mapper found for sortFields field '{}'", field); } else if (!mapper.docValues) { throw new IndexException("Field '{}' does not support sorting", field); } else { return mapper.sortField(field, reverse); } }
[ "@", "Override", "public", "org", ".", "apache", ".", "lucene", ".", "search", ".", "SortField", "sortField", "(", "Schema", "schema", ")", "{", "if", "(", "field", ".", "equalsIgnoreCase", "(", "\"score\"", ")", ")", "{", "return", "FIELD_SCORE", ";", "...
Returns the Lucene {@link org.apache.lucene.search.SortField} representing this {@link SortField}. @param schema the {@link Schema} to be used @return the equivalent Lucene sort field
[ "Returns", "the", "Lucene", "{", "@link", "org", ".", "apache", ".", "lucene", ".", "search", ".", "SortField", "}", "representing", "this", "{", "@link", "SortField", "}", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/search/sort/SimpleSortField.java#L66-L79
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/references/StandardTypeReferenceOwner.java
StandardTypeReferenceOwner.newReferenceTo
@Override public LightweightTypeReference newReferenceTo(Class<?> type, TypeReferenceInitializer<? super ParameterizedTypeReference> init) { if (init == null) { throw new NullPointerException("initializer"); } JvmType rawType = getServices().getTypeReferences().findDeclaredType(type, getContextResourceSet()); if (rawType == null) { return newUnknownTypeReference(type.getName()); } if (rawType.eClass() == TypesPackage.Literals.JVM_ARRAY_TYPE) { throw new IllegalArgumentException("given type is an array type: " + type); } ParameterizedTypeReference result = newParameterizedTypeReference(rawType); return init.enhance(result); }
java
@Override public LightweightTypeReference newReferenceTo(Class<?> type, TypeReferenceInitializer<? super ParameterizedTypeReference> init) { if (init == null) { throw new NullPointerException("initializer"); } JvmType rawType = getServices().getTypeReferences().findDeclaredType(type, getContextResourceSet()); if (rawType == null) { return newUnknownTypeReference(type.getName()); } if (rawType.eClass() == TypesPackage.Literals.JVM_ARRAY_TYPE) { throw new IllegalArgumentException("given type is an array type: " + type); } ParameterizedTypeReference result = newParameterizedTypeReference(rawType); return init.enhance(result); }
[ "@", "Override", "public", "LightweightTypeReference", "newReferenceTo", "(", "Class", "<", "?", ">", "type", ",", "TypeReferenceInitializer", "<", "?", "super", "ParameterizedTypeReference", ">", "init", ")", "{", "if", "(", "init", "==", "null", ")", "{", "t...
Creates a references to the given class or returns an {@link UnknownTypeReference} if no JRE is available. If the type is available, the given acceptor is used to initialize it further.
[ "Creates", "a", "references", "to", "the", "given", "class", "or", "returns", "an", "{" ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/references/StandardTypeReferenceOwner.java#L227-L241
nemerosa/ontrack
ontrack-common/src/main/java/net/nemerosa/ontrack/common/Utils.java
Utils.toHexString
public static String toHexString(byte[] bytes, int start, int len) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < len; i++) { int b = bytes[start + i] & 0xFF; if (b < 16) buf.append('0'); buf.append(Integer.toHexString(b)); } return buf.toString(); }
java
public static String toHexString(byte[] bytes, int start, int len) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < len; i++) { int b = bytes[start + i] & 0xFF; if (b < 16) buf.append('0'); buf.append(Integer.toHexString(b)); } return buf.toString(); }
[ "public", "static", "String", "toHexString", "(", "byte", "[", "]", "bytes", ",", "int", "start", ",", "int", "len", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len...
Writes some bytes in Hexadecimal format @param bytes Bytes to format @param start Start position for the conversion @param len Number of bytes to convert @return Hex string
[ "Writes", "some", "bytes", "in", "Hexadecimal", "format" ]
train
https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-common/src/main/java/net/nemerosa/ontrack/common/Utils.java#L118-L126
jenkinsci/jenkins
core/src/main/java/hudson/util/ArgumentListBuilder.java
ArgumentListBuilder.addKeyValuePairs
public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props, Set<String> propsToMask) { for (Entry<String,String> e : props.entrySet()) { addKeyValuePair(prefix, e.getKey(), e.getValue(), (propsToMask != null) && propsToMask.contains(e.getKey())); } return this; }
java
public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props, Set<String> propsToMask) { for (Entry<String,String> e : props.entrySet()) { addKeyValuePair(prefix, e.getKey(), e.getValue(), (propsToMask != null) && propsToMask.contains(e.getKey())); } return this; }
[ "public", "ArgumentListBuilder", "addKeyValuePairs", "(", "String", "prefix", ",", "Map", "<", "String", ",", "String", ">", "props", ",", "Set", "<", "String", ">", "propsToMask", ")", "{", "for", "(", "Entry", "<", "String", ",", "String", ">", "e", ":...
Adds key value pairs as "-Dkey=value -Dkey=value ..." with masking. @param prefix Configures the -D portion of the example. Defaults to -D if null. @param props The map of key/value pairs to add @param propsToMask Set containing key names to mark as masked in the argument list. Key names that do not exist in the set will be added unmasked. @since 1.378
[ "Adds", "key", "value", "pairs", "as", "-", "Dkey", "=", "value", "-", "Dkey", "=", "value", "...", "with", "masking", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/ArgumentListBuilder.java#L189-L194
digipost/signature-api-client-java
src/main/java/no/digipost/signature/client/security/KeyStoreConfig.java
KeyStoreConfig.fromJavaKeyStore
public static KeyStoreConfig fromJavaKeyStore(final InputStream javaKeyStore, final String alias, final String keyStorePassword, final String privatekeyPassword) { KeyStore ks = KeyStoreType.JCEKS.loadKeyStore(javaKeyStore, keyStorePassword); return new KeyStoreConfig(ks, alias, keyStorePassword, privatekeyPassword); }
java
public static KeyStoreConfig fromJavaKeyStore(final InputStream javaKeyStore, final String alias, final String keyStorePassword, final String privatekeyPassword) { KeyStore ks = KeyStoreType.JCEKS.loadKeyStore(javaKeyStore, keyStorePassword); return new KeyStoreConfig(ks, alias, keyStorePassword, privatekeyPassword); }
[ "public", "static", "KeyStoreConfig", "fromJavaKeyStore", "(", "final", "InputStream", "javaKeyStore", ",", "final", "String", "alias", ",", "final", "String", "keyStorePassword", ",", "final", "String", "privatekeyPassword", ")", "{", "KeyStore", "ks", "=", "KeySto...
Create a {@link KeyStoreConfig} from a Java Key Store containing an Organization Certificate (Virksomhetssertifikat). @param javaKeyStore A stream of the certificate in JCEKS format. @param alias The alias of the organization certificate in the key store. @param keyStorePassword The password for the key store itself. @param privatekeyPassword The password for the private key of the organization certificate within the key store. @return The config, containing the certificate, the private key and the certificate chain.
[ "Create", "a", "{", "@link", "KeyStoreConfig", "}", "from", "a", "Java", "Key", "Store", "containing", "an", "Organization", "Certificate", "(", "Virksomhetssertifikat", ")", "." ]
train
https://github.com/digipost/signature-api-client-java/blob/246207571641fbac6beda5ffc585eec188825c45/src/main/java/no/digipost/signature/client/security/KeyStoreConfig.java#L108-L112