repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
recommenders/rival
rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/AbstractStrategy.java
AbstractStrategy.printRanking
protected void printRanking(final String user, final Map<Long, Double> scoredItems, final PrintStream out, final OUTPUT_FORMAT format) { final Map<Double, Set<Long>> preferenceMap = new HashMap<Double, Set<Long>>(); for (Map.Entry<Long, Double> e : scoredItems.entrySet()) { long item = e.getKey(); double pref = e.getValue(); // ignore NaN's if (Double.isNaN(pref)) { continue; } Set<Long> items = preferenceMap.get(pref); if (items == null) { items = new HashSet<Long>(); preferenceMap.put(pref, items); } items.add(item); } final List<Double> sortedScores = new ArrayList<Double>(preferenceMap.keySet()); Collections.sort(sortedScores, Collections.reverseOrder()); // Write estimated preferences int pos = 1; for (double pref : sortedScores) { for (long itemID : preferenceMap.get(pref)) { switch (format) { case TRECEVAL: out.println(user + "\tQ0\t" + itemID + "\t" + pos + "\t" + pref + "\t" + "r"); break; default: case SIMPLE: out.println(user + "\t" + itemID + "\t" + pref); break; } pos++; } } }
java
protected void printRanking(final String user, final Map<Long, Double> scoredItems, final PrintStream out, final OUTPUT_FORMAT format) { final Map<Double, Set<Long>> preferenceMap = new HashMap<Double, Set<Long>>(); for (Map.Entry<Long, Double> e : scoredItems.entrySet()) { long item = e.getKey(); double pref = e.getValue(); // ignore NaN's if (Double.isNaN(pref)) { continue; } Set<Long> items = preferenceMap.get(pref); if (items == null) { items = new HashSet<Long>(); preferenceMap.put(pref, items); } items.add(item); } final List<Double> sortedScores = new ArrayList<Double>(preferenceMap.keySet()); Collections.sort(sortedScores, Collections.reverseOrder()); // Write estimated preferences int pos = 1; for (double pref : sortedScores) { for (long itemID : preferenceMap.get(pref)) { switch (format) { case TRECEVAL: out.println(user + "\tQ0\t" + itemID + "\t" + pos + "\t" + pref + "\t" + "r"); break; default: case SIMPLE: out.println(user + "\t" + itemID + "\t" + pref); break; } pos++; } } }
[ "protected", "void", "printRanking", "(", "final", "String", "user", ",", "final", "Map", "<", "Long", ",", "Double", ">", "scoredItems", ",", "final", "PrintStream", "out", ",", "final", "OUTPUT_FORMAT", "format", ")", "{", "final", "Map", "<", "Double", ...
Print the item ranking and scores for a specific user. @param user The user (as a String). @param scoredItems The item to print rankings for. @param out Where to direct the print. @param format The format of the printer.
[ "Print", "the", "item", "ranking", "and", "scores", "for", "a", "specific", "user", "." ]
train
https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/AbstractStrategy.java#L133-L167
super-csv/super-csv
super-csv-joda/src/main/java/org/supercsv/cellprocessor/joda/ParseDuration.java
ParseDuration.execute
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if (!(value instanceof String)) { throw new SuperCsvCellProcessorException(String.class, value, context, this); } final Duration result; try { result = Duration.parse((String) value); } catch (IllegalArgumentException e) { throw new SuperCsvCellProcessorException( "Failed to parse value as a Duration", context, this, e); } return next.execute(result, context); }
java
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if (!(value instanceof String)) { throw new SuperCsvCellProcessorException(String.class, value, context, this); } final Duration result; try { result = Duration.parse((String) value); } catch (IllegalArgumentException e) { throw new SuperCsvCellProcessorException( "Failed to parse value as a Duration", context, this, e); } return next.execute(result, context); }
[ "public", "Object", "execute", "(", "final", "Object", "value", ",", "final", "CsvContext", "context", ")", "{", "validateInputNotNull", "(", "value", ",", "context", ")", ";", "if", "(", "!", "(", "value", "instanceof", "String", ")", ")", "{", "throw", ...
{@inheritDoc} @throws SuperCsvCellProcessorException if value is null or is not a String
[ "{", "@inheritDoc", "}" ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv-joda/src/main/java/org/supercsv/cellprocessor/joda/ParseDuration.java#L64-L78
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addInlineComment
public void addInlineComment(Element element, Content htmltree) { addCommentTags(element, utils.getFullBody(element), false, false, htmltree); }
java
public void addInlineComment(Element element, Content htmltree) { addCommentTags(element, utils.getFullBody(element), false, false, htmltree); }
[ "public", "void", "addInlineComment", "(", "Element", "element", ",", "Content", "htmltree", ")", "{", "addCommentTags", "(", "element", ",", "utils", ".", "getFullBody", "(", "element", ")", ",", "false", ",", "false", ",", "htmltree", ")", ";", "}" ]
Adds the inline comment. @param element the Element for which the inline comments will be generated @param htmltree the documentation tree to which the inline comments will be added
[ "Adds", "the", "inline", "comment", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L1685-L1687
zalando-nakadi/fahrschein
fahrschein-http-simple/src/main/java/org/zalando/fahrschein/http/simple/SimpleRequestFactory.java
SimpleRequestFactory.prepareConnection
private void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException { if (this.connectTimeout >= 0) { connection.setConnectTimeout(this.connectTimeout); } if (this.readTimeout >= 0) { connection.setReadTimeout(this.readTimeout); } connection.setDoInput(true); if ("GET".equals(httpMethod)) { connection.setInstanceFollowRedirects(true); } else { connection.setInstanceFollowRedirects(false); } if ("POST".equals(httpMethod) || "PUT".equals(httpMethod) || "PATCH".equals(httpMethod) || "DELETE".equals(httpMethod)) { connection.setDoOutput(true); } else { connection.setDoOutput(false); } connection.setRequestMethod(httpMethod); }
java
private void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException { if (this.connectTimeout >= 0) { connection.setConnectTimeout(this.connectTimeout); } if (this.readTimeout >= 0) { connection.setReadTimeout(this.readTimeout); } connection.setDoInput(true); if ("GET".equals(httpMethod)) { connection.setInstanceFollowRedirects(true); } else { connection.setInstanceFollowRedirects(false); } if ("POST".equals(httpMethod) || "PUT".equals(httpMethod) || "PATCH".equals(httpMethod) || "DELETE".equals(httpMethod)) { connection.setDoOutput(true); } else { connection.setDoOutput(false); } connection.setRequestMethod(httpMethod); }
[ "private", "void", "prepareConnection", "(", "HttpURLConnection", "connection", ",", "String", "httpMethod", ")", "throws", "IOException", "{", "if", "(", "this", ".", "connectTimeout", ">=", "0", ")", "{", "connection", ".", "setConnectTimeout", "(", "this", "....
Template method for preparing the given {@link HttpURLConnection}. <p>The default implementation prepares the connection for input and output, and sets the HTTP method. @param connection the connection to prepare @param httpMethod the HTTP request method ({@code GET}, {@code POST}, etc.) @throws IOException in case of I/O errors
[ "Template", "method", "for", "preparing", "the", "given", "{", "@link", "HttpURLConnection", "}", ".", "<p", ">", "The", "default", "implementation", "prepares", "the", "connection", "for", "input", "and", "output", "and", "sets", "the", "HTTP", "method", "." ...
train
https://github.com/zalando-nakadi/fahrschein/blob/b55ae0ff79aacb300548a88f3969fd11a0904804/fahrschein-http-simple/src/main/java/org/zalando/fahrschein/http/simple/SimpleRequestFactory.java#L78-L101
igniterealtime/Smack
smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/SecretKeyBackupHelper.java
SecretKeyBackupHelper.createSecretkeyElement
public static SecretkeyElement createSecretkeyElement(OpenPgpProvider provider, BareJid owner, Set<OpenPgpV4Fingerprint> fingerprints, String backupCode) throws PGPException, IOException, MissingOpenPgpKeyException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); for (OpenPgpV4Fingerprint fingerprint : fingerprints) { PGPSecretKeyRing key = provider.getStore().getSecretKeyRing(owner, fingerprint); if (key == null) { throw new MissingOpenPgpKeyException(owner, fingerprint); } byte[] bytes = key.getEncoded(); buffer.write(bytes); } return createSecretkeyElement(buffer.toByteArray(), backupCode); }
java
public static SecretkeyElement createSecretkeyElement(OpenPgpProvider provider, BareJid owner, Set<OpenPgpV4Fingerprint> fingerprints, String backupCode) throws PGPException, IOException, MissingOpenPgpKeyException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); for (OpenPgpV4Fingerprint fingerprint : fingerprints) { PGPSecretKeyRing key = provider.getStore().getSecretKeyRing(owner, fingerprint); if (key == null) { throw new MissingOpenPgpKeyException(owner, fingerprint); } byte[] bytes = key.getEncoded(); buffer.write(bytes); } return createSecretkeyElement(buffer.toByteArray(), backupCode); }
[ "public", "static", "SecretkeyElement", "createSecretkeyElement", "(", "OpenPgpProvider", "provider", ",", "BareJid", "owner", ",", "Set", "<", "OpenPgpV4Fingerprint", ">", "fingerprints", ",", "String", "backupCode", ")", "throws", "PGPException", ",", "IOException", ...
Create a {@link SecretkeyElement} which contains the secret keys listed in {@code fingerprints} and is encrypted symmetrically using the {@code backupCode}. @param provider {@link OpenPgpProvider} for symmetric encryption. @param owner owner of the secret keys (usually our jid). @param fingerprints set of {@link OpenPgpV4Fingerprint}s of the keys which are going to be backed up. @param backupCode passphrase for symmetric encryption. @return {@link SecretkeyElement} @throws PGPException PGP is brittle @throws IOException IO is dangerous @throws MissingOpenPgpKeyException in case one of the keys whose fingerprint is in {@code fingerprints} is not accessible.
[ "Create", "a", "{", "@link", "SecretkeyElement", "}", "which", "contains", "the", "secret", "keys", "listed", "in", "{", "@code", "fingerprints", "}", "and", "is", "encrypted", "symmetrically", "using", "the", "{", "@code", "backupCode", "}", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/SecretKeyBackupHelper.java#L91-L109
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/GitLabApi.java
GitLabApi.enableRequestResponseLogging
public void enableRequestResponseLogging(Logger logger, Level level, int maxEntitySize) { enableRequestResponseLogging(logger, level, maxEntitySize, MaskingLoggingFilter.DEFAULT_MASKED_HEADER_NAMES); }
java
public void enableRequestResponseLogging(Logger logger, Level level, int maxEntitySize) { enableRequestResponseLogging(logger, level, maxEntitySize, MaskingLoggingFilter.DEFAULT_MASKED_HEADER_NAMES); }
[ "public", "void", "enableRequestResponseLogging", "(", "Logger", "logger", ",", "Level", "level", ",", "int", "maxEntitySize", ")", "{", "enableRequestResponseLogging", "(", "logger", ",", "level", ",", "maxEntitySize", ",", "MaskingLoggingFilter", ".", "DEFAULT_MASKE...
Enable the logging of the requests to and the responses from the GitLab server API using the specified logger. Logging will mask PRIVATE-TOKEN and Authorization headers. @param logger the Logger instance to log to @param level the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST) @param maxEntitySize maximum number of entity bytes to be logged. When logging if the maxEntitySize is reached, the entity logging will be truncated at maxEntitySize and "...more..." will be added at the end of the log entry. If maxEntitySize is &lt;= 0, entity logging will be disabled
[ "Enable", "the", "logging", "of", "the", "requests", "to", "and", "the", "responses", "from", "the", "GitLab", "server", "API", "using", "the", "specified", "logger", ".", "Logging", "will", "mask", "PRIVATE", "-", "TOKEN", "and", "Authorization", "headers", ...
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GitLabApi.java#L667-L669
LearnLib/learnlib
algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/util/ADTUtil.java
ADTUtil.computeEffectiveResets
public static <S, I, O> int computeEffectiveResets(final ADTNode<S, I, O> adt) { return computeEffectiveResetsInternal(adt, 0); }
java
public static <S, I, O> int computeEffectiveResets(final ADTNode<S, I, O> adt) { return computeEffectiveResetsInternal(adt, 0); }
[ "public", "static", "<", "S", ",", "I", ",", "O", ">", "int", "computeEffectiveResets", "(", "final", "ADTNode", "<", "S", ",", "I", ",", "O", ">", "adt", ")", "{", "return", "computeEffectiveResetsInternal", "(", "adt", ",", "0", ")", ";", "}" ]
Computes how often reset nodes are encountered when traversing from the given node to the leaves of the induced subtree of the given node. @param adt the node whose subtree should be analyzed @param <S> (hypothesis) state type @param <I> input alphabet type @param <O> output alphabet type @return the number of encountered reset nodes
[ "Computes", "how", "often", "reset", "nodes", "are", "encountered", "when", "traversing", "from", "the", "given", "node", "to", "the", "leaves", "of", "the", "induced", "subtree", "of", "the", "given", "node", "." ]
train
https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/util/ADTUtil.java#L218-L220
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getImpersonationToken
public ImpersonationToken getImpersonationToken(Object userIdOrUsername, Integer tokenId) throws GitLabApiException { if (tokenId == null) { throw new RuntimeException("tokenId cannot be null"); } Response response = get(Response.Status.OK, null, "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens", tokenId); return (response.readEntity(ImpersonationToken.class)); }
java
public ImpersonationToken getImpersonationToken(Object userIdOrUsername, Integer tokenId) throws GitLabApiException { if (tokenId == null) { throw new RuntimeException("tokenId cannot be null"); } Response response = get(Response.Status.OK, null, "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens", tokenId); return (response.readEntity(ImpersonationToken.class)); }
[ "public", "ImpersonationToken", "getImpersonationToken", "(", "Object", "userIdOrUsername", ",", "Integer", "tokenId", ")", "throws", "GitLabApiException", "{", "if", "(", "tokenId", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"tokenId cannot be...
Get an impersonation token of a user. Available only for admin users. <pre><code>GitLab Endpoint: GET /users/:user_id/impersonation_tokens/:impersonation_token_id</code></pre> @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param tokenId the impersonation token ID to get @return the specified impersonation token @throws GitLabApiException if any exception occurs
[ "Get", "an", "impersonation", "token", "of", "a", "user", ".", "Available", "only", "for", "admin", "users", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L768-L776
qiniu/java-sdk
src/main/java/com/qiniu/util/Auth.java
Auth.privateDownloadUrl
public String privateDownloadUrl(String baseUrl, long expires) { long deadline = System.currentTimeMillis() / 1000 + expires; return privateDownloadUrlWithDeadline(baseUrl, deadline); }
java
public String privateDownloadUrl(String baseUrl, long expires) { long deadline = System.currentTimeMillis() / 1000 + expires; return privateDownloadUrlWithDeadline(baseUrl, deadline); }
[ "public", "String", "privateDownloadUrl", "(", "String", "baseUrl", ",", "long", "expires", ")", "{", "long", "deadline", "=", "System", ".", "currentTimeMillis", "(", ")", "/", "1000", "+", "expires", ";", "return", "privateDownloadUrlWithDeadline", "(", "baseU...
下载签名 @param baseUrl 待签名文件url,如 http://img.domain.com/u/3.jpg 、 http://img.domain.com/u/3.jpg?imageView2/1/w/120 @param expires 有效时长,单位秒。默认3600s @return
[ "下载签名" ]
train
https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/util/Auth.java#L178-L181
googleapis/google-cloud-java
google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java
GrafeasV1Beta1Client.updateNote
public final Note updateNote(NoteName name, Note note, FieldMask updateMask) { UpdateNoteRequest request = UpdateNoteRequest.newBuilder() .setName(name == null ? null : name.toString()) .setNote(note) .setUpdateMask(updateMask) .build(); return updateNote(request); }
java
public final Note updateNote(NoteName name, Note note, FieldMask updateMask) { UpdateNoteRequest request = UpdateNoteRequest.newBuilder() .setName(name == null ? null : name.toString()) .setNote(note) .setUpdateMask(updateMask) .build(); return updateNote(request); }
[ "public", "final", "Note", "updateNote", "(", "NoteName", "name", ",", "Note", "note", ",", "FieldMask", "updateMask", ")", "{", "UpdateNoteRequest", "request", "=", "UpdateNoteRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", "==", "null", ...
Updates the specified note. <p>Sample code: <pre><code> try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); Note note = Note.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Note response = grafeasV1Beta1Client.updateNote(name, note, updateMask); } </code></pre> @param name The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. @param note The updated note. @param updateMask The fields to update. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "the", "specified", "note", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java#L1505-L1514
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.executeCommand
private CommandResult executeCommand(final Commandline cmd, final boolean failOnError, final String argStr, final String... args) throws CommandLineException, MojoFailureException { // initialize executables initExecutables(); if (getLog().isDebugEnabled()) { getLog().debug( cmd.getExecutable() + " " + StringUtils.join(args, " ") + (argStr == null ? "" : " " + argStr)); } cmd.clearArgs(); cmd.addArguments(args); if (StringUtils.isNotBlank(argStr)) { cmd.createArg().setLine(argStr); } final StringBufferStreamConsumer out = new StringBufferStreamConsumer( verbose); final CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer(); // execute final int exitCode = CommandLineUtils.executeCommandLine(cmd, out, err); String errorStr = err.getOutput(); String outStr = out.getOutput(); if (failOnError && exitCode != SUCCESS_EXIT_CODE) { // not all commands print errors to error stream if (StringUtils.isBlank(errorStr) && StringUtils.isNotBlank(outStr)) { errorStr = outStr; } throw new MojoFailureException(errorStr); } return new CommandResult(exitCode, outStr, errorStr); }
java
private CommandResult executeCommand(final Commandline cmd, final boolean failOnError, final String argStr, final String... args) throws CommandLineException, MojoFailureException { // initialize executables initExecutables(); if (getLog().isDebugEnabled()) { getLog().debug( cmd.getExecutable() + " " + StringUtils.join(args, " ") + (argStr == null ? "" : " " + argStr)); } cmd.clearArgs(); cmd.addArguments(args); if (StringUtils.isNotBlank(argStr)) { cmd.createArg().setLine(argStr); } final StringBufferStreamConsumer out = new StringBufferStreamConsumer( verbose); final CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer(); // execute final int exitCode = CommandLineUtils.executeCommandLine(cmd, out, err); String errorStr = err.getOutput(); String outStr = out.getOutput(); if (failOnError && exitCode != SUCCESS_EXIT_CODE) { // not all commands print errors to error stream if (StringUtils.isBlank(errorStr) && StringUtils.isNotBlank(outStr)) { errorStr = outStr; } throw new MojoFailureException(errorStr); } return new CommandResult(exitCode, outStr, errorStr); }
[ "private", "CommandResult", "executeCommand", "(", "final", "Commandline", "cmd", ",", "final", "boolean", "failOnError", ",", "final", "String", "argStr", ",", "final", "String", "...", "args", ")", "throws", "CommandLineException", ",", "MojoFailureException", "{"...
Executes command line. @param cmd Command line. @param failOnError Whether to throw exception on NOT success exit code. @param argStr Command line arguments as a string. @param args Command line arguments. @return {@link CommandResult} instance holding command exit code, output and error if any. @throws CommandLineException @throws MojoFailureException If <code>failOnError</code> is <code>true</code> and command exit code is NOT equals to 0.
[ "Executes", "command", "line", "." ]
train
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L1071-L1112
reinert/requestor
requestor/ext/requestor-oauth2/src/main/java/io/reinert/requestor/oauth2/AuthRequest.java
AuthRequest.fromString
static AuthRequest fromString(String str) { String[] parts = str.split("-----"); String clientId = parts[0]; String[] scopes = parts.length == 2 ? parts[1].split(",") : new String[0]; AuthRequest req = new AuthRequest("", clientId).withScopes(scopes); return req; }
java
static AuthRequest fromString(String str) { String[] parts = str.split("-----"); String clientId = parts[0]; String[] scopes = parts.length == 2 ? parts[1].split(",") : new String[0]; AuthRequest req = new AuthRequest("", clientId).withScopes(scopes); return req; }
[ "static", "AuthRequest", "fromString", "(", "String", "str", ")", "{", "String", "[", "]", "parts", "=", "str", ".", "split", "(", "\"-----\"", ")", ";", "String", "clientId", "=", "parts", "[", "0", "]", ";", "String", "[", "]", "scopes", "=", "part...
Returns an {@link AuthRequest} represented by the string serialization.
[ "Returns", "an", "{" ]
train
https://github.com/reinert/requestor/blob/40163a75cd17815d5089935d0dd97b8d652ad6d4/requestor/ext/requestor-oauth2/src/main/java/io/reinert/requestor/oauth2/AuthRequest.java#L104-L110
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/responder/responderpolicy_binding.java
responderpolicy_binding.get
public static responderpolicy_binding get(nitro_service service, String name) throws Exception{ responderpolicy_binding obj = new responderpolicy_binding(); obj.set_name(name); responderpolicy_binding response = (responderpolicy_binding) obj.get_resource(service); return response; }
java
public static responderpolicy_binding get(nitro_service service, String name) throws Exception{ responderpolicy_binding obj = new responderpolicy_binding(); obj.set_name(name); responderpolicy_binding response = (responderpolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "responderpolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "responderpolicy_binding", "obj", "=", "new", "responderpolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "nam...
Use this API to fetch responderpolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "responderpolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/responder/responderpolicy_binding.java#L136-L141
opentok/Opentok-Java-SDK
src/main/java/com/opentok/OpenTok.java
OpenTok.listArchives
public ArchiveList listArchives(String sessionId, int offset, int count) throws OpenTokException { String archives = this.client.getArchives(sessionId, offset, count); try { return archiveListReader.readValue(archives); } catch (JsonProcessingException e) { throw new RequestException("Exception mapping json: " + e.getMessage()); } catch (IOException e) { throw new RequestException("Exception mapping json: " + e.getMessage()); } }
java
public ArchiveList listArchives(String sessionId, int offset, int count) throws OpenTokException { String archives = this.client.getArchives(sessionId, offset, count); try { return archiveListReader.readValue(archives); } catch (JsonProcessingException e) { throw new RequestException("Exception mapping json: " + e.getMessage()); } catch (IOException e) { throw new RequestException("Exception mapping json: " + e.getMessage()); } }
[ "public", "ArchiveList", "listArchives", "(", "String", "sessionId", ",", "int", "offset", ",", "int", "count", ")", "throws", "OpenTokException", "{", "String", "archives", "=", "this", ".", "client", ".", "getArchives", "(", "sessionId", ",", "offset", ",", ...
Returns a List of {@link Archive} objects, representing archives that are both both completed and in-progress, for your API key. @param offset The index offset of the first archive. 0 is offset of the most recently started archive. 1 is the offset of the archive that started prior to the most recent archive. @param count The number of archives to be returned. The maximum number of archives returned is 1000. @param sessionId The sessionid of the session which started or automatically enabled archiving. @return A List of {@link Archive} objects.
[ "Returns", "a", "List", "of", "{", "@link", "Archive", "}", "objects", "representing", "archives", "that", "are", "both", "both", "completed", "and", "in", "-", "progress", "for", "your", "API", "key", "." ]
train
https://github.com/opentok/Opentok-Java-SDK/blob/d71b7999facc3131c415aebea874ea55776d477f/src/main/java/com/opentok/OpenTok.java#L403-L412
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java
TagletManager.addCustomTag
public void addCustomTag(String classname, JavaFileManager fileManager, String tagletPath) { try { Class<?> customTagClass = null; // construct class loader String cpString = null; // make sure env.class.path defaults to dot ClassLoader tagClassLoader; if (fileManager != null && fileManager.hasLocation(DocumentationTool.Location.TAGLET_PATH)) { tagClassLoader = fileManager.getClassLoader(DocumentationTool.Location.TAGLET_PATH); } else { // do prepends to get correct ordering cpString = appendPath(System.getProperty("env.class.path"), cpString); cpString = appendPath(System.getProperty("java.class.path"), cpString); cpString = appendPath(tagletPath, cpString); tagClassLoader = new URLClassLoader(pathToURLs(cpString)); } customTagClass = tagClassLoader.loadClass(classname); Method meth = customTagClass.getMethod("register", new Class<?>[] {java.util.Map.class}); Object[] list = customTags.values().toArray(); Taglet lastTag = (list != null && list.length > 0) ? (Taglet) list[list.length-1] : null; meth.invoke(null, new Object[] {customTags}); list = customTags.values().toArray(); Object newLastTag = (list != null&& list.length > 0) ? list[list.length-1] : null; if (lastTag != newLastTag) { //New taglets must always be added to the end of the LinkedHashMap. //If the current and previous last taglet are not equal, that //means a new Taglet has been added. message.notice("doclet.Notice_taglet_registered", classname); if (newLastTag != null) { checkTaglet(newLastTag); } } } catch (Exception exc) { message.error("doclet.Error_taglet_not_registered", exc.getClass().getName(), classname); } }
java
public void addCustomTag(String classname, JavaFileManager fileManager, String tagletPath) { try { Class<?> customTagClass = null; // construct class loader String cpString = null; // make sure env.class.path defaults to dot ClassLoader tagClassLoader; if (fileManager != null && fileManager.hasLocation(DocumentationTool.Location.TAGLET_PATH)) { tagClassLoader = fileManager.getClassLoader(DocumentationTool.Location.TAGLET_PATH); } else { // do prepends to get correct ordering cpString = appendPath(System.getProperty("env.class.path"), cpString); cpString = appendPath(System.getProperty("java.class.path"), cpString); cpString = appendPath(tagletPath, cpString); tagClassLoader = new URLClassLoader(pathToURLs(cpString)); } customTagClass = tagClassLoader.loadClass(classname); Method meth = customTagClass.getMethod("register", new Class<?>[] {java.util.Map.class}); Object[] list = customTags.values().toArray(); Taglet lastTag = (list != null && list.length > 0) ? (Taglet) list[list.length-1] : null; meth.invoke(null, new Object[] {customTags}); list = customTags.values().toArray(); Object newLastTag = (list != null&& list.length > 0) ? list[list.length-1] : null; if (lastTag != newLastTag) { //New taglets must always be added to the end of the LinkedHashMap. //If the current and previous last taglet are not equal, that //means a new Taglet has been added. message.notice("doclet.Notice_taglet_registered", classname); if (newLastTag != null) { checkTaglet(newLastTag); } } } catch (Exception exc) { message.error("doclet.Error_taglet_not_registered", exc.getClass().getName(), classname); } }
[ "public", "void", "addCustomTag", "(", "String", "classname", ",", "JavaFileManager", "fileManager", ",", "String", "tagletPath", ")", "{", "try", "{", "Class", "<", "?", ">", "customTagClass", "=", "null", ";", "// construct class loader", "String", "cpString", ...
Add a new <code>Taglet</code>. Print a message to indicate whether or not the Taglet was registered properly. @param classname the name of the class representing the custom tag. @param tagletPath the path to the class representing the custom tag.
[ "Add", "a", "new", "<code", ">", "Taglet<", "/", "code", ">", ".", "Print", "a", "message", "to", "indicate", "whether", "or", "not", "the", "Taglet", "was", "registered", "properly", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java#L219-L259
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/GrowingSparseMatrix.java
GrowingSparseMatrix.setRow
public void setRow(int row, double[] columns) { checkIndices(row, columns.length - 1); if (cols <= columns.length) cols = columns.length; SparseDoubleVector rowVec = updateRow(row); for (int col = 0; col < cols; ++col) { double val = columns[col]; rowVec.set(col, val); } }
java
public void setRow(int row, double[] columns) { checkIndices(row, columns.length - 1); if (cols <= columns.length) cols = columns.length; SparseDoubleVector rowVec = updateRow(row); for (int col = 0; col < cols; ++col) { double val = columns[col]; rowVec.set(col, val); } }
[ "public", "void", "setRow", "(", "int", "row", ",", "double", "[", "]", "columns", ")", "{", "checkIndices", "(", "row", ",", "columns", ".", "length", "-", "1", ")", ";", "if", "(", "cols", "<=", "columns", ".", "length", ")", "cols", "=", "column...
{@inheritDoc} The size of the matrix will be expanded if either row or col is larger than the largest previously seen row or column value. When the matrix is expanded by either dimension, the values for the new row/column will all be assumed to be zero.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/GrowingSparseMatrix.java#L236-L248
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java
JMElasticsearchBulk.deleteBulkDocs
public boolean deleteBulkDocs(String index, String type) { return executeBulkRequest(buildDeleteBulkRequestBuilder( buildAllDeleteRequestBuilderList(index, type))).hasFailures(); }
java
public boolean deleteBulkDocs(String index, String type) { return executeBulkRequest(buildDeleteBulkRequestBuilder( buildAllDeleteRequestBuilderList(index, type))).hasFailures(); }
[ "public", "boolean", "deleteBulkDocs", "(", "String", "index", ",", "String", "type", ")", "{", "return", "executeBulkRequest", "(", "buildDeleteBulkRequestBuilder", "(", "buildAllDeleteRequestBuilderList", "(", "index", ",", "type", ")", ")", ")", ".", "hasFailures...
Delete bulk docs boolean. @param index the index @param type the type @return the boolean
[ "Delete", "bulk", "docs", "boolean", "." ]
train
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java#L459-L462
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/Constant.java
Constant.getSystemProperty
public static String getSystemProperty(String property, String def) { Check.notNull(property); try { return System.getProperty(property, def); } catch (final SecurityException exception) { Verbose.exception(exception, new StringBuilder(Constant.HUNDRED).append(ERROR_PROPERTY) .append(property) .append(" (") .append(exception.getClass().getName()) .append(')') .toString()); return def; } }
java
public static String getSystemProperty(String property, String def) { Check.notNull(property); try { return System.getProperty(property, def); } catch (final SecurityException exception) { Verbose.exception(exception, new StringBuilder(Constant.HUNDRED).append(ERROR_PROPERTY) .append(property) .append(" (") .append(exception.getClass().getName()) .append(')') .toString()); return def; } }
[ "public", "static", "String", "getSystemProperty", "(", "String", "property", ",", "String", "def", ")", "{", "Check", ".", "notNull", "(", "property", ")", ";", "try", "{", "return", "System", ".", "getProperty", "(", "property", ",", "def", ")", ";", "...
Get the system property. If the property is not valid due to a {@link SecurityException}, an empty string is returned. @param property The system property (must not be <code>null</code>). @param def The default value used if property is not available (can be <code>null</code>). @return The system property value.
[ "Get", "the", "system", "property", ".", "If", "the", "property", "is", "not", "valid", "due", "to", "a", "{", "@link", "SecurityException", "}", "an", "empty", "string", "is", "returned", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/Constant.java#L121-L140
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/ExtensionsInner.java
ExtensionsInner.createAsync
public Observable<Void> createAsync(String resourceGroupName, String clusterName, String extensionName, ExtensionInner parameters) { return createWithServiceResponseAsync(resourceGroupName, clusterName, extensionName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> createAsync(String resourceGroupName, String clusterName, String extensionName, ExtensionInner parameters) { return createWithServiceResponseAsync(resourceGroupName, clusterName, extensionName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "extensionName", ",", "ExtensionInner", "parameters", ")", "{", "return", "createWithServiceResponseAsync", "(", "resourceGroupName"...
Creates an HDInsight cluster extension. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param extensionName The name of the cluster extension. @param parameters The cluster extensions create request. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "an", "HDInsight", "cluster", "extension", "." ]
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/ExtensionsInner.java#L551-L558
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/lexer/LexerEngine.java
LexerEngine.accept
public void accept(final TokenType tokenType) { if (lexer.getCurrentToken().getType() != tokenType) { throw new SQLParsingException(lexer, tokenType); } lexer.nextToken(); }
java
public void accept(final TokenType tokenType) { if (lexer.getCurrentToken().getType() != tokenType) { throw new SQLParsingException(lexer, tokenType); } lexer.nextToken(); }
[ "public", "void", "accept", "(", "final", "TokenType", "tokenType", ")", "{", "if", "(", "lexer", ".", "getCurrentToken", "(", ")", ".", "getType", "(", ")", "!=", "tokenType", ")", "{", "throw", "new", "SQLParsingException", "(", "lexer", ",", "tokenType"...
Assert current token type should equals input token and go to next token type. @param tokenType token type
[ "Assert", "current", "token", "type", "should", "equals", "input", "token", "and", "go", "to", "next", "token", "type", "." ]
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/lexer/LexerEngine.java#L120-L125
structurizr/java
structurizr-core/src/com/structurizr/model/DeploymentNode.java
DeploymentNode.addDeploymentNode
public DeploymentNode addDeploymentNode(String name, String description, String technology, int instances, Map<String, String> properties) { DeploymentNode deploymentNode = getModel().addDeploymentNode(this, this.getEnvironment(), name, description, technology, instances, properties); if (deploymentNode != null) { children.add(deploymentNode); } return deploymentNode; }
java
public DeploymentNode addDeploymentNode(String name, String description, String technology, int instances, Map<String, String> properties) { DeploymentNode deploymentNode = getModel().addDeploymentNode(this, this.getEnvironment(), name, description, technology, instances, properties); if (deploymentNode != null) { children.add(deploymentNode); } return deploymentNode; }
[ "public", "DeploymentNode", "addDeploymentNode", "(", "String", "name", ",", "String", "description", ",", "String", "technology", ",", "int", "instances", ",", "Map", "<", "String", ",", "String", ">", "properties", ")", "{", "DeploymentNode", "deploymentNode", ...
Adds a child deployment node. @param name the name of the deployment node @param description a short description @param technology the technology @param instances the number of instances @param properties a Map (String,String) describing name=value properties @return a DeploymentNode object
[ "Adds", "a", "child", "deployment", "node", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/DeploymentNode.java#L92-L98
forge/javaee-descriptors
impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/webfragment30/WebFragmentDescriptorImpl.java
WebFragmentDescriptorImpl.addNamespace
public WebFragmentDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
java
public WebFragmentDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
[ "public", "WebFragmentDescriptor", "addNamespace", "(", "String", "name", ",", "String", "value", ")", "{", "model", ".", "attribute", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a new namespace @return the current instance of <code>WebFragmentDescriptor</code>
[ "Adds", "a", "new", "namespace" ]
train
https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/webfragment30/WebFragmentDescriptorImpl.java#L142-L146
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java
JavaTokenizer.lexError
protected void lexError(int pos, String key, Object... args) { log.error(pos, key, args); tk = TokenKind.ERROR; errPos = pos; }
java
protected void lexError(int pos, String key, Object... args) { log.error(pos, key, args); tk = TokenKind.ERROR; errPos = pos; }
[ "protected", "void", "lexError", "(", "int", "pos", ",", "String", "key", ",", "Object", "...", "args", ")", "{", "log", ".", "error", "(", "pos", ",", "key", ",", "args", ")", ";", "tk", "=", "TokenKind", ".", "ERROR", ";", "errPos", "=", "pos", ...
Report an error at the given position using the provided arguments.
[ "Report", "an", "error", "at", "the", "given", "position", "using", "the", "provided", "arguments", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java#L130-L134
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/util/StringHelper.java
StringHelper.parseString
public static String parseString(String inputStr, char startingChar, char endingChar, String key) { if (null == inputStr || null == key) { return null; } int matchedStartingIndex = inputStr.indexOf(key + startingChar); if (-1 == matchedStartingIndex) { return null; } int matchedEndingIndex = inputStr.indexOf(endingChar, matchedStartingIndex); if (-1 == matchedEndingIndex) { return inputStr.substring(matchedStartingIndex + key.length() + 1); } else { return inputStr.substring(matchedStartingIndex + key.length() + 1, matchedEndingIndex); } }
java
public static String parseString(String inputStr, char startingChar, char endingChar, String key) { if (null == inputStr || null == key) { return null; } int matchedStartingIndex = inputStr.indexOf(key + startingChar); if (-1 == matchedStartingIndex) { return null; } int matchedEndingIndex = inputStr.indexOf(endingChar, matchedStartingIndex); if (-1 == matchedEndingIndex) { return inputStr.substring(matchedStartingIndex + key.length() + 1); } else { return inputStr.substring(matchedStartingIndex + key.length() + 1, matchedEndingIndex); } }
[ "public", "static", "String", "parseString", "(", "String", "inputStr", ",", "char", "startingChar", ",", "char", "endingChar", ",", "String", "key", ")", "{", "if", "(", "null", "==", "inputStr", "||", "null", "==", "key", ")", "{", "return", "null", ";...
Method which parses the input String to send back the value corresponding to the input key. For eg: If the inputStr is "TradingPartnerKey=5; OWNER=L3; CBTN=3036240004; RTI=105" startingChar is '=', endingChar = ';' & key = "TradingPartnerKey" Then the response String will be "5" @param inputStr The input String to be parsed @param startingChar The first character to be found after the input key @param endingChar The first character to be found after the input key-value pair @param key For which you need to extract the value @return
[ "Method", "which", "parses", "the", "input", "String", "to", "send", "back", "the", "value", "corresponding", "to", "the", "input", "key", ".", "For", "eg", ":", "If", "the", "inputStr", "is", "TradingPartnerKey", "=", "5", ";", "OWNER", "=", "L3", ";", ...
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/StringHelper.java#L1045-L1059
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/naming/SingletonInitialContextFactory.java
SingletonInitialContextFactory.getInstance
public static synchronized Context getInstance( Hashtable<?, ?> environment ) { if (SINGLETON == null) SINGLETON = new SingletonInitialContext(environment); return SINGLETON; }
java
public static synchronized Context getInstance( Hashtable<?, ?> environment ) { if (SINGLETON == null) SINGLETON = new SingletonInitialContext(environment); return SINGLETON; }
[ "public", "static", "synchronized", "Context", "getInstance", "(", "Hashtable", "<", "?", ",", "?", ">", "environment", ")", "{", "if", "(", "SINGLETON", "==", "null", ")", "SINGLETON", "=", "new", "SingletonInitialContext", "(", "environment", ")", ";", "re...
Return the {@link Context} singleton instance. If no such context has been configured, this method will configured the singletone using the supplied environment. @param environment the environment for the naming context; may be null or empty @return the singleton context; never null @see #getInitialContext(Hashtable) @see #getInstance(Hashtable)
[ "Return", "the", "{", "@link", "Context", "}", "singleton", "instance", ".", "If", "no", "such", "context", "has", "been", "configured", "this", "method", "will", "configured", "the", "singletone", "using", "the", "supplied", "environment", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/naming/SingletonInitialContextFactory.java#L73-L76
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/AppUtil.java
AppUtil.startDialer
public static void startDialer(@NonNull final Context context, final long phoneNumber) { startDialer(context, Long.toString(phoneNumber)); }
java
public static void startDialer(@NonNull final Context context, final long phoneNumber) { startDialer(context, Long.toString(phoneNumber)); }
[ "public", "static", "void", "startDialer", "(", "@", "NonNull", "final", "Context", "context", ",", "final", "long", "phoneNumber", ")", "{", "startDialer", "(", "context", ",", "Long", ".", "toString", "(", "phoneNumber", ")", ")", ";", "}" ]
Starts the dialer in order to call a specific phone number. The call has to be manually started by the user. If an error occurs while starting the dialer, an {@link ActivityNotFoundException} will be thrown. @param context The context, the dialer should be started from, as an instance of the class {@link Context}. The context may not be null @param phoneNumber The phone number, which should be dialed, as a {@link Long} value
[ "Starts", "the", "dialer", "in", "order", "to", "call", "a", "specific", "phone", "number", ".", "The", "call", "has", "to", "be", "manually", "started", "by", "the", "user", ".", "If", "an", "error", "occurs", "while", "starting", "the", "dialer", "an",...
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/AppUtil.java#L336-L338
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/v1/DbxClientV1.java
DbxClientV1.chunkedUploadCommon
private <E extends Throwable> HttpRequestor.Response chunkedUploadCommon(String[] params, long chunkSize, DbxStreamWriter<E> writer) throws DbxException, E { String apiPath = "1/chunked_upload"; ArrayList<HttpRequestor.Header> headers = new ArrayList<HttpRequestor.Header>(); headers.add(new HttpRequestor.Header("Content-Type", "application/octet-stream")); headers.add(new HttpRequestor.Header("Content-Length", Long.toString(chunkSize))); HttpRequestor.Uploader uploader = DbxRequestUtil.startPut(requestConfig, accessToken, USER_AGENT_ID, host.getContent(), apiPath, params, headers); try { NoThrowOutputStream nt = new NoThrowOutputStream(uploader.getBody()); try { // Any exceptions thrown by writer.write (e.g. IOException) are "owned" by // the caller so let them propagate. We should only handle exceptions caused // by our uploader OutputStream. writer.write(nt); } catch (NoThrowOutputStream.HiddenException ex) { if (ex.owner == nt) throw new NetworkIOException(ex.getCause()); throw ex; } long bytesWritten = nt.getBytesWritten(); if (bytesWritten != chunkSize) { throw new IllegalStateException("'chunkSize' is " + chunkSize + ", but 'writer' only wrote " + bytesWritten + " bytes"); } try { return uploader.finish(); } catch (IOException ex) { throw new NetworkIOException(ex); } } finally { uploader.close(); } }
java
private <E extends Throwable> HttpRequestor.Response chunkedUploadCommon(String[] params, long chunkSize, DbxStreamWriter<E> writer) throws DbxException, E { String apiPath = "1/chunked_upload"; ArrayList<HttpRequestor.Header> headers = new ArrayList<HttpRequestor.Header>(); headers.add(new HttpRequestor.Header("Content-Type", "application/octet-stream")); headers.add(new HttpRequestor.Header("Content-Length", Long.toString(chunkSize))); HttpRequestor.Uploader uploader = DbxRequestUtil.startPut(requestConfig, accessToken, USER_AGENT_ID, host.getContent(), apiPath, params, headers); try { NoThrowOutputStream nt = new NoThrowOutputStream(uploader.getBody()); try { // Any exceptions thrown by writer.write (e.g. IOException) are "owned" by // the caller so let them propagate. We should only handle exceptions caused // by our uploader OutputStream. writer.write(nt); } catch (NoThrowOutputStream.HiddenException ex) { if (ex.owner == nt) throw new NetworkIOException(ex.getCause()); throw ex; } long bytesWritten = nt.getBytesWritten(); if (bytesWritten != chunkSize) { throw new IllegalStateException("'chunkSize' is " + chunkSize + ", but 'writer' only wrote " + bytesWritten + " bytes"); } try { return uploader.finish(); } catch (IOException ex) { throw new NetworkIOException(ex); } } finally { uploader.close(); } }
[ "private", "<", "E", "extends", "Throwable", ">", "HttpRequestor", ".", "Response", "chunkedUploadCommon", "(", "String", "[", "]", "params", ",", "long", "chunkSize", ",", "DbxStreamWriter", "<", "E", ">", "writer", ")", "throws", "DbxException", ",", "E", ...
Internal function called by both chunkedUploadFirst and chunkedUploadAppend.
[ "Internal", "function", "called", "by", "both", "chunkedUploadFirst", "and", "chunkedUploadAppend", "." ]
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L930-L968
RestComm/jain-slee.sip
examples/sip-wake-up/sbb/src/main/java/org/mobicents/slee/examples/wakeup/WakeUpSbb.java
WakeUpSbb.onMessageEvent
public void onMessageEvent(javax.sip.RequestEvent event, ActivityContextInterface aci) { final Request request = event.getRequest(); try { // message body should be *FIRST_TOKEN<timer value in // seconds>MIDDLE_TOKEN<msg to send back to UA>LAST_TOKEN* final String body = new String(request.getRawContent()); final int firstTokenStart = body.indexOf(FIRST_TOKEN); final int timerDurationStart = firstTokenStart + FIRST_TOKEN_LENGTH; final int middleTokenStart = body.indexOf(MIDDLE_TOKEN, timerDurationStart); final int bodyMessageStart = middleTokenStart + MIDDLE_TOKEN_LENGTH; final int lastTokenStart = body.indexOf(LAST_TOKEN, bodyMessageStart); if (firstTokenStart > -1 && middleTokenStart > -1 && lastTokenStart > -1) { // extract the timer duration final int timerDuration = Integer.parseInt(body.substring( timerDurationStart, middleTokenStart)); // create a null AC and attach the sbb local object final ActivityContextInterface timerACI = this.nullACIFactory .getActivityContextInterface(this.nullActivityFactory .createNullActivity()); timerACI.attach(sbbContext.getSbbLocalObject()); // set the timer on the null AC, because the one from this event // will end as soon as we send back the 200 ok this.timerFacility.setTimer(timerACI, null, System .currentTimeMillis() + (timerDuration * 1000), new TimerOptions()); // extract the body message final String bodyMessage = body.substring(bodyMessageStart, lastTokenStart); // store it in a cmp field setBody(bodyMessage); // do the same for the call id setCallId((CallIdHeader) request.getHeader(CallIdHeader.NAME)); // also store the sender's address, so we can send the wake up // message final FromHeader fromHeader = (FromHeader) request .getHeader(FromHeader.NAME); if (tracer.isInfoEnabled()) { tracer.info("Received a valid message from " + fromHeader.getAddress() + " requesting a reply containing '" + bodyMessage + "' after " + timerDuration + "s"); } setSender(fromHeader.getAddress()); // finally reply to the SIP message request sendResponse(event, Response.OK); } else { // parsing failed tracer.warning("Invalid msg '" + body + "' received"); sendResponse(event, Response.BAD_REQUEST); } } catch (Throwable e) { // oh oh something wrong happened tracer.severe("Exception while processing MESSAGE", e); try { sendResponse(event, Response.SERVER_INTERNAL_ERROR); } catch (Exception f) { tracer.severe("Exception while sending SERVER INTERNAL ERROR", f); } } }
java
public void onMessageEvent(javax.sip.RequestEvent event, ActivityContextInterface aci) { final Request request = event.getRequest(); try { // message body should be *FIRST_TOKEN<timer value in // seconds>MIDDLE_TOKEN<msg to send back to UA>LAST_TOKEN* final String body = new String(request.getRawContent()); final int firstTokenStart = body.indexOf(FIRST_TOKEN); final int timerDurationStart = firstTokenStart + FIRST_TOKEN_LENGTH; final int middleTokenStart = body.indexOf(MIDDLE_TOKEN, timerDurationStart); final int bodyMessageStart = middleTokenStart + MIDDLE_TOKEN_LENGTH; final int lastTokenStart = body.indexOf(LAST_TOKEN, bodyMessageStart); if (firstTokenStart > -1 && middleTokenStart > -1 && lastTokenStart > -1) { // extract the timer duration final int timerDuration = Integer.parseInt(body.substring( timerDurationStart, middleTokenStart)); // create a null AC and attach the sbb local object final ActivityContextInterface timerACI = this.nullACIFactory .getActivityContextInterface(this.nullActivityFactory .createNullActivity()); timerACI.attach(sbbContext.getSbbLocalObject()); // set the timer on the null AC, because the one from this event // will end as soon as we send back the 200 ok this.timerFacility.setTimer(timerACI, null, System .currentTimeMillis() + (timerDuration * 1000), new TimerOptions()); // extract the body message final String bodyMessage = body.substring(bodyMessageStart, lastTokenStart); // store it in a cmp field setBody(bodyMessage); // do the same for the call id setCallId((CallIdHeader) request.getHeader(CallIdHeader.NAME)); // also store the sender's address, so we can send the wake up // message final FromHeader fromHeader = (FromHeader) request .getHeader(FromHeader.NAME); if (tracer.isInfoEnabled()) { tracer.info("Received a valid message from " + fromHeader.getAddress() + " requesting a reply containing '" + bodyMessage + "' after " + timerDuration + "s"); } setSender(fromHeader.getAddress()); // finally reply to the SIP message request sendResponse(event, Response.OK); } else { // parsing failed tracer.warning("Invalid msg '" + body + "' received"); sendResponse(event, Response.BAD_REQUEST); } } catch (Throwable e) { // oh oh something wrong happened tracer.severe("Exception while processing MESSAGE", e); try { sendResponse(event, Response.SERVER_INTERNAL_ERROR); } catch (Exception f) { tracer.severe("Exception while sending SERVER INTERNAL ERROR", f); } } }
[ "public", "void", "onMessageEvent", "(", "javax", ".", "sip", ".", "RequestEvent", "event", ",", "ActivityContextInterface", "aci", ")", "{", "final", "Request", "request", "=", "event", ".", "getRequest", "(", ")", ";", "try", "{", "// message body should be *F...
Event handler for the SIP MESSAGE from the UA @param event @param aci
[ "Event", "handler", "for", "the", "SIP", "MESSAGE", "from", "the", "UA" ]
train
https://github.com/RestComm/jain-slee.sip/blob/2c173af0a760cb0ea13fe0ffa58c0f82b14731f9/examples/sip-wake-up/sbb/src/main/java/org/mobicents/slee/examples/wakeup/WakeUpSbb.java#L236-L301
lessthanoptimal/BoofCV
main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java
ConvertBufferedImage.convertFromSingle
public static <T extends ImageGray<T>> T convertFromSingle(BufferedImage src, T dst, Class<T> type) { if (type == GrayU8.class) { return (T) convertFrom(src, (GrayU8) dst); } else if( GrayI16.class.isAssignableFrom(type) ) { return (T) convertFrom(src, (GrayI16) dst,(Class)type); } else if (type == GrayF32.class) { return (T) convertFrom(src, (GrayF32) dst); } else { throw new IllegalArgumentException("Unknown type " + type); } }
java
public static <T extends ImageGray<T>> T convertFromSingle(BufferedImage src, T dst, Class<T> type) { if (type == GrayU8.class) { return (T) convertFrom(src, (GrayU8) dst); } else if( GrayI16.class.isAssignableFrom(type) ) { return (T) convertFrom(src, (GrayI16) dst,(Class)type); } else if (type == GrayF32.class) { return (T) convertFrom(src, (GrayF32) dst); } else { throw new IllegalArgumentException("Unknown type " + type); } }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ">", "T", "convertFromSingle", "(", "BufferedImage", "src", ",", "T", "dst", ",", "Class", "<", "T", ">", "type", ")", "{", "if", "(", "type", "==", "GrayU8", ".", "class", ")", "...
Converts a buffered image into an image of the specified type. In a 'dst' image is provided it will be used for output, otherwise a new image will be created.
[ "Converts", "a", "buffered", "image", "into", "an", "image", "of", "the", "specified", "type", ".", "In", "a", "dst", "image", "is", "provided", "it", "will", "be", "used", "for", "output", "otherwise", "a", "new", "image", "will", "be", "created", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java#L343-L353
meltmedia/cadmium
core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java
Jsr250Utils.preDestroy
public static void preDestroy(Object obj, Logger log) throws Exception { List<Method> methodsToRun = getAnnotatedMethodsFromChildToParent(obj.getClass(), PreDestroy.class, log); for(Method aMethod : methodsToRun) { safeInvokeMethod(obj, aMethod, log); } }
java
public static void preDestroy(Object obj, Logger log) throws Exception { List<Method> methodsToRun = getAnnotatedMethodsFromChildToParent(obj.getClass(), PreDestroy.class, log); for(Method aMethod : methodsToRun) { safeInvokeMethod(obj, aMethod, log); } }
[ "public", "static", "void", "preDestroy", "(", "Object", "obj", ",", "Logger", "log", ")", "throws", "Exception", "{", "List", "<", "Method", ">", "methodsToRun", "=", "getAnnotatedMethodsFromChildToParent", "(", "obj", ".", "getClass", "(", ")", ",", "PreDest...
Calls all @PreDestroy methods on the object passed in called in order from child class to super class. @param obj The instance to inspect for Annotated methods and call them. @param log @throws Exception
[ "Calls", "all", "@PreDestroy", "methods", "on", "the", "object", "passed", "in", "called", "in", "order", "from", "child", "class", "to", "super", "class", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java#L86-L91
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.utils/src/com/ibm/ws/jca/utils/xml/metatype/MetatypeOcd.java
MetatypeOcd.addInternalMetatypeAd
public void addInternalMetatypeAd(String id, String value) { MetatypeAd ad = new MetatypeAd(metaTypeProviderFactory); ad.setId(id); ad.setType("String"); ad.setDefault(value); ad.setFinal(true); ad.setName("internal"); ad.setDescription("internal use only"); addMetatypeAd(ad); }
java
public void addInternalMetatypeAd(String id, String value) { MetatypeAd ad = new MetatypeAd(metaTypeProviderFactory); ad.setId(id); ad.setType("String"); ad.setDefault(value); ad.setFinal(true); ad.setName("internal"); ad.setDescription("internal use only"); addMetatypeAd(ad); }
[ "public", "void", "addInternalMetatypeAd", "(", "String", "id", ",", "String", "value", ")", "{", "MetatypeAd", "ad", "=", "new", "MetatypeAd", "(", "metaTypeProviderFactory", ")", ";", "ad", ".", "setId", "(", "id", ")", ";", "ad", ".", "setType", "(", ...
Adds an internal, ibm:final metatype ad @param id id @param value default value
[ "Adds", "an", "internal", "ibm", ":", "final", "metatype", "ad" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.utils/src/com/ibm/ws/jca/utils/xml/metatype/MetatypeOcd.java#L153-L162
apache/incubator-druid
extensions-contrib/materialized-view-selection/src/main/java/org/apache/druid/query/materializedview/DerivativeDataSourceManager.java
DerivativeDataSourceManager.getAvgSizePerGranularity
private long getAvgSizePerGranularity(String datasource) { return connector.retryWithHandle( new HandleCallback<Long>() { Set<Interval> intervals = new HashSet<>(); long totalSize = 0; @Override public Long withHandle(Handle handle) { handle.createQuery( StringUtils.format("SELECT start,%1$send%1$s,payload FROM %2$s WHERE used = true AND dataSource = :dataSource", connector.getQuoteString(), dbTables.get().getSegmentsTable() ) ) .bind("dataSource", datasource) .map( new ResultSetMapper<Object>() { @Override public Object map(int index, ResultSet r, StatementContext ctx) throws SQLException { try { intervals.add(Intervals.utc(DateTimes.of(r.getString("start")).getMillis(), DateTimes.of(r.getString("end")).getMillis())); DataSegment segment = objectMapper.readValue(r.getBytes("payload"), DataSegment.class); totalSize += segment.getSize(); } catch (IOException e) { throw new RuntimeException(e); } return null; } } ) .first(); return intervals.isEmpty() ? 0L : totalSize / intervals.size(); } } ); }
java
private long getAvgSizePerGranularity(String datasource) { return connector.retryWithHandle( new HandleCallback<Long>() { Set<Interval> intervals = new HashSet<>(); long totalSize = 0; @Override public Long withHandle(Handle handle) { handle.createQuery( StringUtils.format("SELECT start,%1$send%1$s,payload FROM %2$s WHERE used = true AND dataSource = :dataSource", connector.getQuoteString(), dbTables.get().getSegmentsTable() ) ) .bind("dataSource", datasource) .map( new ResultSetMapper<Object>() { @Override public Object map(int index, ResultSet r, StatementContext ctx) throws SQLException { try { intervals.add(Intervals.utc(DateTimes.of(r.getString("start")).getMillis(), DateTimes.of(r.getString("end")).getMillis())); DataSegment segment = objectMapper.readValue(r.getBytes("payload"), DataSegment.class); totalSize += segment.getSize(); } catch (IOException e) { throw new RuntimeException(e); } return null; } } ) .first(); return intervals.isEmpty() ? 0L : totalSize / intervals.size(); } } ); }
[ "private", "long", "getAvgSizePerGranularity", "(", "String", "datasource", ")", "{", "return", "connector", ".", "retryWithHandle", "(", "new", "HandleCallback", "<", "Long", ">", "(", ")", "{", "Set", "<", "Interval", ">", "intervals", "=", "new", "HashSet",...
calculate the average data size per segment granularity for a given datasource. e.g. for a datasource, there're 5 segments as follows, interval = "2018-04-01/2017-04-02", segment size = 1024 * 1024 * 2 interval = "2018-04-01/2017-04-02", segment size = 1024 * 1024 * 2 interval = "2018-04-02/2017-04-03", segment size = 1024 * 1024 * 1 interval = "2018-04-02/2017-04-03", segment size = 1024 * 1024 * 1 interval = "2018-04-02/2017-04-03", segment size = 1024 * 1024 * 1 Then, we get interval number = 2, total segment size = 1024 * 1024 * 7 At last, return the result 1024 * 1024 * 7 / 2 = 1024 * 1024 * 3.5 @param datasource @return average data size per segment granularity
[ "calculate", "the", "average", "data", "size", "per", "segment", "granularity", "for", "a", "given", "datasource", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-contrib/materialized-view-selection/src/main/java/org/apache/druid/query/materializedview/DerivativeDataSourceManager.java#L227-L265
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/Util.java
Util.cardinalityInBitmapWordRange
@Deprecated public static int cardinalityInBitmapWordRange(long[] bitmap, int start, int end) { if (start >= end) { return 0; } int firstword = start / 64; int endword = (end - 1) / 64; int answer = 0; for (int i = firstword; i <= endword; i++) { answer += Long.bitCount(bitmap[i]); } return answer; }
java
@Deprecated public static int cardinalityInBitmapWordRange(long[] bitmap, int start, int end) { if (start >= end) { return 0; } int firstword = start / 64; int endword = (end - 1) / 64; int answer = 0; for (int i = firstword; i <= endword; i++) { answer += Long.bitCount(bitmap[i]); } return answer; }
[ "@", "Deprecated", "public", "static", "int", "cardinalityInBitmapWordRange", "(", "long", "[", "]", "bitmap", ",", "int", "start", ",", "int", "end", ")", "{", "if", "(", "start", ">=", "end", ")", "{", "return", "0", ";", "}", "int", "firstword", "="...
Hamming weight of the 64-bit words involved in the range start, start+1,..., end-1, that is, it will compute the cardinality of the bitset from index (floor(start/64) to floor((end-1)/64)) inclusively. @param bitmap array of words representing a bitset @param start first index (inclusive) @param end last index (exclusive) @return the hamming weight of the corresponding words
[ "Hamming", "weight", "of", "the", "64", "-", "bit", "words", "involved", "in", "the", "range", "start", "start", "+", "1", "...", "end", "-", "1", "that", "is", "it", "will", "compute", "the", "cardinality", "of", "the", "bitset", "from", "index", "(",...
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/Util.java#L313-L325
unbescape/unbescape
src/main/java/org/unbescape/java/JavaEscapeUtil.java
JavaEscapeUtil.requiresUnicodeUnescape
static boolean requiresUnicodeUnescape(final char[] text, final int offset, final int len) { if (text == null) { return false; } final int max = (offset + len); for (int i = offset; i < max; i++) { final char c = text[i]; if (c != ESCAPE_PREFIX || (i + 1) >= max) { continue; } if (c == ESCAPE_PREFIX) { final char c1 = text[i + 1]; if (c1 == ESCAPE_UHEXA_PREFIX2) { // This can be a uhexa escape return true; } } } return false; }
java
static boolean requiresUnicodeUnescape(final char[] text, final int offset, final int len) { if (text == null) { return false; } final int max = (offset + len); for (int i = offset; i < max; i++) { final char c = text[i]; if (c != ESCAPE_PREFIX || (i + 1) >= max) { continue; } if (c == ESCAPE_PREFIX) { final char c1 = text[i + 1]; if (c1 == ESCAPE_UHEXA_PREFIX2) { // This can be a uhexa escape return true; } } } return false; }
[ "static", "boolean", "requiresUnicodeUnescape", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ")", "{", "if", "(", "text", "==", "null", ")", "{", "return", "false", ";", "}", "final", "int", "max", ...
/* Determine whether we will need unicode unescape or not, so that we avoid creating a writer object if it is not needed.
[ "/", "*", "Determine", "whether", "we", "will", "need", "unicode", "unescape", "or", "not", "so", "that", "we", "avoid", "creating", "a", "writer", "object", "if", "it", "is", "not", "needed", "." ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/java/JavaEscapeUtil.java#L863-L894
stripe/stripe-android
stripe/src/main/java/com/stripe/android/PaymentSession.java
PaymentSession.handlePaymentData
public boolean handlePaymentData(int requestCode, int resultCode, @NonNull Intent data) { if (resultCode == Activity.RESULT_CANCELED) { fetchCustomer(); return false; } else if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case PAYMENT_METHOD_REQUEST: { fetchCustomer(); return true; } case PAYMENT_SHIPPING_DETAILS_REQUEST: { final PaymentSessionData paymentSessionData = data.getParcelableExtra( PAYMENT_SESSION_DATA_KEY); paymentSessionData.updateIsPaymentReadyToCharge(mPaymentSessionConfig); mPaymentSessionData = paymentSessionData; if (mPaymentSessionListener != null) { mPaymentSessionListener.onPaymentSessionDataChanged(paymentSessionData); } return true; } default: { break; } } } return false; }
java
public boolean handlePaymentData(int requestCode, int resultCode, @NonNull Intent data) { if (resultCode == Activity.RESULT_CANCELED) { fetchCustomer(); return false; } else if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case PAYMENT_METHOD_REQUEST: { fetchCustomer(); return true; } case PAYMENT_SHIPPING_DETAILS_REQUEST: { final PaymentSessionData paymentSessionData = data.getParcelableExtra( PAYMENT_SESSION_DATA_KEY); paymentSessionData.updateIsPaymentReadyToCharge(mPaymentSessionConfig); mPaymentSessionData = paymentSessionData; if (mPaymentSessionListener != null) { mPaymentSessionListener.onPaymentSessionDataChanged(paymentSessionData); } return true; } default: { break; } } } return false; }
[ "public", "boolean", "handlePaymentData", "(", "int", "requestCode", ",", "int", "resultCode", ",", "@", "NonNull", "Intent", "data", ")", "{", "if", "(", "resultCode", "==", "Activity", ".", "RESULT_CANCELED", ")", "{", "fetchCustomer", "(", ")", ";", "retu...
Method to handle Activity results from Stripe activities. Pass data here from your host Activity's {@link Activity#onActivityResult(int, int, Intent)} function. @param requestCode the request code used to open the resulting activity @param resultCode a result code representing the success of the intended action @param data an {@link Intent} with the resulting data from the Activity @return {@code true} if the activity result was handled by this function, otherwise {@code false}
[ "Method", "to", "handle", "Activity", "results", "from", "Stripe", "activities", ".", "Pass", "data", "here", "from", "your", "host", "Activity", "s", "{", "@link", "Activity#onActivityResult", "(", "int", "int", "Intent", ")", "}", "function", "." ]
train
https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/PaymentSession.java#L83-L109
casbin/jcasbin
src/main/java/org/casbin/jcasbin/util/Util.java
Util.setEquals
public static boolean setEquals(List<String> a, List<String> b) { if (a == null) { a = new ArrayList<>(); } if (b == null) { b = new ArrayList<>(); } if (a.size() != b.size()) { return false; } Collections.sort(a); Collections.sort(b); for (int i = 0; i < a.size(); i ++) { if (!a.get(i).equals(b.get(i))) { return false; } } return true; }
java
public static boolean setEquals(List<String> a, List<String> b) { if (a == null) { a = new ArrayList<>(); } if (b == null) { b = new ArrayList<>(); } if (a.size() != b.size()) { return false; } Collections.sort(a); Collections.sort(b); for (int i = 0; i < a.size(); i ++) { if (!a.get(i).equals(b.get(i))) { return false; } } return true; }
[ "public", "static", "boolean", "setEquals", "(", "List", "<", "String", ">", "a", ",", "List", "<", "String", ">", "b", ")", "{", "if", "(", "a", "==", "null", ")", "{", "a", "=", "new", "ArrayList", "<>", "(", ")", ";", "}", "if", "(", "b", ...
setEquals determines whether two string sets are identical. @param a the first set. @param b the second set. @return whether a equals to b.
[ "setEquals", "determines", "whether", "two", "string", "sets", "are", "identical", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/util/Util.java#L182-L202
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/WorkspacesApi.java
WorkspacesApi.listWorkspaceFolderItems
public WorkspaceFolderContents listWorkspaceFolderItems(String accountId, String workspaceId, String folderId, WorkspacesApi.ListWorkspaceFolderItemsOptions 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 listWorkspaceFolderItems"); } // verify the required parameter 'workspaceId' is set if (workspaceId == null) { throw new ApiException(400, "Missing the required parameter 'workspaceId' when calling listWorkspaceFolderItems"); } // verify the required parameter 'folderId' is set if (folderId == null) { throw new ApiException(400, "Missing the required parameter 'folderId' when calling listWorkspaceFolderItems"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/workspaces/{workspaceId}/folders/{folderId}".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "workspaceId" + "\\}", apiClient.escapeString(workspaceId.toString())) .replaceAll("\\{" + "folderId" + "\\}", apiClient.escapeString(folderId.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("", "count", options.count)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_files", options.includeFiles)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_sub_folders", options.includeSubFolders)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_thumbnails", options.includeThumbnails)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_user_detail", options.includeUserDetail)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "workspace_user_id", options.workspaceUserId)); } 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<WorkspaceFolderContents> localVarReturnType = new GenericType<WorkspaceFolderContents>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
java
public WorkspaceFolderContents listWorkspaceFolderItems(String accountId, String workspaceId, String folderId, WorkspacesApi.ListWorkspaceFolderItemsOptions 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 listWorkspaceFolderItems"); } // verify the required parameter 'workspaceId' is set if (workspaceId == null) { throw new ApiException(400, "Missing the required parameter 'workspaceId' when calling listWorkspaceFolderItems"); } // verify the required parameter 'folderId' is set if (folderId == null) { throw new ApiException(400, "Missing the required parameter 'folderId' when calling listWorkspaceFolderItems"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/workspaces/{workspaceId}/folders/{folderId}".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "workspaceId" + "\\}", apiClient.escapeString(workspaceId.toString())) .replaceAll("\\{" + "folderId" + "\\}", apiClient.escapeString(folderId.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("", "count", options.count)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_files", options.includeFiles)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_sub_folders", options.includeSubFolders)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_thumbnails", options.includeThumbnails)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_user_detail", options.includeUserDetail)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "workspace_user_id", options.workspaceUserId)); } 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<WorkspaceFolderContents> localVarReturnType = new GenericType<WorkspaceFolderContents>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
[ "public", "WorkspaceFolderContents", "listWorkspaceFolderItems", "(", "String", "accountId", ",", "String", "workspaceId", ",", "String", "folderId", ",", "WorkspacesApi", ".", "ListWorkspaceFolderItemsOptions", "options", ")", "throws", "ApiException", "{", "Object", "lo...
List Workspace Folder Contents Retrieves workspace folder contents, which can include sub folders and files. @param accountId The external account number (int) or account ID Guid. (required) @param workspaceId Specifies the workspace ID GUID. (required) @param folderId The ID of the folder being accessed. (required) @param options for modifying the method behavior. @return WorkspaceFolderContents @throws ApiException if fails to make API call
[ "List", "Workspace", "Folder", "Contents", "Retrieves", "workspace", "folder", "contents", "which", "can", "include", "sub", "folders", "and", "files", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/WorkspacesApi.java#L657-L711
dashorst/wicket-stuff-markup-validator
jing/src/main/java/com/thaiopensource/datatype/xsd/DurationDatatype.java
DurationDatatype.daysPlusSeconds
private static BigDecimal daysPlusSeconds(BigInteger days, BigDecimal seconds) { return seconds.add(new BigDecimal(days.multiply(BigInteger.valueOf(24*60*60)))); }
java
private static BigDecimal daysPlusSeconds(BigInteger days, BigDecimal seconds) { return seconds.add(new BigDecimal(days.multiply(BigInteger.valueOf(24*60*60)))); }
[ "private", "static", "BigDecimal", "daysPlusSeconds", "(", "BigInteger", "days", ",", "BigDecimal", "seconds", ")", "{", "return", "seconds", ".", "add", "(", "new", "BigDecimal", "(", "days", ".", "multiply", "(", "BigInteger", ".", "valueOf", "(", "24", "*...
Returns the total number of seconds from a specified number of days and seconds.
[ "Returns", "the", "total", "number", "of", "seconds", "from", "a", "specified", "number", "of", "days", "and", "seconds", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/datatype/xsd/DurationDatatype.java#L221-L223
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java
ClusterJoinManager.shouldMergeTo
private boolean shouldMergeTo(Address thisAddress, Address targetAddress) { String thisAddressStr = "[" + thisAddress.getHost() + "]:" + thisAddress.getPort(); String targetAddressStr = "[" + targetAddress.getHost() + "]:" + targetAddress.getPort(); if (thisAddressStr.equals(targetAddressStr)) { throw new IllegalArgumentException("Addresses should be different! This: " + thisAddress + ", Target: " + targetAddress); } // Since strings are guaranteed to be different, result will always be non-zero. int result = thisAddressStr.compareTo(targetAddressStr); return result > 0; }
java
private boolean shouldMergeTo(Address thisAddress, Address targetAddress) { String thisAddressStr = "[" + thisAddress.getHost() + "]:" + thisAddress.getPort(); String targetAddressStr = "[" + targetAddress.getHost() + "]:" + targetAddress.getPort(); if (thisAddressStr.equals(targetAddressStr)) { throw new IllegalArgumentException("Addresses should be different! This: " + thisAddress + ", Target: " + targetAddress); } // Since strings are guaranteed to be different, result will always be non-zero. int result = thisAddressStr.compareTo(targetAddressStr); return result > 0; }
[ "private", "boolean", "shouldMergeTo", "(", "Address", "thisAddress", ",", "Address", "targetAddress", ")", "{", "String", "thisAddressStr", "=", "\"[\"", "+", "thisAddress", ".", "getHost", "(", ")", "+", "\"]:\"", "+", "thisAddress", ".", "getPort", "(", ")"...
Determines whether this address should merge to target address and called when two sides are equal on all aspects. This is a pure function that must produce always the same output when called with the same parameters. This logic should not be changed, otherwise compatibility will be broken. @param thisAddress this address @param targetAddress target address @return true if this address should merge to target, false otherwise
[ "Determines", "whether", "this", "address", "should", "merge", "to", "target", "address", "and", "called", "when", "two", "sides", "are", "equal", "on", "all", "aspects", ".", "This", "is", "a", "pure", "function", "that", "must", "produce", "always", "the",...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java#L910-L922
alibaba/ARouter
arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java
Postcard.withFloatArray
public Postcard withFloatArray(@Nullable String key, @Nullable float[] value) { mBundle.putFloatArray(key, value); return this; }
java
public Postcard withFloatArray(@Nullable String key, @Nullable float[] value) { mBundle.putFloatArray(key, value); return this; }
[ "public", "Postcard", "withFloatArray", "(", "@", "Nullable", "String", "key", ",", "@", "Nullable", "float", "[", "]", "value", ")", "{", "mBundle", ".", "putFloatArray", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a float array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a float array object, or null @return current
[ "Inserts", "a", "float", "array", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L520-L523
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/BuildProject.java
BuildProject.createBuildRun
public BuildRun createBuildRun(String name, DateTime date) { return getInstance().create().buildRun(this, name, date); }
java
public BuildRun createBuildRun(String name, DateTime date) { return getInstance().create().buildRun(this, name, date); }
[ "public", "BuildRun", "createBuildRun", "(", "String", "name", ",", "DateTime", "date", ")", "{", "return", "getInstance", "(", ")", ".", "create", "(", ")", ".", "buildRun", "(", "this", ",", "name", ",", "date", ")", ";", "}" ]
Create a Build Run with the given name and date in this Build Project. @param name of creating BuildRun. @param date of creating BuildRun. @return A new Build Run in this Build Project.
[ "Create", "a", "Build", "Run", "with", "the", "given", "name", "and", "date", "in", "this", "Build", "Project", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/BuildProject.java#L70-L72
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/Base58.java
Base58.divmod
private static byte divmod(byte[] number, int firstDigit, int base, int divisor) { // this is just long division which accounts for the base of the input digits int remainder = 0; for (int i = firstDigit; i < number.length; i++) { int digit = (int) number[i] & 0xFF; int temp = remainder * base + digit; number[i] = (byte) (temp / divisor); remainder = temp % divisor; } return (byte) remainder; }
java
private static byte divmod(byte[] number, int firstDigit, int base, int divisor) { // this is just long division which accounts for the base of the input digits int remainder = 0; for (int i = firstDigit; i < number.length; i++) { int digit = (int) number[i] & 0xFF; int temp = remainder * base + digit; number[i] = (byte) (temp / divisor); remainder = temp % divisor; } return (byte) remainder; }
[ "private", "static", "byte", "divmod", "(", "byte", "[", "]", "number", ",", "int", "firstDigit", ",", "int", "base", ",", "int", "divisor", ")", "{", "// this is just long division which accounts for the base of the input digits", "int", "remainder", "=", "0", ";",...
Divides a number, represented as an array of bytes each containing a single digit in the specified base, by the given divisor. The given number is modified in-place to contain the quotient, and the return value is the remainder. @param number the number to divide @param firstDigit the index within the array of the first non-zero digit (this is used for optimization by skipping the leading zeros) @param base the base in which the number's digits are represented (up to 256) @param divisor the number to divide by (up to 256) @return the remainder of the division operation
[ "Divides", "a", "number", "represented", "as", "an", "array", "of", "bytes", "each", "containing", "a", "single", "digit", "in", "the", "specified", "base", "by", "the", "given", "divisor", ".", "The", "given", "number", "is", "modified", "in", "-", "place...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Base58.java#L194-L204
BigBadaboom/androidsvg
androidsvg/src/main/java/com/caverock/androidsvg/SVGParser.java
SVGParser.parseLength
static Length parseLength(String val) throws SVGParseException { if (val.length() == 0) throw new SVGParseException("Invalid length value (empty string)"); int end = val.length(); Unit unit = Unit.px; char lastChar = val.charAt(end-1); if (lastChar == '%') { end -= 1; unit = Unit.percent; } else if (end > 2 && Character.isLetter(lastChar) && Character.isLetter(val.charAt(end-2))) { end -= 2; String unitStr = val.substring(end); try { unit = Unit.valueOf(unitStr.toLowerCase(Locale.US)); } catch (IllegalArgumentException e) { throw new SVGParseException("Invalid length unit specifier: "+val); } } try { float scalar = parseFloat(val, 0, end); return new Length(scalar, unit); } catch (NumberFormatException e) { throw new SVGParseException("Invalid length value: "+val, e); } }
java
static Length parseLength(String val) throws SVGParseException { if (val.length() == 0) throw new SVGParseException("Invalid length value (empty string)"); int end = val.length(); Unit unit = Unit.px; char lastChar = val.charAt(end-1); if (lastChar == '%') { end -= 1; unit = Unit.percent; } else if (end > 2 && Character.isLetter(lastChar) && Character.isLetter(val.charAt(end-2))) { end -= 2; String unitStr = val.substring(end); try { unit = Unit.valueOf(unitStr.toLowerCase(Locale.US)); } catch (IllegalArgumentException e) { throw new SVGParseException("Invalid length unit specifier: "+val); } } try { float scalar = parseFloat(val, 0, end); return new Length(scalar, unit); } catch (NumberFormatException e) { throw new SVGParseException("Invalid length value: "+val, e); } }
[ "static", "Length", "parseLength", "(", "String", "val", ")", "throws", "SVGParseException", "{", "if", "(", "val", ".", "length", "(", ")", "==", "0", ")", "throw", "new", "SVGParseException", "(", "\"Invalid length value (empty string)\"", ")", ";", "int", "...
/* Parse an SVG 'Length' value (usually a coordinate). Spec says: length ::= number ("em" | "ex" | "px" | "in" | "cm" | "mm" | "pt" | "pc" | "%")?
[ "/", "*", "Parse", "an", "SVG", "Length", "value", "(", "usually", "a", "coordinate", ")", ".", "Spec", "says", ":", "length", "::", "=", "number", "(", "em", "|", "ex", "|", "px", "|", "in", "|", "cm", "|", "mm", "|", "pt", "|", "pc", "|", "...
train
https://github.com/BigBadaboom/androidsvg/blob/0d1614dd1a4da10ea4afe3b0cea1361a4ac6b45a/androidsvg/src/main/java/com/caverock/androidsvg/SVGParser.java#L3421-L3450
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java
CommerceOrderPersistenceImpl.fetchByC_ERC
@Override public CommerceOrder fetchByC_ERC(long companyId, String externalReferenceCode) { return fetchByC_ERC(companyId, externalReferenceCode, true); }
java
@Override public CommerceOrder fetchByC_ERC(long companyId, String externalReferenceCode) { return fetchByC_ERC(companyId, externalReferenceCode, true); }
[ "@", "Override", "public", "CommerceOrder", "fetchByC_ERC", "(", "long", "companyId", ",", "String", "externalReferenceCode", ")", "{", "return", "fetchByC_ERC", "(", "companyId", ",", "externalReferenceCode", ",", "true", ")", ";", "}" ]
Returns the commerce order where companyId = &#63; and externalReferenceCode = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param companyId the company ID @param externalReferenceCode the external reference code @return the matching commerce order, or <code>null</code> if a matching commerce order could not be found
[ "Returns", "the", "commerce", "order", "where", "companyId", "=", "&#63", ";", "and", "externalReferenceCode", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "fin...
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java#L5912-L5916
phax/ph-commons
ph-json/src/main/java/com/helger/json/serialize/JsonReader.java
JsonReader.isValidJson
public static boolean isValidJson (@Nonnull final IHasInputStream aISP, @Nonnull final Charset aFallbackCharset) { ValueEnforcer.notNull (aISP, "InputStreamProvider"); ValueEnforcer.notNull (aFallbackCharset, "FallbackCharset"); final InputStream aIS = aISP.getInputStream (); if (aIS == null) { if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Failed to open Json InputStream from " + aISP); return false; } return isValidJson (aIS, aFallbackCharset); }
java
public static boolean isValidJson (@Nonnull final IHasInputStream aISP, @Nonnull final Charset aFallbackCharset) { ValueEnforcer.notNull (aISP, "InputStreamProvider"); ValueEnforcer.notNull (aFallbackCharset, "FallbackCharset"); final InputStream aIS = aISP.getInputStream (); if (aIS == null) { if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Failed to open Json InputStream from " + aISP); return false; } return isValidJson (aIS, aFallbackCharset); }
[ "public", "static", "boolean", "isValidJson", "(", "@", "Nonnull", "final", "IHasInputStream", "aISP", ",", "@", "Nonnull", "final", "Charset", "aFallbackCharset", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aISP", ",", "\"InputStreamProvider\"", ")", ";", ...
Check if the passed input stream can be resembled to valid Json content. This is accomplished by fully parsing the Json file each time the method is called. This consumes <b>less memory</b> than calling any of the <code>read...</code> methods and checking for a non-<code>null</code> result. @param aISP The resource to be parsed. May not be <code>null</code>. @param aFallbackCharset The charset to be used for reading the Json file in case no BOM is present. May not be <code>null</code>. @return <code>true</code> if the file can be parsed without error, <code>false</code> if not
[ "Check", "if", "the", "passed", "input", "stream", "can", "be", "resembled", "to", "valid", "Json", "content", ".", "This", "is", "accomplished", "by", "fully", "parsing", "the", "Json", "file", "each", "time", "the", "method", "is", "called", ".", "This",...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-json/src/main/java/com/helger/json/serialize/JsonReader.java#L295-L308
HeidelTime/heideltime
src/jvntextpro/util/StringUtils.java
StringUtils.indexOf
public static int indexOf( String[] array, String s ) { for (int index = 0; index < array.length; index++) { if( s.equals( array[index] ) ) { return index; } } return -1; }
java
public static int indexOf( String[] array, String s ) { for (int index = 0; index < array.length; index++) { if( s.equals( array[index] ) ) { return index; } } return -1; }
[ "public", "static", "int", "indexOf", "(", "String", "[", "]", "array", ",", "String", "s", ")", "{", "for", "(", "int", "index", "=", "0", ";", "index", "<", "array", ".", "length", ";", "index", "++", ")", "{", "if", "(", "s", ".", "equals", ...
Returns the index of the first occurrence of the specified <tt>String</tt> in an array of <tt>String</tt>s. @param array array of <tt>String</tt>s to search. @param s the <tt>String</tt> to search for. @return the index of the first occurrence of the argument in this list, or -1 if the string is not found.
[ "Returns", "the", "index", "of", "the", "first", "occurrence", "of", "the", "specified", "<tt", ">", "String<", "/", "tt", ">", "in", "an", "array", "of", "<tt", ">", "String<", "/", "tt", ">", "s", "." ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/jvntextpro/util/StringUtils.java#L582-L592
apache/groovy
src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.leftShift
public static Writer leftShift(Writer self, Object value) throws IOException { InvokerHelper.write(self, value); return self; }
java
public static Writer leftShift(Writer self, Object value) throws IOException { InvokerHelper.write(self, value); return self; }
[ "public", "static", "Writer", "leftShift", "(", "Writer", "self", ",", "Object", "value", ")", "throws", "IOException", "{", "InvokerHelper", ".", "write", "(", "self", ",", "value", ")", ";", "return", "self", ";", "}" ]
Overloads the leftShift operator for Writer to allow an object to be written using Groovy's default representation for the object. @param self a Writer @param value an Object whose default representation will be written to the Writer @return the writer on which this operation was invoked @throws IOException if an I/O error occurs. @since 1.0
[ "Overloads", "the", "leftShift", "operator", "for", "Writer", "to", "allow", "an", "object", "to", "be", "written", "using", "Groovy", "s", "default", "representation", "for", "the", "object", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L92-L95
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.readAliasByPath
public CmsAlias readAliasByPath(CmsRequestContext context, String siteRoot, String path) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { CmsAlias alias = m_driverManager.readAliasByPath(dbc, context.getCurrentProject(), siteRoot, path); return alias; } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DB_OPERATION_0), e); return null; // will never be executed } finally { dbc.clear(); } }
java
public CmsAlias readAliasByPath(CmsRequestContext context, String siteRoot, String path) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { CmsAlias alias = m_driverManager.readAliasByPath(dbc, context.getCurrentProject(), siteRoot, path); return alias; } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DB_OPERATION_0), e); return null; // will never be executed } finally { dbc.clear(); } }
[ "public", "CmsAlias", "readAliasByPath", "(", "CmsRequestContext", "context", ",", "String", "siteRoot", ",", "String", "path", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "tr...
Reads the alias with a given path in a given site.<p> @param context the current request context @param siteRoot the site root @param path the site relative alias path @return the alias for the path, or null if no such alias exists @throws CmsException if something goes wrong
[ "Reads", "the", "alias", "with", "a", "given", "path", "in", "a", "given", "site", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L3878-L3890
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java
SimpleRandomSampling.minimumSampleSizeForMaximumXbarStd
public static int minimumSampleSizeForMaximumXbarStd(double maximumXbarStd, double populationStd, int populationN) { if(populationN<=0) { throw new IllegalArgumentException("The populationN parameter must be positive."); } double minimumSampleN = 1.0/(Math.pow(maximumXbarStd/populationStd,2) + 1.0/populationN); return (int)Math.ceil(minimumSampleN); }
java
public static int minimumSampleSizeForMaximumXbarStd(double maximumXbarStd, double populationStd, int populationN) { if(populationN<=0) { throw new IllegalArgumentException("The populationN parameter must be positive."); } double minimumSampleN = 1.0/(Math.pow(maximumXbarStd/populationStd,2) + 1.0/populationN); return (int)Math.ceil(minimumSampleN); }
[ "public", "static", "int", "minimumSampleSizeForMaximumXbarStd", "(", "double", "maximumXbarStd", ",", "double", "populationStd", ",", "int", "populationN", ")", "{", "if", "(", "populationN", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "...
Returns the minimum required sample size when we set a specific maximum Xbar STD Error for finite population size. @param maximumXbarStd @param populationStd @param populationN @return
[ "Returns", "the", "minimum", "required", "sample", "size", "when", "we", "set", "a", "specific", "maximum", "Xbar", "STD", "Error", "for", "finite", "population", "size", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L265-L273
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/websphere/exception/DistributedExceptionInfo.java
DistributedExceptionInfo.setLocalizationInfo
public void setLocalizationInfo(String resourceBundleName, String resourceKey, Object[] formatArguments) { this.resourceBundleName = resourceBundleName; this.resourceKey = resourceKey; this.formatArguments = formatArguments; }
java
public void setLocalizationInfo(String resourceBundleName, String resourceKey, Object[] formatArguments) { this.resourceBundleName = resourceBundleName; this.resourceKey = resourceKey; this.formatArguments = formatArguments; }
[ "public", "void", "setLocalizationInfo", "(", "String", "resourceBundleName", ",", "String", "resourceKey", ",", "Object", "[", "]", "formatArguments", ")", "{", "this", ".", "resourceBundleName", "=", "resourceBundleName", ";", "this", ".", "resourceKey", "=", "r...
FOR WEBSPHERE INTERNAL USE ONLY Set the localization information. @param resourceBundleName java.lang.String @param resourceKey java.lang.String @param arguments java.lang.Object[]
[ "FOR", "WEBSPHERE", "INTERNAL", "USE", "ONLY", "Set", "the", "localization", "information", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/websphere/exception/DistributedExceptionInfo.java#L689-L693
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java
MetadataFinder.deliverTrackMetadataUpdate
private void deliverTrackMetadataUpdate(int player, TrackMetadata metadata) { if (!getTrackMetadataListeners().isEmpty()) { final TrackMetadataUpdate update = new TrackMetadataUpdate(player, metadata); for (final TrackMetadataListener listener : getTrackMetadataListeners()) { try { listener.metadataChanged(update); } catch (Throwable t) { logger.warn("Problem delivering track metadata update to listener", t); } } } }
java
private void deliverTrackMetadataUpdate(int player, TrackMetadata metadata) { if (!getTrackMetadataListeners().isEmpty()) { final TrackMetadataUpdate update = new TrackMetadataUpdate(player, metadata); for (final TrackMetadataListener listener : getTrackMetadataListeners()) { try { listener.metadataChanged(update); } catch (Throwable t) { logger.warn("Problem delivering track metadata update to listener", t); } } } }
[ "private", "void", "deliverTrackMetadataUpdate", "(", "int", "player", ",", "TrackMetadata", "metadata", ")", "{", "if", "(", "!", "getTrackMetadataListeners", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "final", "TrackMetadataUpdate", "update", "=", "new", ...
Send a track metadata update announcement to all registered listeners.
[ "Send", "a", "track", "metadata", "update", "announcement", "to", "all", "registered", "listeners", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java#L1023-L1035
aws/aws-sdk-java
aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/GetOpenIdTokenRequest.java
GetOpenIdTokenRequest.withLogins
public GetOpenIdTokenRequest withLogins(java.util.Map<String, String> logins) { setLogins(logins); return this; }
java
public GetOpenIdTokenRequest withLogins(java.util.Map<String, String> logins) { setLogins(logins); return this; }
[ "public", "GetOpenIdTokenRequest", "withLogins", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "logins", ")", "{", "setLogins", "(", "logins", ")", ";", "return", "this", ";", "}" ]
<p> A set of optional name-value pairs that map provider names to provider tokens. When using graph.facebook.com and www.amazon.com, supply the access_token returned from the provider's authflow. For accounts.google.com, an Amazon Cognito user pool provider, or any other OpenId Connect provider, always include the <code>id_token</code>. </p> @param logins A set of optional name-value pairs that map provider names to provider tokens. When using graph.facebook.com and www.amazon.com, supply the access_token returned from the provider's authflow. For accounts.google.com, an Amazon Cognito user pool provider, or any other OpenId Connect provider, always include the <code>id_token</code>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "set", "of", "optional", "name", "-", "value", "pairs", "that", "map", "provider", "names", "to", "provider", "tokens", ".", "When", "using", "graph", ".", "facebook", ".", "com", "and", "www", ".", "amazon", ".", "com", "supply", "the"...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/GetOpenIdTokenRequest.java#L136-L139
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/genia/Event.java
Event.setCauses_protein
public void setCauses_protein(int i, Protein v) { if (Event_Type.featOkTst && ((Event_Type)jcasType).casFeat_causes_protein == null) jcasType.jcas.throwFeatMissing("causes_protein", "ch.epfl.bbp.uima.genia.Event"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_causes_protein), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_causes_protein), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setCauses_protein(int i, Protein v) { if (Event_Type.featOkTst && ((Event_Type)jcasType).casFeat_causes_protein == null) jcasType.jcas.throwFeatMissing("causes_protein", "ch.epfl.bbp.uima.genia.Event"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_causes_protein), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_causes_protein), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setCauses_protein", "(", "int", "i", ",", "Protein", "v", ")", "{", "if", "(", "Event_Type", ".", "featOkTst", "&&", "(", "(", "Event_Type", ")", "jcasType", ")", ".", "casFeat_causes_protein", "==", "null", ")", "jcasType", ".", "jcas",...
indexed setter for causes_protein - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "causes_protein", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/genia/Event.java#L185-L189
google/Accessibility-Test-Framework-for-Android
src/main/java/com/googlecode/eyesfree/utils/ScreenshotUtils.java
ScreenshotUtils.writeBitmap
public static File writeBitmap(Context context, Bitmap bitmap, String dir, String filename) { if ((bitmap == null) || TextUtils.isEmpty(dir) || TextUtils.isEmpty(filename)) { return null; } final File dirFile = new File(context.getFilesDir(), dir); return writeBitmapToDirectory(bitmap, filename, dirFile); }
java
public static File writeBitmap(Context context, Bitmap bitmap, String dir, String filename) { if ((bitmap == null) || TextUtils.isEmpty(dir) || TextUtils.isEmpty(filename)) { return null; } final File dirFile = new File(context.getFilesDir(), dir); return writeBitmapToDirectory(bitmap, filename, dirFile); }
[ "public", "static", "File", "writeBitmap", "(", "Context", "context", ",", "Bitmap", "bitmap", ",", "String", "dir", ",", "String", "filename", ")", "{", "if", "(", "(", "bitmap", "==", "null", ")", "||", "TextUtils", ".", "isEmpty", "(", "dir", ")", "...
Writes a {@link Bitmap} object to a file in the current context's files directory. @param context The current context. @param bitmap The bitmap object to output. @param dir The output directory name within the files directory. @param filename The name of the file to output. @return A file where the Bitmap was stored, or {@code null} if the write operation failed.
[ "Writes", "a", "{", "@link", "Bitmap", "}", "object", "to", "a", "file", "in", "the", "current", "context", "s", "files", "directory", "." ]
train
https://github.com/google/Accessibility-Test-Framework-for-Android/blob/a6117fe0059c82dd764fa628d3817d724570f69e/src/main/java/com/googlecode/eyesfree/utils/ScreenshotUtils.java#L194-L200
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.order_orderId_paymentMethods_GET
public OvhPaymentMethods order_orderId_paymentMethods_GET(Long orderId) throws IOException { String qPath = "/me/order/{orderId}/paymentMethods"; StringBuilder sb = path(qPath, orderId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPaymentMethods.class); }
java
public OvhPaymentMethods order_orderId_paymentMethods_GET(Long orderId) throws IOException { String qPath = "/me/order/{orderId}/paymentMethods"; StringBuilder sb = path(qPath, orderId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPaymentMethods.class); }
[ "public", "OvhPaymentMethods", "order_orderId_paymentMethods_GET", "(", "Long", "orderId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/order/{orderId}/paymentMethods\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "orderId", ")", ...
List of registered payment method you can use to pay this order REST: GET /me/order/{orderId}/paymentMethods @param orderId [required] API beta
[ "List", "of", "registered", "payment", "method", "you", "can", "use", "to", "pay", "this", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1972-L1977
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MessageProcessor.java
MessageProcessor.setCustomProperty
@Override public void setCustomProperty(String propertyName, String propertyValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setCustomProperty", new Object[] { propertyName, propertyValue }); _customProperties.setProperty(propertyName, propertyValue); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setCustomProperty"); }
java
@Override public void setCustomProperty(String propertyName, String propertyValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setCustomProperty", new Object[] { propertyName, propertyValue }); _customProperties.setProperty(propertyName, propertyValue); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setCustomProperty"); }
[ "@", "Override", "public", "void", "setCustomProperty", "(", "String", "propertyName", ",", "String", "propertyValue", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", ...
setCustomProperty is implemented from the interface JsEngineComponent and is used to set properties on the MP @param propertyName The name of the Attribute @param propertyValue The value of the Attribute @see com.ibm.ws.sib.admin.JsEngineComponent.setCustomProperty
[ "setCustomProperty", "is", "implemented", "from", "the", "interface", "JsEngineComponent", "and", "is", "used", "to", "set", "properties", "on", "the", "MP" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MessageProcessor.java#L2728-L2740
f2prateek/rx-preferences
rx-preferences/src/main/java/com/f2prateek/rx/preferences2/RxSharedPreferences.java
RxSharedPreferences.getStringSet
@RequiresApi(HONEYCOMB) @CheckResult @NonNull public Preference<Set<String>> getStringSet(@NonNull String key) { return getStringSet(key, Collections.<String>emptySet()); }
java
@RequiresApi(HONEYCOMB) @CheckResult @NonNull public Preference<Set<String>> getStringSet(@NonNull String key) { return getStringSet(key, Collections.<String>emptySet()); }
[ "@", "RequiresApi", "(", "HONEYCOMB", ")", "@", "CheckResult", "@", "NonNull", "public", "Preference", "<", "Set", "<", "String", ">", ">", "getStringSet", "(", "@", "NonNull", "String", "key", ")", "{", "return", "getStringSet", "(", "key", ",", "Collecti...
Create a string set preference for {@code key}. Default is an empty set. Note that returned set value will always be unmodifiable.
[ "Create", "a", "string", "set", "preference", "for", "{" ]
train
https://github.com/f2prateek/rx-preferences/blob/e338b4e6cee9c0c7b850be86ab41ed7b39a3637e/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/RxSharedPreferences.java#L157-L161
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.subMonths
public static long subMonths(final String dateString1, final String dateString2) { Date date1 = getDateFromString(dateString1, DEFAULT_DATE_SIMPLE_PATTERN); Date date2 = getDateFromString(dateString2, DEFAULT_DATE_SIMPLE_PATTERN); return subMonths(date1, date2); }
java
public static long subMonths(final String dateString1, final String dateString2) { Date date1 = getDateFromString(dateString1, DEFAULT_DATE_SIMPLE_PATTERN); Date date2 = getDateFromString(dateString2, DEFAULT_DATE_SIMPLE_PATTERN); return subMonths(date1, date2); }
[ "public", "static", "long", "subMonths", "(", "final", "String", "dateString1", ",", "final", "String", "dateString2", ")", "{", "Date", "date1", "=", "getDateFromString", "(", "dateString1", ",", "DEFAULT_DATE_SIMPLE_PATTERN", ")", ";", "Date", "date2", "=", "g...
Get how many months between two date, the date pattern is 'yyyy-MM-dd'. @param dateString1 date string to be tested. @param dateString2 date string to be tested. @return how many months between two date. @throws DateException
[ "Get", "how", "many", "months", "between", "two", "date", "the", "date", "pattern", "is", "yyyy", "-", "MM", "-", "dd", "." ]
train
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L475-L480
alkacon/opencms-core
src/org/opencms/scheduler/jobs/CmsImageCacheCleanupJob.java
CmsImageCacheCleanupJob.cleanImageCache
public static int cleanImageCache(float maxAge) { // calculate oldest possible date for the cache files long expireDate = System.currentTimeMillis() - (long)(maxAge * 60f * 60f * 1000f); File basedir = new File(CmsImageLoader.getImageRepositoryPath()); // perform the cache cleanup return cleanImageCache(expireDate, basedir); }
java
public static int cleanImageCache(float maxAge) { // calculate oldest possible date for the cache files long expireDate = System.currentTimeMillis() - (long)(maxAge * 60f * 60f * 1000f); File basedir = new File(CmsImageLoader.getImageRepositoryPath()); // perform the cache cleanup return cleanImageCache(expireDate, basedir); }
[ "public", "static", "int", "cleanImageCache", "(", "float", "maxAge", ")", "{", "// calculate oldest possible date for the cache files", "long", "expireDate", "=", "System", ".", "currentTimeMillis", "(", ")", "-", "(", "long", ")", "(", "maxAge", "*", "60f", "*",...
Removes all expired image cache entries from the RFS cache.<p> Empty directories are removed as well.<p> @param maxAge the maximum age of the image cache files in hours (or fractions of hours) @return the total number of deleted resources
[ "Removes", "all", "expired", "image", "cache", "entries", "from", "the", "RFS", "cache", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/scheduler/jobs/CmsImageCacheCleanupJob.java#L70-L77
bushidowallet/bushido-java-service
bushido-wallet-service/src/main/java/com/authy/api/Users.java
Users.requestSms
public Hash requestSms(int userId, Map<String, String> options) { String url = ""; try { url = URLEncoder.encode(Integer.toString(userId), ENCODE); } catch(Exception e) { e.printStackTrace(); } MapToResponse opt = new MapToResponse(options); String content = this.get(SMS_PATH + url, opt); return instanceFromXml(this.getStatus(), content); }
java
public Hash requestSms(int userId, Map<String, String> options) { String url = ""; try { url = URLEncoder.encode(Integer.toString(userId), ENCODE); } catch(Exception e) { e.printStackTrace(); } MapToResponse opt = new MapToResponse(options); String content = this.get(SMS_PATH + url, opt); return instanceFromXml(this.getStatus(), content); }
[ "public", "Hash", "requestSms", "(", "int", "userId", ",", "Map", "<", "String", ",", "String", ">", "options", ")", "{", "String", "url", "=", "\"\"", ";", "try", "{", "url", "=", "URLEncoder", ".", "encode", "(", "Integer", ".", "toString", "(", "u...
Send token via sms to a user with some options defined. @param userId @param options @return Hash instance with API's response.
[ "Send", "token", "via", "sms", "to", "a", "user", "with", "some", "options", "defined", "." ]
train
https://github.com/bushidowallet/bushido-java-service/blob/e1a0157527e57459b509718044d2df44084876a2/bushido-wallet-service/src/main/java/com/authy/api/Users.java#L76-L90
fullcontact/hadoop-sstable
sstable-core/src/main/java/com/fullcontact/cassandra/io/sstable/Descriptor.java
Descriptor.fromFilename
public static Pair<Descriptor, String> fromFilename(Path directory, String name) { // tokenize the filename StringTokenizer st = new StringTokenizer(name, String.valueOf(separator)); String nexttok; // all filenames must start with keyspace and column family String ksname = st.nextToken(); String cfname = st.nextToken(); // optional temporary marker nexttok = st.nextToken(); boolean temporary = false; if (nexttok.equals(SSTable.TEMPFILE_MARKER)) { temporary = true; nexttok = st.nextToken(); } // optional version string Version version = Version.LEGACY; if (Version.validate(nexttok)) { version = new Version(nexttok); nexttok = st.nextToken(); } int generation = Integer.parseInt(nexttok); // component suffix String component = st.nextToken(); directory = directory != null ? directory : new Path("."); return Pair.create(new Descriptor(version, directory, ksname, cfname, generation, temporary), component); }
java
public static Pair<Descriptor, String> fromFilename(Path directory, String name) { // tokenize the filename StringTokenizer st = new StringTokenizer(name, String.valueOf(separator)); String nexttok; // all filenames must start with keyspace and column family String ksname = st.nextToken(); String cfname = st.nextToken(); // optional temporary marker nexttok = st.nextToken(); boolean temporary = false; if (nexttok.equals(SSTable.TEMPFILE_MARKER)) { temporary = true; nexttok = st.nextToken(); } // optional version string Version version = Version.LEGACY; if (Version.validate(nexttok)) { version = new Version(nexttok); nexttok = st.nextToken(); } int generation = Integer.parseInt(nexttok); // component suffix String component = st.nextToken(); directory = directory != null ? directory : new Path("."); return Pair.create(new Descriptor(version, directory, ksname, cfname, generation, temporary), component); }
[ "public", "static", "Pair", "<", "Descriptor", ",", "String", ">", "fromFilename", "(", "Path", "directory", ",", "String", "name", ")", "{", "// tokenize the filename", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "name", ",", "String", ".", "...
Filename of the form "<ksname>-<cfname>-[tmp-][<version>-]<gen>-<component>" @param directory The directory of the SSTable files @param name The name of the SSTable file @return A Descriptor for the SSTable, and the Component remainder.
[ "Filename", "of", "the", "form", "<ksname", ">", "-", "<cfname", ">", "-", "[", "tmp", "-", "]", "[", "<version", ">", "-", "]", "<gen", ">", "-", "<component", ">" ]
train
https://github.com/fullcontact/hadoop-sstable/blob/1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2/sstable-core/src/main/java/com/fullcontact/cassandra/io/sstable/Descriptor.java#L243-L272
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/dsl/ParsingModelIo.java
ParsingModelIo.writeConfigurationFile
public static String writeConfigurationFile( FileDefinition relationsFile, boolean writeComments, String lineSeparator ) { return new FileDefinitionSerializer( lineSeparator ).write( relationsFile, writeComments ); }
java
public static String writeConfigurationFile( FileDefinition relationsFile, boolean writeComments, String lineSeparator ) { return new FileDefinitionSerializer( lineSeparator ).write( relationsFile, writeComments ); }
[ "public", "static", "String", "writeConfigurationFile", "(", "FileDefinition", "relationsFile", ",", "boolean", "writeComments", ",", "String", "lineSeparator", ")", "{", "return", "new", "FileDefinitionSerializer", "(", "lineSeparator", ")", ".", "write", "(", "relat...
Writes a model into a string. @param relationsFile the relations file @param writeComments true to write comments @param lineSeparator the line separator (if null, the OS' one is used) @return a string (never null)
[ "Writes", "a", "model", "into", "a", "string", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/dsl/ParsingModelIo.java#L75-L77
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/com/digitalpebble/rasp/Token.java
Token.setWordForms
public void setWordForms(int i, WordForm v) { if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_wordForms == null) jcasType.jcas.throwFeatMissing("wordForms", "com.digitalpebble.rasp.Token"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_wordForms), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_wordForms), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setWordForms(int i, WordForm v) { if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_wordForms == null) jcasType.jcas.throwFeatMissing("wordForms", "com.digitalpebble.rasp.Token"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_wordForms), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_wordForms), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setWordForms", "(", "int", "i", ",", "WordForm", "v", ")", "{", "if", "(", "Token_Type", ".", "featOkTst", "&&", "(", "(", "Token_Type", ")", "jcasType", ")", ".", "casFeat_wordForms", "==", "null", ")", "jcasType", ".", "jcas", ".", ...
indexed setter for wordForms - sets an indexed value - A Token is related to one or more WordForm @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "wordForms", "-", "sets", "an", "indexed", "value", "-", "A", "Token", "is", "related", "to", "one", "or", "more", "WordForm" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/com/digitalpebble/rasp/Token.java#L117-L121
weld/core
impl/src/main/java/org/jboss/weld/util/bytecode/ClassFileUtils.java
ClassFileUtils.makeClassLoaderMethodsAccessible
public static void makeClassLoaderMethodsAccessible() { // the AtomicBoolean make sure this gets invoked only once as WeldStartup is triggered per deployment if (classLoaderMethodsMadeAccessible.compareAndSet(false, true)) { try { AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { Class<?> cl = Class.forName("java.lang.ClassLoader"); final String name = "defineClass"; defineClass1 = cl.getDeclaredMethod(name, String.class, byte[].class, int.class, int.class); defineClass2 = cl.getDeclaredMethod(name, String.class, byte[].class, int.class, int.class, ProtectionDomain.class); // First try with Unsafe to avoid illegal access try { // get Unsafe singleton instance Field singleoneInstanceField = Unsafe.class.getDeclaredField("theUnsafe"); singleoneInstanceField.setAccessible(true); Unsafe theUnsafe = (Unsafe) singleoneInstanceField.get(null); // get the offset of the override field in AccessibleObject long overrideOffset = theUnsafe.objectFieldOffset(AccessibleObject.class.getDeclaredField("override")); // make both accessible theUnsafe.putBoolean(defineClass1, overrideOffset, true); theUnsafe.putBoolean(defineClass2, overrideOffset, true); return null; } catch (NoSuchFieldException e) { // This is JDK 12+, the "override" field isn't there anymore, fallback to setAccessible() defineClass1.setAccessible(true); defineClass2.setAccessible(true); return null; } } }); } catch (PrivilegedActionException pae) { throw new RuntimeException("cannot initialize ClassPool", pae.getException()); } } }
java
public static void makeClassLoaderMethodsAccessible() { // the AtomicBoolean make sure this gets invoked only once as WeldStartup is triggered per deployment if (classLoaderMethodsMadeAccessible.compareAndSet(false, true)) { try { AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { Class<?> cl = Class.forName("java.lang.ClassLoader"); final String name = "defineClass"; defineClass1 = cl.getDeclaredMethod(name, String.class, byte[].class, int.class, int.class); defineClass2 = cl.getDeclaredMethod(name, String.class, byte[].class, int.class, int.class, ProtectionDomain.class); // First try with Unsafe to avoid illegal access try { // get Unsafe singleton instance Field singleoneInstanceField = Unsafe.class.getDeclaredField("theUnsafe"); singleoneInstanceField.setAccessible(true); Unsafe theUnsafe = (Unsafe) singleoneInstanceField.get(null); // get the offset of the override field in AccessibleObject long overrideOffset = theUnsafe.objectFieldOffset(AccessibleObject.class.getDeclaredField("override")); // make both accessible theUnsafe.putBoolean(defineClass1, overrideOffset, true); theUnsafe.putBoolean(defineClass2, overrideOffset, true); return null; } catch (NoSuchFieldException e) { // This is JDK 12+, the "override" field isn't there anymore, fallback to setAccessible() defineClass1.setAccessible(true); defineClass2.setAccessible(true); return null; } } }); } catch (PrivilegedActionException pae) { throw new RuntimeException("cannot initialize ClassPool", pae.getException()); } } }
[ "public", "static", "void", "makeClassLoaderMethodsAccessible", "(", ")", "{", "// the AtomicBoolean make sure this gets invoked only once as WeldStartup is triggered per deployment", "if", "(", "classLoaderMethodsMadeAccessible", ".", "compareAndSet", "(", "false", ",", "true", ")...
This method cracks open {@code ClassLoader#defineClass()} methods using {@code Unsafe}. It is invoked during {@code WeldStartup#startContainer()} and only in case the integrator does not fully implement {@link ProxyServices}. Method first attempts to use {@code Unsafe} and if that fails then reverts to {@code setAccessible}
[ "This", "method", "cracks", "open", "{", "@code", "ClassLoader#defineClass", "()", "}", "methods", "using", "{", "@code", "Unsafe", "}", ".", "It", "is", "invoked", "during", "{", "@code", "WeldStartup#startContainer", "()", "}", "and", "only", "in", "case", ...
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/bytecode/ClassFileUtils.java#L60-L98
Jasig/resource-server
resource-server-utils/src/main/java/org/jasig/resourceserver/utils/aggr/ResourcesElementsProviderImpl.java
ResourcesElementsProviderImpl.appendJsNode
protected void appendJsNode(HttpServletRequest request, Document document, DocumentFragment head, Js js, String relativeRoot) { final String scriptPath = getElementPath(request, js, relativeRoot); if (resourcesDao.isConditional(js)) { Comment c = document.createComment(""); c.appendData(OPEN_COND_COMMENT_PRE); c.appendData(js.getConditional()); c.appendData(OPEN_COND_COMMENT_POST); c.appendData(OPEN_SCRIPT); c.appendData(scriptPath); c.appendData(CLOSE_SCRIPT); c.appendData(CLOSE_COND_COMMENT); head.appendChild(c); } else { Element element = document.createElement(SCRIPT); element.setAttribute(TYPE, "text/javascript"); element.setAttribute(SRC, scriptPath); element.appendChild(document.createTextNode(" ")); head.appendChild(element); } }
java
protected void appendJsNode(HttpServletRequest request, Document document, DocumentFragment head, Js js, String relativeRoot) { final String scriptPath = getElementPath(request, js, relativeRoot); if (resourcesDao.isConditional(js)) { Comment c = document.createComment(""); c.appendData(OPEN_COND_COMMENT_PRE); c.appendData(js.getConditional()); c.appendData(OPEN_COND_COMMENT_POST); c.appendData(OPEN_SCRIPT); c.appendData(scriptPath); c.appendData(CLOSE_SCRIPT); c.appendData(CLOSE_COND_COMMENT); head.appendChild(c); } else { Element element = document.createElement(SCRIPT); element.setAttribute(TYPE, "text/javascript"); element.setAttribute(SRC, scriptPath); element.appendChild(document.createTextNode(" ")); head.appendChild(element); } }
[ "protected", "void", "appendJsNode", "(", "HttpServletRequest", "request", ",", "Document", "document", ",", "DocumentFragment", "head", ",", "Js", "js", ",", "String", "relativeRoot", ")", "{", "final", "String", "scriptPath", "=", "getElementPath", "(", "request...
Convert the {@link Js} argument to an HTML script tag and append it to the {@link DocumentFragment}.
[ "Convert", "the", "{" ]
train
https://github.com/Jasig/resource-server/blob/13375f716777ec3c99ae9917f672881d4aa32df3/resource-server-utils/src/main/java/org/jasig/resourceserver/utils/aggr/ResourcesElementsProviderImpl.java#L482-L504
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenuItem.java
WMenuItem.setMessage
public void setMessage(final String message, final Serializable... args) { getOrCreateComponentModel().message = I18nUtilities.asMessage(message, args); }
java
public void setMessage(final String message, final Serializable... args) { getOrCreateComponentModel().message = I18nUtilities.asMessage(message, args); }
[ "public", "void", "setMessage", "(", "final", "String", "message", ",", "final", "Serializable", "...", "args", ")", "{", "getOrCreateComponentModel", "(", ")", ".", "message", "=", "I18nUtilities", ".", "asMessage", "(", "message", ",", "args", ")", ";", "}...
Sets the confirmation message that is to be displayed to the user for this menu item. @param message the confirmation message to display, using {@link MessageFormat} syntax. @param args optional arguments for the message format string.
[ "Sets", "the", "confirmation", "message", "that", "is", "to", "be", "displayed", "to", "the", "user", "for", "this", "menu", "item", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenuItem.java#L404-L406
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/face/AipFace.java
AipFace.addUser
public JSONObject addUser(String image, String imageType, String groupId, String userId, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("image", image); request.addBody("image_type", imageType); request.addBody("group_id", groupId); request.addBody("user_id", userId); if (options != null) { request.addBody(options); } request.setUri(FaceConsts.USER_ADD); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
java
public JSONObject addUser(String image, String imageType, String groupId, String userId, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("image", image); request.addBody("image_type", imageType); request.addBody("group_id", groupId); request.addBody("user_id", userId); if (options != null) { request.addBody(options); } request.setUri(FaceConsts.USER_ADD); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "addUser", "(", "String", "image", ",", "String", "imageType", ",", "String", "groupId", ",", "String", "userId", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest...
人脸注册接口 @param image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断 @param imageType - 图片类型 **BASE64**:图片的base64值,base64编码后的图片数据,需urlencode,编码后的图片大小不超过2M;**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长)**;FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个 @param groupId - 用户组id(由数字、字母、下划线组成),长度限制128B @param userId - 用户id(由数字、字母、下划线组成),长度限制128B @param options - 可选参数对象,key: value都为string类型 options - options列表: user_info 用户资料,长度限制256B quality_control 图片质量控制 **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE** liveness_control 活体检测控制 **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE** @return JSONObject
[ "人脸注册接口" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/face/AipFace.java#L109-L127
openengsb/openengsb
components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/AbstractStandardTransformationOperation.java
AbstractStandardTransformationOperation.parseIntString
protected Integer parseIntString(String string, boolean abortOnError, int def) throws TransformationOperationException { Integer integer = def; if (string == null) { logger.debug("Given string is empty so the default value is taken."); } try { integer = Integer.parseInt(string); } catch (NumberFormatException e) { StringBuilder builder = new StringBuilder(); builder.append("The string ").append(string).append(" is not a number. "); if (abortOnError) { builder.append("The step will be skipped."); } else { builder.append(def).append(" will be taken instead."); } logger.warn(builder.toString()); if (abortOnError) { throw new TransformationOperationException(builder.toString()); } } return integer; }
java
protected Integer parseIntString(String string, boolean abortOnError, int def) throws TransformationOperationException { Integer integer = def; if (string == null) { logger.debug("Given string is empty so the default value is taken."); } try { integer = Integer.parseInt(string); } catch (NumberFormatException e) { StringBuilder builder = new StringBuilder(); builder.append("The string ").append(string).append(" is not a number. "); if (abortOnError) { builder.append("The step will be skipped."); } else { builder.append(def).append(" will be taken instead."); } logger.warn(builder.toString()); if (abortOnError) { throw new TransformationOperationException(builder.toString()); } } return integer; }
[ "protected", "Integer", "parseIntString", "(", "String", "string", ",", "boolean", "abortOnError", ",", "int", "def", ")", "throws", "TransformationOperationException", "{", "Integer", "integer", "=", "def", ";", "if", "(", "string", "==", "null", ")", "{", "l...
Parses a string to an integer object. AbortOnError defines if the function should throw an exception if an error occurs during the parsing. If it doesn't abort, the given default value is given back as result on error.
[ "Parses", "a", "string", "to", "an", "integer", "object", ".", "AbortOnError", "defines", "if", "the", "function", "should", "throw", "an", "exception", "if", "an", "error", "occurs", "during", "the", "parsing", ".", "If", "it", "doesn", "t", "abort", "the...
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/AbstractStandardTransformationOperation.java#L124-L147
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonServiceDocumentWriter.java
JsonServiceDocumentWriter.writeURL
private void writeURL(JsonGenerator jsonGenerator, Object entity) throws IOException { // It is exactly the same as the 'name' property. jsonGenerator.writeFieldName(URL); if (entity instanceof EntitySet) { jsonGenerator.writeObject(((EntitySet) entity).getName()); } else { jsonGenerator.writeObject(((Singleton) entity).getName()); } }
java
private void writeURL(JsonGenerator jsonGenerator, Object entity) throws IOException { // It is exactly the same as the 'name' property. jsonGenerator.writeFieldName(URL); if (entity instanceof EntitySet) { jsonGenerator.writeObject(((EntitySet) entity).getName()); } else { jsonGenerator.writeObject(((Singleton) entity).getName()); } }
[ "private", "void", "writeURL", "(", "JsonGenerator", "jsonGenerator", ",", "Object", "entity", ")", "throws", "IOException", "{", "// It is exactly the same as the 'name' property.", "jsonGenerator", ".", "writeFieldName", "(", "URL", ")", ";", "if", "(", "entity", "i...
Writes the url of the entity It is a MUST element. @param jsonGenerator jsonGenerator @param entity entity from the container
[ "Writes", "the", "url", "of", "the", "entity", "It", "is", "a", "MUST", "element", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonServiceDocumentWriter.java#L154-L162
springfox/springfox
springfox-schema/src/main/java/springfox/documentation/schema/Annotations.java
Annotations.findPropertyAnnotation
public static <A extends Annotation> Optional<A> findPropertyAnnotation( BeanPropertyDefinition beanPropertyDefinition, Class<A> annotationClass) { return tryGetFieldAnnotation(beanPropertyDefinition, annotationClass) .map(Optional::of).orElse(tryGetGetterAnnotation(beanPropertyDefinition, annotationClass)) .map(Optional::of).orElse(tryGetSetterAnnotation(beanPropertyDefinition, annotationClass)); }
java
public static <A extends Annotation> Optional<A> findPropertyAnnotation( BeanPropertyDefinition beanPropertyDefinition, Class<A> annotationClass) { return tryGetFieldAnnotation(beanPropertyDefinition, annotationClass) .map(Optional::of).orElse(tryGetGetterAnnotation(beanPropertyDefinition, annotationClass)) .map(Optional::of).orElse(tryGetSetterAnnotation(beanPropertyDefinition, annotationClass)); }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "Optional", "<", "A", ">", "findPropertyAnnotation", "(", "BeanPropertyDefinition", "beanPropertyDefinition", ",", "Class", "<", "A", ">", "annotationClass", ")", "{", "return", "tryGetFieldAnnotation", "("...
Finds first annotation of the given type on the given bean property and returns it. Search precedence is getter, setter, field. @param beanPropertyDefinition introspected jackson property definition @param annotationClass class object representing desired annotation @param <A> type that extends Annotation @return first annotation found for property
[ "Finds", "first", "annotation", "of", "the", "given", "type", "on", "the", "given", "bean", "property", "and", "returns", "it", ".", "Search", "precedence", "is", "getter", "setter", "field", "." ]
train
https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-schema/src/main/java/springfox/documentation/schema/Annotations.java#L46-L53
cubedtear/aritzh
aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java
Configuration.hasProperty
public boolean hasProperty(String category, String key) { return this.categories.containsKey(category) && this.categories.get(category).containsKey(key); }
java
public boolean hasProperty(String category, String key) { return this.categories.containsKey(category) && this.categories.get(category).containsKey(key); }
[ "public", "boolean", "hasProperty", "(", "String", "category", ",", "String", "key", ")", "{", "return", "this", ".", "categories", ".", "containsKey", "(", "category", ")", "&&", "this", ".", "categories", ".", "get", "(", "category", ")", ".", "containsK...
Checks whether the specified key is present in the specified category @param category The category to look into for the key @param key The key to look for @return {@code true} if the key was found in the category, {@code false} otherwise
[ "Checks", "whether", "the", "specified", "key", "is", "present", "in", "the", "specified", "category" ]
train
https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java#L262-L264
devnull-tools/trugger
src/main/java/tools/devnull/trugger/reflection/impl/TruggerGenericTypeResolver.java
TruggerGenericTypeResolver.resolveParameterName
static Class<?> resolveParameterName(String parameterName, Class<?> target) { Map<Type, Type> typeVariableMap = getTypeVariableMap(target); Set<Entry<Type, Type>> set = typeVariableMap.entrySet(); Type type = Object.class; for (Entry<Type, Type> entry : set) { if (entry.getKey().toString().equals(parameterName)) { type = entry.getKey(); break; } } return resolveType(type, typeVariableMap); }
java
static Class<?> resolveParameterName(String parameterName, Class<?> target) { Map<Type, Type> typeVariableMap = getTypeVariableMap(target); Set<Entry<Type, Type>> set = typeVariableMap.entrySet(); Type type = Object.class; for (Entry<Type, Type> entry : set) { if (entry.getKey().toString().equals(parameterName)) { type = entry.getKey(); break; } } return resolveType(type, typeVariableMap); }
[ "static", "Class", "<", "?", ">", "resolveParameterName", "(", "String", "parameterName", ",", "Class", "<", "?", ">", "target", ")", "{", "Map", "<", "Type", ",", "Type", ">", "typeVariableMap", "=", "getTypeVariableMap", "(", "target", ")", ";", "Set", ...
Resolves the generic parameter name of a class. @param parameterName the parameter name @param target the target class @return the parameter class.
[ "Resolves", "the", "generic", "parameter", "name", "of", "a", "class", "." ]
train
https://github.com/devnull-tools/trugger/blob/614d5f0b30daf82fc251a46fb436d0fc5e787627/src/main/java/tools/devnull/trugger/reflection/impl/TruggerGenericTypeResolver.java#L72-L84
redisson/redisson
redisson/src/main/java/org/redisson/executor/TasksRunnerService.java
TasksRunnerService.asyncScheduledServiceAtFixed
private RemoteExecutorServiceAsync asyncScheduledServiceAtFixed(String executorId, String requestId) { ScheduledTasksService scheduledRemoteService = new ScheduledTasksService(codec, name, commandExecutor, executorId, responses); scheduledRemoteService.setTerminationTopicName(terminationTopicName); scheduledRemoteService.setTasksCounterName(tasksCounterName); scheduledRemoteService.setStatusName(statusName); scheduledRemoteService.setSchedulerQueueName(schedulerQueueName); scheduledRemoteService.setSchedulerChannelName(schedulerChannelName); scheduledRemoteService.setTasksName(tasksName); scheduledRemoteService.setRequestId(new RequestId(requestId)); scheduledRemoteService.setTasksRetryIntervalName(tasksRetryIntervalName); RemoteExecutorServiceAsync asyncScheduledServiceAtFixed = scheduledRemoteService.get(RemoteExecutorServiceAsync.class, RemoteInvocationOptions.defaults().noAck().noResult()); return asyncScheduledServiceAtFixed; }
java
private RemoteExecutorServiceAsync asyncScheduledServiceAtFixed(String executorId, String requestId) { ScheduledTasksService scheduledRemoteService = new ScheduledTasksService(codec, name, commandExecutor, executorId, responses); scheduledRemoteService.setTerminationTopicName(terminationTopicName); scheduledRemoteService.setTasksCounterName(tasksCounterName); scheduledRemoteService.setStatusName(statusName); scheduledRemoteService.setSchedulerQueueName(schedulerQueueName); scheduledRemoteService.setSchedulerChannelName(schedulerChannelName); scheduledRemoteService.setTasksName(tasksName); scheduledRemoteService.setRequestId(new RequestId(requestId)); scheduledRemoteService.setTasksRetryIntervalName(tasksRetryIntervalName); RemoteExecutorServiceAsync asyncScheduledServiceAtFixed = scheduledRemoteService.get(RemoteExecutorServiceAsync.class, RemoteInvocationOptions.defaults().noAck().noResult()); return asyncScheduledServiceAtFixed; }
[ "private", "RemoteExecutorServiceAsync", "asyncScheduledServiceAtFixed", "(", "String", "executorId", ",", "String", "requestId", ")", "{", "ScheduledTasksService", "scheduledRemoteService", "=", "new", "ScheduledTasksService", "(", "codec", ",", "name", ",", "commandExecut...
Creates RemoteExecutorServiceAsync with special executor which overrides requestId generation and uses current requestId. Because recurring tasks should use the same requestId. @return
[ "Creates", "RemoteExecutorServiceAsync", "with", "special", "executor", "which", "overrides", "requestId", "generation", "and", "uses", "current", "requestId", ".", "Because", "recurring", "tasks", "should", "use", "the", "same", "requestId", "." ]
train
https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/executor/TasksRunnerService.java#L163-L175
lessthanoptimal/ddogleg
src/org/ddogleg/solver/PolynomialOps.java
PolynomialOps.multiply
public static Polynomial multiply( Polynomial a , Polynomial b , Polynomial result ) { int N = Math.max(0,a.size() + b.size() - 1); if( result == null ) { result = new Polynomial(N); } else { if( result.size < N ) throw new IllegalArgumentException("Unexpected length of 'result'"); result.zero(); } for( int i = 0; i < a.size; i++ ) { double coef = a.c[i]; int index = i; for( int j = 0; j < b.size; j++ ) { result.c[index++] += coef*b.c[j]; } } return result; }
java
public static Polynomial multiply( Polynomial a , Polynomial b , Polynomial result ) { int N = Math.max(0,a.size() + b.size() - 1); if( result == null ) { result = new Polynomial(N); } else { if( result.size < N ) throw new IllegalArgumentException("Unexpected length of 'result'"); result.zero(); } for( int i = 0; i < a.size; i++ ) { double coef = a.c[i]; int index = i; for( int j = 0; j < b.size; j++ ) { result.c[index++] += coef*b.c[j]; } } return result; }
[ "public", "static", "Polynomial", "multiply", "(", "Polynomial", "a", ",", "Polynomial", "b", ",", "Polynomial", "result", ")", "{", "int", "N", "=", "Math", ".", "max", "(", "0", ",", "a", ".", "size", "(", ")", "+", "b", ".", "size", "(", ")", ...
Multiplies the two polynomials together. @param a Polynomial @param b Polynomial @param result Optional storage parameter for the results. Must be have enough coefficients to store the results. If null a new instance is declared. @return Results of the multiplication
[ "Multiplies", "the", "two", "polynomials", "together", "." ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/PolynomialOps.java#L150-L172
aspectran/aspectran
shell/src/main/java/com/aspectran/shell/command/option/DefaultOptionParser.java
DefaultOptionParser.handleLongOptionWithEqual
private void handleLongOptionWithEqual(String token) throws OptionParserException { int pos = token.indexOf('='); String name = token.substring(0, pos); String value = token.substring(pos + 1); List<String> matchingOpts = getMatchingLongOptions(name); if (matchingOpts.isEmpty()) { handleUnknownToken(currentToken); } else if (matchingOpts.size() > 1 && !options.hasLongOption(name)) { throw new AmbiguousOptionException(name, matchingOpts); } else { String key = (options.hasLongOption(name) ? name : matchingOpts.get(0)); Option option = options.getOption(key); if (option.acceptsValue()) { handleOption(option); currentOption.addValue(value); currentOption = null; } else { handleUnknownToken(currentToken); } } }
java
private void handleLongOptionWithEqual(String token) throws OptionParserException { int pos = token.indexOf('='); String name = token.substring(0, pos); String value = token.substring(pos + 1); List<String> matchingOpts = getMatchingLongOptions(name); if (matchingOpts.isEmpty()) { handleUnknownToken(currentToken); } else if (matchingOpts.size() > 1 && !options.hasLongOption(name)) { throw new AmbiguousOptionException(name, matchingOpts); } else { String key = (options.hasLongOption(name) ? name : matchingOpts.get(0)); Option option = options.getOption(key); if (option.acceptsValue()) { handleOption(option); currentOption.addValue(value); currentOption = null; } else { handleUnknownToken(currentToken); } } }
[ "private", "void", "handleLongOptionWithEqual", "(", "String", "token", ")", "throws", "OptionParserException", "{", "int", "pos", "=", "token", ".", "indexOf", "(", "'", "'", ")", ";", "String", "name", "=", "token", ".", "substring", "(", "0", ",", "pos"...
Handles the following tokens: <pre> --L=V -L=V --l=V -l=V </pre> @param token the command line token to handle @throws OptionParserException if option parsing fails
[ "Handles", "the", "following", "tokens", ":", "<pre", ">", "--", "L", "=", "V", "-", "L", "=", "V", "--", "l", "=", "V", "-", "l", "=", "V", "<", "/", "pre", ">" ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/DefaultOptionParser.java#L290-L310
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsSessionImpl.java
JmsSessionImpl.instantiateConsumer
JmsMsgConsumer instantiateConsumer(ConsumerProperties consumerProperties) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateConsumer", consumerProperties); JmsMsgConsumer messageConsumer = new JmsMsgConsumerImpl(coreConnection, this, consumerProperties); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateConsumer", messageConsumer); return messageConsumer; }
java
JmsMsgConsumer instantiateConsumer(ConsumerProperties consumerProperties) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateConsumer", consumerProperties); JmsMsgConsumer messageConsumer = new JmsMsgConsumerImpl(coreConnection, this, consumerProperties); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateConsumer", messageConsumer); return messageConsumer; }
[ "JmsMsgConsumer", "instantiateConsumer", "(", "ConsumerProperties", "consumerProperties", ")", "throws", "JMSException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", ...
This method is overriden by subclasses in order to instantiate an instance of the MsgConsumer class. This means that the QueueSession.createReceiver method can delegate straight to Session.createConsumer, and still get back an instance of a QueueReceiver, rather than a vanilla MessageConsumer. Note, since this method is over-ridden by Queue and Topic specific classes, updates to any one of these methods will require consideration of the other two versions.
[ "This", "method", "is", "overriden", "by", "subclasses", "in", "order", "to", "instantiate", "an", "instance", "of", "the", "MsgConsumer", "class", ".", "This", "means", "that", "the", "QueueSession", ".", "createReceiver", "method", "can", "delegate", "straight...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsSessionImpl.java#L1671-L1678
alkacon/opencms-core
src/org/opencms/scheduler/jobs/CmsCreateImageSizeJob.java
CmsCreateImageSizeJob.lockResource
private void lockResource(CmsObject cms, CmsLock lock, CmsResource res) throws CmsException { if (lock.isNullLock()) { cms.lockResource(res.getRootPath()); } }
java
private void lockResource(CmsObject cms, CmsLock lock, CmsResource res) throws CmsException { if (lock.isNullLock()) { cms.lockResource(res.getRootPath()); } }
[ "private", "void", "lockResource", "(", "CmsObject", "cms", ",", "CmsLock", "lock", ",", "CmsResource", "res", ")", "throws", "CmsException", "{", "if", "(", "lock", ".", "isNullLock", "(", ")", ")", "{", "cms", ".", "lockResource", "(", "res", ".", "get...
Locks the given resource (if required).<p> @param cms the OpenCms user context @param lock the previous lock status of the resource @param res the resource to lock @throws CmsException in case something goes wrong
[ "Locks", "the", "given", "resource", "(", "if", "required", ")", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/scheduler/jobs/CmsCreateImageSizeJob.java#L228-L233
stackify/stackify-metrics
src/main/java/com/stackify/metric/impl/MetricAggregate.java
MetricAggregate.fromMetricIdentity
public static MetricAggregate fromMetricIdentity(final MetricIdentity identity, final long currentMinute) { Preconditions.checkNotNull(identity); return new MetricAggregate(identity, currentMinute); }
java
public static MetricAggregate fromMetricIdentity(final MetricIdentity identity, final long currentMinute) { Preconditions.checkNotNull(identity); return new MetricAggregate(identity, currentMinute); }
[ "public", "static", "MetricAggregate", "fromMetricIdentity", "(", "final", "MetricIdentity", "identity", ",", "final", "long", "currentMinute", ")", "{", "Preconditions", ".", "checkNotNull", "(", "identity", ")", ";", "return", "new", "MetricAggregate", "(", "ident...
Creates a MetricAggregate @param identity The metric identity @param currentMinute Current minute @return The MetricAggregate
[ "Creates", "a", "MetricAggregate" ]
train
https://github.com/stackify/stackify-metrics/blob/6827d516085e4b29a3e54da963eebb2955822a5c/src/main/java/com/stackify/metric/impl/MetricAggregate.java#L52-L55
mfornos/humanize
humanize-slim/src/main/java/humanize/Humanize.java
Humanize.nanoTime
@Expose public static String nanoTime(final Number value, final Locale locale) { return withinLocale(new Callable<String>() { public String call() { return prefix(value, 1000, nanoTimePrefixes); } }, locale); }
java
@Expose public static String nanoTime(final Number value, final Locale locale) { return withinLocale(new Callable<String>() { public String call() { return prefix(value, 1000, nanoTimePrefixes); } }, locale); }
[ "@", "Expose", "public", "static", "String", "nanoTime", "(", "final", "Number", "value", ",", "final", "Locale", "locale", ")", "{", "return", "withinLocale", "(", "new", "Callable", "<", "String", ">", "(", ")", "{", "public", "String", "call", "(", ")...
<p> Same as {@link #nanoTime(Number)} for the specified locale. </p> @param value Number of nanoseconds @param locale Target locale @return The number preceded by the corresponding SI symbol
[ "<p", ">", "Same", "as", "{", "@link", "#nanoTime", "(", "Number", ")", "}", "for", "the", "specified", "locale", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L1436-L1446
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java
CommonOps_DDF4.addEquals
public static void addEquals( DMatrix4x4 a , DMatrix4x4 b ) { a.a11 += b.a11; a.a12 += b.a12; a.a13 += b.a13; a.a14 += b.a14; a.a21 += b.a21; a.a22 += b.a22; a.a23 += b.a23; a.a24 += b.a24; a.a31 += b.a31; a.a32 += b.a32; a.a33 += b.a33; a.a34 += b.a34; a.a41 += b.a41; a.a42 += b.a42; a.a43 += b.a43; a.a44 += b.a44; }
java
public static void addEquals( DMatrix4x4 a , DMatrix4x4 b ) { a.a11 += b.a11; a.a12 += b.a12; a.a13 += b.a13; a.a14 += b.a14; a.a21 += b.a21; a.a22 += b.a22; a.a23 += b.a23; a.a24 += b.a24; a.a31 += b.a31; a.a32 += b.a32; a.a33 += b.a33; a.a34 += b.a34; a.a41 += b.a41; a.a42 += b.a42; a.a43 += b.a43; a.a44 += b.a44; }
[ "public", "static", "void", "addEquals", "(", "DMatrix4x4", "a", ",", "DMatrix4x4", "b", ")", "{", "a", ".", "a11", "+=", "b", ".", "a11", ";", "a", ".", "a12", "+=", "b", ".", "a12", ";", "a", ".", "a13", "+=", "b", ".", "a13", ";", "a", "."...
<p>Performs the following operation:<br> <br> a = a + b <br> a<sub>ij</sub> = a<sub>ij</sub> + b<sub>ij</sub> <br> </p> @param a A Matrix. Modified. @param b A Matrix. Not modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "a", "=", "a", "+", "b", "<br", ">", "a<sub", ">", "ij<", "/", "sub", ">", "=", "a<sub", ">", "ij<", "/", "sub", ">", "+", "b<sub", ">", "ij<", "/", "sub", "...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java#L98-L115
LearnLib/learnlib
algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/util/ADTUtil.java
ADTUtil.mergeADS
public static <S, I, O> boolean mergeADS(final ADTNode<S, I, O> parent, final ADTNode<S, I, O> child) { ADTNode<S, I, O> parentIter = parent, childIter = child; while (!(ADTUtil.isLeafNode(parentIter) || ADTUtil.isResetNode(parentIter)) && !ADTUtil.isLeafNode(childIter)) { if (!parentIter.getSymbol().equals(childIter.getSymbol())) { return false; } final Map<O, ADTNode<S, I, O>> childSuccessors = childIter.getChildren(); if (childSuccessors.size() != 1) { throw new IllegalArgumentException("No single trace child"); } final Map<O, ADTNode<S, I, O>> parentSuccessors = parentIter.getChildren(); final Map.Entry<O, ADTNode<S, I, O>> childSuccessor = childSuccessors.entrySet().iterator().next(); final O childOutput = childSuccessor.getKey(); final ADTNode<S, I, O> childADS = childSuccessor.getValue(); if (!parentSuccessors.containsKey(childOutput)) { parentSuccessors.put(childOutput, childADS); childADS.setParent(parentIter); return true; } parentIter = parentSuccessors.get(childOutput); childIter = childADS; } return false; }
java
public static <S, I, O> boolean mergeADS(final ADTNode<S, I, O> parent, final ADTNode<S, I, O> child) { ADTNode<S, I, O> parentIter = parent, childIter = child; while (!(ADTUtil.isLeafNode(parentIter) || ADTUtil.isResetNode(parentIter)) && !ADTUtil.isLeafNode(childIter)) { if (!parentIter.getSymbol().equals(childIter.getSymbol())) { return false; } final Map<O, ADTNode<S, I, O>> childSuccessors = childIter.getChildren(); if (childSuccessors.size() != 1) { throw new IllegalArgumentException("No single trace child"); } final Map<O, ADTNode<S, I, O>> parentSuccessors = parentIter.getChildren(); final Map.Entry<O, ADTNode<S, I, O>> childSuccessor = childSuccessors.entrySet().iterator().next(); final O childOutput = childSuccessor.getKey(); final ADTNode<S, I, O> childADS = childSuccessor.getValue(); if (!parentSuccessors.containsKey(childOutput)) { parentSuccessors.put(childOutput, childADS); childADS.setParent(parentIter); return true; } parentIter = parentSuccessors.get(childOutput); childIter = childADS; } return false; }
[ "public", "static", "<", "S", ",", "I", ",", "O", ">", "boolean", "mergeADS", "(", "final", "ADTNode", "<", "S", ",", "I", ",", "O", ">", "parent", ",", "final", "ADTNode", "<", "S", ",", "I", ",", "O", ">", "child", ")", "{", "ADTNode", "<", ...
Tries to merge the given (single trace) ADSs (which only contains one leaf) into the given parent ADSs. If possible, the parent ADS is altered as a side-effect @param parent the parent ADS in which the given child ADS should be merged into @param child the (single trace) ADS which should be incorporated into the parent ADS. @param <S> (hypothesis) state type @param <I> input alphabet type @param <O> output alphabet type @return {@code true} if ADSs could be merged, {@code false} otherwise
[ "Tries", "to", "merge", "the", "given", "(", "single", "trace", ")", "ADSs", "(", "which", "only", "contains", "one", "leaf", ")", "into", "the", "given", "parent", "ADSs", ".", "If", "possible", "the", "parent", "ADS", "is", "altered", "as", "a", "sid...
train
https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/util/ADTUtil.java#L322-L355
Stratio/bdt
src/main/java/com/stratio/qa/specs/CommandExecutionSpec.java
CommandExecutionSpec.copyFromRemoteFile
@Given("^I inbound copy '(.+?)' through a ssh connection to '(.+?)'$") public void copyFromRemoteFile(String remotePath, String localPath) throws Exception { commonspec.getRemoteSSHConnection().copyFrom(remotePath, localPath); }
java
@Given("^I inbound copy '(.+?)' through a ssh connection to '(.+?)'$") public void copyFromRemoteFile(String remotePath, String localPath) throws Exception { commonspec.getRemoteSSHConnection().copyFrom(remotePath, localPath); }
[ "@", "Given", "(", "\"^I inbound copy '(.+?)' through a ssh connection to '(.+?)'$\"", ")", "public", "void", "copyFromRemoteFile", "(", "String", "remotePath", ",", "String", "localPath", ")", "throws", "Exception", "{", "commonspec", ".", "getRemoteSSHConnection", "(", ...
/* Copies file/s from remote system into local system @param remotePath path where file is going to be copy @param localPath path where file is located @throws Exception exception
[ "/", "*", "Copies", "file", "/", "s", "from", "remote", "system", "into", "local", "system" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommandExecutionSpec.java#L78-L81
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/base/AbstractApplicationFrame.java
AbstractApplicationFrame.newConfigurationDirectory
protected File newConfigurationDirectory(final @NonNull String parent, final @NonNull String child) { File configurationDir = new File(parent, child); if (!configurationDir.exists()) { configurationDir.mkdir(); } return configurationDir; }
java
protected File newConfigurationDirectory(final @NonNull String parent, final @NonNull String child) { File configurationDir = new File(parent, child); if (!configurationDir.exists()) { configurationDir.mkdir(); } return configurationDir; }
[ "protected", "File", "newConfigurationDirectory", "(", "final", "@", "NonNull", "String", "parent", ",", "final", "@", "NonNull", "String", "child", ")", "{", "File", "configurationDir", "=", "new", "File", "(", "parent", ",", "child", ")", ";", "if", "(", ...
Factory method for create a new configuration directory {@link File} object if it is not exists. This method is invoked in the constructor and can be overridden from the derived classes so users can provide their own version of a new configuration {@link File} object @param parent the parent @param child the child @return the new configuration directory {@link File} object or the existing one
[ "Factory", "method", "for", "create", "a", "new", "configuration", "directory", "{", "@link", "File", "}", "object", "if", "it", "is", "not", "exists", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "and", "can", "be", "overridden", "f...
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/base/AbstractApplicationFrame.java#L142-L151
marklogic/marklogic-contentpump
mlcp/src/main/java/com/marklogic/contentpump/utilities/EncodingUtil.java
EncodingUtil.handleBOMUTF8
public static void handleBOMUTF8(String[] vales, int i) { byte[] buf = vales[i].getBytes(); if (LOG.isDebugEnabled()) { StringBuilder sb = new StringBuilder(); for (byte b : buf) { sb.append(Byte.toString(b)); sb.append(" "); } LOG.debug(vales[i]); LOG.debug(sb.toString()); } if (buf[0] == (byte) 0xEF && buf[1] == (byte) 0xBB && buf[2] == (byte) 0xBF) { vales[i] = new String(buf, 3, buf.length - 3); } }
java
public static void handleBOMUTF8(String[] vales, int i) { byte[] buf = vales[i].getBytes(); if (LOG.isDebugEnabled()) { StringBuilder sb = new StringBuilder(); for (byte b : buf) { sb.append(Byte.toString(b)); sb.append(" "); } LOG.debug(vales[i]); LOG.debug(sb.toString()); } if (buf[0] == (byte) 0xEF && buf[1] == (byte) 0xBB && buf[2] == (byte) 0xBF) { vales[i] = new String(buf, 3, buf.length - 3); } }
[ "public", "static", "void", "handleBOMUTF8", "(", "String", "[", "]", "vales", ",", "int", "i", ")", "{", "byte", "[", "]", "buf", "=", "vales", "[", "i", "]", ".", "getBytes", "(", ")", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")"...
Oracle jdk bug 4508058: UTF-8 encoding does not recognize initial BOM, and it will not be fixed. Work Around : Application code must recognize and skip the BOM itself.
[ "Oracle", "jdk", "bug", "4508058", ":", "UTF", "-", "8", "encoding", "does", "not", "recognize", "initial", "BOM", "and", "it", "will", "not", "be", "fixed", ".", "Work", "Around", ":", "Application", "code", "must", "recognize", "and", "skip", "the", "B...
train
https://github.com/marklogic/marklogic-contentpump/blob/4c41e4a953301f81a4c655efb2a847603dee8afc/mlcp/src/main/java/com/marklogic/contentpump/utilities/EncodingUtil.java#L29-L44
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.getFragment
@GwtIncompatible("incompatible method") private static long getFragment(final Calendar calendar, final int fragment, final TimeUnit unit) { if(calendar == null) { throw new IllegalArgumentException("The date must not be null"); } long result = 0; final int offset = (unit == TimeUnit.DAYS) ? 0 : 1; // Fragments bigger than a day require a breakdown to days switch (fragment) { case Calendar.YEAR: result += unit.convert(calendar.get(Calendar.DAY_OF_YEAR) - offset, TimeUnit.DAYS); break; case Calendar.MONTH: result += unit.convert(calendar.get(Calendar.DAY_OF_MONTH) - offset, TimeUnit.DAYS); break; default: break; } switch (fragment) { // Number of days already calculated for these cases case Calendar.YEAR: case Calendar.MONTH: // The rest of the valid cases case Calendar.DAY_OF_YEAR: case Calendar.DATE: result += unit.convert(calendar.get(Calendar.HOUR_OF_DAY), TimeUnit.HOURS); //$FALL-THROUGH$ case Calendar.HOUR_OF_DAY: result += unit.convert(calendar.get(Calendar.MINUTE), TimeUnit.MINUTES); //$FALL-THROUGH$ case Calendar.MINUTE: result += unit.convert(calendar.get(Calendar.SECOND), TimeUnit.SECONDS); //$FALL-THROUGH$ case Calendar.SECOND: result += unit.convert(calendar.get(Calendar.MILLISECOND), TimeUnit.MILLISECONDS); break; case Calendar.MILLISECOND: break;//never useful default: throw new IllegalArgumentException("The fragment " + fragment + " is not supported"); } return result; }
java
@GwtIncompatible("incompatible method") private static long getFragment(final Calendar calendar, final int fragment, final TimeUnit unit) { if(calendar == null) { throw new IllegalArgumentException("The date must not be null"); } long result = 0; final int offset = (unit == TimeUnit.DAYS) ? 0 : 1; // Fragments bigger than a day require a breakdown to days switch (fragment) { case Calendar.YEAR: result += unit.convert(calendar.get(Calendar.DAY_OF_YEAR) - offset, TimeUnit.DAYS); break; case Calendar.MONTH: result += unit.convert(calendar.get(Calendar.DAY_OF_MONTH) - offset, TimeUnit.DAYS); break; default: break; } switch (fragment) { // Number of days already calculated for these cases case Calendar.YEAR: case Calendar.MONTH: // The rest of the valid cases case Calendar.DAY_OF_YEAR: case Calendar.DATE: result += unit.convert(calendar.get(Calendar.HOUR_OF_DAY), TimeUnit.HOURS); //$FALL-THROUGH$ case Calendar.HOUR_OF_DAY: result += unit.convert(calendar.get(Calendar.MINUTE), TimeUnit.MINUTES); //$FALL-THROUGH$ case Calendar.MINUTE: result += unit.convert(calendar.get(Calendar.SECOND), TimeUnit.SECONDS); //$FALL-THROUGH$ case Calendar.SECOND: result += unit.convert(calendar.get(Calendar.MILLISECOND), TimeUnit.MILLISECONDS); break; case Calendar.MILLISECOND: break;//never useful default: throw new IllegalArgumentException("The fragment " + fragment + " is not supported"); } return result; }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "private", "static", "long", "getFragment", "(", "final", "Calendar", "calendar", ",", "final", "int", "fragment", ",", "final", "TimeUnit", "unit", ")", "{", "if", "(", "calendar", "==", "null", ")"...
Gets a Calendar fragment for any unit. @param calendar the calendar to work with, not null @param fragment the Calendar field part of calendar to calculate @param unit the time unit @return number of units within the fragment of the calendar @throws IllegalArgumentException if the date is <code>null</code> or fragment is not supported @since 2.4
[ "Gets", "a", "Calendar", "fragment", "for", "any", "unit", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L1683-L1728
BioPAX/Paxtools
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
QueryExecuter.runCommonStreamWithPOI
public static Set<BioPAXElement> runCommonStreamWithPOI( Set<BioPAXElement> sourceSet, Model model, Direction direction, int limit, Filter... filters) { Graph graph; if (model.getLevel() == BioPAXLevel.L3) { graph = new GraphL3(model, filters); } else return Collections.emptySet(); Collection<Set<Node>> sourceSets = prepareNodeSets(sourceSet, graph); if (sourceSet.size() < 2) return Collections.emptySet(); return runCommonStreamWithPOIContinued(sourceSets, direction, limit, graph); }
java
public static Set<BioPAXElement> runCommonStreamWithPOI( Set<BioPAXElement> sourceSet, Model model, Direction direction, int limit, Filter... filters) { Graph graph; if (model.getLevel() == BioPAXLevel.L3) { graph = new GraphL3(model, filters); } else return Collections.emptySet(); Collection<Set<Node>> sourceSets = prepareNodeSets(sourceSet, graph); if (sourceSet.size() < 2) return Collections.emptySet(); return runCommonStreamWithPOIContinued(sourceSets, direction, limit, graph); }
[ "public", "static", "Set", "<", "BioPAXElement", ">", "runCommonStreamWithPOI", "(", "Set", "<", "BioPAXElement", ">", "sourceSet", ",", "Model", "model", ",", "Direction", "direction", ",", "int", "limit", ",", "Filter", "...", "filters", ")", "{", "Graph", ...
First finds the common stream, then completes it with the paths between seed and common stream. @param sourceSet Seed to the query @param model BioPAX model @param direction UPSTREAM or DOWNSTREAM @param limit Length limit for the search @param filters for filtering graph elements @return BioPAX elements in the result
[ "First", "finds", "the", "common", "stream", "then", "completes", "it", "with", "the", "paths", "between", "seed", "and", "common", "stream", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L331-L351
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_mailingList_name_changeOptions_POST
public OvhTaskMl domain_mailingList_name_changeOptions_POST(String domain, String name, OvhDomainMlOptionsStruct options) throws IOException { String qPath = "/email/domain/{domain}/mailingList/{name}/changeOptions"; StringBuilder sb = path(qPath, domain, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "options", options); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskMl.class); }
java
public OvhTaskMl domain_mailingList_name_changeOptions_POST(String domain, String name, OvhDomainMlOptionsStruct options) throws IOException { String qPath = "/email/domain/{domain}/mailingList/{name}/changeOptions"; StringBuilder sb = path(qPath, domain, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "options", options); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskMl.class); }
[ "public", "OvhTaskMl", "domain_mailingList_name_changeOptions_POST", "(", "String", "domain", ",", "String", "name", ",", "OvhDomainMlOptionsStruct", "options", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/mailingList/{name}/changeOptions...
Change mailing list options REST: POST /email/domain/{domain}/mailingList/{name}/changeOptions @param options [required] Options of mailing list @param domain [required] Name of your domain name @param name [required] Name of mailing list
[ "Change", "mailing", "list", "options" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1430-L1437
micwin/ticino
context/src/main/java/net/micwin/ticino/context/GenericContext.java
GenericContext.lookup
@Override public GenericContext<ElementType> lookup(final Predicate<ElementType> pPredicate) { return lookup(pPredicate, Integer.MAX_VALUE, new GenericContext<ElementType>()); }
java
@Override public GenericContext<ElementType> lookup(final Predicate<ElementType> pPredicate) { return lookup(pPredicate, Integer.MAX_VALUE, new GenericContext<ElementType>()); }
[ "@", "Override", "public", "GenericContext", "<", "ElementType", ">", "lookup", "(", "final", "Predicate", "<", "ElementType", ">", "pPredicate", ")", "{", "return", "lookup", "(", "pPredicate", ",", "Integer", ".", "MAX_VALUE", ",", "new", "GenericContext", "...
Looks up elements that match given predicate and returns them in a newly created DefaultContext. @param pPredicate The criteria the elements must match to be found.
[ "Looks", "up", "elements", "that", "match", "given", "predicate", "and", "returns", "them", "in", "a", "newly", "created", "DefaultContext", "." ]
train
https://github.com/micwin/ticino/blob/4d143093500cd2fb9767ebe8cd05ddda23e35613/context/src/main/java/net/micwin/ticino/context/GenericContext.java#L64-L68
alibaba/ARouter
arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java
Postcard.withShortArray
public Postcard withShortArray(@Nullable String key, @Nullable short[] value) { mBundle.putShortArray(key, value); return this; }
java
public Postcard withShortArray(@Nullable String key, @Nullable short[] value) { mBundle.putShortArray(key, value); return this; }
[ "public", "Postcard", "withShortArray", "(", "@", "Nullable", "String", "key", ",", "@", "Nullable", "short", "[", "]", "value", ")", "{", "mBundle", ".", "putShortArray", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a short array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a short array object, or null @return current
[ "Inserts", "a", "short", "array", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L494-L497
structurizr/java
structurizr-core/src/com/structurizr/configuration/WorkspaceConfiguration.java
WorkspaceConfiguration.addUser
public void addUser(String username, Role role) { if (StringUtils.isNullOrEmpty(username)) { throw new IllegalArgumentException("A username must be specified."); } if (role == null) { throw new IllegalArgumentException("A role must be specified."); } users.add(new User(username, role)); }
java
public void addUser(String username, Role role) { if (StringUtils.isNullOrEmpty(username)) { throw new IllegalArgumentException("A username must be specified."); } if (role == null) { throw new IllegalArgumentException("A role must be specified."); } users.add(new User(username, role)); }
[ "public", "void", "addUser", "(", "String", "username", ",", "Role", "role", ")", "{", "if", "(", "StringUtils", ".", "isNullOrEmpty", "(", "username", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A username must be specified.\"", ")", ";",...
Adds a user, with the specified username and role. @param username the username (e.g. an e-mail address) @param role the user's role
[ "Adds", "a", "user", "with", "the", "specified", "username", "and", "role", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/configuration/WorkspaceConfiguration.java#L39-L49
threerings/nenya
tools/src/main/java/com/threerings/cast/bundle/tools/ComponentBundler.java
ComponentBundler.saveBroker
protected void saveBroker (File mapfile, HashMapIDBroker broker) throws RuntimeException { // bail if the broker wasn't modified if (!broker.isModified()) { return; } try { BufferedWriter bout = new BufferedWriter(new FileWriter(mapfile)); broker.writeTo(bout); bout.close(); } catch (IOException ioe) { throw new RuntimeException( "Unable to store component ID map [mapfile=" + mapfile + "]", ioe); } }
java
protected void saveBroker (File mapfile, HashMapIDBroker broker) throws RuntimeException { // bail if the broker wasn't modified if (!broker.isModified()) { return; } try { BufferedWriter bout = new BufferedWriter(new FileWriter(mapfile)); broker.writeTo(bout); bout.close(); } catch (IOException ioe) { throw new RuntimeException( "Unable to store component ID map [mapfile=" + mapfile + "]", ioe); } }
[ "protected", "void", "saveBroker", "(", "File", "mapfile", ",", "HashMapIDBroker", "broker", ")", "throws", "RuntimeException", "{", "// bail if the broker wasn't modified", "if", "(", "!", "broker", ".", "isModified", "(", ")", ")", "{", "return", ";", "}", "tr...
Stores a persistent representation of the supplied hashmap ID broker in the specified file.
[ "Stores", "a", "persistent", "representation", "of", "the", "supplied", "hashmap", "ID", "broker", "in", "the", "specified", "file", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/cast/bundle/tools/ComponentBundler.java#L372-L388
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/delegated/zos/NativeMethodHelper.java
NativeMethodHelper.deregisterNatives
public static long deregisterNatives(long dllHandle, Class<?> clazz, String nativeDescriptorName, Object[] extraInfo) { if (!initialized) { if (loadFailure != null) { Error e = new UnsatisfiedLinkError(); e.initCause(loadFailure); throw e; } else { return 0; } } return ntv_deregisterNatives(dllHandle, clazz, nativeDescriptorName, extraInfo); }
java
public static long deregisterNatives(long dllHandle, Class<?> clazz, String nativeDescriptorName, Object[] extraInfo) { if (!initialized) { if (loadFailure != null) { Error e = new UnsatisfiedLinkError(); e.initCause(loadFailure); throw e; } else { return 0; } } return ntv_deregisterNatives(dllHandle, clazz, nativeDescriptorName, extraInfo); }
[ "public", "static", "long", "deregisterNatives", "(", "long", "dllHandle", ",", "Class", "<", "?", ">", "clazz", ",", "String", "nativeDescriptorName", ",", "Object", "[", "]", "extraInfo", ")", "{", "if", "(", "!", "initialized", ")", "{", "if", "(", "l...
Drive the deregistration hooks the native methods from the core DLL for the specified class. @param clazz the class cleanup should occur for @param nativeDescriptorName the name of the structure used for registration @param dllHandle the DLL handle that was used during registration @param extraInfo extra information provided to the callback by the caller @return the return code
[ "Drive", "the", "deregistration", "hooks", "the", "native", "methods", "from", "the", "core", "DLL", "for", "the", "specified", "class", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/delegated/zos/NativeMethodHelper.java#L82-L94
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java
SARLOperationHelper._hasSideEffects
protected Boolean _hasSideEffects(XAssignment expression, ISideEffectContext context) { if (internalHasOperationSideEffects(expression, context, true)) { return true; } if (hasSideEffects(expression.getValue(), context)) { return true; } final JvmIdentifiableElement feature = expression.getFeature(); if (feature instanceof XVariableDeclaration) { context.assignVariable(feature.getIdentifier(), expression.getValue()); } return false; }
java
protected Boolean _hasSideEffects(XAssignment expression, ISideEffectContext context) { if (internalHasOperationSideEffects(expression, context, true)) { return true; } if (hasSideEffects(expression.getValue(), context)) { return true; } final JvmIdentifiableElement feature = expression.getFeature(); if (feature instanceof XVariableDeclaration) { context.assignVariable(feature.getIdentifier(), expression.getValue()); } return false; }
[ "protected", "Boolean", "_hasSideEffects", "(", "XAssignment", "expression", ",", "ISideEffectContext", "context", ")", "{", "if", "(", "internalHasOperationSideEffects", "(", "expression", ",", "context", ",", "true", ")", ")", "{", "return", "true", ";", "}", ...
Test if the given expression has side effects. @param expression the expression. @param context the list of context expressions. @return {@code true} if the expression has side effects.
[ "Test", "if", "the", "given", "expression", "has", "side", "effects", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L568-L580
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/lb/lbvserver_stats.java
lbvserver_stats.get
public static lbvserver_stats get(nitro_service service, String name) throws Exception{ lbvserver_stats obj = new lbvserver_stats(); obj.set_name(name); lbvserver_stats response = (lbvserver_stats) obj.stat_resource(service); return response; }
java
public static lbvserver_stats get(nitro_service service, String name) throws Exception{ lbvserver_stats obj = new lbvserver_stats(); obj.set_name(name); lbvserver_stats response = (lbvserver_stats) obj.stat_resource(service); return response; }
[ "public", "static", "lbvserver_stats", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "lbvserver_stats", "obj", "=", "new", "lbvserver_stats", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "lbv...
Use this API to fetch statistics of lbvserver_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "lbvserver_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/lb/lbvserver_stats.java#L517-L522
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
UseVarArgs.hasMethod
private static boolean hasMethod(JavaClass c, Method candidateMethod) { String name = candidateMethod.getName(); String sig = candidateMethod.getSignature(); for (Method method : c.getMethods()) { if (!method.isStatic() && method.getName().equals(name) && method.getSignature().equals(sig)) { return true; } } return false; }
java
private static boolean hasMethod(JavaClass c, Method candidateMethod) { String name = candidateMethod.getName(); String sig = candidateMethod.getSignature(); for (Method method : c.getMethods()) { if (!method.isStatic() && method.getName().equals(name) && method.getSignature().equals(sig)) { return true; } } return false; }
[ "private", "static", "boolean", "hasMethod", "(", "JavaClass", "c", ",", "Method", "candidateMethod", ")", "{", "String", "name", "=", "candidateMethod", ".", "getName", "(", ")", ";", "String", "sig", "=", "candidateMethod", ".", "getSignature", "(", ")", "...
looks to see if a class has a method with a specific name and signature @param c the class to check @param candidateMethod the method to look for @return whether this class has the exact method
[ "looks", "to", "see", "if", "a", "class", "has", "a", "method", "with", "a", "specific", "name", "and", "signature" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java#L206-L217
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java
SftpSubsystemChannel.setAttributes
public void setAttributes(String path, SftpFileAttributes attrs) throws SftpStatusException, SshException { try { UnsignedInteger32 requestId = nextRequestId(); Packet msg = createPacket(); msg.write(SSH_FXP_SETSTAT); msg.writeInt(requestId.longValue()); msg.writeString(path, CHARSET_ENCODING); msg.write(attrs.toByteArray()); sendMessage(msg); getOKRequestStatus(requestId); } catch (SshIOException ex) { throw ex.getRealException(); } catch (IOException ex) { throw new SshException(ex, SshException.INTERNAL_ERROR); } }
java
public void setAttributes(String path, SftpFileAttributes attrs) throws SftpStatusException, SshException { try { UnsignedInteger32 requestId = nextRequestId(); Packet msg = createPacket(); msg.write(SSH_FXP_SETSTAT); msg.writeInt(requestId.longValue()); msg.writeString(path, CHARSET_ENCODING); msg.write(attrs.toByteArray()); sendMessage(msg); getOKRequestStatus(requestId); } catch (SshIOException ex) { throw ex.getRealException(); } catch (IOException ex) { throw new SshException(ex, SshException.INTERNAL_ERROR); } }
[ "public", "void", "setAttributes", "(", "String", "path", ",", "SftpFileAttributes", "attrs", ")", "throws", "SftpStatusException", ",", "SshException", "{", "try", "{", "UnsignedInteger32", "requestId", "=", "nextRequestId", "(", ")", ";", "Packet", "msg", "=", ...
Sets the attributes of a file. @param path the path to the file. @param attrs the file attributes. @throws SftpStatusException , SshException
[ "Sets", "the", "attributes", "of", "a", "file", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L466-L485
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java
CodedConstant.getWriteValueToField
public static String getWriteValueToField(FieldType type, String express, boolean isList) { if ((type == FieldType.STRING || type == FieldType.BYTES) && !isList) { String method = "copyFromUtf8"; if (type == FieldType.BYTES) { method = "copyFrom"; } return "com.google.protobuf.ByteString." + method + "(" + express + ")"; } return express; }
java
public static String getWriteValueToField(FieldType type, String express, boolean isList) { if ((type == FieldType.STRING || type == FieldType.BYTES) && !isList) { String method = "copyFromUtf8"; if (type == FieldType.BYTES) { method = "copyFrom"; } return "com.google.protobuf.ByteString." + method + "(" + express + ")"; } return express; }
[ "public", "static", "String", "getWriteValueToField", "(", "FieldType", "type", ",", "String", "express", ",", "boolean", "isList", ")", "{", "if", "(", "(", "type", "==", "FieldType", ".", "STRING", "||", "type", "==", "FieldType", ".", "BYTES", ")", "&&"...
Gets the write value to field. @param type the type @param express the express @param isList the is list @return the write value to field
[ "Gets", "the", "write", "value", "to", "field", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L155-L166
GenesysPureEngage/authentication-client-java
src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java
AuthenticationApi.signOut1
public ModelApiResponse signOut1(String authorization, Boolean global, String redirectUri) throws ApiException { ApiResponse<ModelApiResponse> resp = signOut1WithHttpInfo(authorization, global, redirectUri); return resp.getData(); }
java
public ModelApiResponse signOut1(String authorization, Boolean global, String redirectUri) throws ApiException { ApiResponse<ModelApiResponse> resp = signOut1WithHttpInfo(authorization, global, redirectUri); return resp.getData(); }
[ "public", "ModelApiResponse", "signOut1", "(", "String", "authorization", ",", "Boolean", "global", ",", "String", "redirectUri", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ModelApiResponse", ">", "resp", "=", "signOut1WithHttpInfo", "(", "authorization"...
Sign-out a logged in user Sign-out the current user and invalidate either the current token or all tokens associated with the user. @param authorization The OAuth 2 bearer access token you received from [/auth/v3/oauth/token](/reference/authentication/Authentication/index.html#retrieveToken). For example: \&quot;Authorization: bearer a4b5da75-a584-4053-9227-0f0ab23ff06e\&quot; (required) @param global Specifies whether to invalidate all tokens for the current user (&#x60;true&#x60;) or only the current token (&#x60;false&#x60;). (optional) @param redirectUri Specifies the URI where the browser is redirected after sign-out is successful. (optional) @return ModelApiResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Sign", "-", "out", "a", "logged", "in", "user", "Sign", "-", "out", "the", "current", "user", "and", "invalidate", "either", "the", "current", "token", "or", "all", "tokens", "associated", "with", "the", "user", "." ]
train
https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java#L1462-L1465
wcm-io/wcm-io-wcm
commons/src/main/java/io/wcm/wcm/commons/util/RunMode.java
RunMode.disableIfNotPublish
@Deprecated public static boolean disableIfNotPublish(Set<String> runModes, ComponentContext componentContext, Logger log) { return disableIfNoRunModeActive(runModes, new String[] { PUBLISH }, componentContext, log); }
java
@Deprecated public static boolean disableIfNotPublish(Set<String> runModes, ComponentContext componentContext, Logger log) { return disableIfNoRunModeActive(runModes, new String[] { PUBLISH }, componentContext, log); }
[ "@", "Deprecated", "public", "static", "boolean", "disableIfNotPublish", "(", "Set", "<", "String", ">", "runModes", ",", "ComponentContext", "componentContext", ",", "Logger", "log", ")", "{", "return", "disableIfNoRunModeActive", "(", "runModes", ",", "new", "St...
Use this to disable a component if the runmode "publish" is not active. Component activation status is logged with DEBUG level. This method is a replacement for the <code>com.day.cq.commons.RunModeUtil#disableIfNoRunModeActive(RunMode, String[], ComponentContext, Logger)</code> method which is deprecated. @param runModes Run modes @param componentContext OSGI component context @param log Logger @return true if component was disabled @deprecated Instead of directly using the run modes, it is better to make the component in question require a configuration (see OSGI Declarative Services Spec: configuration policy). In this case, a component gets only active if a configuration is available. Such a configuration can be put into the repository for the specific run mode.
[ "Use", "this", "to", "disable", "a", "component", "if", "the", "runmode", "publish", "is", "not", "active", ".", "Component", "activation", "status", "is", "logged", "with", "DEBUG", "level", ".", "This", "method", "is", "a", "replacement", "for", "the", "...
train
https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/commons/src/main/java/io/wcm/wcm/commons/util/RunMode.java#L187-L192
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.replaceResource
@Deprecated public void replaceResource(String resourcename, int type, byte[] content, List<CmsProperty> properties) throws CmsException { replaceResource(resourcename, getResourceType(type), content, properties); }
java
@Deprecated public void replaceResource(String resourcename, int type, byte[] content, List<CmsProperty> properties) throws CmsException { replaceResource(resourcename, getResourceType(type), content, properties); }
[ "@", "Deprecated", "public", "void", "replaceResource", "(", "String", "resourcename", ",", "int", "type", ",", "byte", "[", "]", "content", ",", "List", "<", "CmsProperty", ">", "properties", ")", "throws", "CmsException", "{", "replaceResource", "(", "resour...
Replaces the content, type and properties of a resource.<p> @param resourcename the name of the resource to replace (full current site relative path) @param type the new type of the resource @param content the new content of the resource @param properties the new properties of the resource @throws CmsException if something goes wrong @deprecated Use {@link #replaceResource(String, I_CmsResourceType, byte[], List)} instead. Resource types should always be referenced either by its type class (preferred) or by type name. Use of int based resource type references will be discontinued in a future OpenCms release.
[ "Replaces", "the", "content", "type", "and", "properties", "of", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3668-L3673