repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java
AbstractExecutableMemberWriter.addParameters
protected void addParameters(ExecutableElement member, Content htmltree, int indentSize) { """ Add all the parameters for the executable member. @param member the member to write parameters for. @param htmltree the content tree to which the parameters information will be added. """ addParameters(member, true, htmltree, indentSize); }
java
protected void addParameters(ExecutableElement member, Content htmltree, int indentSize) { addParameters(member, true, htmltree, indentSize); }
[ "protected", "void", "addParameters", "(", "ExecutableElement", "member", ",", "Content", "htmltree", ",", "int", "indentSize", ")", "{", "addParameters", "(", "member", ",", "true", ",", "htmltree", ",", "indentSize", ")", ";", "}" ]
Add all the parameters for the executable member. @param member the member to write parameters for. @param htmltree the content tree to which the parameters information will be added.
[ "Add", "all", "the", "parameters", "for", "the", "executable", "member", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java#L189-L191
lucee/Lucee
core/src/main/java/lucee/runtime/op/date/DateCaster.java
DateCaster.toDateAdvanced
public static DateTime toDateAdvanced(String str, TimeZone timezone) throws PageException { """ converts a Object to a DateTime Object (Advanced but slower) @param str String to Convert @param timezone @return Date Time Object @throws PageException """ DateTime dt = toDateAdvanced(str, timezone, null); if (dt == null) throw new ExpressionException("can't cast [" + str + "] to date value"); return dt; }
java
public static DateTime toDateAdvanced(String str, TimeZone timezone) throws PageException { DateTime dt = toDateAdvanced(str, timezone, null); if (dt == null) throw new ExpressionException("can't cast [" + str + "] to date value"); return dt; }
[ "public", "static", "DateTime", "toDateAdvanced", "(", "String", "str", ",", "TimeZone", "timezone", ")", "throws", "PageException", "{", "DateTime", "dt", "=", "toDateAdvanced", "(", "str", ",", "timezone", ",", "null", ")", ";", "if", "(", "dt", "==", "null", ")", "throw", "new", "ExpressionException", "(", "\"can't cast [\"", "+", "str", "+", "\"] to date value\"", ")", ";", "return", "dt", ";", "}" ]
converts a Object to a DateTime Object (Advanced but slower) @param str String to Convert @param timezone @return Date Time Object @throws PageException
[ "converts", "a", "Object", "to", "a", "DateTime", "Object", "(", "Advanced", "but", "slower", ")" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/date/DateCaster.java#L104-L108
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/keywords/GrammarKeywordAccessFragment2.java
GrammarKeywordAccessFragment2.generateMembersFromConfig
protected StringConcatenationClient generateMembersFromConfig(Set<String> addedKeywords, Map<String, String> getters) { """ Generate the members of the accessors. @param addedKeywords the set of keywords that are added to the output. @param getters filled by this function with the getters' names. @return the content. """ final List<StringConcatenationClient> clients = new ArrayList<>(); for (final String keyword : this.configuration.getKeywords()) { final String id = keyword.toLowerCase(); if (!addedKeywords.contains(id) && !this.configuration.getIgnoredKeywords().contains(keyword)) { clients.add(generateKeyword(keyword, getGrammar().getName(), getters)); addedKeywords.add(id); } } for (final String keyword : this.configuration.getLiterals()) { final String id = keyword.toLowerCase(); if (!addedKeywords.contains(id) && !this.configuration.getIgnoredKeywords().contains(keyword)) { clients.add(generateKeyword(keyword, getGrammar().getName(), getters)); addedKeywords.add(id); } } return new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { for (final StringConcatenationClient client : clients) { it.append(client); } } }; }
java
protected StringConcatenationClient generateMembersFromConfig(Set<String> addedKeywords, Map<String, String> getters) { final List<StringConcatenationClient> clients = new ArrayList<>(); for (final String keyword : this.configuration.getKeywords()) { final String id = keyword.toLowerCase(); if (!addedKeywords.contains(id) && !this.configuration.getIgnoredKeywords().contains(keyword)) { clients.add(generateKeyword(keyword, getGrammar().getName(), getters)); addedKeywords.add(id); } } for (final String keyword : this.configuration.getLiterals()) { final String id = keyword.toLowerCase(); if (!addedKeywords.contains(id) && !this.configuration.getIgnoredKeywords().contains(keyword)) { clients.add(generateKeyword(keyword, getGrammar().getName(), getters)); addedKeywords.add(id); } } return new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { for (final StringConcatenationClient client : clients) { it.append(client); } } }; }
[ "protected", "StringConcatenationClient", "generateMembersFromConfig", "(", "Set", "<", "String", ">", "addedKeywords", ",", "Map", "<", "String", ",", "String", ">", "getters", ")", "{", "final", "List", "<", "StringConcatenationClient", ">", "clients", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "final", "String", "keyword", ":", "this", ".", "configuration", ".", "getKeywords", "(", ")", ")", "{", "final", "String", "id", "=", "keyword", ".", "toLowerCase", "(", ")", ";", "if", "(", "!", "addedKeywords", ".", "contains", "(", "id", ")", "&&", "!", "this", ".", "configuration", ".", "getIgnoredKeywords", "(", ")", ".", "contains", "(", "keyword", ")", ")", "{", "clients", ".", "add", "(", "generateKeyword", "(", "keyword", ",", "getGrammar", "(", ")", ".", "getName", "(", ")", ",", "getters", ")", ")", ";", "addedKeywords", ".", "add", "(", "id", ")", ";", "}", "}", "for", "(", "final", "String", "keyword", ":", "this", ".", "configuration", ".", "getLiterals", "(", ")", ")", "{", "final", "String", "id", "=", "keyword", ".", "toLowerCase", "(", ")", ";", "if", "(", "!", "addedKeywords", ".", "contains", "(", "id", ")", "&&", "!", "this", ".", "configuration", ".", "getIgnoredKeywords", "(", ")", ".", "contains", "(", "keyword", ")", ")", "{", "clients", ".", "add", "(", "generateKeyword", "(", "keyword", ",", "getGrammar", "(", ")", ".", "getName", "(", ")", ",", "getters", ")", ")", ";", "addedKeywords", ".", "add", "(", "id", ")", ";", "}", "}", "return", "new", "StringConcatenationClient", "(", ")", "{", "@", "Override", "protected", "void", "appendTo", "(", "TargetStringConcatenation", "it", ")", "{", "for", "(", "final", "StringConcatenationClient", "client", ":", "clients", ")", "{", "it", ".", "append", "(", "client", ")", ";", "}", "}", "}", ";", "}" ]
Generate the members of the accessors. @param addedKeywords the set of keywords that are added to the output. @param getters filled by this function with the getters' names. @return the content.
[ "Generate", "the", "members", "of", "the", "accessors", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/keywords/GrammarKeywordAccessFragment2.java#L200-L224
networknt/light-4j
client/src/main/java/org/apache/hc/core5/util/copied/ByteArrayBuffer.java
ByteArrayBuffer.indexOf
public int indexOf(final byte b, final int from, final int to) { """ Returns the index within this buffer of the first occurrence of the specified byte, starting the search at the specified {@code beginIndex} and finishing at {@code endIndex}. If no such byte occurs in this buffer within the specified bounds, {@code -1} is returned. <p> There is no restriction on the value of {@code beginIndex} and {@code endIndex}. If {@code beginIndex} is negative, it has the same effect as if it were zero. If {@code endIndex} is greater than {@link #length()}, it has the same effect as if it were {@link #length()}. If the {@code beginIndex} is greater than the {@code endIndex}, {@code -1} is returned. @param b the byte to search for. @param from the index to start the search from. @param to the index to finish the search at. @return the index of the first occurrence of the byte in the buffer within the given bounds, or {@code -1} if the byte does not occur. @since 4.1 """ int beginIndex = from; if (beginIndex < 0) { beginIndex = 0; } int endIndex = to; if (endIndex > this.len) { endIndex = this.len; } if (beginIndex > endIndex) { return -1; } for (int i = beginIndex; i < endIndex; i++) { if (this.array[i] == b) { return i; } } return -1; }
java
public int indexOf(final byte b, final int from, final int to) { int beginIndex = from; if (beginIndex < 0) { beginIndex = 0; } int endIndex = to; if (endIndex > this.len) { endIndex = this.len; } if (beginIndex > endIndex) { return -1; } for (int i = beginIndex; i < endIndex; i++) { if (this.array[i] == b) { return i; } } return -1; }
[ "public", "int", "indexOf", "(", "final", "byte", "b", ",", "final", "int", "from", ",", "final", "int", "to", ")", "{", "int", "beginIndex", "=", "from", ";", "if", "(", "beginIndex", "<", "0", ")", "{", "beginIndex", "=", "0", ";", "}", "int", "endIndex", "=", "to", ";", "if", "(", "endIndex", ">", "this", ".", "len", ")", "{", "endIndex", "=", "this", ".", "len", ";", "}", "if", "(", "beginIndex", ">", "endIndex", ")", "{", "return", "-", "1", ";", "}", "for", "(", "int", "i", "=", "beginIndex", ";", "i", "<", "endIndex", ";", "i", "++", ")", "{", "if", "(", "this", ".", "array", "[", "i", "]", "==", "b", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
Returns the index within this buffer of the first occurrence of the specified byte, starting the search at the specified {@code beginIndex} and finishing at {@code endIndex}. If no such byte occurs in this buffer within the specified bounds, {@code -1} is returned. <p> There is no restriction on the value of {@code beginIndex} and {@code endIndex}. If {@code beginIndex} is negative, it has the same effect as if it were zero. If {@code endIndex} is greater than {@link #length()}, it has the same effect as if it were {@link #length()}. If the {@code beginIndex} is greater than the {@code endIndex}, {@code -1} is returned. @param b the byte to search for. @param from the index to start the search from. @param to the index to finish the search at. @return the index of the first occurrence of the byte in the buffer within the given bounds, or {@code -1} if the byte does not occur. @since 4.1
[ "Returns", "the", "index", "within", "this", "buffer", "of", "the", "first", "occurrence", "of", "the", "specified", "byte", "starting", "the", "search", "at", "the", "specified", "{", "@code", "beginIndex", "}", "and", "finishing", "at", "{", "@code", "endIndex", "}", ".", "If", "no", "such", "byte", "occurs", "in", "this", "buffer", "within", "the", "specified", "bounds", "{", "@code", "-", "1", "}", "is", "returned", ".", "<p", ">", "There", "is", "no", "restriction", "on", "the", "value", "of", "{", "@code", "beginIndex", "}", "and", "{", "@code", "endIndex", "}", ".", "If", "{", "@code", "beginIndex", "}", "is", "negative", "it", "has", "the", "same", "effect", "as", "if", "it", "were", "zero", ".", "If", "{", "@code", "endIndex", "}", "is", "greater", "than", "{", "@link", "#length", "()", "}", "it", "has", "the", "same", "effect", "as", "if", "it", "were", "{", "@link", "#length", "()", "}", ".", "If", "the", "{", "@code", "beginIndex", "}", "is", "greater", "than", "the", "{", "@code", "endIndex", "}", "{", "@code", "-", "1", "}", "is", "returned", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/util/copied/ByteArrayBuffer.java#L309-L327
jtmelton/appsensor
appsensor-core/src/main/java/org/owasp/appsensor/core/util/XmlUtils.java
XmlUtils.getElementQualifiedName
public static String getElementQualifiedName(XMLStreamReader xmlReader, Map<String, String> namespaces) { """ Helper method for getting qualified name from stax reader given a set of specified schema namespaces @param xmlReader stax reader @param namespaces specified schema namespaces @return qualified element name """ String namespaceUri = null; String localName = null; switch(xmlReader.getEventType()) { case XMLStreamConstants.START_ELEMENT: case XMLStreamConstants.END_ELEMENT: namespaceUri = xmlReader.getNamespaceURI(); localName = xmlReader.getLocalName(); break; default: localName = StringUtils.EMPTY; break; } return namespaces.get(namespaceUri) + ":" + localName; }
java
public static String getElementQualifiedName(XMLStreamReader xmlReader, Map<String, String> namespaces) { String namespaceUri = null; String localName = null; switch(xmlReader.getEventType()) { case XMLStreamConstants.START_ELEMENT: case XMLStreamConstants.END_ELEMENT: namespaceUri = xmlReader.getNamespaceURI(); localName = xmlReader.getLocalName(); break; default: localName = StringUtils.EMPTY; break; } return namespaces.get(namespaceUri) + ":" + localName; }
[ "public", "static", "String", "getElementQualifiedName", "(", "XMLStreamReader", "xmlReader", ",", "Map", "<", "String", ",", "String", ">", "namespaces", ")", "{", "String", "namespaceUri", "=", "null", ";", "String", "localName", "=", "null", ";", "switch", "(", "xmlReader", ".", "getEventType", "(", ")", ")", "{", "case", "XMLStreamConstants", ".", "START_ELEMENT", ":", "case", "XMLStreamConstants", ".", "END_ELEMENT", ":", "namespaceUri", "=", "xmlReader", ".", "getNamespaceURI", "(", ")", ";", "localName", "=", "xmlReader", ".", "getLocalName", "(", ")", ";", "break", ";", "default", ":", "localName", "=", "StringUtils", ".", "EMPTY", ";", "break", ";", "}", "return", "namespaces", ".", "get", "(", "namespaceUri", ")", "+", "\":\"", "+", "localName", ";", "}" ]
Helper method for getting qualified name from stax reader given a set of specified schema namespaces @param xmlReader stax reader @param namespaces specified schema namespaces @return qualified element name
[ "Helper", "method", "for", "getting", "qualified", "name", "from", "stax", "reader", "given", "a", "set", "of", "specified", "schema", "namespaces" ]
train
https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/appsensor-core/src/main/java/org/owasp/appsensor/core/util/XmlUtils.java#L97-L113
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bos/model/CompleteMultipartUploadRequest.java
CompleteMultipartUploadRequest.setPartETags
public void setPartETags(List<PartETag> partETags) { """ Sets the list of part numbers and ETags that identify the individual parts of the multipart upload to complete. @param partETags The list of part numbers and ETags that identify the individual parts of the multipart upload to complete. """ checkNotNull(partETags, "partETags should not be null."); for (int i = 0; i < partETags.size(); ++i) { PartETag partETag = partETags.get(i); checkNotNull(partETag, "partETags[%s] should not be null.", i); int partNumber = partETag.getPartNumber(); checkArgument(partNumber > 0, "partNumber should be positive. partETags[%s].partNumber:%s", i, partNumber); checkNotNull(partETag.getETag(), "partETags[%s].eTag should not be null.", i); } Collections.sort(partETags, new Comparator<PartETag>() { @Override public int compare(PartETag tag1, PartETag tag2) { return tag1.getPartNumber() - tag2.getPartNumber(); } }); int lastPartNumber = 0; for (int i = 0; i < partETags.size(); ++i) { int partNumber = partETags.get(i).getPartNumber(); checkArgument(partNumber != lastPartNumber, "Duplicated partNumber %s.", partNumber); lastPartNumber = partNumber; } this.partETags = partETags; }
java
public void setPartETags(List<PartETag> partETags) { checkNotNull(partETags, "partETags should not be null."); for (int i = 0; i < partETags.size(); ++i) { PartETag partETag = partETags.get(i); checkNotNull(partETag, "partETags[%s] should not be null.", i); int partNumber = partETag.getPartNumber(); checkArgument(partNumber > 0, "partNumber should be positive. partETags[%s].partNumber:%s", i, partNumber); checkNotNull(partETag.getETag(), "partETags[%s].eTag should not be null.", i); } Collections.sort(partETags, new Comparator<PartETag>() { @Override public int compare(PartETag tag1, PartETag tag2) { return tag1.getPartNumber() - tag2.getPartNumber(); } }); int lastPartNumber = 0; for (int i = 0; i < partETags.size(); ++i) { int partNumber = partETags.get(i).getPartNumber(); checkArgument(partNumber != lastPartNumber, "Duplicated partNumber %s.", partNumber); lastPartNumber = partNumber; } this.partETags = partETags; }
[ "public", "void", "setPartETags", "(", "List", "<", "PartETag", ">", "partETags", ")", "{", "checkNotNull", "(", "partETags", ",", "\"partETags should not be null.\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "partETags", ".", "size", "(", ")", ";", "++", "i", ")", "{", "PartETag", "partETag", "=", "partETags", ".", "get", "(", "i", ")", ";", "checkNotNull", "(", "partETag", ",", "\"partETags[%s] should not be null.\"", ",", "i", ")", ";", "int", "partNumber", "=", "partETag", ".", "getPartNumber", "(", ")", ";", "checkArgument", "(", "partNumber", ">", "0", ",", "\"partNumber should be positive. partETags[%s].partNumber:%s\"", ",", "i", ",", "partNumber", ")", ";", "checkNotNull", "(", "partETag", ".", "getETag", "(", ")", ",", "\"partETags[%s].eTag should not be null.\"", ",", "i", ")", ";", "}", "Collections", ".", "sort", "(", "partETags", ",", "new", "Comparator", "<", "PartETag", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "PartETag", "tag1", ",", "PartETag", "tag2", ")", "{", "return", "tag1", ".", "getPartNumber", "(", ")", "-", "tag2", ".", "getPartNumber", "(", ")", ";", "}", "}", ")", ";", "int", "lastPartNumber", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "partETags", ".", "size", "(", ")", ";", "++", "i", ")", "{", "int", "partNumber", "=", "partETags", ".", "get", "(", "i", ")", ".", "getPartNumber", "(", ")", ";", "checkArgument", "(", "partNumber", "!=", "lastPartNumber", ",", "\"Duplicated partNumber %s.\"", ",", "partNumber", ")", ";", "lastPartNumber", "=", "partNumber", ";", "}", "this", ".", "partETags", "=", "partETags", ";", "}" ]
Sets the list of part numbers and ETags that identify the individual parts of the multipart upload to complete. @param partETags The list of part numbers and ETags that identify the individual parts of the multipart upload to complete.
[ "Sets", "the", "list", "of", "part", "numbers", "and", "ETags", "that", "identify", "the", "individual", "parts", "of", "the", "multipart", "upload", "to", "complete", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/model/CompleteMultipartUploadRequest.java#L170-L192
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/JSONAssert.java
JSONAssert.assertEquals
public static void assertEquals(String expectedStr, JSONObject actual, JSONCompareMode compareMode) throws JSONException { """ Asserts that the JSONObject provided matches the expected string. If it isn't it throws an {@link AssertionError}. @param expectedStr Expected JSON string @param actual JSONObject to compare @param compareMode Specifies which comparison mode to use @throws JSONException JSON parsing error """ assertEquals("", expectedStr, actual, compareMode); }
java
public static void assertEquals(String expectedStr, JSONObject actual, JSONCompareMode compareMode) throws JSONException { assertEquals("", expectedStr, actual, compareMode); }
[ "public", "static", "void", "assertEquals", "(", "String", "expectedStr", ",", "JSONObject", "actual", ",", "JSONCompareMode", "compareMode", ")", "throws", "JSONException", "{", "assertEquals", "(", "\"\"", ",", "expectedStr", ",", "actual", ",", "compareMode", ")", ";", "}" ]
Asserts that the JSONObject provided matches the expected string. If it isn't it throws an {@link AssertionError}. @param expectedStr Expected JSON string @param actual JSONObject to compare @param compareMode Specifies which comparison mode to use @throws JSONException JSON parsing error
[ "Asserts", "that", "the", "JSONObject", "provided", "matches", "the", "expected", "string", ".", "If", "it", "isn", "t", "it", "throws", "an", "{", "@link", "AssertionError", "}", "." ]
train
https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONAssert.java#L126-L129
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/plugins/RxJavaPlugins.java
RxJavaPlugins.createNewThreadScheduler
@NonNull @GwtIncompatible public static Scheduler createNewThreadScheduler(@NonNull ThreadFactory threadFactory) { """ Create an instance of the default {@link Scheduler} used for {@link Schedulers#newThread()} except using {@code threadFactory} for thread creation. <p>History: 2.0.5 - experimental @param threadFactory thread factory to use for creating worker threads. Note that this takes precedence over any system properties for configuring new thread creation. Cannot be null. @return the created Scheduler instance @since 2.1 """ return new NewThreadScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null")); }
java
@NonNull @GwtIncompatible public static Scheduler createNewThreadScheduler(@NonNull ThreadFactory threadFactory) { return new NewThreadScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null")); }
[ "@", "NonNull", "@", "GwtIncompatible", "public", "static", "Scheduler", "createNewThreadScheduler", "(", "@", "NonNull", "ThreadFactory", "threadFactory", ")", "{", "return", "new", "NewThreadScheduler", "(", "ObjectHelper", ".", "requireNonNull", "(", "threadFactory", ",", "\"threadFactory is null\"", ")", ")", ";", "}" ]
Create an instance of the default {@link Scheduler} used for {@link Schedulers#newThread()} except using {@code threadFactory} for thread creation. <p>History: 2.0.5 - experimental @param threadFactory thread factory to use for creating worker threads. Note that this takes precedence over any system properties for configuring new thread creation. Cannot be null. @return the created Scheduler instance @since 2.1
[ "Create", "an", "instance", "of", "the", "default", "{" ]
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/plugins/RxJavaPlugins.java#L1239-L1243
julianhyde/sqlline
src/main/java/sqlline/SqlLine.java
SqlLine.mainWithInputRedirection
public static Status mainWithInputRedirection(String[] args, InputStream inputStream) throws IOException { """ Starts the program with redirected input. <p>For redirected output, use {@link #setOutputStream} and {@link #setErrorStream}. <p>Exits with 0 on success, 1 on invalid arguments, and 2 on any other error. @param args same as main() @param inputStream redirected input, or null to use standard input @return Status code to be returned to the operating system @throws IOException on error """ return start(args, inputStream, false); }
java
public static Status mainWithInputRedirection(String[] args, InputStream inputStream) throws IOException { return start(args, inputStream, false); }
[ "public", "static", "Status", "mainWithInputRedirection", "(", "String", "[", "]", "args", ",", "InputStream", "inputStream", ")", "throws", "IOException", "{", "return", "start", "(", "args", ",", "inputStream", ",", "false", ")", ";", "}" ]
Starts the program with redirected input. <p>For redirected output, use {@link #setOutputStream} and {@link #setErrorStream}. <p>Exits with 0 on success, 1 on invalid arguments, and 2 on any other error. @param args same as main() @param inputStream redirected input, or null to use standard input @return Status code to be returned to the operating system @throws IOException on error
[ "Starts", "the", "program", "with", "redirected", "input", "." ]
train
https://github.com/julianhyde/sqlline/blob/7577f3ebaca0897a9ff01d1553d4576487e1d2c3/src/main/java/sqlline/SqlLine.java#L218-L221
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/Messages.java
Messages.getWithDefault
public String getWithDefault(String key, String defaultMessage, String language, Object... args) { """ Gets the requested localized message. <p/> <p> The current Request and Response are used to help determine the messages resource to use. <ol> <li>Exact locale match, return the registered locale message <li>Language match, but not a locale match, return the registered language message <li>Return supplied default message </ol> <p> The message can be formatted with optional arguments using the {@link java.text.MessageFormat} syntax. </p> @param key @param defaultMessage @param args @return the message or the key if the key does not exist """ String value = get(key, language, args); if (value.equals(key)) { // key does not exist, format default message value = formatMessage(defaultMessage, language, args); } return value; }
java
public String getWithDefault(String key, String defaultMessage, String language, Object... args) { String value = get(key, language, args); if (value.equals(key)) { // key does not exist, format default message value = formatMessage(defaultMessage, language, args); } return value; }
[ "public", "String", "getWithDefault", "(", "String", "key", ",", "String", "defaultMessage", ",", "String", "language", ",", "Object", "...", "args", ")", "{", "String", "value", "=", "get", "(", "key", ",", "language", ",", "args", ")", ";", "if", "(", "value", ".", "equals", "(", "key", ")", ")", "{", "// key does not exist, format default message", "value", "=", "formatMessage", "(", "defaultMessage", ",", "language", ",", "args", ")", ";", "}", "return", "value", ";", "}" ]
Gets the requested localized message. <p/> <p> The current Request and Response are used to help determine the messages resource to use. <ol> <li>Exact locale match, return the registered locale message <li>Language match, but not a locale match, return the registered language message <li>Return supplied default message </ol> <p> The message can be formatted with optional arguments using the {@link java.text.MessageFormat} syntax. </p> @param key @param defaultMessage @param args @return the message or the key if the key does not exist
[ "Gets", "the", "requested", "localized", "message", ".", "<p", "/", ">", "<p", ">", "The", "current", "Request", "and", "Response", "are", "used", "to", "help", "determine", "the", "messages", "resource", "to", "use", ".", "<ol", ">", "<li", ">", "Exact", "locale", "match", "return", "the", "registered", "locale", "message", "<li", ">", "Language", "match", "but", "not", "a", "locale", "match", "return", "the", "registered", "language", "message", "<li", ">", "Return", "supplied", "default", "message", "<", "/", "ol", ">", "<p", ">", "The", "message", "can", "be", "formatted", "with", "optional", "arguments", "using", "the", "{", "@link", "java", ".", "text", ".", "MessageFormat", "}", "syntax", ".", "<", "/", "p", ">" ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Messages.java#L178-L186
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bcc/BccClient.java
BccClient.attachVolume
public AttachVolumeResponse attachVolume(String volumeId, String instanceId) { """ Attaching the specified volume to a specified instance. You can attach the specified volume to a specified instance only when the volume is Available and the instance is Running or Stopped , otherwise,it's will get <code>409</code> errorCode. @param volumeId The id of the volume which will be attached to specified instance. @param instanceId The id of the instance which will be attached with a volume. @return The response containing the volume-instance attach relation. """ return attachVolume(new AttachVolumeRequest().withVolumeId(volumeId).withInstanceId(instanceId)); }
java
public AttachVolumeResponse attachVolume(String volumeId, String instanceId) { return attachVolume(new AttachVolumeRequest().withVolumeId(volumeId).withInstanceId(instanceId)); }
[ "public", "AttachVolumeResponse", "attachVolume", "(", "String", "volumeId", ",", "String", "instanceId", ")", "{", "return", "attachVolume", "(", "new", "AttachVolumeRequest", "(", ")", ".", "withVolumeId", "(", "volumeId", ")", ".", "withInstanceId", "(", "instanceId", ")", ")", ";", "}" ]
Attaching the specified volume to a specified instance. You can attach the specified volume to a specified instance only when the volume is Available and the instance is Running or Stopped , otherwise,it's will get <code>409</code> errorCode. @param volumeId The id of the volume which will be attached to specified instance. @param instanceId The id of the instance which will be attached with a volume. @return The response containing the volume-instance attach relation.
[ "Attaching", "the", "specified", "volume", "to", "a", "specified", "instance", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L963-L965
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/search/PathFinder.java
PathFinder.getRelativePathTo
public static File getRelativePathTo(File parent, final List<String> folders) { """ Gets the file or directory from the given parent File object and the relative path given over the list as String objects. @param parent The parent directory. @param folders The list with the directories and optional a filename. @return the resulted file or directory from the given arguments. """ for (final String string : folders) { final File nextFolder = new File(parent, string); parent = nextFolder; } return parent; }
java
public static File getRelativePathTo(File parent, final List<String> folders) { for (final String string : folders) { final File nextFolder = new File(parent, string); parent = nextFolder; } return parent; }
[ "public", "static", "File", "getRelativePathTo", "(", "File", "parent", ",", "final", "List", "<", "String", ">", "folders", ")", "{", "for", "(", "final", "String", "string", ":", "folders", ")", "{", "final", "File", "nextFolder", "=", "new", "File", "(", "parent", ",", "string", ")", ";", "parent", "=", "nextFolder", ";", "}", "return", "parent", ";", "}" ]
Gets the file or directory from the given parent File object and the relative path given over the list as String objects. @param parent The parent directory. @param folders The list with the directories and optional a filename. @return the resulted file or directory from the given arguments.
[ "Gets", "the", "file", "or", "directory", "from", "the", "given", "parent", "File", "object", "and", "the", "relative", "path", "given", "over", "the", "list", "as", "String", "objects", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/PathFinder.java#L138-L146
derari/cthul
objects/src/main/java/org/cthul/objects/Boxing.java
Boxing.deepBox
public static Object deepBox(Object src) { """ Returns any multidimensional array into an array of boxed values. @param src source array @return multidimensional array """ Class<?> resultType = arrayBoxingType(src.getClass()); return deepBox(resultType, src); }
java
public static Object deepBox(Object src) { Class<?> resultType = arrayBoxingType(src.getClass()); return deepBox(resultType, src); }
[ "public", "static", "Object", "deepBox", "(", "Object", "src", ")", "{", "Class", "<", "?", ">", "resultType", "=", "arrayBoxingType", "(", "src", ".", "getClass", "(", ")", ")", ";", "return", "deepBox", "(", "resultType", ",", "src", ")", ";", "}" ]
Returns any multidimensional array into an array of boxed values. @param src source array @return multidimensional array
[ "Returns", "any", "multidimensional", "array", "into", "an", "array", "of", "boxed", "values", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/Boxing.java#L713-L716
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.powerOffAsync
public Observable<OperationStatusResponseInner> powerOffAsync(String resourceGroupName, String vmScaleSetName) { """ Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return powerOffWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> powerOffAsync(String resourceGroupName, String vmScaleSetName) { return powerOffWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "powerOffAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ")", "{", "return", "powerOffWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "OperationStatusResponseInner", ">", ",", "OperationStatusResponseInner", ">", "(", ")", "{", "@", "Override", "public", "OperationStatusResponseInner", "call", "(", "ServiceResponse", "<", "OperationStatusResponseInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Power", "off", "(", "stop", ")", "one", "or", "more", "virtual", "machines", "in", "a", "VM", "scale", "set", ".", "Note", "that", "resources", "are", "still", "attached", "and", "you", "are", "getting", "charged", "for", "the", "resources", ".", "Instead", "use", "deallocate", "to", "release", "resources", "and", "avoid", "charges", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L1751-L1758
augustd/burp-suite-utils
src/main/java/com/codemagi/burp/parser/HttpRequest.java
HttpRequest.setParameter
public void setParameter(String name, String value) { """ Sets a parameter value based on its name. @param name The parameter name to set @param value The parameter value to set """ sortedParams = null; parameters.add(new Parameter(name, value)); }
java
public void setParameter(String name, String value) { sortedParams = null; parameters.add(new Parameter(name, value)); }
[ "public", "void", "setParameter", "(", "String", "name", ",", "String", "value", ")", "{", "sortedParams", "=", "null", ";", "parameters", ".", "add", "(", "new", "Parameter", "(", "name", ",", "value", ")", ")", ";", "}" ]
Sets a parameter value based on its name. @param name The parameter name to set @param value The parameter value to set
[ "Sets", "a", "parameter", "value", "based", "on", "its", "name", "." ]
train
https://github.com/augustd/burp-suite-utils/blob/5e34a6b9147f5705382f98049dd9e4f387b78629/src/main/java/com/codemagi/burp/parser/HttpRequest.java#L309-L312
GerdHolz/TOVAL
src/de/invation/code/toval/os/OSUtils.java
OSUtils.runCommand
public void runCommand(String[] command, GenericHandler<BufferedReader> inputHandler, GenericHandler<BufferedReader> errorHandler) throws OSException { """ Runs a command on the operating system. @param command String array of command parts. The parts are concatenated with spaces between the parts. The single command parts should not contain whitespaces. @param inputHandler {@link GenericHandler} to handle the process input stream {@link BufferedReader}. @param errorHandler {@link GenericHandler} to handle the process error output {@link BufferedReader}. @throws OSException """ Validate.notNull(command); try { Process p = Runtime.getRuntime().exec(command); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream())); if (inputHandler != null) { inputHandler.handle(in); } if (errorHandler != null) { errorHandler.handle(err); } in.close(); p.waitFor(); p.exitValue(); } catch (Exception ex) { throw new OSException(ex.getMessage(), ex); } }
java
public void runCommand(String[] command, GenericHandler<BufferedReader> inputHandler, GenericHandler<BufferedReader> errorHandler) throws OSException { Validate.notNull(command); try { Process p = Runtime.getRuntime().exec(command); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream())); if (inputHandler != null) { inputHandler.handle(in); } if (errorHandler != null) { errorHandler.handle(err); } in.close(); p.waitFor(); p.exitValue(); } catch (Exception ex) { throw new OSException(ex.getMessage(), ex); } }
[ "public", "void", "runCommand", "(", "String", "[", "]", "command", ",", "GenericHandler", "<", "BufferedReader", ">", "inputHandler", ",", "GenericHandler", "<", "BufferedReader", ">", "errorHandler", ")", "throws", "OSException", "{", "Validate", ".", "notNull", "(", "command", ")", ";", "try", "{", "Process", "p", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "command", ")", ";", "BufferedReader", "in", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "p", ".", "getInputStream", "(", ")", ")", ")", ";", "BufferedReader", "err", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "p", ".", "getErrorStream", "(", ")", ")", ")", ";", "if", "(", "inputHandler", "!=", "null", ")", "{", "inputHandler", ".", "handle", "(", "in", ")", ";", "}", "if", "(", "errorHandler", "!=", "null", ")", "{", "errorHandler", ".", "handle", "(", "err", ")", ";", "}", "in", ".", "close", "(", ")", ";", "p", ".", "waitFor", "(", ")", ";", "p", ".", "exitValue", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "OSException", "(", "ex", ".", "getMessage", "(", ")", ",", "ex", ")", ";", "}", "}" ]
Runs a command on the operating system. @param command String array of command parts. The parts are concatenated with spaces between the parts. The single command parts should not contain whitespaces. @param inputHandler {@link GenericHandler} to handle the process input stream {@link BufferedReader}. @param errorHandler {@link GenericHandler} to handle the process error output {@link BufferedReader}. @throws OSException
[ "Runs", "a", "command", "on", "the", "operating", "system", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/OSUtils.java#L170-L191
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java
CmsDomUtil.positionElement
public static void positionElement(Element elem, Element referenceElement, int dx, int dy) { """ Positions an element in the DOM relative to another element.<p> @param elem the element to position @param referenceElement the element relative to which the first element should be positioned @param dx the x offset relative to the reference element @param dy the y offset relative to the reference element """ com.google.gwt.dom.client.Style style = elem.getStyle(); style.setLeft(0, Unit.PX); style.setTop(0, Unit.PX); int myX = elem.getAbsoluteLeft(); int myY = elem.getAbsoluteTop(); int refX = referenceElement.getAbsoluteLeft(); int refY = referenceElement.getAbsoluteTop(); int newX = (refX - myX) + dx; int newY = (refY - myY) + dy; style.setLeft(newX, Unit.PX); style.setTop(newY, Unit.PX); }
java
public static void positionElement(Element elem, Element referenceElement, int dx, int dy) { com.google.gwt.dom.client.Style style = elem.getStyle(); style.setLeft(0, Unit.PX); style.setTop(0, Unit.PX); int myX = elem.getAbsoluteLeft(); int myY = elem.getAbsoluteTop(); int refX = referenceElement.getAbsoluteLeft(); int refY = referenceElement.getAbsoluteTop(); int newX = (refX - myX) + dx; int newY = (refY - myY) + dy; style.setLeft(newX, Unit.PX); style.setTop(newY, Unit.PX); }
[ "public", "static", "void", "positionElement", "(", "Element", "elem", ",", "Element", "referenceElement", ",", "int", "dx", ",", "int", "dy", ")", "{", "com", ".", "google", ".", "gwt", ".", "dom", ".", "client", ".", "Style", "style", "=", "elem", ".", "getStyle", "(", ")", ";", "style", ".", "setLeft", "(", "0", ",", "Unit", ".", "PX", ")", ";", "style", ".", "setTop", "(", "0", ",", "Unit", ".", "PX", ")", ";", "int", "myX", "=", "elem", ".", "getAbsoluteLeft", "(", ")", ";", "int", "myY", "=", "elem", ".", "getAbsoluteTop", "(", ")", ";", "int", "refX", "=", "referenceElement", ".", "getAbsoluteLeft", "(", ")", ";", "int", "refY", "=", "referenceElement", ".", "getAbsoluteTop", "(", ")", ";", "int", "newX", "=", "(", "refX", "-", "myX", ")", "+", "dx", ";", "int", "newY", "=", "(", "refY", "-", "myY", ")", "+", "dy", ";", "style", ".", "setLeft", "(", "newX", ",", "Unit", ".", "PX", ")", ";", "style", ".", "setTop", "(", "newY", ",", "Unit", ".", "PX", ")", ";", "}" ]
Positions an element in the DOM relative to another element.<p> @param elem the element to position @param referenceElement the element relative to which the first element should be positioned @param dx the x offset relative to the reference element @param dy the y offset relative to the reference element
[ "Positions", "an", "element", "in", "the", "DOM", "relative", "to", "another", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L1766-L1779
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/FormLoginAuthenticator.java
FormLoginAuthenticator.allowToAddCookieToResponse
private boolean allowToAddCookieToResponse(WebAppSecurityConfig config, HttpServletRequest req) { """ This method checks the following conditions: 1) If SSO requires SSL is true and NOT HTTPs request, returns false. 2) Otherwise returns true. @param req @return """ boolean secureRequest = req.isSecure(); if (config.getSSORequiresSSL() && !secureRequest) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "SSO requires SSL. The cookie will not be sent back because the request is not over https."); } return false; } return true; }
java
private boolean allowToAddCookieToResponse(WebAppSecurityConfig config, HttpServletRequest req) { boolean secureRequest = req.isSecure(); if (config.getSSORequiresSSL() && !secureRequest) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "SSO requires SSL. The cookie will not be sent back because the request is not over https."); } return false; } return true; }
[ "private", "boolean", "allowToAddCookieToResponse", "(", "WebAppSecurityConfig", "config", ",", "HttpServletRequest", "req", ")", "{", "boolean", "secureRequest", "=", "req", ".", "isSecure", "(", ")", ";", "if", "(", "config", ".", "getSSORequiresSSL", "(", ")", "&&", "!", "secureRequest", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"SSO requires SSL. The cookie will not be sent back because the request is not over https.\"", ")", ";", "}", "return", "false", ";", "}", "return", "true", ";", "}" ]
This method checks the following conditions: 1) If SSO requires SSL is true and NOT HTTPs request, returns false. 2) Otherwise returns true. @param req @return
[ "This", "method", "checks", "the", "following", "conditions", ":", "1", ")", "If", "SSO", "requires", "SSL", "is", "true", "and", "NOT", "HTTPs", "request", "returns", "false", ".", "2", ")", "Otherwise", "returns", "true", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/FormLoginAuthenticator.java#L229-L238
appium/java-client
src/main/java/io/appium/java_client/events/EventFiringObjectFactory.java
EventFiringObjectFactory.getEventFiringObject
public static <T> T getEventFiringObject(T t, WebDriver driver, Listener ... listeners) { """ This method makes an event firing object. @param t an original {@link Object} that is supposed to be listenable @param driver an instance of {@link org.openqa.selenium.WebDriver} @param listeners is an array of {@link io.appium.java_client.events.api.Listener} that is supposed to be used for the event firing @param <T> T @return an instance of {@link org.openqa.selenium.WebDriver} that fires events """ return getEventFiringObject(t, driver, Arrays.asList(listeners)); }
java
public static <T> T getEventFiringObject(T t, WebDriver driver, Listener ... listeners) { return getEventFiringObject(t, driver, Arrays.asList(listeners)); }
[ "public", "static", "<", "T", ">", "T", "getEventFiringObject", "(", "T", "t", ",", "WebDriver", "driver", ",", "Listener", "...", "listeners", ")", "{", "return", "getEventFiringObject", "(", "t", ",", "driver", ",", "Arrays", ".", "asList", "(", "listeners", ")", ")", ";", "}" ]
This method makes an event firing object. @param t an original {@link Object} that is supposed to be listenable @param driver an instance of {@link org.openqa.selenium.WebDriver} @param listeners is an array of {@link io.appium.java_client.events.api.Listener} that is supposed to be used for the event firing @param <T> T @return an instance of {@link org.openqa.selenium.WebDriver} that fires events
[ "This", "method", "makes", "an", "event", "firing", "object", "." ]
train
https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/events/EventFiringObjectFactory.java#L70-L72
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ClassContext.java
ClassContext.getBytecodeSet
@CheckForNull static public BitSet getBytecodeSet(JavaClass clazz, Method method) { """ Get a BitSet representing the bytecodes that are used in the given method. This is useful for prescreening a method for the existence of particular instructions. Because this step doesn't require building a MethodGen, it is very fast and memory-efficient. It may allow a Detector to avoid some very expensive analysis, which is a Big Win for the user. @param method the method @return the BitSet containing the opcodes which appear in the method, or null if the method has no code """ XMethod xmethod = XFactory.createXMethod(clazz, method); if (cachedBitsets().containsKey(xmethod)) { return cachedBitsets().get(xmethod); } Code code = method.getCode(); if (code == null) { return null; } byte[] instructionList = code.getCode(); // Create callback UnpackedBytecodeCallback callback = new UnpackedBytecodeCallback(instructionList.length); // Scan the method. BytecodeScanner scanner = new BytecodeScanner(); scanner.scan(instructionList, callback); UnpackedCode unpackedCode = callback.getUnpackedCode(); BitSet result = null; if (unpackedCode != null) { result = unpackedCode.getBytecodeSet(); } cachedBitsets().put(xmethod, result); return result; }
java
@CheckForNull static public BitSet getBytecodeSet(JavaClass clazz, Method method) { XMethod xmethod = XFactory.createXMethod(clazz, method); if (cachedBitsets().containsKey(xmethod)) { return cachedBitsets().get(xmethod); } Code code = method.getCode(); if (code == null) { return null; } byte[] instructionList = code.getCode(); // Create callback UnpackedBytecodeCallback callback = new UnpackedBytecodeCallback(instructionList.length); // Scan the method. BytecodeScanner scanner = new BytecodeScanner(); scanner.scan(instructionList, callback); UnpackedCode unpackedCode = callback.getUnpackedCode(); BitSet result = null; if (unpackedCode != null) { result = unpackedCode.getBytecodeSet(); } cachedBitsets().put(xmethod, result); return result; }
[ "@", "CheckForNull", "static", "public", "BitSet", "getBytecodeSet", "(", "JavaClass", "clazz", ",", "Method", "method", ")", "{", "XMethod", "xmethod", "=", "XFactory", ".", "createXMethod", "(", "clazz", ",", "method", ")", ";", "if", "(", "cachedBitsets", "(", ")", ".", "containsKey", "(", "xmethod", ")", ")", "{", "return", "cachedBitsets", "(", ")", ".", "get", "(", "xmethod", ")", ";", "}", "Code", "code", "=", "method", ".", "getCode", "(", ")", ";", "if", "(", "code", "==", "null", ")", "{", "return", "null", ";", "}", "byte", "[", "]", "instructionList", "=", "code", ".", "getCode", "(", ")", ";", "// Create callback", "UnpackedBytecodeCallback", "callback", "=", "new", "UnpackedBytecodeCallback", "(", "instructionList", ".", "length", ")", ";", "// Scan the method.", "BytecodeScanner", "scanner", "=", "new", "BytecodeScanner", "(", ")", ";", "scanner", ".", "scan", "(", "instructionList", ",", "callback", ")", ";", "UnpackedCode", "unpackedCode", "=", "callback", ".", "getUnpackedCode", "(", ")", ";", "BitSet", "result", "=", "null", ";", "if", "(", "unpackedCode", "!=", "null", ")", "{", "result", "=", "unpackedCode", ".", "getBytecodeSet", "(", ")", ";", "}", "cachedBitsets", "(", ")", ".", "put", "(", "xmethod", ",", "result", ")", ";", "return", "result", ";", "}" ]
Get a BitSet representing the bytecodes that are used in the given method. This is useful for prescreening a method for the existence of particular instructions. Because this step doesn't require building a MethodGen, it is very fast and memory-efficient. It may allow a Detector to avoid some very expensive analysis, which is a Big Win for the user. @param method the method @return the BitSet containing the opcodes which appear in the method, or null if the method has no code
[ "Get", "a", "BitSet", "representing", "the", "bytecodes", "that", "are", "used", "in", "the", "given", "method", ".", "This", "is", "useful", "for", "prescreening", "a", "method", "for", "the", "existence", "of", "particular", "instructions", ".", "Because", "this", "step", "doesn", "t", "require", "building", "a", "MethodGen", "it", "is", "very", "fast", "and", "memory", "-", "efficient", ".", "It", "may", "allow", "a", "Detector", "to", "avoid", "some", "very", "expensive", "analysis", "which", "is", "a", "Big", "Win", "for", "the", "user", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ClassContext.java#L428-L456
VoltDB/voltdb
src/frontend/org/voltdb/iv2/InitiatorMailbox.java
InitiatorMailbox.repairReplicasWith
void repairReplicasWith(List<Long> needsRepair, VoltMessage repairWork) { """ Create a real repair message from the msg repair log contents and instruct the message handler to execute a repair. Single partition work needs to do duplicate counting; MPI can simply broadcast the repair to the needs repair units -- where the SP will do the rest. """ //For an SpInitiator the lock should already have been acquire since //this method is reach via SpPromoteAlgo.deliver which is reached by InitiatorMailbox.deliver //which should already have acquire the lock assert(Thread.holdsLock(this)); repairReplicasWithInternal(needsRepair, repairWork); }
java
void repairReplicasWith(List<Long> needsRepair, VoltMessage repairWork) { //For an SpInitiator the lock should already have been acquire since //this method is reach via SpPromoteAlgo.deliver which is reached by InitiatorMailbox.deliver //which should already have acquire the lock assert(Thread.holdsLock(this)); repairReplicasWithInternal(needsRepair, repairWork); }
[ "void", "repairReplicasWith", "(", "List", "<", "Long", ">", "needsRepair", ",", "VoltMessage", "repairWork", ")", "{", "//For an SpInitiator the lock should already have been acquire since", "//this method is reach via SpPromoteAlgo.deliver which is reached by InitiatorMailbox.deliver", "//which should already have acquire the lock", "assert", "(", "Thread", ".", "holdsLock", "(", "this", ")", ")", ";", "repairReplicasWithInternal", "(", "needsRepair", ",", "repairWork", ")", ";", "}" ]
Create a real repair message from the msg repair log contents and instruct the message handler to execute a repair. Single partition work needs to do duplicate counting; MPI can simply broadcast the repair to the needs repair units -- where the SP will do the rest.
[ "Create", "a", "real", "repair", "message", "from", "the", "msg", "repair", "log", "contents", "and", "instruct", "the", "message", "handler", "to", "execute", "a", "repair", ".", "Single", "partition", "work", "needs", "to", "do", "duplicate", "counting", ";", "MPI", "can", "simply", "broadcast", "the", "repair", "to", "the", "needs", "repair", "units", "--", "where", "the", "SP", "will", "do", "the", "rest", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/InitiatorMailbox.java#L591-L598
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.biConsumer
public static <T, U> BiConsumer<T, U> biConsumer(CheckedBiConsumer<T, U> consumer) { """ Wrap a {@link org.jooq.lambda.fi.util.function.CheckedBiConsumer} in a {@link BiConsumer}. <p> Example: <code><pre> map.forEach(Unchecked.biConsumer((k, v) -> { if (k == null || v == null) throw new Exception("No nulls allowed in map"); })); </pre></code> """ return biConsumer(consumer, THROWABLE_TO_RUNTIME_EXCEPTION); }
java
public static <T, U> BiConsumer<T, U> biConsumer(CheckedBiConsumer<T, U> consumer) { return biConsumer(consumer, THROWABLE_TO_RUNTIME_EXCEPTION); }
[ "public", "static", "<", "T", ",", "U", ">", "BiConsumer", "<", "T", ",", "U", ">", "biConsumer", "(", "CheckedBiConsumer", "<", "T", ",", "U", ">", "consumer", ")", "{", "return", "biConsumer", "(", "consumer", ",", "THROWABLE_TO_RUNTIME_EXCEPTION", ")", ";", "}" ]
Wrap a {@link org.jooq.lambda.fi.util.function.CheckedBiConsumer} in a {@link BiConsumer}. <p> Example: <code><pre> map.forEach(Unchecked.biConsumer((k, v) -> { if (k == null || v == null) throw new Exception("No nulls allowed in map"); })); </pre></code>
[ "Wrap", "a", "{" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L210-L212
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
MP3FileID3Controller.setTrack
public void setTrack(int track, int type) { """ Set the track number of this mp3. @param track the track number of this mp3 """ if (allow(type&ID3V1)) { id3v1.setTrack(track); } if (allow(type&ID3V2)) { id3v2.setTextFrame(ID3v2Frames.TRACK_NUMBER, String.valueOf(track)); } }
java
public void setTrack(int track, int type) { if (allow(type&ID3V1)) { id3v1.setTrack(track); } if (allow(type&ID3V2)) { id3v2.setTextFrame(ID3v2Frames.TRACK_NUMBER, String.valueOf(track)); } }
[ "public", "void", "setTrack", "(", "int", "track", ",", "int", "type", ")", "{", "if", "(", "allow", "(", "type", "&", "ID3V1", ")", ")", "{", "id3v1", ".", "setTrack", "(", "track", ")", ";", "}", "if", "(", "allow", "(", "type", "&", "ID3V2", ")", ")", "{", "id3v2", ".", "setTextFrame", "(", "ID3v2Frames", ".", "TRACK_NUMBER", ",", "String", ".", "valueOf", "(", "track", ")", ")", ";", "}", "}" ]
Set the track number of this mp3. @param track the track number of this mp3
[ "Set", "the", "track", "number", "of", "this", "mp3", "." ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L261-L271
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java
DateTimeFormatter.ofPattern
public static DateTimeFormatter ofPattern(String pattern, Locale locale) { """ Creates a formatter using the specified pattern and locale. <p> This method will create a formatter based on a simple <a href="#patterns">pattern of letters and symbols</a> as described in the class documentation. For example, {@code d MMM uuuu} will format 2011-12-03 as '3 Dec 2011'. <p> The formatter will use the specified locale. This can be changed using {@link DateTimeFormatter#withLocale(Locale)} on the returned formatter <p> The returned formatter has no override chronology or zone. It uses {@link ResolverStyle#SMART SMART} resolver style. @param pattern the pattern to use, not null @param locale the locale to use, not null @return the formatter based on the pattern, not null @throws IllegalArgumentException if the pattern is invalid @see DateTimeFormatterBuilder#appendPattern(String) """ return new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter(locale); }
java
public static DateTimeFormatter ofPattern(String pattern, Locale locale) { return new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter(locale); }
[ "public", "static", "DateTimeFormatter", "ofPattern", "(", "String", "pattern", ",", "Locale", "locale", ")", "{", "return", "new", "DateTimeFormatterBuilder", "(", ")", ".", "appendPattern", "(", "pattern", ")", ".", "toFormatter", "(", "locale", ")", ";", "}" ]
Creates a formatter using the specified pattern and locale. <p> This method will create a formatter based on a simple <a href="#patterns">pattern of letters and symbols</a> as described in the class documentation. For example, {@code d MMM uuuu} will format 2011-12-03 as '3 Dec 2011'. <p> The formatter will use the specified locale. This can be changed using {@link DateTimeFormatter#withLocale(Locale)} on the returned formatter <p> The returned formatter has no override chronology or zone. It uses {@link ResolverStyle#SMART SMART} resolver style. @param pattern the pattern to use, not null @param locale the locale to use, not null @return the formatter based on the pattern, not null @throws IllegalArgumentException if the pattern is invalid @see DateTimeFormatterBuilder#appendPattern(String)
[ "Creates", "a", "formatter", "using", "the", "specified", "pattern", "and", "locale", ".", "<p", ">", "This", "method", "will", "create", "a", "formatter", "based", "on", "a", "simple", "<a", "href", "=", "#patterns", ">", "pattern", "of", "letters", "and", "symbols<", "/", "a", ">", "as", "described", "in", "the", "class", "documentation", ".", "For", "example", "{", "@code", "d", "MMM", "uuuu", "}", "will", "format", "2011", "-", "12", "-", "03", "as", "3", "Dec", "2011", ".", "<p", ">", "The", "formatter", "will", "use", "the", "specified", "locale", ".", "This", "can", "be", "changed", "using", "{", "@link", "DateTimeFormatter#withLocale", "(", "Locale", ")", "}", "on", "the", "returned", "formatter", "<p", ">", "The", "returned", "formatter", "has", "no", "override", "chronology", "or", "zone", ".", "It", "uses", "{", "@link", "ResolverStyle#SMART", "SMART", "}", "resolver", "style", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java#L559-L561
alkacon/opencms-core
src-setup/org/opencms/setup/CmsSetupDb.java
CmsSetupDb.replaceTokens
private String replaceTokens(String sql, Map<String, String> replacers) { """ Replaces tokens "${xxx}" in a specified SQL query.<p> @param sql a SQL query @param replacers a Map with values keyed by "${xxx}" tokens @return the SQl query with all "${xxx}" tokens replaced """ Iterator<Map.Entry<String, String>> keys = replacers.entrySet().iterator(); while (keys.hasNext()) { Map.Entry<String, String> entry = keys.next(); String key = entry.getKey(); String value = entry.getValue(); sql = CmsStringUtil.substitute(sql, key, value); } return sql; }
java
private String replaceTokens(String sql, Map<String, String> replacers) { Iterator<Map.Entry<String, String>> keys = replacers.entrySet().iterator(); while (keys.hasNext()) { Map.Entry<String, String> entry = keys.next(); String key = entry.getKey(); String value = entry.getValue(); sql = CmsStringUtil.substitute(sql, key, value); } return sql; }
[ "private", "String", "replaceTokens", "(", "String", "sql", ",", "Map", "<", "String", ",", "String", ">", "replacers", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "String", ",", "String", ">", ">", "keys", "=", "replacers", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "keys", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", "=", "keys", ".", "next", "(", ")", ";", "String", "key", "=", "entry", ".", "getKey", "(", ")", ";", "String", "value", "=", "entry", ".", "getValue", "(", ")", ";", "sql", "=", "CmsStringUtil", ".", "substitute", "(", "sql", ",", "key", ",", "value", ")", ";", "}", "return", "sql", ";", "}" ]
Replaces tokens "${xxx}" in a specified SQL query.<p> @param sql a SQL query @param replacers a Map with values keyed by "${xxx}" tokens @return the SQl query with all "${xxx}" tokens replaced
[ "Replaces", "tokens", "$", "{", "xxx", "}", "in", "a", "specified", "SQL", "query", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupDb.java#L774-L787
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.reimageAllAsync
public Observable<OperationStatusResponseInner> reimageAllAsync(String resourceGroupName, String vmScaleSetName) { """ Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only supported for managed disks. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return reimageAllWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> reimageAllAsync(String resourceGroupName, String vmScaleSetName) { return reimageAllWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "reimageAllAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ")", "{", "return", "reimageAllWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "OperationStatusResponseInner", ">", ",", "OperationStatusResponseInner", ">", "(", ")", "{", "@", "Override", "public", "OperationStatusResponseInner", "call", "(", "ServiceResponse", "<", "OperationStatusResponseInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only supported for managed disks. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Reimages", "all", "the", "disks", "(", "including", "data", "disks", ")", "in", "the", "virtual", "machines", "in", "a", "VM", "scale", "set", ".", "This", "operation", "is", "only", "supported", "for", "managed", "disks", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L3243-L3250
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listMetricDefinitions
public MetricDefinitionInner listMetricDefinitions(String resourceGroupName, String name) { """ Get global metric definitions of an App Service Environment. Get global metric definitions of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the MetricDefinitionInner object if successful. """ return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
java
public MetricDefinitionInner listMetricDefinitions(String resourceGroupName, String name) { return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
[ "public", "MetricDefinitionInner", "listMetricDefinitions", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "listMetricDefinitionsWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Get global metric definitions of an App Service Environment. Get global metric definitions of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the MetricDefinitionInner object if successful.
[ "Get", "global", "metric", "definitions", "of", "an", "App", "Service", "Environment", ".", "Get", "global", "metric", "definitions", "of", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L1703-L1705
Netflix/eureka
eureka-core/src/main/java/com/netflix/eureka/EurekaBootStrap.java
EurekaBootStrap.contextInitialized
@Override public void contextInitialized(ServletContextEvent event) { """ Initializes Eureka, including syncing up with other Eureka peers and publishing the registry. @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) """ try { initEurekaEnvironment(); initEurekaServerContext(); ServletContext sc = event.getServletContext(); sc.setAttribute(EurekaServerContext.class.getName(), serverContext); } catch (Throwable e) { logger.error("Cannot bootstrap eureka server :", e); throw new RuntimeException("Cannot bootstrap eureka server :", e); } }
java
@Override public void contextInitialized(ServletContextEvent event) { try { initEurekaEnvironment(); initEurekaServerContext(); ServletContext sc = event.getServletContext(); sc.setAttribute(EurekaServerContext.class.getName(), serverContext); } catch (Throwable e) { logger.error("Cannot bootstrap eureka server :", e); throw new RuntimeException("Cannot bootstrap eureka server :", e); } }
[ "@", "Override", "public", "void", "contextInitialized", "(", "ServletContextEvent", "event", ")", "{", "try", "{", "initEurekaEnvironment", "(", ")", ";", "initEurekaServerContext", "(", ")", ";", "ServletContext", "sc", "=", "event", ".", "getServletContext", "(", ")", ";", "sc", ".", "setAttribute", "(", "EurekaServerContext", ".", "class", ".", "getName", "(", ")", ",", "serverContext", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "logger", ".", "error", "(", "\"Cannot bootstrap eureka server :\"", ",", "e", ")", ";", "throw", "new", "RuntimeException", "(", "\"Cannot bootstrap eureka server :\"", ",", "e", ")", ";", "}", "}" ]
Initializes Eureka, including syncing up with other Eureka peers and publishing the registry. @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
[ "Initializes", "Eureka", "including", "syncing", "up", "with", "other", "Eureka", "peers", "and", "publishing", "the", "registry", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/EurekaBootStrap.java#L110-L122
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/conversion/smile/SmileConverter.java
SmileConverter.nominalDataset
public AttributeDataset nominalDataset(int responseColIndex, int... variablesColIndices) { """ Returns a dataset where the response column is nominal. E.g. to be used for a classification """ return dataset(table.numberColumn(responseColIndex), AttributeType.NOMINAL, table.columns(variablesColIndices)); }
java
public AttributeDataset nominalDataset(int responseColIndex, int... variablesColIndices) { return dataset(table.numberColumn(responseColIndex), AttributeType.NOMINAL, table.columns(variablesColIndices)); }
[ "public", "AttributeDataset", "nominalDataset", "(", "int", "responseColIndex", ",", "int", "...", "variablesColIndices", ")", "{", "return", "dataset", "(", "table", ".", "numberColumn", "(", "responseColIndex", ")", ",", "AttributeType", ".", "NOMINAL", ",", "table", ".", "columns", "(", "variablesColIndices", ")", ")", ";", "}" ]
Returns a dataset where the response column is nominal. E.g. to be used for a classification
[ "Returns", "a", "dataset", "where", "the", "response", "column", "is", "nominal", ".", "E", ".", "g", ".", "to", "be", "used", "for", "a", "classification" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/conversion/smile/SmileConverter.java#L63-L65
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/AccountingChronology.java
AccountingChronology.dateYearDay
@Override public AccountingDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { """ Obtains a local date in Accounting calendar system from the era, year-of-era and day-of-year fields. @param era the Accounting era, not null @param yearOfEra the year-of-era @param dayOfYear the day-of-year @return the Accounting local date, not null @throws DateTimeException if unable to create the date @throws ClassCastException if the {@code era} is not a {@code AccountingEra} """ return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
java
@Override public AccountingDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
[ "@", "Override", "public", "AccountingDate", "dateYearDay", "(", "Era", "era", ",", "int", "yearOfEra", ",", "int", "dayOfYear", ")", "{", "return", "dateYearDay", "(", "prolepticYear", "(", "era", ",", "yearOfEra", ")", ",", "dayOfYear", ")", ";", "}" ]
Obtains a local date in Accounting calendar system from the era, year-of-era and day-of-year fields. @param era the Accounting era, not null @param yearOfEra the year-of-era @param dayOfYear the day-of-year @return the Accounting local date, not null @throws DateTimeException if unable to create the date @throws ClassCastException if the {@code era} is not a {@code AccountingEra}
[ "Obtains", "a", "local", "date", "in", "Accounting", "calendar", "system", "from", "the", "era", "year", "-", "of", "-", "era", "and", "day", "-", "of", "-", "year", "fields", "." ]
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/AccountingChronology.java#L323-L326
ops4j/org.ops4j.pax.exam1
pax-exam-container-rbc-client/src/main/java/org/ops4j/pax/exam/rbc/client/RemoteBundleContextClient.java
RemoteBundleContextClient.getService
@SuppressWarnings( "unchecked" ) public <T> T getService( final Class<T> serviceType, final long timeoutInMillis ) { """ {@inheritDoc} Returns a dynamic proxy in place of the actual service, forwarding the calls via the remote bundle context. """ return (T) Proxy.newProxyInstance( getClass().getClassLoader(), new Class<?>[]{ serviceType }, new InvocationHandler() { /** * {@inheritDoc} * Delegates the call to remote bundle context. */ public Object invoke( final Object proxy, final Method method, final Object[] params ) throws Throwable { try { return getRemoteBundleContext().remoteCall( method.getDeclaringClass(), method.getName(), method.getParameterTypes(), timeoutInMillis, params ); } catch( InvocationTargetException e ) { throw e.getCause(); } catch( RemoteException e ) { throw new TestContainerException( "Remote exception", e ); } catch( Exception e ) { throw new TestContainerException( "Invocation exception", e ); } } } ); }
java
@SuppressWarnings( "unchecked" ) public <T> T getService( final Class<T> serviceType, final long timeoutInMillis ) { return (T) Proxy.newProxyInstance( getClass().getClassLoader(), new Class<?>[]{ serviceType }, new InvocationHandler() { /** * {@inheritDoc} * Delegates the call to remote bundle context. */ public Object invoke( final Object proxy, final Method method, final Object[] params ) throws Throwable { try { return getRemoteBundleContext().remoteCall( method.getDeclaringClass(), method.getName(), method.getParameterTypes(), timeoutInMillis, params ); } catch( InvocationTargetException e ) { throw e.getCause(); } catch( RemoteException e ) { throw new TestContainerException( "Remote exception", e ); } catch( Exception e ) { throw new TestContainerException( "Invocation exception", e ); } } } ); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "getService", "(", "final", "Class", "<", "T", ">", "serviceType", ",", "final", "long", "timeoutInMillis", ")", "{", "return", "(", "T", ")", "Proxy", ".", "newProxyInstance", "(", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ",", "new", "Class", "<", "?", ">", "[", "]", "{", "serviceType", "}", ",", "new", "InvocationHandler", "(", ")", "{", "/**\n * {@inheritDoc}\n * Delegates the call to remote bundle context.\n */", "public", "Object", "invoke", "(", "final", "Object", "proxy", ",", "final", "Method", "method", ",", "final", "Object", "[", "]", "params", ")", "throws", "Throwable", "{", "try", "{", "return", "getRemoteBundleContext", "(", ")", ".", "remoteCall", "(", "method", ".", "getDeclaringClass", "(", ")", ",", "method", ".", "getName", "(", ")", ",", "method", ".", "getParameterTypes", "(", ")", ",", "timeoutInMillis", ",", "params", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "e", ".", "getCause", "(", ")", ";", "}", "catch", "(", "RemoteException", "e", ")", "{", "throw", "new", "TestContainerException", "(", "\"Remote exception\"", ",", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "TestContainerException", "(", "\"Invocation exception\"", ",", "e", ")", ";", "}", "}", "}", ")", ";", "}" ]
{@inheritDoc} Returns a dynamic proxy in place of the actual service, forwarding the calls via the remote bundle context.
[ "{" ]
train
https://github.com/ops4j/org.ops4j.pax.exam1/blob/7c8742208117ff91bd24bcd3a185d2d019f7000f/pax-exam-container-rbc-client/src/main/java/org/ops4j/pax/exam/rbc/client/RemoteBundleContextClient.java#L91-L134
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicylabel_binding.java
appfwpolicylabel_binding.get
public static appfwpolicylabel_binding get(nitro_service service, String labelname) throws Exception { """ Use this API to fetch appfwpolicylabel_binding resource of given name . """ appfwpolicylabel_binding obj = new appfwpolicylabel_binding(); obj.set_labelname(labelname); appfwpolicylabel_binding response = (appfwpolicylabel_binding) obj.get_resource(service); return response; }
java
public static appfwpolicylabel_binding get(nitro_service service, String labelname) throws Exception{ appfwpolicylabel_binding obj = new appfwpolicylabel_binding(); obj.set_labelname(labelname); appfwpolicylabel_binding response = (appfwpolicylabel_binding) obj.get_resource(service); return response; }
[ "public", "static", "appfwpolicylabel_binding", "get", "(", "nitro_service", "service", ",", "String", "labelname", ")", "throws", "Exception", "{", "appfwpolicylabel_binding", "obj", "=", "new", "appfwpolicylabel_binding", "(", ")", ";", "obj", ".", "set_labelname", "(", "labelname", ")", ";", "appfwpolicylabel_binding", "response", "=", "(", "appfwpolicylabel_binding", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch appfwpolicylabel_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "appfwpolicylabel_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicylabel_binding.java#L114-L119
h2oai/h2o-3
h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeNode.java
SharedTreeNode.printDotNodesAtLevel
void printDotNodesAtLevel(PrintStream os, int levelToPrint, boolean detail, PrintMojo.PrintTreeOptions treeOptions) { """ Recursively print nodes at a particular depth level in the tree. Useful to group them so they render properly. @param os output stream @param levelToPrint level number @param detail include additional node detail information """ if (getDepth() == levelToPrint) { printDotNode(os, detail, treeOptions); return; } assert (getDepth() < levelToPrint); if (leftChild != null) { leftChild.printDotNodesAtLevel(os, levelToPrint, detail, treeOptions); } if (rightChild != null) { rightChild.printDotNodesAtLevel(os, levelToPrint, detail, treeOptions); } }
java
void printDotNodesAtLevel(PrintStream os, int levelToPrint, boolean detail, PrintMojo.PrintTreeOptions treeOptions) { if (getDepth() == levelToPrint) { printDotNode(os, detail, treeOptions); return; } assert (getDepth() < levelToPrint); if (leftChild != null) { leftChild.printDotNodesAtLevel(os, levelToPrint, detail, treeOptions); } if (rightChild != null) { rightChild.printDotNodesAtLevel(os, levelToPrint, detail, treeOptions); } }
[ "void", "printDotNodesAtLevel", "(", "PrintStream", "os", ",", "int", "levelToPrint", ",", "boolean", "detail", ",", "PrintMojo", ".", "PrintTreeOptions", "treeOptions", ")", "{", "if", "(", "getDepth", "(", ")", "==", "levelToPrint", ")", "{", "printDotNode", "(", "os", ",", "detail", ",", "treeOptions", ")", ";", "return", ";", "}", "assert", "(", "getDepth", "(", ")", "<", "levelToPrint", ")", ";", "if", "(", "leftChild", "!=", "null", ")", "{", "leftChild", ".", "printDotNodesAtLevel", "(", "os", ",", "levelToPrint", ",", "detail", ",", "treeOptions", ")", ";", "}", "if", "(", "rightChild", "!=", "null", ")", "{", "rightChild", ".", "printDotNodesAtLevel", "(", "os", ",", "levelToPrint", ",", "detail", ",", "treeOptions", ")", ";", "}", "}" ]
Recursively print nodes at a particular depth level in the tree. Useful to group them so they render properly. @param os output stream @param levelToPrint level number @param detail include additional node detail information
[ "Recursively", "print", "nodes", "at", "a", "particular", "depth", "level", "in", "the", "tree", ".", "Useful", "to", "group", "them", "so", "they", "render", "properly", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeNode.java#L344-L358
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/DefaultBeanContext.java
DefaultBeanContext.getBean
public @Nonnull <T> T getBean(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType, @Nullable Qualifier<T> qualifier) { """ Get a bean of the given type and qualifier. @param resolutionContext The bean context resolution @param beanType The bean type @param qualifier The qualifier @param <T> The bean type parameter @return The found bean """ ArgumentUtils.requireNonNull("beanType", beanType); return getBeanInternal(resolutionContext, beanType, qualifier, true, true); }
java
public @Nonnull <T> T getBean(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType, @Nullable Qualifier<T> qualifier) { ArgumentUtils.requireNonNull("beanType", beanType); return getBeanInternal(resolutionContext, beanType, qualifier, true, true); }
[ "public", "@", "Nonnull", "<", "T", ">", "T", "getBean", "(", "@", "Nullable", "BeanResolutionContext", "resolutionContext", ",", "@", "Nonnull", "Class", "<", "T", ">", "beanType", ",", "@", "Nullable", "Qualifier", "<", "T", ">", "qualifier", ")", "{", "ArgumentUtils", ".", "requireNonNull", "(", "\"beanType\"", ",", "beanType", ")", ";", "return", "getBeanInternal", "(", "resolutionContext", ",", "beanType", ",", "qualifier", ",", "true", ",", "true", ")", ";", "}" ]
Get a bean of the given type and qualifier. @param resolutionContext The bean context resolution @param beanType The bean type @param qualifier The qualifier @param <T> The bean type parameter @return The found bean
[ "Get", "a", "bean", "of", "the", "given", "type", "and", "qualifier", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/DefaultBeanContext.java#L1011-L1014
tanhaichao/leopard-lang
leopard-servlet/src/main/java/io/leopard/web/servlet/CookieUtil.java
CookieUtil.deleteCookie
public static void deleteCookie(String name, HttpServletRequest request, HttpServletResponse response) { """ 删除cookie</br> @param name cookie名称 @param request http请求 @param response http响应 """ if (name == null || name.length() == 0) { throw new IllegalArgumentException("cookie名称不能为空."); } CookieUtil.setCookie(name, "", -1, false, request, response); }
java
public static void deleteCookie(String name, HttpServletRequest request, HttpServletResponse response) { if (name == null || name.length() == 0) { throw new IllegalArgumentException("cookie名称不能为空."); } CookieUtil.setCookie(name, "", -1, false, request, response); }
[ "public", "static", "void", "deleteCookie", "(", "String", "name", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "{", "if", "(", "name", "==", "null", "||", "name", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"cookie名称不能为空.\");", "", "", "}", "CookieUtil", ".", "setCookie", "(", "name", ",", "\"\"", ",", "-", "1", ",", "false", ",", "request", ",", "response", ")", ";", "}" ]
删除cookie</br> @param name cookie名称 @param request http请求 @param response http响应
[ "删除cookie<", "/", "br", ">" ]
train
https://github.com/tanhaichao/leopard-lang/blob/8ab110f6ca4ea84484817a3d752253ac69ea268b/leopard-servlet/src/main/java/io/leopard/web/servlet/CookieUtil.java#L124-L129
alkacon/opencms-core
src/org/opencms/search/solr/CmsSolrIndex.java
CmsSolrIndex.getLocaleForResource
@Override public Locale getLocaleForResource(CmsObject cms, CmsResource resource, List<Locale> availableLocales) { """ Returns the language locale for the given resource in this index.<p> @param cms the current OpenCms user context @param resource the resource to check @param availableLocales a list of locales supported by the resource @return the language locale for the given resource in this index """ Locale result = null; List<Locale> defaultLocales = OpenCms.getLocaleManager().getDefaultLocales(cms, resource); if ((availableLocales != null) && (availableLocales.size() > 0)) { result = OpenCms.getLocaleManager().getBestMatchingLocale( defaultLocales.get(0), defaultLocales, availableLocales); } if (result == null) { result = ((availableLocales != null) && availableLocales.isEmpty()) ? availableLocales.get(0) : defaultLocales.get(0); } return result; }
java
@Override public Locale getLocaleForResource(CmsObject cms, CmsResource resource, List<Locale> availableLocales) { Locale result = null; List<Locale> defaultLocales = OpenCms.getLocaleManager().getDefaultLocales(cms, resource); if ((availableLocales != null) && (availableLocales.size() > 0)) { result = OpenCms.getLocaleManager().getBestMatchingLocale( defaultLocales.get(0), defaultLocales, availableLocales); } if (result == null) { result = ((availableLocales != null) && availableLocales.isEmpty()) ? availableLocales.get(0) : defaultLocales.get(0); } return result; }
[ "@", "Override", "public", "Locale", "getLocaleForResource", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ",", "List", "<", "Locale", ">", "availableLocales", ")", "{", "Locale", "result", "=", "null", ";", "List", "<", "Locale", ">", "defaultLocales", "=", "OpenCms", ".", "getLocaleManager", "(", ")", ".", "getDefaultLocales", "(", "cms", ",", "resource", ")", ";", "if", "(", "(", "availableLocales", "!=", "null", ")", "&&", "(", "availableLocales", ".", "size", "(", ")", ">", "0", ")", ")", "{", "result", "=", "OpenCms", ".", "getLocaleManager", "(", ")", ".", "getBestMatchingLocale", "(", "defaultLocales", ".", "get", "(", "0", ")", ",", "defaultLocales", ",", "availableLocales", ")", ";", "}", "if", "(", "result", "==", "null", ")", "{", "result", "=", "(", "(", "availableLocales", "!=", "null", ")", "&&", "availableLocales", ".", "isEmpty", "(", ")", ")", "?", "availableLocales", ".", "get", "(", "0", ")", ":", "defaultLocales", ".", "get", "(", "0", ")", ";", "}", "return", "result", ";", "}" ]
Returns the language locale for the given resource in this index.<p> @param cms the current OpenCms user context @param resource the resource to check @param availableLocales a list of locales supported by the resource @return the language locale for the given resource in this index
[ "Returns", "the", "language", "locale", "for", "the", "given", "resource", "in", "this", "index", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrIndex.java#L598-L615
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/ModClusterContainer.java
ModClusterContainer.addNode
public synchronized boolean addNode(final NodeConfig config, final Balancer.BalancerBuilder balancerConfig, final XnioIoThread ioThread, final ByteBufferPool bufferPool) { """ Register a new node. @param config the node configuration @param balancerConfig the balancer configuration @param ioThread the associated I/O thread @param bufferPool the buffer pool @return whether the node could be created or not """ final String jvmRoute = config.getJvmRoute(); final Node existing = nodes.get(jvmRoute); if (existing != null) { if (config.getConnectionURI().equals(existing.getNodeConfig().getConnectionURI())) { // TODO better check if they are the same existing.resetState(); return true; } else { existing.markRemoved(); removeNode(existing); if (!existing.isInErrorState()) { return false; // replies with MNODERM error } } } final String balancerRef = config.getBalancer(); Balancer balancer = balancers.get(balancerRef); if (balancer != null) { UndertowLogger.ROOT_LOGGER.debugf("Balancer %s already exists, replacing", balancerRef); } balancer = balancerConfig.build(); balancers.put(balancerRef, balancer); final Node node = new Node(config, balancer, ioThread, bufferPool, this); nodes.put(jvmRoute, node); // Schedule the health check scheduleHealthCheck(node, ioThread); // Reset the load factor periodically if (updateLoadTask.cancelKey == null) { updateLoadTask.cancelKey = ioThread.executeAtInterval(updateLoadTask, modCluster.getHealthCheckInterval(), TimeUnit.MILLISECONDS); } // Remove from the failover groups failoverDomains.remove(node.getJvmRoute()); UndertowLogger.ROOT_LOGGER.registeringNode(jvmRoute, config.getConnectionURI()); return true; }
java
public synchronized boolean addNode(final NodeConfig config, final Balancer.BalancerBuilder balancerConfig, final XnioIoThread ioThread, final ByteBufferPool bufferPool) { final String jvmRoute = config.getJvmRoute(); final Node existing = nodes.get(jvmRoute); if (existing != null) { if (config.getConnectionURI().equals(existing.getNodeConfig().getConnectionURI())) { // TODO better check if they are the same existing.resetState(); return true; } else { existing.markRemoved(); removeNode(existing); if (!existing.isInErrorState()) { return false; // replies with MNODERM error } } } final String balancerRef = config.getBalancer(); Balancer balancer = balancers.get(balancerRef); if (balancer != null) { UndertowLogger.ROOT_LOGGER.debugf("Balancer %s already exists, replacing", balancerRef); } balancer = balancerConfig.build(); balancers.put(balancerRef, balancer); final Node node = new Node(config, balancer, ioThread, bufferPool, this); nodes.put(jvmRoute, node); // Schedule the health check scheduleHealthCheck(node, ioThread); // Reset the load factor periodically if (updateLoadTask.cancelKey == null) { updateLoadTask.cancelKey = ioThread.executeAtInterval(updateLoadTask, modCluster.getHealthCheckInterval(), TimeUnit.MILLISECONDS); } // Remove from the failover groups failoverDomains.remove(node.getJvmRoute()); UndertowLogger.ROOT_LOGGER.registeringNode(jvmRoute, config.getConnectionURI()); return true; }
[ "public", "synchronized", "boolean", "addNode", "(", "final", "NodeConfig", "config", ",", "final", "Balancer", ".", "BalancerBuilder", "balancerConfig", ",", "final", "XnioIoThread", "ioThread", ",", "final", "ByteBufferPool", "bufferPool", ")", "{", "final", "String", "jvmRoute", "=", "config", ".", "getJvmRoute", "(", ")", ";", "final", "Node", "existing", "=", "nodes", ".", "get", "(", "jvmRoute", ")", ";", "if", "(", "existing", "!=", "null", ")", "{", "if", "(", "config", ".", "getConnectionURI", "(", ")", ".", "equals", "(", "existing", ".", "getNodeConfig", "(", ")", ".", "getConnectionURI", "(", ")", ")", ")", "{", "// TODO better check if they are the same", "existing", ".", "resetState", "(", ")", ";", "return", "true", ";", "}", "else", "{", "existing", ".", "markRemoved", "(", ")", ";", "removeNode", "(", "existing", ")", ";", "if", "(", "!", "existing", ".", "isInErrorState", "(", ")", ")", "{", "return", "false", ";", "// replies with MNODERM error", "}", "}", "}", "final", "String", "balancerRef", "=", "config", ".", "getBalancer", "(", ")", ";", "Balancer", "balancer", "=", "balancers", ".", "get", "(", "balancerRef", ")", ";", "if", "(", "balancer", "!=", "null", ")", "{", "UndertowLogger", ".", "ROOT_LOGGER", ".", "debugf", "(", "\"Balancer %s already exists, replacing\"", ",", "balancerRef", ")", ";", "}", "balancer", "=", "balancerConfig", ".", "build", "(", ")", ";", "balancers", ".", "put", "(", "balancerRef", ",", "balancer", ")", ";", "final", "Node", "node", "=", "new", "Node", "(", "config", ",", "balancer", ",", "ioThread", ",", "bufferPool", ",", "this", ")", ";", "nodes", ".", "put", "(", "jvmRoute", ",", "node", ")", ";", "// Schedule the health check", "scheduleHealthCheck", "(", "node", ",", "ioThread", ")", ";", "// Reset the load factor periodically", "if", "(", "updateLoadTask", ".", "cancelKey", "==", "null", ")", "{", "updateLoadTask", ".", "cancelKey", "=", "ioThread", ".", "executeAtInterval", "(", "updateLoadTask", ",", "modCluster", ".", "getHealthCheckInterval", "(", ")", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}", "// Remove from the failover groups", "failoverDomains", ".", "remove", "(", "node", ".", "getJvmRoute", "(", ")", ")", ";", "UndertowLogger", ".", "ROOT_LOGGER", ".", "registeringNode", "(", "jvmRoute", ",", "config", ".", "getConnectionURI", "(", ")", ")", ";", "return", "true", ";", "}" ]
Register a new node. @param config the node configuration @param balancerConfig the balancer configuration @param ioThread the associated I/O thread @param bufferPool the buffer pool @return whether the node could be created or not
[ "Register", "a", "new", "node", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/ModClusterContainer.java#L167-L205
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/parser/RtfImportMgr.java
RtfImportMgr.importColor
public void importColor(String colorNr, Color color) { """ Imports a color value. The color number for the color defined by its red, green and blue values is determined and then the resulting mapping is added. @param colorNr The original color number. @param color The color to import. """ RtfColor rtfColor = new RtfColor(this.rtfDoc, color); this.importColorMapping.put(colorNr, Integer.toString(rtfColor.getColorNumber())); }
java
public void importColor(String colorNr, Color color) { RtfColor rtfColor = new RtfColor(this.rtfDoc, color); this.importColorMapping.put(colorNr, Integer.toString(rtfColor.getColorNumber())); }
[ "public", "void", "importColor", "(", "String", "colorNr", ",", "Color", "color", ")", "{", "RtfColor", "rtfColor", "=", "new", "RtfColor", "(", "this", ".", "rtfDoc", ",", "color", ")", ";", "this", ".", "importColorMapping", ".", "put", "(", "colorNr", ",", "Integer", ".", "toString", "(", "rtfColor", ".", "getColorNumber", "(", ")", ")", ")", ";", "}" ]
Imports a color value. The color number for the color defined by its red, green and blue values is determined and then the resulting mapping is added. @param colorNr The original color number. @param color The color to import.
[ "Imports", "a", "color", "value", ".", "The", "color", "number", "for", "the", "color", "defined", "by", "its", "red", "green", "and", "blue", "values", "is", "determined", "and", "then", "the", "resulting", "mapping", "is", "added", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/parser/RtfImportMgr.java#L193-L196
Stratio/bdt
src/main/java/com/stratio/qa/specs/DatabaseSpec.java
DatabaseSpec.saveElasticCluster
@Given("^I obtain elasticsearch cluster name in '([^:]+?)(:.+?)?' and save it in variable '(.+?)'?$") public void saveElasticCluster(String host, String port, String envVar) throws Exception { """ Save clustername of elasticsearch in an environment varible for future use. @param host elasticsearch connection @param port elasticsearch port @param envVar thread variable where to store the value @throws IllegalAccessException exception @throws IllegalArgumentException exception @throws SecurityException exception @throws NoSuchFieldException exception @throws ClassNotFoundException exception @throws InstantiationException exception @throws InvocationTargetException exception @throws NoSuchMethodException exception """ commonspec.setRestProtocol("http://"); commonspec.setRestHost(host); commonspec.setRestPort(port); Future<Response> response; response = commonspec.generateRequest("GET", false, null, null, "/", "", "json", ""); commonspec.setResponse("GET", response.get()); String json; String parsedElement; json = commonspec.getResponse().getResponse(); parsedElement = "$..cluster_name"; String json2 = "[" + json + "]"; String value = commonspec.getJSONPathString(json2, parsedElement, "0"); if (value == null) { throw new Exception("No cluster name is found"); } else { ThreadProperty.set(envVar, value); } }
java
@Given("^I obtain elasticsearch cluster name in '([^:]+?)(:.+?)?' and save it in variable '(.+?)'?$") public void saveElasticCluster(String host, String port, String envVar) throws Exception { commonspec.setRestProtocol("http://"); commonspec.setRestHost(host); commonspec.setRestPort(port); Future<Response> response; response = commonspec.generateRequest("GET", false, null, null, "/", "", "json", ""); commonspec.setResponse("GET", response.get()); String json; String parsedElement; json = commonspec.getResponse().getResponse(); parsedElement = "$..cluster_name"; String json2 = "[" + json + "]"; String value = commonspec.getJSONPathString(json2, parsedElement, "0"); if (value == null) { throw new Exception("No cluster name is found"); } else { ThreadProperty.set(envVar, value); } }
[ "@", "Given", "(", "\"^I obtain elasticsearch cluster name in '([^:]+?)(:.+?)?' and save it in variable '(.+?)'?$\"", ")", "public", "void", "saveElasticCluster", "(", "String", "host", ",", "String", "port", ",", "String", "envVar", ")", "throws", "Exception", "{", "commonspec", ".", "setRestProtocol", "(", "\"http://\"", ")", ";", "commonspec", ".", "setRestHost", "(", "host", ")", ";", "commonspec", ".", "setRestPort", "(", "port", ")", ";", "Future", "<", "Response", ">", "response", ";", "response", "=", "commonspec", ".", "generateRequest", "(", "\"GET\"", ",", "false", ",", "null", ",", "null", ",", "\"/\"", ",", "\"\"", ",", "\"json\"", ",", "\"\"", ")", ";", "commonspec", ".", "setResponse", "(", "\"GET\"", ",", "response", ".", "get", "(", ")", ")", ";", "String", "json", ";", "String", "parsedElement", ";", "json", "=", "commonspec", ".", "getResponse", "(", ")", ".", "getResponse", "(", ")", ";", "parsedElement", "=", "\"$..cluster_name\"", ";", "String", "json2", "=", "\"[\"", "+", "json", "+", "\"]\"", ";", "String", "value", "=", "commonspec", ".", "getJSONPathString", "(", "json2", ",", "parsedElement", ",", "\"0\"", ")", ";", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "Exception", "(", "\"No cluster name is found\"", ")", ";", "}", "else", "{", "ThreadProperty", ".", "set", "(", "envVar", ",", "value", ")", ";", "}", "}" ]
Save clustername of elasticsearch in an environment varible for future use. @param host elasticsearch connection @param port elasticsearch port @param envVar thread variable where to store the value @throws IllegalAccessException exception @throws IllegalArgumentException exception @throws SecurityException exception @throws NoSuchFieldException exception @throws ClassNotFoundException exception @throws InstantiationException exception @throws InvocationTargetException exception @throws NoSuchMethodException exception
[ "Save", "clustername", "of", "elasticsearch", "in", "an", "environment", "varible", "for", "future", "use", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DatabaseSpec.java#L229-L254
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/FullDTDReader.java
FullDTDReader.flattenExternalSubset
public static DTDSubset flattenExternalSubset(WstxInputSource src, Writer flattenWriter, boolean inclComments, boolean inclConditionals, boolean inclPEs) throws IOException, XMLStreamException { """ Method that will parse, process and output contents of an external DTD subset. It will do processing similar to {@link #readExternalSubset}, but additionally will copy its processed ("flattened") input to specified writer. @param src Input source used to read the main external subset @param flattenWriter Writer to output processed DTD content to @param inclComments If true, will pass comments to the writer; if false, will strip comments out @param inclConditionals If true, will include conditional block markers, as well as intervening content; if false, will strip out both markers and ignorable sections. @param inclPEs If true, will output parameter entity declarations; if false will parse and use them, but not output. """ ReaderConfig cfg = ReaderConfig.createFullDefaults(); // Need to create a non-shared copy to populate symbol table field cfg = cfg.createNonShared(new SymbolTable()); /* Let's assume xml 1.0... can be taken as an arg later on, if we * truly care. */ FullDTDReader r = new FullDTDReader(src, cfg, null, true, XmlConsts.XML_V_UNKNOWN); r.setFlattenWriter(flattenWriter, inclComments, inclConditionals, inclPEs); DTDSubset ss = r.parseDTD(); r.flushFlattenWriter(); flattenWriter.flush(); return ss; }
java
public static DTDSubset flattenExternalSubset(WstxInputSource src, Writer flattenWriter, boolean inclComments, boolean inclConditionals, boolean inclPEs) throws IOException, XMLStreamException { ReaderConfig cfg = ReaderConfig.createFullDefaults(); // Need to create a non-shared copy to populate symbol table field cfg = cfg.createNonShared(new SymbolTable()); /* Let's assume xml 1.0... can be taken as an arg later on, if we * truly care. */ FullDTDReader r = new FullDTDReader(src, cfg, null, true, XmlConsts.XML_V_UNKNOWN); r.setFlattenWriter(flattenWriter, inclComments, inclConditionals, inclPEs); DTDSubset ss = r.parseDTD(); r.flushFlattenWriter(); flattenWriter.flush(); return ss; }
[ "public", "static", "DTDSubset", "flattenExternalSubset", "(", "WstxInputSource", "src", ",", "Writer", "flattenWriter", ",", "boolean", "inclComments", ",", "boolean", "inclConditionals", ",", "boolean", "inclPEs", ")", "throws", "IOException", ",", "XMLStreamException", "{", "ReaderConfig", "cfg", "=", "ReaderConfig", ".", "createFullDefaults", "(", ")", ";", "// Need to create a non-shared copy to populate symbol table field", "cfg", "=", "cfg", ".", "createNonShared", "(", "new", "SymbolTable", "(", ")", ")", ";", "/* Let's assume xml 1.0... can be taken as an arg later on, if we\n * truly care.\n */", "FullDTDReader", "r", "=", "new", "FullDTDReader", "(", "src", ",", "cfg", ",", "null", ",", "true", ",", "XmlConsts", ".", "XML_V_UNKNOWN", ")", ";", "r", ".", "setFlattenWriter", "(", "flattenWriter", ",", "inclComments", ",", "inclConditionals", ",", "inclPEs", ")", ";", "DTDSubset", "ss", "=", "r", ".", "parseDTD", "(", ")", ";", "r", ".", "flushFlattenWriter", "(", ")", ";", "flattenWriter", ".", "flush", "(", ")", ";", "return", "ss", ";", "}" ]
Method that will parse, process and output contents of an external DTD subset. It will do processing similar to {@link #readExternalSubset}, but additionally will copy its processed ("flattened") input to specified writer. @param src Input source used to read the main external subset @param flattenWriter Writer to output processed DTD content to @param inclComments If true, will pass comments to the writer; if false, will strip comments out @param inclConditionals If true, will include conditional block markers, as well as intervening content; if false, will strip out both markers and ignorable sections. @param inclPEs If true, will output parameter entity declarations; if false will parse and use them, but not output.
[ "Method", "that", "will", "parse", "process", "and", "output", "contents", "of", "an", "external", "DTD", "subset", ".", "It", "will", "do", "processing", "similar", "to", "{", "@link", "#readExternalSubset", "}", "but", "additionally", "will", "copy", "its", "processed", "(", "flattened", ")", "input", "to", "specified", "writer", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/FullDTDReader.java#L466-L485
soulwarelabs/jCommons-API
src/main/java/com/soulwarelabs/jcommons/data/Version.java
Version.append
public Version append(int number, String label) { """ Adds a new version number. @param number version number (not negative). @param label version number label (optional). @return version descriptor. @throws IllegalArgumentException if version number is illegal. @since v1.1.0 """ validateNumber(number); return appendNumber(number, label); }
java
public Version append(int number, String label) { validateNumber(number); return appendNumber(number, label); }
[ "public", "Version", "append", "(", "int", "number", ",", "String", "label", ")", "{", "validateNumber", "(", "number", ")", ";", "return", "appendNumber", "(", "number", ",", "label", ")", ";", "}" ]
Adds a new version number. @param number version number (not negative). @param label version number label (optional). @return version descriptor. @throws IllegalArgumentException if version number is illegal. @since v1.1.0
[ "Adds", "a", "new", "version", "number", "." ]
train
https://github.com/soulwarelabs/jCommons-API/blob/57795ae28aea144e68502149506ec99dd67f0c67/src/main/java/com/soulwarelabs/jcommons/data/Version.java#L408-L411
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java
ObjectOutputStream.writeNewString
private int writeNewString(String object, boolean unshared) throws IOException { """ Write String {@code object} into the receiver. It is assumed the String has not been dumped yet. Returns the handle for this object (String) which is dumped here. Strings are saved encoded with {@link DataInput modified UTF-8}. @param object the string to dump. @return the handle assigned to the String being dumped @throws IOException If an IO exception happened when writing the String. """ long count = ModifiedUtf8.countBytes(object, false); byte[] buffer; int offset = 0; if (count <= 0xffff) { buffer = new byte[1 + SizeOf.SHORT + (int) count]; buffer[offset++] = TC_STRING; Memory.pokeShort(buffer, offset, (short) count, ByteOrder.BIG_ENDIAN); offset += SizeOf.SHORT; } else { buffer = new byte[1 + SizeOf.LONG + (int) count]; buffer[offset++] = TC_LONGSTRING; Memory.pokeLong(buffer, offset, count, ByteOrder.BIG_ENDIAN); offset += SizeOf.LONG; } ModifiedUtf8.encode(buffer, offset, object); output.write(buffer, 0, buffer.length); int handle = nextHandle(); if (!unshared) { objectsWritten.put(object, handle); } return handle; }
java
private int writeNewString(String object, boolean unshared) throws IOException { long count = ModifiedUtf8.countBytes(object, false); byte[] buffer; int offset = 0; if (count <= 0xffff) { buffer = new byte[1 + SizeOf.SHORT + (int) count]; buffer[offset++] = TC_STRING; Memory.pokeShort(buffer, offset, (short) count, ByteOrder.BIG_ENDIAN); offset += SizeOf.SHORT; } else { buffer = new byte[1 + SizeOf.LONG + (int) count]; buffer[offset++] = TC_LONGSTRING; Memory.pokeLong(buffer, offset, count, ByteOrder.BIG_ENDIAN); offset += SizeOf.LONG; } ModifiedUtf8.encode(buffer, offset, object); output.write(buffer, 0, buffer.length); int handle = nextHandle(); if (!unshared) { objectsWritten.put(object, handle); } return handle; }
[ "private", "int", "writeNewString", "(", "String", "object", ",", "boolean", "unshared", ")", "throws", "IOException", "{", "long", "count", "=", "ModifiedUtf8", ".", "countBytes", "(", "object", ",", "false", ")", ";", "byte", "[", "]", "buffer", ";", "int", "offset", "=", "0", ";", "if", "(", "count", "<=", "0xffff", ")", "{", "buffer", "=", "new", "byte", "[", "1", "+", "SizeOf", ".", "SHORT", "+", "(", "int", ")", "count", "]", ";", "buffer", "[", "offset", "++", "]", "=", "TC_STRING", ";", "Memory", ".", "pokeShort", "(", "buffer", ",", "offset", ",", "(", "short", ")", "count", ",", "ByteOrder", ".", "BIG_ENDIAN", ")", ";", "offset", "+=", "SizeOf", ".", "SHORT", ";", "}", "else", "{", "buffer", "=", "new", "byte", "[", "1", "+", "SizeOf", ".", "LONG", "+", "(", "int", ")", "count", "]", ";", "buffer", "[", "offset", "++", "]", "=", "TC_LONGSTRING", ";", "Memory", ".", "pokeLong", "(", "buffer", ",", "offset", ",", "count", ",", "ByteOrder", ".", "BIG_ENDIAN", ")", ";", "offset", "+=", "SizeOf", ".", "LONG", ";", "}", "ModifiedUtf8", ".", "encode", "(", "buffer", ",", "offset", ",", "object", ")", ";", "output", ".", "write", "(", "buffer", ",", "0", ",", "buffer", ".", "length", ")", ";", "int", "handle", "=", "nextHandle", "(", ")", ";", "if", "(", "!", "unshared", ")", "{", "objectsWritten", ".", "put", "(", "object", ",", "handle", ")", ";", "}", "return", "handle", ";", "}" ]
Write String {@code object} into the receiver. It is assumed the String has not been dumped yet. Returns the handle for this object (String) which is dumped here. Strings are saved encoded with {@link DataInput modified UTF-8}. @param object the string to dump. @return the handle assigned to the String being dumped @throws IOException If an IO exception happened when writing the String.
[ "Write", "String", "{", "@code", "object", "}", "into", "the", "receiver", ".", "It", "is", "assumed", "the", "String", "has", "not", "been", "dumped", "yet", ".", "Returns", "the", "handle", "for", "this", "object", "(", "String", ")", "which", "is", "dumped", "here", ".", "Strings", "are", "saved", "encoded", "with", "{", "@link", "DataInput", "modified", "UTF", "-", "8", "}", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java#L1411-L1435
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/RemoteFieldTable.java
RemoteFieldTable.init
public void init(Rec record, RemoteTable tableRemote, Object syncObject) { """ Constructor. @param record The record to handle. @param tableRemote The remote table. @param server The remote server (only used for synchronization). """ super.init(record); this.setRemoteTable(tableRemote, syncObject); }
java
public void init(Rec record, RemoteTable tableRemote, Object syncObject) { super.init(record); this.setRemoteTable(tableRemote, syncObject); }
[ "public", "void", "init", "(", "Rec", "record", ",", "RemoteTable", "tableRemote", ",", "Object", "syncObject", ")", "{", "super", ".", "init", "(", "record", ")", ";", "this", ".", "setRemoteTable", "(", "tableRemote", ",", "syncObject", ")", ";", "}" ]
Constructor. @param record The record to handle. @param tableRemote The remote table. @param server The remote server (only used for synchronization).
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/RemoteFieldTable.java#L77-L81
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
ClassFinder.loadClass
public ClassSymbol loadClass(ModuleSymbol msym, Name flatname) throws CompletionFailure { """ Load a toplevel class with given fully qualified name The class is entered into `classes' only if load was successful. """ Assert.checkNonNull(msym); Name packageName = Convert.packagePart(flatname); PackageSymbol ps = syms.lookupPackage(msym, packageName); Assert.checkNonNull(ps.modle, () -> "msym=" + msym + "; flatName=" + flatname); boolean absent = syms.getClass(ps.modle, flatname) == null; ClassSymbol c = syms.enterClass(ps.modle, flatname); if (c.members_field == null) { try { c.complete(); } catch (CompletionFailure ex) { if (absent) syms.removeClass(ps.modle, flatname); throw ex; } } return c; }
java
public ClassSymbol loadClass(ModuleSymbol msym, Name flatname) throws CompletionFailure { Assert.checkNonNull(msym); Name packageName = Convert.packagePart(flatname); PackageSymbol ps = syms.lookupPackage(msym, packageName); Assert.checkNonNull(ps.modle, () -> "msym=" + msym + "; flatName=" + flatname); boolean absent = syms.getClass(ps.modle, flatname) == null; ClassSymbol c = syms.enterClass(ps.modle, flatname); if (c.members_field == null) { try { c.complete(); } catch (CompletionFailure ex) { if (absent) syms.removeClass(ps.modle, flatname); throw ex; } } return c; }
[ "public", "ClassSymbol", "loadClass", "(", "ModuleSymbol", "msym", ",", "Name", "flatname", ")", "throws", "CompletionFailure", "{", "Assert", ".", "checkNonNull", "(", "msym", ")", ";", "Name", "packageName", "=", "Convert", ".", "packagePart", "(", "flatname", ")", ";", "PackageSymbol", "ps", "=", "syms", ".", "lookupPackage", "(", "msym", ",", "packageName", ")", ";", "Assert", ".", "checkNonNull", "(", "ps", ".", "modle", ",", "(", ")", "->", "\"msym=\"", "+", "msym", "+", "\"; flatName=\"", "+", "flatname", ")", ";", "boolean", "absent", "=", "syms", ".", "getClass", "(", "ps", ".", "modle", ",", "flatname", ")", "==", "null", ";", "ClassSymbol", "c", "=", "syms", ".", "enterClass", "(", "ps", ".", "modle", ",", "flatname", ")", ";", "if", "(", "c", ".", "members_field", "==", "null", ")", "{", "try", "{", "c", ".", "complete", "(", ")", ";", "}", "catch", "(", "CompletionFailure", "ex", ")", "{", "if", "(", "absent", ")", "syms", ".", "removeClass", "(", "ps", ".", "modle", ",", "flatname", ")", ";", "throw", "ex", ";", "}", "}", "return", "c", ";", "}" ]
Load a toplevel class with given fully qualified name The class is entered into `classes' only if load was successful.
[ "Load", "a", "toplevel", "class", "with", "given", "fully", "qualified", "name", "The", "class", "is", "entered", "into", "classes", "only", "if", "load", "was", "successful", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java#L399-L418
janus-project/guava.janusproject.io
guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/FluentIterable.java
FluentIterable.append
@Beta @CheckReturnValue public final FluentIterable<E> append(E... elements) { """ Returns a fluent iterable whose iterators traverse first the elements of this fluent iterable, followed by {@code elements}. @since 18.0 """ return from(Iterables.concat(iterable, Arrays.asList(elements))); }
java
@Beta @CheckReturnValue public final FluentIterable<E> append(E... elements) { return from(Iterables.concat(iterable, Arrays.asList(elements))); }
[ "@", "Beta", "@", "CheckReturnValue", "public", "final", "FluentIterable", "<", "E", ">", "append", "(", "E", "...", "elements", ")", "{", "return", "from", "(", "Iterables", ".", "concat", "(", "iterable", ",", "Arrays", ".", "asList", "(", "elements", ")", ")", ")", ";", "}" ]
Returns a fluent iterable whose iterators traverse first the elements of this fluent iterable, followed by {@code elements}. @since 18.0
[ "Returns", "a", "fluent", "iterable", "whose", "iterators", "traverse", "first", "the", "elements", "of", "this", "fluent", "iterable", "followed", "by", "{", "@code", "elements", "}", "." ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/FluentIterable.java#L186-L190
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/resource/ResourceModelFactory.java
ResourceModelFactory.newResourceModel
public static IModel<String> newResourceModel(final String resourceKey, final Component component) { """ Factory method to create a new {@link StringResourceModel} from the given resource key and given component. @param resourceKey the resource key @param component the component @return a new {@link StringResourceModel} as an {@link IModel} """ return newResourceModel(resourceKey, component, null, ""); }
java
public static IModel<String> newResourceModel(final String resourceKey, final Component component) { return newResourceModel(resourceKey, component, null, ""); }
[ "public", "static", "IModel", "<", "String", ">", "newResourceModel", "(", "final", "String", "resourceKey", ",", "final", "Component", "component", ")", "{", "return", "newResourceModel", "(", "resourceKey", ",", "component", ",", "null", ",", "\"\"", ")", ";", "}" ]
Factory method to create a new {@link StringResourceModel} from the given resource key and given component. @param resourceKey the resource key @param component the component @return a new {@link StringResourceModel} as an {@link IModel}
[ "Factory", "method", "to", "create", "a", "new", "{", "@link", "StringResourceModel", "}", "from", "the", "given", "resource", "key", "and", "given", "component", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/resource/ResourceModelFactory.java#L127-L131
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java
DateUtil.between
public static long between(Date beginDate, Date endDate, DateUnit unit) { """ 判断两个日期相差的时长,只保留绝对值 @param beginDate 起始日期 @param endDate 结束日期 @param unit 相差的单位:相差 天{@link DateUnit#DAY}、小时{@link DateUnit#HOUR} 等 @return 日期差 """ return between(beginDate, endDate, unit, true); }
java
public static long between(Date beginDate, Date endDate, DateUnit unit) { return between(beginDate, endDate, unit, true); }
[ "public", "static", "long", "between", "(", "Date", "beginDate", ",", "Date", "endDate", ",", "DateUnit", "unit", ")", "{", "return", "between", "(", "beginDate", ",", "endDate", ",", "unit", ",", "true", ")", ";", "}" ]
判断两个日期相差的时长,只保留绝对值 @param beginDate 起始日期 @param endDate 结束日期 @param unit 相差的单位:相差 天{@link DateUnit#DAY}、小时{@link DateUnit#HOUR} 等 @return 日期差
[ "判断两个日期相差的时长,只保留绝对值" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1228-L1230
kiswanij/jk-util
src/main/java/com/jk/util/locale/JKMessage.java
JKMessage.addLables
public void addLables(JKLocale locale, String fileName) { """ Adds the lables. @param locale the locale @param fileName the file name """ addLables(locale, JKIOUtil.readPropertiesFile(fileName)); }
java
public void addLables(JKLocale locale, String fileName) { addLables(locale, JKIOUtil.readPropertiesFile(fileName)); }
[ "public", "void", "addLables", "(", "JKLocale", "locale", ",", "String", "fileName", ")", "{", "addLables", "(", "locale", ",", "JKIOUtil", ".", "readPropertiesFile", "(", "fileName", ")", ")", ";", "}" ]
Adds the lables. @param locale the locale @param fileName the file name
[ "Adds", "the", "lables", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/locale/JKMessage.java#L284-L286
apereo/cas
core/cas-server-core-tickets-api/src/main/java/org/apereo/cas/ticket/factory/DefaultTicketGrantingTicketFactory.java
DefaultTicketGrantingTicketFactory.produceTicket
protected <T extends TicketGrantingTicket> T produceTicket(final Authentication authentication, final String tgtId, final Class<T> clazz) { """ Produce ticket. @param <T> the type parameter @param authentication the authentication @param tgtId the tgt id @param clazz the clazz @return the ticket. """ val result = new TicketGrantingTicketImpl(tgtId, authentication, this.ticketGrantingTicketExpirationPolicy); if (!clazz.isAssignableFrom(result.getClass())) { throw new ClassCastException("Result [" + result + " is of type " + result.getClass() + " when we were expecting " + clazz); } return (T) result; }
java
protected <T extends TicketGrantingTicket> T produceTicket(final Authentication authentication, final String tgtId, final Class<T> clazz) { val result = new TicketGrantingTicketImpl(tgtId, authentication, this.ticketGrantingTicketExpirationPolicy); if (!clazz.isAssignableFrom(result.getClass())) { throw new ClassCastException("Result [" + result + " is of type " + result.getClass() + " when we were expecting " + clazz); } return (T) result; }
[ "protected", "<", "T", "extends", "TicketGrantingTicket", ">", "T", "produceTicket", "(", "final", "Authentication", "authentication", ",", "final", "String", "tgtId", ",", "final", "Class", "<", "T", ">", "clazz", ")", "{", "val", "result", "=", "new", "TicketGrantingTicketImpl", "(", "tgtId", ",", "authentication", ",", "this", ".", "ticketGrantingTicketExpirationPolicy", ")", ";", "if", "(", "!", "clazz", ".", "isAssignableFrom", "(", "result", ".", "getClass", "(", ")", ")", ")", "{", "throw", "new", "ClassCastException", "(", "\"Result [\"", "+", "result", "+", "\" is of type \"", "+", "result", ".", "getClass", "(", ")", "+", "\" when we were expecting \"", "+", "clazz", ")", ";", "}", "return", "(", "T", ")", "result", ";", "}" ]
Produce ticket. @param <T> the type parameter @param authentication the authentication @param tgtId the tgt id @param clazz the clazz @return the ticket.
[ "Produce", "ticket", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-tickets-api/src/main/java/org/apereo/cas/ticket/factory/DefaultTicketGrantingTicketFactory.java#L64-L73
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_disk.java
xen_health_disk.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ xen_health_disk_responses result = (xen_health_disk_responses) service.get_payload_formatter().string_to_resource(xen_health_disk_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_disk_response_array); } xen_health_disk[] result_xen_health_disk = new xen_health_disk[result.xen_health_disk_response_array.length]; for(int i = 0; i < result.xen_health_disk_response_array.length; i++) { result_xen_health_disk[i] = result.xen_health_disk_response_array[i].xen_health_disk[0]; } return result_xen_health_disk; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_disk_responses result = (xen_health_disk_responses) service.get_payload_formatter().string_to_resource(xen_health_disk_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_disk_response_array); } xen_health_disk[] result_xen_health_disk = new xen_health_disk[result.xen_health_disk_response_array.length]; for(int i = 0; i < result.xen_health_disk_response_array.length; i++) { result_xen_health_disk[i] = result.xen_health_disk_response_array[i].xen_health_disk[0]; } return result_xen_health_disk; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "xen_health_disk_responses", "result", "=", "(", "xen_health_disk_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "xen_health_disk_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "xen_health_disk_response_array", ")", ";", "}", "xen_health_disk", "[", "]", "result_xen_health_disk", "=", "new", "xen_health_disk", "[", "result", ".", "xen_health_disk_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "xen_health_disk_response_array", ".", "length", ";", "i", "++", ")", "{", "result_xen_health_disk", "[", "i", "]", "=", "result", ".", "xen_health_disk_response_array", "[", "i", "]", ".", "xen_health_disk", "[", "0", "]", ";", "}", "return", "result_xen_health_disk", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_disk.java#L397-L414
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VpnConnectionsInner.java
VpnConnectionsInner.createOrUpdate
public VpnConnectionInner createOrUpdate(String resourceGroupName, String gatewayName, String connectionName, VpnConnectionInner vpnConnectionParameters) { """ Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the existing connection. @param resourceGroupName The resource group name of the VpnGateway. @param gatewayName The name of the gateway. @param connectionName The name of the connection. @param vpnConnectionParameters Parameters supplied to create or Update a VPN Connection. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VpnConnectionInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters).toBlocking().last().body(); }
java
public VpnConnectionInner createOrUpdate(String resourceGroupName, String gatewayName, String connectionName, VpnConnectionInner vpnConnectionParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters).toBlocking().last().body(); }
[ "public", "VpnConnectionInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "gatewayName", ",", "String", "connectionName", ",", "VpnConnectionInner", "vpnConnectionParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "gatewayName", ",", "connectionName", ",", "vpnConnectionParameters", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the existing connection. @param resourceGroupName The resource group name of the VpnGateway. @param gatewayName The name of the gateway. @param connectionName The name of the connection. @param vpnConnectionParameters Parameters supplied to create or Update a VPN Connection. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VpnConnectionInner object if successful.
[ "Creates", "a", "vpn", "connection", "to", "a", "scalable", "vpn", "gateway", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "connection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VpnConnectionsInner.java#L197-L199
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/StringUtil.java
StringUtil.wrapText
public static String wrapText(final String inString, final String newline, final int wrapColumn) { """ Takes a block of text which might have long lines in it and wraps the long lines based on the supplied wrapColumn parameter. It was initially implemented for use by VelocityEmail. If there are tabs in inString, you are going to get results that are a bit strange, since tabs are a single character but are displayed as 4 or 8 spaces. Remove the tabs. @param inString Text which is in need of word-wrapping. @param newline The characters that define a newline. @param wrapColumn The column to wrap the words at. @return The text with all the long lines word-wrapped. """ if (inString == null) { return null; } final StringTokenizer lineTokenizer = new StringTokenizer(inString, newline, true); final StringBuilder builder = new StringBuilder(); while (lineTokenizer.hasMoreTokens()) { try { String nextLine = lineTokenizer.nextToken(); if (nextLine.length() > wrapColumn) { // This line is long enough to be wrapped. nextLine = wrapLine(nextLine, newline, wrapColumn); } builder.append(nextLine); } catch (final NoSuchElementException nsee) { // thrown by nextToken(), but I don't know why it would break; } } return builder.toString(); }
java
public static String wrapText(final String inString, final String newline, final int wrapColumn) { if (inString == null) { return null; } final StringTokenizer lineTokenizer = new StringTokenizer(inString, newline, true); final StringBuilder builder = new StringBuilder(); while (lineTokenizer.hasMoreTokens()) { try { String nextLine = lineTokenizer.nextToken(); if (nextLine.length() > wrapColumn) { // This line is long enough to be wrapped. nextLine = wrapLine(nextLine, newline, wrapColumn); } builder.append(nextLine); } catch (final NoSuchElementException nsee) { // thrown by nextToken(), but I don't know why it would break; } } return builder.toString(); }
[ "public", "static", "String", "wrapText", "(", "final", "String", "inString", ",", "final", "String", "newline", ",", "final", "int", "wrapColumn", ")", "{", "if", "(", "inString", "==", "null", ")", "{", "return", "null", ";", "}", "final", "StringTokenizer", "lineTokenizer", "=", "new", "StringTokenizer", "(", "inString", ",", "newline", ",", "true", ")", ";", "final", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "while", "(", "lineTokenizer", ".", "hasMoreTokens", "(", ")", ")", "{", "try", "{", "String", "nextLine", "=", "lineTokenizer", ".", "nextToken", "(", ")", ";", "if", "(", "nextLine", ".", "length", "(", ")", ">", "wrapColumn", ")", "{", "// This line is long enough to be wrapped.\r", "nextLine", "=", "wrapLine", "(", "nextLine", ",", "newline", ",", "wrapColumn", ")", ";", "}", "builder", ".", "append", "(", "nextLine", ")", ";", "}", "catch", "(", "final", "NoSuchElementException", "nsee", ")", "{", "// thrown by nextToken(), but I don't know why it would\r", "break", ";", "}", "}", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Takes a block of text which might have long lines in it and wraps the long lines based on the supplied wrapColumn parameter. It was initially implemented for use by VelocityEmail. If there are tabs in inString, you are going to get results that are a bit strange, since tabs are a single character but are displayed as 4 or 8 spaces. Remove the tabs. @param inString Text which is in need of word-wrapping. @param newline The characters that define a newline. @param wrapColumn The column to wrap the words at. @return The text with all the long lines word-wrapped.
[ "Takes", "a", "block", "of", "text", "which", "might", "have", "long", "lines", "in", "it", "and", "wraps", "the", "long", "lines", "based", "on", "the", "supplied", "wrapColumn", "parameter", ".", "It", "was", "initially", "implemented", "for", "use", "by", "VelocityEmail", ".", "If", "there", "are", "tabs", "in", "inString", "you", "are", "going", "to", "get", "results", "that", "are", "a", "bit", "strange", "since", "tabs", "are", "a", "single", "character", "but", "are", "displayed", "as", "4", "or", "8", "spaces", ".", "Remove", "the", "tabs", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L183-L207
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Lock.java
Lock.setName
public void setName(String name) throws ApplicationException { """ set the value name @param name value to set @throws ApplicationException """ if (name == null) return; this.name = name.trim(); if (name.length() == 0) throw new ApplicationException("invalid attribute definition", "attribute [name] can't be a empty string"); }
java
public void setName(String name) throws ApplicationException { if (name == null) return; this.name = name.trim(); if (name.length() == 0) throw new ApplicationException("invalid attribute definition", "attribute [name] can't be a empty string"); }
[ "public", "void", "setName", "(", "String", "name", ")", "throws", "ApplicationException", "{", "if", "(", "name", "==", "null", ")", "return", ";", "this", ".", "name", "=", "name", ".", "trim", "(", ")", ";", "if", "(", "name", ".", "length", "(", ")", "==", "0", ")", "throw", "new", "ApplicationException", "(", "\"invalid attribute definition\"", ",", "\"attribute [name] can't be a empty string\"", ")", ";", "}" ]
set the value name @param name value to set @throws ApplicationException
[ "set", "the", "value", "name" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Lock.java#L195-L199
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java
GeneratedDFactoryDaoImpl.queryByUpdatedBy
public Iterable<DFactory> queryByUpdatedBy(java.lang.String updatedBy) { """ query-by method for field updatedBy @param updatedBy the specified attribute @return an Iterable of DFactorys for the specified updatedBy """ return queryByField(null, DFactoryMapper.Field.UPDATEDBY.getFieldName(), updatedBy); }
java
public Iterable<DFactory> queryByUpdatedBy(java.lang.String updatedBy) { return queryByField(null, DFactoryMapper.Field.UPDATEDBY.getFieldName(), updatedBy); }
[ "public", "Iterable", "<", "DFactory", ">", "queryByUpdatedBy", "(", "java", ".", "lang", ".", "String", "updatedBy", ")", "{", "return", "queryByField", "(", "null", ",", "DFactoryMapper", ".", "Field", ".", "UPDATEDBY", ".", "getFieldName", "(", ")", ",", "updatedBy", ")", ";", "}" ]
query-by method for field updatedBy @param updatedBy the specified attribute @return an Iterable of DFactorys for the specified updatedBy
[ "query", "-", "by", "method", "for", "field", "updatedBy" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java#L115-L117
osiam/connector4java
src/main/java/org/osiam/client/OsiamConnector.java
OsiamConnector.updateUser
@Deprecated public User updateUser(String id, UpdateUser updateUser, AccessToken accessToken) { """ update the user of the given id with the values given in the User Object. For more detailed information how to set new field, update Fields or to delete Fields please look in the documentation. This method is not compatible with OSIAM 3.x. @param id if of the User to be updated @param updateUser all Fields that need to be updated @param accessToken the OSIAM access token from for the current session @return the updated User Object with all new Fields @throws UnauthorizedException if the request could not be authorized. @throws ConflictException if the User could not be updated @throws NoResultException if no user with the given id can be found @throws ForbiddenException if the scope doesn't allow this request @throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized @throws IllegalStateException if OSIAM's endpoint(s) are not properly configured @see <a href="https://github.com/osiam/connector4java/docs/working-with-user.md">Working with user</a> @deprecated Updating with PATCH has been removed in OSIAM 3.0. This method is going to go away with version 1.12 or 2.0. """ return getUserService().updateUser(id, updateUser, accessToken); }
java
@Deprecated public User updateUser(String id, UpdateUser updateUser, AccessToken accessToken) { return getUserService().updateUser(id, updateUser, accessToken); }
[ "@", "Deprecated", "public", "User", "updateUser", "(", "String", "id", ",", "UpdateUser", "updateUser", ",", "AccessToken", "accessToken", ")", "{", "return", "getUserService", "(", ")", ".", "updateUser", "(", "id", ",", "updateUser", ",", "accessToken", ")", ";", "}" ]
update the user of the given id with the values given in the User Object. For more detailed information how to set new field, update Fields or to delete Fields please look in the documentation. This method is not compatible with OSIAM 3.x. @param id if of the User to be updated @param updateUser all Fields that need to be updated @param accessToken the OSIAM access token from for the current session @return the updated User Object with all new Fields @throws UnauthorizedException if the request could not be authorized. @throws ConflictException if the User could not be updated @throws NoResultException if no user with the given id can be found @throws ForbiddenException if the scope doesn't allow this request @throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized @throws IllegalStateException if OSIAM's endpoint(s) are not properly configured @see <a href="https://github.com/osiam/connector4java/docs/working-with-user.md">Working with user</a> @deprecated Updating with PATCH has been removed in OSIAM 3.0. This method is going to go away with version 1.12 or 2.0.
[ "update", "the", "user", "of", "the", "given", "id", "with", "the", "values", "given", "in", "the", "User", "Object", ".", "For", "more", "detailed", "information", "how", "to", "set", "new", "field", "update", "Fields", "or", "to", "delete", "Fields", "please", "look", "in", "the", "documentation", ".", "This", "method", "is", "not", "compatible", "with", "OSIAM", "3", ".", "x", "." ]
train
https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L524-L527
jmchilton/galaxy-bootstrap
src/main/java/com/github/jmchilton/galaxybootstrap/DownloadProperties.java
DownloadProperties.forGalaxyDist
@Deprecated public static DownloadProperties forGalaxyDist(final File destination, String revision) { """ Builds a new DownloadProperties for downloading Galaxy from galaxy-dist. @param destination The destination directory to store Galaxy, null if a directory should be chosen by default. @param revision The revision to use for Galaxy. @return A new DownloadProperties for downloading Galaxy from galaxy-dist. """ return new DownloadProperties(GALAXY_DIST_REPOSITORY_URL, BRANCH_STABLE, revision, destination); }
java
@Deprecated public static DownloadProperties forGalaxyDist(final File destination, String revision) { return new DownloadProperties(GALAXY_DIST_REPOSITORY_URL, BRANCH_STABLE, revision, destination); }
[ "@", "Deprecated", "public", "static", "DownloadProperties", "forGalaxyDist", "(", "final", "File", "destination", ",", "String", "revision", ")", "{", "return", "new", "DownloadProperties", "(", "GALAXY_DIST_REPOSITORY_URL", ",", "BRANCH_STABLE", ",", "revision", ",", "destination", ")", ";", "}" ]
Builds a new DownloadProperties for downloading Galaxy from galaxy-dist. @param destination The destination directory to store Galaxy, null if a directory should be chosen by default. @param revision The revision to use for Galaxy. @return A new DownloadProperties for downloading Galaxy from galaxy-dist.
[ "Builds", "a", "new", "DownloadProperties", "for", "downloading", "Galaxy", "from", "galaxy", "-", "dist", "." ]
train
https://github.com/jmchilton/galaxy-bootstrap/blob/4a899f5e6ec0c9f6f4b9b21d5a0320e5925ec649/src/main/java/com/github/jmchilton/galaxybootstrap/DownloadProperties.java#L326-L329
trellis-ldp/trellis
core/http/src/main/java/org/trellisldp/http/impl/HttpUtils.java
HttpUtils.closeInputStreamAsync
public static BiConsumer<Object, Throwable> closeInputStreamAsync(final InputStream input) { """ Close an input stream in an async chain. @param input the input stream @return a bifunction that closes the stream """ return (val, err) -> { try { input.close(); } catch (final IOException ex) { throw new UncheckedIOException("Error closing input stream", ex); } }; }
java
public static BiConsumer<Object, Throwable> closeInputStreamAsync(final InputStream input) { return (val, err) -> { try { input.close(); } catch (final IOException ex) { throw new UncheckedIOException("Error closing input stream", ex); } }; }
[ "public", "static", "BiConsumer", "<", "Object", ",", "Throwable", ">", "closeInputStreamAsync", "(", "final", "InputStream", "input", ")", "{", "return", "(", "val", ",", "err", ")", "->", "{", "try", "{", "input", ".", "close", "(", ")", ";", "}", "catch", "(", "final", "IOException", "ex", ")", "{", "throw", "new", "UncheckedIOException", "(", "\"Error closing input stream\"", ",", "ex", ")", ";", "}", "}", ";", "}" ]
Close an input stream in an async chain. @param input the input stream @return a bifunction that closes the stream
[ "Close", "an", "input", "stream", "in", "an", "async", "chain", "." ]
train
https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/core/http/src/main/java/org/trellisldp/http/impl/HttpUtils.java#L234-L242
elastic/elasticsearch-hadoop
mr/src/main/java/org/elasticsearch/hadoop/rest/bulk/BulkProcessor.java
BulkProcessor.initFlushOperation
private void initFlushOperation(String bulkLoggingID, boolean retryOperation, long retriedDocs, long waitTime) { """ Logs flushing messages and performs backoff waiting if there is a wait time for retry. """ if (retryOperation) { if (waitTime > 0L) { debugLog(bulkLoggingID, "Retrying [%d] entries after backing off for [%s] ms", retriedDocs, TimeValue.timeValueMillis(waitTime)); try { Thread.sleep(waitTime); } catch (InterruptedException e) { debugLog(bulkLoggingID, "Thread interrupted - giving up on retrying..."); throw new EsHadoopException("Thread interrupted - giving up on retrying...", e); } } else { debugLog(bulkLoggingID, "Retrying [%d] entries immediately (without backoff)", retriedDocs); } } else { debugLog(bulkLoggingID, "Sending batch of [%d] bytes/[%s] entries", data.length(), dataEntries); } }
java
private void initFlushOperation(String bulkLoggingID, boolean retryOperation, long retriedDocs, long waitTime) { if (retryOperation) { if (waitTime > 0L) { debugLog(bulkLoggingID, "Retrying [%d] entries after backing off for [%s] ms", retriedDocs, TimeValue.timeValueMillis(waitTime)); try { Thread.sleep(waitTime); } catch (InterruptedException e) { debugLog(bulkLoggingID, "Thread interrupted - giving up on retrying..."); throw new EsHadoopException("Thread interrupted - giving up on retrying...", e); } } else { debugLog(bulkLoggingID, "Retrying [%d] entries immediately (without backoff)", retriedDocs); } } else { debugLog(bulkLoggingID, "Sending batch of [%d] bytes/[%s] entries", data.length(), dataEntries); } }
[ "private", "void", "initFlushOperation", "(", "String", "bulkLoggingID", ",", "boolean", "retryOperation", ",", "long", "retriedDocs", ",", "long", "waitTime", ")", "{", "if", "(", "retryOperation", ")", "{", "if", "(", "waitTime", ">", "0L", ")", "{", "debugLog", "(", "bulkLoggingID", ",", "\"Retrying [%d] entries after backing off for [%s] ms\"", ",", "retriedDocs", ",", "TimeValue", ".", "timeValueMillis", "(", "waitTime", ")", ")", ";", "try", "{", "Thread", ".", "sleep", "(", "waitTime", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "debugLog", "(", "bulkLoggingID", ",", "\"Thread interrupted - giving up on retrying...\"", ")", ";", "throw", "new", "EsHadoopException", "(", "\"Thread interrupted - giving up on retrying...\"", ",", "e", ")", ";", "}", "}", "else", "{", "debugLog", "(", "bulkLoggingID", ",", "\"Retrying [%d] entries immediately (without backoff)\"", ",", "retriedDocs", ")", ";", "}", "}", "else", "{", "debugLog", "(", "bulkLoggingID", ",", "\"Sending batch of [%d] bytes/[%s] entries\"", ",", "data", ".", "length", "(", ")", ",", "dataEntries", ")", ";", "}", "}" ]
Logs flushing messages and performs backoff waiting if there is a wait time for retry.
[ "Logs", "flushing", "messages", "and", "performs", "backoff", "waiting", "if", "there", "is", "a", "wait", "time", "for", "retry", "." ]
train
https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/rest/bulk/BulkProcessor.java#L471-L488
j-a-w-r/jawr-main-repo
jawr-dwr2.x/jawr-dwr2.x-extension/src/main/java/net/jawr/web/resource/bundle/generator/dwr/DWRBeanGenerator.java
DWRBeanGenerator.getInterfaceScript
@SuppressWarnings("unchecked") private StringBuffer getInterfaceScript(String scriptName,ServletContext servletContext) { """ Returns a script with a specified DWR interface @param basePath @return """ StringBuffer sb = new StringBuffer(ENGINE_INIT); // List all containers to find all DWR interfaces List<Container> containers = ContainerUtil.getAllPublishedContainers(servletContext); boolean found = false; for(Iterator<Container> it = containers.iterator();it.hasNext() && !found;) { Container container = it.next(); // The creatormanager holds the list of beans CreatorManager ctManager = (CreatorManager) container.getBean(CreatorManager.class.getName()); if( null != ctManager ) { // The remoter builds interface scripts. Remoter remoter = (Remoter) container.getBean(Remoter.class.getName()); String path = getPathReplacementString(container); try { String script = remoter.generateInterfaceScript(scriptName, path); found = true; // Must remove the engine init script to avoid unneeded duplication script = removeEngineInit(script); sb.append(script); } catch(SecurityException ex){throw new BundlingProcessException(ex); } } } if(!found) throw new IllegalArgumentException("The DWR bean named '" + scriptName + "' was not found in any DWR configuration instance."); return sb; }
java
@SuppressWarnings("unchecked") private StringBuffer getInterfaceScript(String scriptName,ServletContext servletContext) { StringBuffer sb = new StringBuffer(ENGINE_INIT); // List all containers to find all DWR interfaces List<Container> containers = ContainerUtil.getAllPublishedContainers(servletContext); boolean found = false; for(Iterator<Container> it = containers.iterator();it.hasNext() && !found;) { Container container = it.next(); // The creatormanager holds the list of beans CreatorManager ctManager = (CreatorManager) container.getBean(CreatorManager.class.getName()); if( null != ctManager ) { // The remoter builds interface scripts. Remoter remoter = (Remoter) container.getBean(Remoter.class.getName()); String path = getPathReplacementString(container); try { String script = remoter.generateInterfaceScript(scriptName, path); found = true; // Must remove the engine init script to avoid unneeded duplication script = removeEngineInit(script); sb.append(script); } catch(SecurityException ex){throw new BundlingProcessException(ex); } } } if(!found) throw new IllegalArgumentException("The DWR bean named '" + scriptName + "' was not found in any DWR configuration instance."); return sb; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "StringBuffer", "getInterfaceScript", "(", "String", "scriptName", ",", "ServletContext", "servletContext", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "ENGINE_INIT", ")", ";", "// List all containers to find all DWR interfaces", "List", "<", "Container", ">", "containers", "=", "ContainerUtil", ".", "getAllPublishedContainers", "(", "servletContext", ")", ";", "boolean", "found", "=", "false", ";", "for", "(", "Iterator", "<", "Container", ">", "it", "=", "containers", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", "&&", "!", "found", ";", ")", "{", "Container", "container", "=", "it", ".", "next", "(", ")", ";", "// The creatormanager holds the list of beans", "CreatorManager", "ctManager", "=", "(", "CreatorManager", ")", "container", ".", "getBean", "(", "CreatorManager", ".", "class", ".", "getName", "(", ")", ")", ";", "if", "(", "null", "!=", "ctManager", ")", "{", "// The remoter builds interface scripts. ", "Remoter", "remoter", "=", "(", "Remoter", ")", "container", ".", "getBean", "(", "Remoter", ".", "class", ".", "getName", "(", ")", ")", ";", "String", "path", "=", "getPathReplacementString", "(", "container", ")", ";", "try", "{", "String", "script", "=", "remoter", ".", "generateInterfaceScript", "(", "scriptName", ",", "path", ")", ";", "found", "=", "true", ";", "// Must remove the engine init script to avoid unneeded duplication", "script", "=", "removeEngineInit", "(", "script", ")", ";", "sb", ".", "append", "(", "script", ")", ";", "}", "catch", "(", "SecurityException", "ex", ")", "{", "throw", "new", "BundlingProcessException", "(", "ex", ")", ";", "}", "}", "}", "if", "(", "!", "found", ")", "throw", "new", "IllegalArgumentException", "(", "\"The DWR bean named '\"", "+", "scriptName", "+", "\"' was not found in any DWR configuration instance.\"", ")", ";", "return", "sb", ";", "}" ]
Returns a script with a specified DWR interface @param basePath @return
[ "Returns", "a", "script", "with", "a", "specified", "DWR", "interface" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr-dwr2.x/jawr-dwr2.x-extension/src/main/java/net/jawr/web/resource/bundle/generator/dwr/DWRBeanGenerator.java#L246-L276
Javen205/IJPay
src/main/java/com/jpay/unionpay/AcpService.java
AcpService.validateBySecureKey
public static boolean validateBySecureKey(Map<String, String> rspData, String secureKey, String encoding) { """ 多密钥验签(通过传入密钥签名)<br> @param resData 返回报文数据<br> @param encoding 上送请求报文域encoding字段的值<br> @return true 通过 false 未通过<br> """ return SDKUtil.validateBySecureKey(rspData, secureKey, encoding); }
java
public static boolean validateBySecureKey(Map<String, String> rspData, String secureKey, String encoding) { return SDKUtil.validateBySecureKey(rspData, secureKey, encoding); }
[ "public", "static", "boolean", "validateBySecureKey", "(", "Map", "<", "String", ",", "String", ">", "rspData", ",", "String", "secureKey", ",", "String", "encoding", ")", "{", "return", "SDKUtil", ".", "validateBySecureKey", "(", "rspData", ",", "secureKey", ",", "encoding", ")", ";", "}" ]
多密钥验签(通过传入密钥签名)<br> @param resData 返回报文数据<br> @param encoding 上送请求报文域encoding字段的值<br> @return true 通过 false 未通过<br>
[ "多密钥验签", "(", "通过传入密钥签名", ")", "<br", ">" ]
train
https://github.com/Javen205/IJPay/blob/78da6be4b70675abc6a41df74817532fa257ef29/src/main/java/com/jpay/unionpay/AcpService.java#L75-L77
Activiti/Activiti
activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/VariableScopeImpl.java
VariableScopeImpl.createVariableLocal
protected void createVariableLocal(String variableName, Object value, ExecutionEntity sourceActivityExecution) { """ only called when a new variable is created on this variable scope. This method is also responsible for propagating the creation of this variable to the history. """ ensureVariableInstancesInitialized(); if (variableInstances.containsKey(variableName)) { throw new ActivitiException("variable '" + variableName + "' already exists. Use setVariableLocal if you want to overwrite the value"); } createVariableInstance(variableName, value, sourceActivityExecution); }
java
protected void createVariableLocal(String variableName, Object value, ExecutionEntity sourceActivityExecution) { ensureVariableInstancesInitialized(); if (variableInstances.containsKey(variableName)) { throw new ActivitiException("variable '" + variableName + "' already exists. Use setVariableLocal if you want to overwrite the value"); } createVariableInstance(variableName, value, sourceActivityExecution); }
[ "protected", "void", "createVariableLocal", "(", "String", "variableName", ",", "Object", "value", ",", "ExecutionEntity", "sourceActivityExecution", ")", "{", "ensureVariableInstancesInitialized", "(", ")", ";", "if", "(", "variableInstances", ".", "containsKey", "(", "variableName", ")", ")", "{", "throw", "new", "ActivitiException", "(", "\"variable '\"", "+", "variableName", "+", "\"' already exists. Use setVariableLocal if you want to overwrite the value\"", ")", ";", "}", "createVariableInstance", "(", "variableName", ",", "value", ",", "sourceActivityExecution", ")", ";", "}" ]
only called when a new variable is created on this variable scope. This method is also responsible for propagating the creation of this variable to the history.
[ "only", "called", "when", "a", "new", "variable", "is", "created", "on", "this", "variable", "scope", ".", "This", "method", "is", "also", "responsible", "for", "propagating", "the", "creation", "of", "this", "variable", "to", "the", "history", "." ]
train
https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/VariableScopeImpl.java#L782-L790
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java
ZooKeeper.getChildren
public List<String> getChildren(final String path, Watcher watcher, Stat stat) throws KeeperException, InterruptedException { """ For the given znode path return the stat and children list. <p> If the watch is non-null and the call is successful (no exception is thrown), a watch will be left on the node with the given path. The watch willbe triggered by a successful operation that deletes the node of the given path or creates/delete a child under the node. <p> The list of children returned is not sorted and no guarantee is provided as to its natural or lexical order. <p> A KeeperException with error code KeeperException.NoNode will be thrown if no node with the given path exists. @since 3.3.0 @param path @param watcher explicit watcher @param stat stat of the znode designated by path @return an unordered array of children of the node with the given path @throws InterruptedException If the server transaction is interrupted. @throws KeeperException If the server signals an error with a non-zero error code. @throws IllegalArgumentException if an invalid path is specified """ verbotenThreadCheck(); final String clientPath = path; PathUtils.validatePath(clientPath); // the watch contains the un-chroot path WatchRegistration wcb = null; if (watcher != null) { wcb = new ChildWatchRegistration(watcher, clientPath); } final String serverPath = prependChroot(clientPath); RequestHeader h = new RequestHeader(); h.setType(ZooDefs.OpCode.getChildren2); GetChildren2Request request = new GetChildren2Request(); request.setPath(serverPath); request.setWatch(watcher != null); GetChildren2Response response = new GetChildren2Response(); ReplyHeader r = cnxn.submitRequest(h, request, response, wcb); if (r.getErr() != 0) { throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath); } if (stat != null) { DataTree.copyStat(response.getStat(), stat); } return response.getChildren(); }
java
public List<String> getChildren(final String path, Watcher watcher, Stat stat) throws KeeperException, InterruptedException { verbotenThreadCheck(); final String clientPath = path; PathUtils.validatePath(clientPath); // the watch contains the un-chroot path WatchRegistration wcb = null; if (watcher != null) { wcb = new ChildWatchRegistration(watcher, clientPath); } final String serverPath = prependChroot(clientPath); RequestHeader h = new RequestHeader(); h.setType(ZooDefs.OpCode.getChildren2); GetChildren2Request request = new GetChildren2Request(); request.setPath(serverPath); request.setWatch(watcher != null); GetChildren2Response response = new GetChildren2Response(); ReplyHeader r = cnxn.submitRequest(h, request, response, wcb); if (r.getErr() != 0) { throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath); } if (stat != null) { DataTree.copyStat(response.getStat(), stat); } return response.getChildren(); }
[ "public", "List", "<", "String", ">", "getChildren", "(", "final", "String", "path", ",", "Watcher", "watcher", ",", "Stat", "stat", ")", "throws", "KeeperException", ",", "InterruptedException", "{", "verbotenThreadCheck", "(", ")", ";", "final", "String", "clientPath", "=", "path", ";", "PathUtils", ".", "validatePath", "(", "clientPath", ")", ";", "// the watch contains the un-chroot path", "WatchRegistration", "wcb", "=", "null", ";", "if", "(", "watcher", "!=", "null", ")", "{", "wcb", "=", "new", "ChildWatchRegistration", "(", "watcher", ",", "clientPath", ")", ";", "}", "final", "String", "serverPath", "=", "prependChroot", "(", "clientPath", ")", ";", "RequestHeader", "h", "=", "new", "RequestHeader", "(", ")", ";", "h", ".", "setType", "(", "ZooDefs", ".", "OpCode", ".", "getChildren2", ")", ";", "GetChildren2Request", "request", "=", "new", "GetChildren2Request", "(", ")", ";", "request", ".", "setPath", "(", "serverPath", ")", ";", "request", ".", "setWatch", "(", "watcher", "!=", "null", ")", ";", "GetChildren2Response", "response", "=", "new", "GetChildren2Response", "(", ")", ";", "ReplyHeader", "r", "=", "cnxn", ".", "submitRequest", "(", "h", ",", "request", ",", "response", ",", "wcb", ")", ";", "if", "(", "r", ".", "getErr", "(", ")", "!=", "0", ")", "{", "throw", "KeeperException", ".", "create", "(", "KeeperException", ".", "Code", ".", "get", "(", "r", ".", "getErr", "(", ")", ")", ",", "clientPath", ")", ";", "}", "if", "(", "stat", "!=", "null", ")", "{", "DataTree", ".", "copyStat", "(", "response", ".", "getStat", "(", ")", ",", "stat", ")", ";", "}", "return", "response", ".", "getChildren", "(", ")", ";", "}" ]
For the given znode path return the stat and children list. <p> If the watch is non-null and the call is successful (no exception is thrown), a watch will be left on the node with the given path. The watch willbe triggered by a successful operation that deletes the node of the given path or creates/delete a child under the node. <p> The list of children returned is not sorted and no guarantee is provided as to its natural or lexical order. <p> A KeeperException with error code KeeperException.NoNode will be thrown if no node with the given path exists. @since 3.3.0 @param path @param watcher explicit watcher @param stat stat of the znode designated by path @return an unordered array of children of the node with the given path @throws InterruptedException If the server transaction is interrupted. @throws KeeperException If the server signals an error with a non-zero error code. @throws IllegalArgumentException if an invalid path is specified
[ "For", "the", "given", "znode", "path", "return", "the", "stat", "and", "children", "list", ".", "<p", ">", "If", "the", "watch", "is", "non", "-", "null", "and", "the", "call", "is", "successful", "(", "no", "exception", "is", "thrown", ")", "a", "watch", "will", "be", "left", "on", "the", "node", "with", "the", "given", "path", ".", "The", "watch", "willbe", "triggered", "by", "a", "successful", "operation", "that", "deletes", "the", "node", "of", "the", "given", "path", "or", "creates", "/", "delete", "a", "child", "under", "the", "node", ".", "<p", ">", "The", "list", "of", "children", "returned", "is", "not", "sorted", "and", "no", "guarantee", "is", "provided", "as", "to", "its", "natural", "or", "lexical", "order", ".", "<p", ">", "A", "KeeperException", "with", "error", "code", "KeeperException", ".", "NoNode", "will", "be", "thrown", "if", "no", "node", "with", "the", "given", "path", "exists", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java#L1410-L1439
easymock/objenesis
tck/src/main/java/org/objenesis/tck/TCK.java
TCK.registerCandidate
public void registerCandidate(Class<?> candidateClass, String description, Candidate.CandidateType type) { """ Register a candidate class to attempt to instantiate. @param candidateClass Class to attempt to instantiate @param description Description of the class """ Candidate candidate = new Candidate(candidateClass, description, type); int index = candidates.indexOf(candidate); if(index >= 0) { Candidate existingCandidate = candidates.get(index); if(!description.equals(existingCandidate.getDescription())) { throw new IllegalStateException("Two different descriptions for candidate " + candidateClass.getName()); } existingCandidate.getTypes().add(type); } else { candidates.add(candidate); } }
java
public void registerCandidate(Class<?> candidateClass, String description, Candidate.CandidateType type) { Candidate candidate = new Candidate(candidateClass, description, type); int index = candidates.indexOf(candidate); if(index >= 0) { Candidate existingCandidate = candidates.get(index); if(!description.equals(existingCandidate.getDescription())) { throw new IllegalStateException("Two different descriptions for candidate " + candidateClass.getName()); } existingCandidate.getTypes().add(type); } else { candidates.add(candidate); } }
[ "public", "void", "registerCandidate", "(", "Class", "<", "?", ">", "candidateClass", ",", "String", "description", ",", "Candidate", ".", "CandidateType", "type", ")", "{", "Candidate", "candidate", "=", "new", "Candidate", "(", "candidateClass", ",", "description", ",", "type", ")", ";", "int", "index", "=", "candidates", ".", "indexOf", "(", "candidate", ")", ";", "if", "(", "index", ">=", "0", ")", "{", "Candidate", "existingCandidate", "=", "candidates", ".", "get", "(", "index", ")", ";", "if", "(", "!", "description", ".", "equals", "(", "existingCandidate", ".", "getDescription", "(", ")", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Two different descriptions for candidate \"", "+", "candidateClass", ".", "getName", "(", ")", ")", ";", "}", "existingCandidate", ".", "getTypes", "(", ")", ".", "add", "(", "type", ")", ";", "}", "else", "{", "candidates", ".", "add", "(", "candidate", ")", ";", "}", "}" ]
Register a candidate class to attempt to instantiate. @param candidateClass Class to attempt to instantiate @param description Description of the class
[ "Register", "a", "candidate", "class", "to", "attempt", "to", "instantiate", "." ]
train
https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/tck/src/main/java/org/objenesis/tck/TCK.java#L91-L104
hdbeukel/james-core
src/main/java/org/jamesframework/core/subset/neigh/SingleAdditionNeighbourhood.java
SingleAdditionNeighbourhood.getRandomMove
@Override public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) { """ Generates a random addition move for the given subset solution that adds a single ID to the selection. Possible fixed IDs are not considered to be added and the maximum subset size is taken into account. If no addition move can be generated, <code>null</code> is returned. @param solution solution for which a random addition move is generated @param rnd source of randomness used to generate random move @return random addition move, <code>null</code> if no move can be generated """ // check size limit if(maxSizeReached(solution)){ // size limit would be exceeded return null; } // get set of candidate IDs for addition (possibly fixed IDs are discarded) Set<Integer> addCandidates = getAddCandidates(solution); // check if addition is possible if(addCandidates.isEmpty()){ return null; } // select random ID to add to selection int add = SetUtilities.getRandomElement(addCandidates, rnd); // create and return addition move return new AdditionMove(add); }
java
@Override public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) { // check size limit if(maxSizeReached(solution)){ // size limit would be exceeded return null; } // get set of candidate IDs for addition (possibly fixed IDs are discarded) Set<Integer> addCandidates = getAddCandidates(solution); // check if addition is possible if(addCandidates.isEmpty()){ return null; } // select random ID to add to selection int add = SetUtilities.getRandomElement(addCandidates, rnd); // create and return addition move return new AdditionMove(add); }
[ "@", "Override", "public", "SubsetMove", "getRandomMove", "(", "SubsetSolution", "solution", ",", "Random", "rnd", ")", "{", "// check size limit", "if", "(", "maxSizeReached", "(", "solution", ")", ")", "{", "// size limit would be exceeded", "return", "null", ";", "}", "// get set of candidate IDs for addition (possibly fixed IDs are discarded)", "Set", "<", "Integer", ">", "addCandidates", "=", "getAddCandidates", "(", "solution", ")", ";", "// check if addition is possible", "if", "(", "addCandidates", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "// select random ID to add to selection", "int", "add", "=", "SetUtilities", ".", "getRandomElement", "(", "addCandidates", ",", "rnd", ")", ";", "// create and return addition move", "return", "new", "AdditionMove", "(", "add", ")", ";", "}" ]
Generates a random addition move for the given subset solution that adds a single ID to the selection. Possible fixed IDs are not considered to be added and the maximum subset size is taken into account. If no addition move can be generated, <code>null</code> is returned. @param solution solution for which a random addition move is generated @param rnd source of randomness used to generate random move @return random addition move, <code>null</code> if no move can be generated
[ "Generates", "a", "random", "addition", "move", "for", "the", "given", "subset", "solution", "that", "adds", "a", "single", "ID", "to", "the", "selection", ".", "Possible", "fixed", "IDs", "are", "not", "considered", "to", "be", "added", "and", "the", "maximum", "subset", "size", "is", "taken", "into", "account", ".", "If", "no", "addition", "move", "can", "be", "generated", "<code", ">", "null<", "/", "code", ">", "is", "returned", "." ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/SingleAdditionNeighbourhood.java#L104-L121
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscCompilationJobStreamsInner.java
DscCompilationJobStreamsInner.listByJob
public JobStreamListResultInner listByJob(String resourceGroupName, String automationAccountName, UUID jobId) { """ Retrieve all the job streams for the compilation Job. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param jobId The job id. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the JobStreamListResultInner object if successful. """ return listByJobWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).toBlocking().single().body(); }
java
public JobStreamListResultInner listByJob(String resourceGroupName, String automationAccountName, UUID jobId) { return listByJobWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).toBlocking().single().body(); }
[ "public", "JobStreamListResultInner", "listByJob", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "UUID", "jobId", ")", "{", "return", "listByJobWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "jobId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Retrieve all the job streams for the compilation Job. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param jobId The job id. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the JobStreamListResultInner object if successful.
[ "Retrieve", "all", "the", "job", "streams", "for", "the", "compilation", "Job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscCompilationJobStreamsInner.java#L72-L74
VoltDB/voltdb
src/frontend/org/voltcore/messaging/HostMessenger.java
HostMessenger.cutLink
public void cutLink(int hostIdA, int hostIdB) { """ Cut the network connection between two hostids immediately Useful for simulating network partitions """ if (m_localHostId == hostIdA) { Iterator<ForeignHost> it = m_foreignHosts.get(hostIdB).iterator(); while (it.hasNext()) { ForeignHost fh = it.next(); fh.cutLink(); } } if (m_localHostId == hostIdB) { Iterator<ForeignHost> it = m_foreignHosts.get(hostIdA).iterator(); while (it.hasNext()) { ForeignHost fh = it.next(); fh.cutLink(); } } }
java
public void cutLink(int hostIdA, int hostIdB) { if (m_localHostId == hostIdA) { Iterator<ForeignHost> it = m_foreignHosts.get(hostIdB).iterator(); while (it.hasNext()) { ForeignHost fh = it.next(); fh.cutLink(); } } if (m_localHostId == hostIdB) { Iterator<ForeignHost> it = m_foreignHosts.get(hostIdA).iterator(); while (it.hasNext()) { ForeignHost fh = it.next(); fh.cutLink(); } } }
[ "public", "void", "cutLink", "(", "int", "hostIdA", ",", "int", "hostIdB", ")", "{", "if", "(", "m_localHostId", "==", "hostIdA", ")", "{", "Iterator", "<", "ForeignHost", ">", "it", "=", "m_foreignHosts", ".", "get", "(", "hostIdB", ")", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "ForeignHost", "fh", "=", "it", ".", "next", "(", ")", ";", "fh", ".", "cutLink", "(", ")", ";", "}", "}", "if", "(", "m_localHostId", "==", "hostIdB", ")", "{", "Iterator", "<", "ForeignHost", ">", "it", "=", "m_foreignHosts", ".", "get", "(", "hostIdA", ")", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "ForeignHost", "fh", "=", "it", ".", "next", "(", ")", ";", "fh", ".", "cutLink", "(", ")", ";", "}", "}", "}" ]
Cut the network connection between two hostids immediately Useful for simulating network partitions
[ "Cut", "the", "network", "connection", "between", "two", "hostids", "immediately", "Useful", "for", "simulating", "network", "partitions" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/messaging/HostMessenger.java#L1869-L1884
graphhopper/graphhopper
core/src/main/java/com/graphhopper/geohash/LinearKeyAlgo.java
LinearKeyAlgo.encode
@Override public final long encode(double lat, double lon) { """ Take latitude and longitude as input. <p> @return the linear key """ lat = Math.min(Math.max(lat, bounds.minLat), bounds.maxLat); lon = Math.min(Math.max(lon, bounds.minLon), bounds.maxLon); // introduce a minor correction to round to lower grid entry! long latIndex = (long) ((lat - bounds.minLat) / latDelta * C); long lonIndex = (long) ((lon - bounds.minLon) / lonDelta * C); return latIndex * lonUnits + lonIndex; }
java
@Override public final long encode(double lat, double lon) { lat = Math.min(Math.max(lat, bounds.minLat), bounds.maxLat); lon = Math.min(Math.max(lon, bounds.minLon), bounds.maxLon); // introduce a minor correction to round to lower grid entry! long latIndex = (long) ((lat - bounds.minLat) / latDelta * C); long lonIndex = (long) ((lon - bounds.minLon) / lonDelta * C); return latIndex * lonUnits + lonIndex; }
[ "@", "Override", "public", "final", "long", "encode", "(", "double", "lat", ",", "double", "lon", ")", "{", "lat", "=", "Math", ".", "min", "(", "Math", ".", "max", "(", "lat", ",", "bounds", ".", "minLat", ")", ",", "bounds", ".", "maxLat", ")", ";", "lon", "=", "Math", ".", "min", "(", "Math", ".", "max", "(", "lon", ",", "bounds", ".", "minLon", ")", ",", "bounds", ".", "maxLon", ")", ";", "// introduce a minor correction to round to lower grid entry!", "long", "latIndex", "=", "(", "long", ")", "(", "(", "lat", "-", "bounds", ".", "minLat", ")", "/", "latDelta", "*", "C", ")", ";", "long", "lonIndex", "=", "(", "long", ")", "(", "(", "lon", "-", "bounds", ".", "minLon", ")", "/", "lonDelta", "*", "C", ")", ";", "return", "latIndex", "*", "lonUnits", "+", "lonIndex", ";", "}" ]
Take latitude and longitude as input. <p> @return the linear key
[ "Take", "latitude", "and", "longitude", "as", "input", ".", "<p", ">" ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/geohash/LinearKeyAlgo.java#L80-L88
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getTargetModuleLink
public Content getTargetModuleLink(String target, Content label, ModuleElement mdle) { """ Get Module link, with target frame. @param target name of the target frame @param label tag for the link @param mdle the module being documented @return a content for the target module link """ return getHyperLink(pathToRoot.resolve( DocPaths.moduleSummary(mdle)), label, "", target); }
java
public Content getTargetModuleLink(String target, Content label, ModuleElement mdle) { return getHyperLink(pathToRoot.resolve( DocPaths.moduleSummary(mdle)), label, "", target); }
[ "public", "Content", "getTargetModuleLink", "(", "String", "target", ",", "Content", "label", ",", "ModuleElement", "mdle", ")", "{", "return", "getHyperLink", "(", "pathToRoot", ".", "resolve", "(", "DocPaths", ".", "moduleSummary", "(", "mdle", ")", ")", ",", "label", ",", "\"\"", ",", "target", ")", ";", "}" ]
Get Module link, with target frame. @param target name of the target frame @param label tag for the link @param mdle the module being documented @return a content for the target module link
[ "Get", "Module", "link", "with", "target", "frame", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L386-L389
RestComm/media-core
scheduler/src/main/java/org/restcomm/media/core/scheduler/PriorityQueueScheduler.java
PriorityQueueScheduler.submit
public void submit(Task task,Integer index) { """ Queues task for execution according to its priority. @param task the task to be executed. """ task.activate(false); taskQueues[index].accept(task); }
java
public void submit(Task task,Integer index) { task.activate(false); taskQueues[index].accept(task); }
[ "public", "void", "submit", "(", "Task", "task", ",", "Integer", "index", ")", "{", "task", ".", "activate", "(", "false", ")", ";", "taskQueues", "[", "index", "]", ".", "accept", "(", "task", ")", ";", "}" ]
Queues task for execution according to its priority. @param task the task to be executed.
[ "Queues", "task", "for", "execution", "according", "to", "its", "priority", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/scheduler/src/main/java/org/restcomm/media/core/scheduler/PriorityQueueScheduler.java#L149-L152
jbundle/jbundle
base/screen/view/data/src/main/java/org/jbundle/base/screen/view/data/DTableAccessScreen.java
DTableAccessScreen.sendData
public void sendData(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { """ Process an HTML get or post. @param req The servlet request. @param res The servlet response object. @exception ServletException From inherited class. @exception IOException From inherited class. """ //? res.setContentType("text/html"); //x OutputStream out = res.getOutputStream(); String strRecordClass = this.getProperty(NDatabase.RECORD_CLASS); String strTableName = this.getProperty(NDatabase.TABLE_NAME); String strLanguage = this.getProperty(DBParams.LANGUAGE); NetUtility.getNetTable(strRecordClass, strTableName, strLanguage, this, this, (RecordOwner)this.getScreenField(), res.getOutputStream()); }
java
public void sendData(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { //? res.setContentType("text/html"); //x OutputStream out = res.getOutputStream(); String strRecordClass = this.getProperty(NDatabase.RECORD_CLASS); String strTableName = this.getProperty(NDatabase.TABLE_NAME); String strLanguage = this.getProperty(DBParams.LANGUAGE); NetUtility.getNetTable(strRecordClass, strTableName, strLanguage, this, this, (RecordOwner)this.getScreenField(), res.getOutputStream()); }
[ "public", "void", "sendData", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "throws", "ServletException", ",", "IOException", "{", "//? res.setContentType(\"text/html\");", "//x OutputStream out = res.getOutputStream();", "String", "strRecordClass", "=", "this", ".", "getProperty", "(", "NDatabase", ".", "RECORD_CLASS", ")", ";", "String", "strTableName", "=", "this", ".", "getProperty", "(", "NDatabase", ".", "TABLE_NAME", ")", ";", "String", "strLanguage", "=", "this", ".", "getProperty", "(", "DBParams", ".", "LANGUAGE", ")", ";", "NetUtility", ".", "getNetTable", "(", "strRecordClass", ",", "strTableName", ",", "strLanguage", ",", "this", ",", "this", ",", "(", "RecordOwner", ")", "this", ".", "getScreenField", "(", ")", ",", "res", ".", "getOutputStream", "(", ")", ")", ";", "}" ]
Process an HTML get or post. @param req The servlet request. @param res The servlet response object. @exception ServletException From inherited class. @exception IOException From inherited class.
[ "Process", "an", "HTML", "get", "or", "post", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/data/src/main/java/org/jbundle/base/screen/view/data/DTableAccessScreen.java#L79-L88
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/base64/Base64.java
Base64.encodeFileToFile
public static void encodeFileToFile (@Nonnull final String infile, @Nonnull final File aFile) throws IOException { """ Reads <code>infile</code> and encodes it to <code>outfile</code>. @param infile Input file @param aFile Output file @throws IOException if there is an error @since 2.2 """ final String encoded = encodeFromFile (infile); try (final OutputStream out = FileHelper.getBufferedOutputStream (aFile)) { // Strict, 7-bit output. out.write (encoded.getBytes (PREFERRED_ENCODING)); } }
java
public static void encodeFileToFile (@Nonnull final String infile, @Nonnull final File aFile) throws IOException { final String encoded = encodeFromFile (infile); try (final OutputStream out = FileHelper.getBufferedOutputStream (aFile)) { // Strict, 7-bit output. out.write (encoded.getBytes (PREFERRED_ENCODING)); } }
[ "public", "static", "void", "encodeFileToFile", "(", "@", "Nonnull", "final", "String", "infile", ",", "@", "Nonnull", "final", "File", "aFile", ")", "throws", "IOException", "{", "final", "String", "encoded", "=", "encodeFromFile", "(", "infile", ")", ";", "try", "(", "final", "OutputStream", "out", "=", "FileHelper", ".", "getBufferedOutputStream", "(", "aFile", ")", ")", "{", "// Strict, 7-bit output.", "out", ".", "write", "(", "encoded", ".", "getBytes", "(", "PREFERRED_ENCODING", ")", ")", ";", "}", "}" ]
Reads <code>infile</code> and encodes it to <code>outfile</code>. @param infile Input file @param aFile Output file @throws IOException if there is an error @since 2.2
[ "Reads", "<code", ">", "infile<", "/", "code", ">", "and", "encodes", "it", "to", "<code", ">", "outfile<", "/", "code", ">", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/base64/Base64.java#L2498-L2506
xebia-france/xebia-logfilter-extras
src/main/java/fr/xebia/extras/filters/logfilters/RequestLoggerFilter.java
RequestLoggerFilter.doFilter
@Override public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException { """ This is where the work is done. @param servletRequest @param servletResponse @param filterChain @throws IOException @throws ServletException """ ServletRequest request = servletRequest; ServletResponse response = servletResponse; int id = 0; // Generate the identifier if dumping is enabled for request and/or response if (LOG_REQUEST.isDebugEnabled() || LOG_RESPONSE.isDebugEnabled()) { id = counter.incrementAndGet(); } // Dumping of the request is enabled so build the RequestWrapper and dump the request if (LOG_REQUEST.isDebugEnabled()) { request = new HttpServletRequestLoggingWrapper((HttpServletRequest) servletRequest, maxDumpSizeInKB); dumpRequest((HttpServletRequestLoggingWrapper) request, id); } if (LOG_RESPONSE.isDebugEnabled()) { // Dumping of the response is enabled so build the wrapper, handle the chain, dump the response, and write it to the outpuStream. response = new HttpServletResponseLoggingWrapper((HttpServletResponse) servletResponse, maxDumpSizeInKB); filterChain.doFilter(request, response); dumpResponse((HttpServletResponseLoggingWrapper) response, id); } else { // Dumping of the response is not needed so we just handle the chain filterChain.doFilter(request, response); } }
java
@Override public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException { ServletRequest request = servletRequest; ServletResponse response = servletResponse; int id = 0; // Generate the identifier if dumping is enabled for request and/or response if (LOG_REQUEST.isDebugEnabled() || LOG_RESPONSE.isDebugEnabled()) { id = counter.incrementAndGet(); } // Dumping of the request is enabled so build the RequestWrapper and dump the request if (LOG_REQUEST.isDebugEnabled()) { request = new HttpServletRequestLoggingWrapper((HttpServletRequest) servletRequest, maxDumpSizeInKB); dumpRequest((HttpServletRequestLoggingWrapper) request, id); } if (LOG_RESPONSE.isDebugEnabled()) { // Dumping of the response is enabled so build the wrapper, handle the chain, dump the response, and write it to the outpuStream. response = new HttpServletResponseLoggingWrapper((HttpServletResponse) servletResponse, maxDumpSizeInKB); filterChain.doFilter(request, response); dumpResponse((HttpServletResponseLoggingWrapper) response, id); } else { // Dumping of the response is not needed so we just handle the chain filterChain.doFilter(request, response); } }
[ "@", "Override", "public", "void", "doFilter", "(", "final", "ServletRequest", "servletRequest", ",", "final", "ServletResponse", "servletResponse", ",", "final", "FilterChain", "filterChain", ")", "throws", "IOException", ",", "ServletException", "{", "ServletRequest", "request", "=", "servletRequest", ";", "ServletResponse", "response", "=", "servletResponse", ";", "int", "id", "=", "0", ";", "// Generate the identifier if dumping is enabled for request and/or response", "if", "(", "LOG_REQUEST", ".", "isDebugEnabled", "(", ")", "||", "LOG_RESPONSE", ".", "isDebugEnabled", "(", ")", ")", "{", "id", "=", "counter", ".", "incrementAndGet", "(", ")", ";", "}", "// Dumping of the request is enabled so build the RequestWrapper and dump the request", "if", "(", "LOG_REQUEST", ".", "isDebugEnabled", "(", ")", ")", "{", "request", "=", "new", "HttpServletRequestLoggingWrapper", "(", "(", "HttpServletRequest", ")", "servletRequest", ",", "maxDumpSizeInKB", ")", ";", "dumpRequest", "(", "(", "HttpServletRequestLoggingWrapper", ")", "request", ",", "id", ")", ";", "}", "if", "(", "LOG_RESPONSE", ".", "isDebugEnabled", "(", ")", ")", "{", "// Dumping of the response is enabled so build the wrapper, handle the chain, dump the response, and write it to the outpuStream.", "response", "=", "new", "HttpServletResponseLoggingWrapper", "(", "(", "HttpServletResponse", ")", "servletResponse", ",", "maxDumpSizeInKB", ")", ";", "filterChain", ".", "doFilter", "(", "request", ",", "response", ")", ";", "dumpResponse", "(", "(", "HttpServletResponseLoggingWrapper", ")", "response", ",", "id", ")", ";", "}", "else", "{", "// Dumping of the response is not needed so we just handle the chain", "filterChain", ".", "doFilter", "(", "request", ",", "response", ")", ";", "}", "}" ]
This is where the work is done. @param servletRequest @param servletResponse @param filterChain @throws IOException @throws ServletException
[ "This", "is", "where", "the", "work", "is", "done", "." ]
train
https://github.com/xebia-france/xebia-logfilter-extras/blob/b1112329816d7f28fdba214425da8f15338a7157/src/main/java/fr/xebia/extras/filters/logfilters/RequestLoggerFilter.java#L106-L131
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WRadioButtonRenderer.java
WRadioButtonRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given WRadioButton. @param component the WRadioButton to paint. @param renderContext the RenderContext to paint to. """ WRadioButton button = (WRadioButton) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = button.isReadOnly(); String value = button.getValue(); xml.appendTagOpen("ui:radiobutton"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", button.isHidden(), "true"); xml.appendAttribute("groupName", button.getGroupName()); xml.appendAttribute("value", WebUtilities.encode(value)); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { xml.appendOptionalAttribute("disabled", button.isDisabled(), "true"); xml.appendOptionalAttribute("required", button.isMandatory(), "true"); xml.appendOptionalAttribute("submitOnChange", button.isSubmitOnChange(), "true"); xml.appendOptionalAttribute("toolTip", button.getToolTip()); xml.appendOptionalAttribute("accessibleText", button.getAccessibleText()); // Check for null option (ie null or empty). Match isEmpty() logic. boolean isNull = value == null ? true : (value.length() == 0); xml.appendOptionalAttribute("isNull", isNull, "true"); } xml.appendOptionalAttribute("selected", button.isSelected(), "true"); xml.appendEnd(); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WRadioButton button = (WRadioButton) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = button.isReadOnly(); String value = button.getValue(); xml.appendTagOpen("ui:radiobutton"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", button.isHidden(), "true"); xml.appendAttribute("groupName", button.getGroupName()); xml.appendAttribute("value", WebUtilities.encode(value)); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { xml.appendOptionalAttribute("disabled", button.isDisabled(), "true"); xml.appendOptionalAttribute("required", button.isMandatory(), "true"); xml.appendOptionalAttribute("submitOnChange", button.isSubmitOnChange(), "true"); xml.appendOptionalAttribute("toolTip", button.getToolTip()); xml.appendOptionalAttribute("accessibleText", button.getAccessibleText()); // Check for null option (ie null or empty). Match isEmpty() logic. boolean isNull = value == null ? true : (value.length() == 0); xml.appendOptionalAttribute("isNull", isNull, "true"); } xml.appendOptionalAttribute("selected", button.isSelected(), "true"); xml.appendEnd(); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WRadioButton", "button", "=", "(", "WRadioButton", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "boolean", "readOnly", "=", "button", ".", "isReadOnly", "(", ")", ";", "String", "value", "=", "button", ".", "getValue", "(", ")", ";", "xml", ".", "appendTagOpen", "(", "\"ui:radiobutton\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "component", ".", "getId", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"class\"", ",", "component", ".", "getHtmlClass", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"track\"", ",", "component", ".", "isTracking", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"hidden\"", ",", "button", ".", "isHidden", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"groupName\"", ",", "button", ".", "getGroupName", "(", ")", ")", ";", "xml", ".", "appendAttribute", "(", "\"value\"", ",", "WebUtilities", ".", "encode", "(", "value", ")", ")", ";", "if", "(", "readOnly", ")", "{", "xml", ".", "appendAttribute", "(", "\"readOnly\"", ",", "\"true\"", ")", ";", "}", "else", "{", "xml", ".", "appendOptionalAttribute", "(", "\"disabled\"", ",", "button", ".", "isDisabled", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"required\"", ",", "button", ".", "isMandatory", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"submitOnChange\"", ",", "button", ".", "isSubmitOnChange", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"toolTip\"", ",", "button", ".", "getToolTip", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"accessibleText\"", ",", "button", ".", "getAccessibleText", "(", ")", ")", ";", "// Check for null option (ie null or empty). Match isEmpty() logic.", "boolean", "isNull", "=", "value", "==", "null", "?", "true", ":", "(", "value", ".", "length", "(", ")", "==", "0", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"isNull\"", ",", "isNull", ",", "\"true\"", ")", ";", "}", "xml", ".", "appendOptionalAttribute", "(", "\"selected\"", ",", "button", ".", "isSelected", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendEnd", "(", ")", ";", "}" ]
Paints the given WRadioButton. @param component the WRadioButton to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WRadioButton", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WRadioButtonRenderer.java#L24-L53
querydsl/querydsl
querydsl-jpa/src/main/java/com/querydsl/jpa/hibernate/HibernateUpdateClause.java
HibernateUpdateClause.setLockMode
@SuppressWarnings("unchecked") public HibernateUpdateClause setLockMode(Path<?> path, LockMode lockMode) { """ Set the lock mode for the given path. @return the current object """ lockModes.put(path, lockMode); return this; }
java
@SuppressWarnings("unchecked") public HibernateUpdateClause setLockMode(Path<?> path, LockMode lockMode) { lockModes.put(path, lockMode); return this; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "HibernateUpdateClause", "setLockMode", "(", "Path", "<", "?", ">", "path", ",", "LockMode", "lockMode", ")", "{", "lockModes", ".", "put", "(", "path", ",", "lockMode", ")", ";", "return", "this", ";", "}" ]
Set the lock mode for the given path. @return the current object
[ "Set", "the", "lock", "mode", "for", "the", "given", "path", "." ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-jpa/src/main/java/com/querydsl/jpa/hibernate/HibernateUpdateClause.java#L143-L147
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/Util.java
Util.convertDotNetBytesToUUID
public static UUID convertDotNetBytesToUUID(byte[] dotNetBytes) { """ First 4 bytes are in reverse order, 5th and 6th bytes are in reverse order, 7th and 8th bytes are also in reverse order """ if(dotNetBytes == null || dotNetBytes.length != GUIDSIZE) { return new UUID(0l, 0l); } byte[] reOrderedBytes = new byte[GUIDSIZE]; for(int i=0; i<GUIDSIZE; i++) { int indexInReorderedBytes; switch(i) { case 0: indexInReorderedBytes = 3; break; case 1: indexInReorderedBytes = 2; break; case 2: indexInReorderedBytes = 1; break; case 3: indexInReorderedBytes = 0; break; case 4: indexInReorderedBytes = 5; break; case 5: indexInReorderedBytes = 4; break; case 6: indexInReorderedBytes = 7; break; case 7: indexInReorderedBytes = 6; break; default: indexInReorderedBytes = i; } reOrderedBytes[indexInReorderedBytes] = dotNetBytes[i]; } ByteBuffer buffer = ByteBuffer.wrap(reOrderedBytes); long mostSignificantBits = buffer.getLong(); long leastSignificantBits = buffer.getLong(); return new UUID(mostSignificantBits, leastSignificantBits); }
java
public static UUID convertDotNetBytesToUUID(byte[] dotNetBytes) { if(dotNetBytes == null || dotNetBytes.length != GUIDSIZE) { return new UUID(0l, 0l); } byte[] reOrderedBytes = new byte[GUIDSIZE]; for(int i=0; i<GUIDSIZE; i++) { int indexInReorderedBytes; switch(i) { case 0: indexInReorderedBytes = 3; break; case 1: indexInReorderedBytes = 2; break; case 2: indexInReorderedBytes = 1; break; case 3: indexInReorderedBytes = 0; break; case 4: indexInReorderedBytes = 5; break; case 5: indexInReorderedBytes = 4; break; case 6: indexInReorderedBytes = 7; break; case 7: indexInReorderedBytes = 6; break; default: indexInReorderedBytes = i; } reOrderedBytes[indexInReorderedBytes] = dotNetBytes[i]; } ByteBuffer buffer = ByteBuffer.wrap(reOrderedBytes); long mostSignificantBits = buffer.getLong(); long leastSignificantBits = buffer.getLong(); return new UUID(mostSignificantBits, leastSignificantBits); }
[ "public", "static", "UUID", "convertDotNetBytesToUUID", "(", "byte", "[", "]", "dotNetBytes", ")", "{", "if", "(", "dotNetBytes", "==", "null", "||", "dotNetBytes", ".", "length", "!=", "GUIDSIZE", ")", "{", "return", "new", "UUID", "(", "0l", ",", "0l", ")", ";", "}", "byte", "[", "]", "reOrderedBytes", "=", "new", "byte", "[", "GUIDSIZE", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "GUIDSIZE", ";", "i", "++", ")", "{", "int", "indexInReorderedBytes", ";", "switch", "(", "i", ")", "{", "case", "0", ":", "indexInReorderedBytes", "=", "3", ";", "break", ";", "case", "1", ":", "indexInReorderedBytes", "=", "2", ";", "break", ";", "case", "2", ":", "indexInReorderedBytes", "=", "1", ";", "break", ";", "case", "3", ":", "indexInReorderedBytes", "=", "0", ";", "break", ";", "case", "4", ":", "indexInReorderedBytes", "=", "5", ";", "break", ";", "case", "5", ":", "indexInReorderedBytes", "=", "4", ";", "break", ";", "case", "6", ":", "indexInReorderedBytes", "=", "7", ";", "break", ";", "case", "7", ":", "indexInReorderedBytes", "=", "6", ";", "break", ";", "default", ":", "indexInReorderedBytes", "=", "i", ";", "}", "reOrderedBytes", "[", "indexInReorderedBytes", "]", "=", "dotNetBytes", "[", "i", "]", ";", "}", "ByteBuffer", "buffer", "=", "ByteBuffer", ".", "wrap", "(", "reOrderedBytes", ")", ";", "long", "mostSignificantBits", "=", "buffer", ".", "getLong", "(", ")", ";", "long", "leastSignificantBits", "=", "buffer", ".", "getLong", "(", ")", ";", "return", "new", "UUID", "(", "mostSignificantBits", ",", "leastSignificantBits", ")", ";", "}" ]
First 4 bytes are in reverse order, 5th and 6th bytes are in reverse order, 7th and 8th bytes are also in reverse order
[ "First", "4", "bytes", "are", "in", "reverse", "order", "5th", "and", "6th", "bytes", "are", "in", "reverse", "order", "7th", "and", "8th", "bytes", "are", "also", "in", "reverse", "order" ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/Util.java#L215-L263
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/convert/TypeConverter.java
TypeConverter.toTypeWithDefault
public static <T> T toTypeWithDefault(Class<T> type, Object value, T defaultValue) { """ Converts value into an object type specified by Type Code or returns default value when conversion is not possible. @param type the Class type for the data type into which 'value' is to be converted. @param value the value to convert. @param defaultValue the default value to return if conversion is not possible (returns null). @return object value of type corresponding to TypeCode, or default value when conversion is not supported. @see TypeConverter#toNullableType(Class, Object) @see TypeConverter#toTypeCode(Class) """ T result = toNullableType(type, value); return result != null ? result : defaultValue; }
java
public static <T> T toTypeWithDefault(Class<T> type, Object value, T defaultValue) { T result = toNullableType(type, value); return result != null ? result : defaultValue; }
[ "public", "static", "<", "T", ">", "T", "toTypeWithDefault", "(", "Class", "<", "T", ">", "type", ",", "Object", "value", ",", "T", "defaultValue", ")", "{", "T", "result", "=", "toNullableType", "(", "type", ",", "value", ")", ";", "return", "result", "!=", "null", "?", "result", ":", "defaultValue", ";", "}" ]
Converts value into an object type specified by Type Code or returns default value when conversion is not possible. @param type the Class type for the data type into which 'value' is to be converted. @param value the value to convert. @param defaultValue the default value to return if conversion is not possible (returns null). @return object value of type corresponding to TypeCode, or default value when conversion is not supported. @see TypeConverter#toNullableType(Class, Object) @see TypeConverter#toTypeCode(Class)
[ "Converts", "value", "into", "an", "object", "type", "specified", "by", "Type", "Code", "or", "returns", "default", "value", "when", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/convert/TypeConverter.java#L193-L196
hypercube1024/firefly
firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java
ScriptUtils.splitSqlScript
public static void splitSqlScript(String script, String separator, List<String> statements) throws ScriptException { """ Split an SQL script into separate statements delimited by the provided separator string. Each individual statement will be added to the provided {@code List}. <p> Within the script, {@value #DEFAULT_COMMENT_PREFIX} will be used as the comment prefix; any text beginning with the comment prefix and extending to the end of the line will be omitted from the output. Similarly, {@value #DEFAULT_BLOCK_COMMENT_START_DELIMITER} and {@value #DEFAULT_BLOCK_COMMENT_END_DELIMITER} will be used as the <em>start</em> and <em>end</em> block comment delimiters: any text enclosed in a block comment will be omitted from the output. In addition, multiple adjacent whitespace characters will be collapsed into a single space. @param script the SQL script @param separator text separating each statement &mdash; typically a ';' or newline character @param statements the list that will contain the individual statements @throws ScriptException if an error occurred while splitting the SQL script @see #splitSqlScript(String, char, List) @see #splitSqlScript(EncodedResource, String, String, String, String, String, List) """ splitSqlScript(null, script, separator, DEFAULT_COMMENT_PREFIX, DEFAULT_BLOCK_COMMENT_START_DELIMITER, DEFAULT_BLOCK_COMMENT_END_DELIMITER, statements); }
java
public static void splitSqlScript(String script, String separator, List<String> statements) throws ScriptException { splitSqlScript(null, script, separator, DEFAULT_COMMENT_PREFIX, DEFAULT_BLOCK_COMMENT_START_DELIMITER, DEFAULT_BLOCK_COMMENT_END_DELIMITER, statements); }
[ "public", "static", "void", "splitSqlScript", "(", "String", "script", ",", "String", "separator", ",", "List", "<", "String", ">", "statements", ")", "throws", "ScriptException", "{", "splitSqlScript", "(", "null", ",", "script", ",", "separator", ",", "DEFAULT_COMMENT_PREFIX", ",", "DEFAULT_BLOCK_COMMENT_START_DELIMITER", ",", "DEFAULT_BLOCK_COMMENT_END_DELIMITER", ",", "statements", ")", ";", "}" ]
Split an SQL script into separate statements delimited by the provided separator string. Each individual statement will be added to the provided {@code List}. <p> Within the script, {@value #DEFAULT_COMMENT_PREFIX} will be used as the comment prefix; any text beginning with the comment prefix and extending to the end of the line will be omitted from the output. Similarly, {@value #DEFAULT_BLOCK_COMMENT_START_DELIMITER} and {@value #DEFAULT_BLOCK_COMMENT_END_DELIMITER} will be used as the <em>start</em> and <em>end</em> block comment delimiters: any text enclosed in a block comment will be omitted from the output. In addition, multiple adjacent whitespace characters will be collapsed into a single space. @param script the SQL script @param separator text separating each statement &mdash; typically a ';' or newline character @param statements the list that will contain the individual statements @throws ScriptException if an error occurred while splitting the SQL script @see #splitSqlScript(String, char, List) @see #splitSqlScript(EncodedResource, String, String, String, String, String, List)
[ "Split", "an", "SQL", "script", "into", "separate", "statements", "delimited", "by", "the", "provided", "separator", "string", ".", "Each", "individual", "statement", "will", "be", "added", "to", "the", "provided", "{", "@code", "List", "}", ".", "<p", ">", "Within", "the", "script", "{", "@value", "#DEFAULT_COMMENT_PREFIX", "}", "will", "be", "used", "as", "the", "comment", "prefix", ";", "any", "text", "beginning", "with", "the", "comment", "prefix", "and", "extending", "to", "the", "end", "of", "the", "line", "will", "be", "omitted", "from", "the", "output", ".", "Similarly", "{", "@value", "#DEFAULT_BLOCK_COMMENT_START_DELIMITER", "}", "and", "{", "@value", "#DEFAULT_BLOCK_COMMENT_END_DELIMITER", "}", "will", "be", "used", "as", "the", "<em", ">", "start<", "/", "em", ">", "and", "<em", ">", "end<", "/", "em", ">", "block", "comment", "delimiters", ":", "any", "text", "enclosed", "in", "a", "block", "comment", "will", "be", "omitted", "from", "the", "output", ".", "In", "addition", "multiple", "adjacent", "whitespace", "characters", "will", "be", "collapsed", "into", "a", "single", "space", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java#L123-L126
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/modules/utils/fileiterator/OmsFileIterator.java
OmsFileIterator.addPrj
public static void addPrj( String folder, String epsg ) throws Exception { """ Utility to add to all found files in a given folder the prj file following the supplied epsg. @param folder the folder to browse. @param epsg the epsg from which to take the prj. @throws Exception """ OmsFileIterator fiter = new OmsFileIterator(); fiter.inFolder = folder; fiter.pCode = epsg; fiter.process(); }
java
public static void addPrj( String folder, String epsg ) throws Exception { OmsFileIterator fiter = new OmsFileIterator(); fiter.inFolder = folder; fiter.pCode = epsg; fiter.process(); }
[ "public", "static", "void", "addPrj", "(", "String", "folder", ",", "String", "epsg", ")", "throws", "Exception", "{", "OmsFileIterator", "fiter", "=", "new", "OmsFileIterator", "(", ")", ";", "fiter", ".", "inFolder", "=", "folder", ";", "fiter", ".", "pCode", "=", "epsg", ";", "fiter", ".", "process", "(", ")", ";", "}" ]
Utility to add to all found files in a given folder the prj file following the supplied epsg. @param folder the folder to browse. @param epsg the epsg from which to take the prj. @throws Exception
[ "Utility", "to", "add", "to", "all", "found", "files", "in", "a", "given", "folder", "the", "prj", "file", "following", "the", "supplied", "epsg", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/utils/fileiterator/OmsFileIterator.java#L181-L186
twitter/hraven
hraven-core/src/main/java/com/twitter/hraven/util/ByteUtil.java
ByteUtil.getValueAsInt
public static int getValueAsInt(byte[] key, Map<byte[], byte[]> infoValues) { """ get value from a map as an int @param key @param infoValues @return int """ byte[] value = infoValues.get(key); if (value != null) { try { int retValue = Bytes.toInt(value); return retValue; } catch (NumberFormatException nfe) { LOG.error("Caught NFE while converting to int ", nfe); return 0; } catch (IllegalArgumentException iae) { // for exceptions like java.lang.IllegalArgumentException: // offset (0) + length (8) exceed the capacity of the array: 7 LOG.error("Caught IAE while converting to int ", iae); return 0; } } else { return 0; } }
java
public static int getValueAsInt(byte[] key, Map<byte[], byte[]> infoValues) { byte[] value = infoValues.get(key); if (value != null) { try { int retValue = Bytes.toInt(value); return retValue; } catch (NumberFormatException nfe) { LOG.error("Caught NFE while converting to int ", nfe); return 0; } catch (IllegalArgumentException iae) { // for exceptions like java.lang.IllegalArgumentException: // offset (0) + length (8) exceed the capacity of the array: 7 LOG.error("Caught IAE while converting to int ", iae); return 0; } } else { return 0; } }
[ "public", "static", "int", "getValueAsInt", "(", "byte", "[", "]", "key", ",", "Map", "<", "byte", "[", "]", ",", "byte", "[", "]", ">", "infoValues", ")", "{", "byte", "[", "]", "value", "=", "infoValues", ".", "get", "(", "key", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "try", "{", "int", "retValue", "=", "Bytes", ".", "toInt", "(", "value", ")", ";", "return", "retValue", ";", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", "LOG", ".", "error", "(", "\"Caught NFE while converting to int \"", ",", "nfe", ")", ";", "return", "0", ";", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "// for exceptions like java.lang.IllegalArgumentException:", "// offset (0) + length (8) exceed the capacity of the array: 7", "LOG", ".", "error", "(", "\"Caught IAE while converting to int \"", ",", "iae", ")", ";", "return", "0", ";", "}", "}", "else", "{", "return", "0", ";", "}", "}" ]
get value from a map as an int @param key @param infoValues @return int
[ "get", "value", "from", "a", "map", "as", "an", "int" ]
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/util/ByteUtil.java#L316-L334
gitblit/fathom
fathom-rest-swagger/src/main/java/fathom/rest/swagger/SwaggerBuilder.java
SwaggerBuilder.registerResponses
protected void registerResponses(Swagger swagger, Operation operation, Method method) { """ Registers the declared responses for the operation. @param swagger @param operation @param method """ for (Return aReturn : ControllerUtil.getReturns(method)) { registerResponse(swagger, operation, aReturn); } }
java
protected void registerResponses(Swagger swagger, Operation operation, Method method) { for (Return aReturn : ControllerUtil.getReturns(method)) { registerResponse(swagger, operation, aReturn); } }
[ "protected", "void", "registerResponses", "(", "Swagger", "swagger", ",", "Operation", "operation", ",", "Method", "method", ")", "{", "for", "(", "Return", "aReturn", ":", "ControllerUtil", ".", "getReturns", "(", "method", ")", ")", "{", "registerResponse", "(", "swagger", ",", "operation", ",", "aReturn", ")", ";", "}", "}" ]
Registers the declared responses for the operation. @param swagger @param operation @param method
[ "Registers", "the", "declared", "responses", "for", "the", "operation", "." ]
train
https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-rest-swagger/src/main/java/fathom/rest/swagger/SwaggerBuilder.java#L446-L450
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/context/AuditorModuleContext.java
AuditorModuleContext.getAuditor
public IHEAuditor getAuditor(String className, boolean useContextAuditorRegistry) { """ Get an IHE Auditor instance from a fully-qualified class name @param className Auditor class to use @param useContextAuditorRegistry Whether to reuse cached auditors from context @return Auditor instance """ return getAuditor(AuditorFactory.getAuditorClassForClassName(className),useContextAuditorRegistry); }
java
public IHEAuditor getAuditor(String className, boolean useContextAuditorRegistry) { return getAuditor(AuditorFactory.getAuditorClassForClassName(className),useContextAuditorRegistry); }
[ "public", "IHEAuditor", "getAuditor", "(", "String", "className", ",", "boolean", "useContextAuditorRegistry", ")", "{", "return", "getAuditor", "(", "AuditorFactory", ".", "getAuditorClassForClassName", "(", "className", ")", ",", "useContextAuditorRegistry", ")", ";", "}" ]
Get an IHE Auditor instance from a fully-qualified class name @param className Auditor class to use @param useContextAuditorRegistry Whether to reuse cached auditors from context @return Auditor instance
[ "Get", "an", "IHE", "Auditor", "instance", "from", "a", "fully", "-", "qualified", "class", "name" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/context/AuditorModuleContext.java#L287-L290
googleads/googleads-java-lib
modules/ads_lib/src/main/java/com/google/api/ads/common/lib/auth/OfflineCredentials.java
OfflineCredentials.generateCredential
public Credential generateCredential() throws OAuthException { """ Generates a new offline credential and immediately refreshes it. @return a newly refreshed offline credential. @throws OAuthException if the credential could not be refreshed. """ GoogleCredential credential = Strings.isNullOrEmpty(this.jsonKeyFilePath) ? generateCredentialFromClientSecrets() : generateCredentialFromKeyFile(); try { if (!oAuth2Helper.callRefreshToken(credential)) { throw new OAuthException( "Credential could not be refreshed. A newly generated refresh token or " + "secret key may be required."); } } catch (IOException e) { throw new OAuthException("Credential could not be refreshed.", e); } return credential; }
java
public Credential generateCredential() throws OAuthException { GoogleCredential credential = Strings.isNullOrEmpty(this.jsonKeyFilePath) ? generateCredentialFromClientSecrets() : generateCredentialFromKeyFile(); try { if (!oAuth2Helper.callRefreshToken(credential)) { throw new OAuthException( "Credential could not be refreshed. A newly generated refresh token or " + "secret key may be required."); } } catch (IOException e) { throw new OAuthException("Credential could not be refreshed.", e); } return credential; }
[ "public", "Credential", "generateCredential", "(", ")", "throws", "OAuthException", "{", "GoogleCredential", "credential", "=", "Strings", ".", "isNullOrEmpty", "(", "this", ".", "jsonKeyFilePath", ")", "?", "generateCredentialFromClientSecrets", "(", ")", ":", "generateCredentialFromKeyFile", "(", ")", ";", "try", "{", "if", "(", "!", "oAuth2Helper", ".", "callRefreshToken", "(", "credential", ")", ")", "{", "throw", "new", "OAuthException", "(", "\"Credential could not be refreshed. A newly generated refresh token or \"", "+", "\"secret key may be required.\"", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "OAuthException", "(", "\"Credential could not be refreshed.\"", ",", "e", ")", ";", "}", "return", "credential", ";", "}" ]
Generates a new offline credential and immediately refreshes it. @return a newly refreshed offline credential. @throws OAuthException if the credential could not be refreshed.
[ "Generates", "a", "new", "offline", "credential", "and", "immediately", "refreshes", "it", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/auth/OfflineCredentials.java#L229-L243
google/closure-compiler
src/com/google/javascript/jscomp/parsing/TypeTransformationParser.java
TypeTransformationParser.validBooleanExpression
private boolean validBooleanExpression(Node expr) { """ A boolean expression must be a boolean predicate or a boolean type predicate """ if (isBooleanOperation(expr)) { return validBooleanOperation(expr); } if (!isOperation(expr)) { warnInvalidExpression("boolean", expr); return false; } if (!isValidPredicate(getCallName(expr))) { warnInvalid("boolean predicate", expr); return false; } Keywords keyword = nameToKeyword(getCallName(expr)); if (!checkParameterCount(expr, keyword)) { return false; } switch (keyword.kind) { case TYPE_PREDICATE: return validTypePredicate(expr, getCallParamCount(expr)); case STRING_PREDICATE: return validStringPredicate(expr, getCallParamCount(expr)); case TYPEVAR_PREDICATE: return validTypevarPredicate(expr, getCallParamCount(expr)); default: throw new IllegalStateException("Invalid boolean expression"); } }
java
private boolean validBooleanExpression(Node expr) { if (isBooleanOperation(expr)) { return validBooleanOperation(expr); } if (!isOperation(expr)) { warnInvalidExpression("boolean", expr); return false; } if (!isValidPredicate(getCallName(expr))) { warnInvalid("boolean predicate", expr); return false; } Keywords keyword = nameToKeyword(getCallName(expr)); if (!checkParameterCount(expr, keyword)) { return false; } switch (keyword.kind) { case TYPE_PREDICATE: return validTypePredicate(expr, getCallParamCount(expr)); case STRING_PREDICATE: return validStringPredicate(expr, getCallParamCount(expr)); case TYPEVAR_PREDICATE: return validTypevarPredicate(expr, getCallParamCount(expr)); default: throw new IllegalStateException("Invalid boolean expression"); } }
[ "private", "boolean", "validBooleanExpression", "(", "Node", "expr", ")", "{", "if", "(", "isBooleanOperation", "(", "expr", ")", ")", "{", "return", "validBooleanOperation", "(", "expr", ")", ";", "}", "if", "(", "!", "isOperation", "(", "expr", ")", ")", "{", "warnInvalidExpression", "(", "\"boolean\"", ",", "expr", ")", ";", "return", "false", ";", "}", "if", "(", "!", "isValidPredicate", "(", "getCallName", "(", "expr", ")", ")", ")", "{", "warnInvalid", "(", "\"boolean predicate\"", ",", "expr", ")", ";", "return", "false", ";", "}", "Keywords", "keyword", "=", "nameToKeyword", "(", "getCallName", "(", "expr", ")", ")", ";", "if", "(", "!", "checkParameterCount", "(", "expr", ",", "keyword", ")", ")", "{", "return", "false", ";", "}", "switch", "(", "keyword", ".", "kind", ")", "{", "case", "TYPE_PREDICATE", ":", "return", "validTypePredicate", "(", "expr", ",", "getCallParamCount", "(", "expr", ")", ")", ";", "case", "STRING_PREDICATE", ":", "return", "validStringPredicate", "(", "expr", ",", "getCallParamCount", "(", "expr", ")", ")", ";", "case", "TYPEVAR_PREDICATE", ":", "return", "validTypevarPredicate", "(", "expr", ",", "getCallParamCount", "(", "expr", ")", ")", ";", "default", ":", "throw", "new", "IllegalStateException", "(", "\"Invalid boolean expression\"", ")", ";", "}", "}" ]
A boolean expression must be a boolean predicate or a boolean type predicate
[ "A", "boolean", "expression", "must", "be", "a", "boolean", "predicate", "or", "a", "boolean", "type", "predicate" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/TypeTransformationParser.java#L572-L599
spotify/docker-client
src/main/java/com/spotify/docker/client/DockerHost.java
DockerHost.fromEnv
public static DockerHost fromEnv() { """ Create a {@link DockerHost} from DOCKER_HOST and DOCKER_PORT env vars. @return The DockerHost object. """ final String host = endpointFromEnv(); final String certPath = certPathFromEnv(); return new DockerHost(host, certPath); }
java
public static DockerHost fromEnv() { final String host = endpointFromEnv(); final String certPath = certPathFromEnv(); return new DockerHost(host, certPath); }
[ "public", "static", "DockerHost", "fromEnv", "(", ")", "{", "final", "String", "host", "=", "endpointFromEnv", "(", ")", ";", "final", "String", "certPath", "=", "certPathFromEnv", "(", ")", ";", "return", "new", "DockerHost", "(", "host", ",", "certPath", ")", ";", "}" ]
Create a {@link DockerHost} from DOCKER_HOST and DOCKER_PORT env vars. @return The DockerHost object.
[ "Create", "a", "{", "@link", "DockerHost", "}", "from", "DOCKER_HOST", "and", "DOCKER_PORT", "env", "vars", "." ]
train
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/DockerHost.java#L169-L173
i-net-software/jlessc
src/com/inet/lib/less/FunctionExpression.java
FunctionExpression.getColor
private double getColor( Expression exp, CssFormatter formatter ) { """ Get a color value from the expression. And set the type variable. @param exp the expression @param formatter current formatter @return the the color value @throws ParameterOutOfBoundsException if the parameter with the index does not exists """ type = exp.getDataType( formatter ); switch( type ) { case COLOR: case RGBA: return exp.doubleValue( formatter ); } throw new ParameterOutOfBoundsException(); }
java
private double getColor( Expression exp, CssFormatter formatter ) { type = exp.getDataType( formatter ); switch( type ) { case COLOR: case RGBA: return exp.doubleValue( formatter ); } throw new ParameterOutOfBoundsException(); }
[ "private", "double", "getColor", "(", "Expression", "exp", ",", "CssFormatter", "formatter", ")", "{", "type", "=", "exp", ".", "getDataType", "(", "formatter", ")", ";", "switch", "(", "type", ")", "{", "case", "COLOR", ":", "case", "RGBA", ":", "return", "exp", ".", "doubleValue", "(", "formatter", ")", ";", "}", "throw", "new", "ParameterOutOfBoundsException", "(", ")", ";", "}" ]
Get a color value from the expression. And set the type variable. @param exp the expression @param formatter current formatter @return the the color value @throws ParameterOutOfBoundsException if the parameter with the index does not exists
[ "Get", "a", "color", "value", "from", "the", "expression", ".", "And", "set", "the", "type", "variable", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L993-L1001
wcm-io/wcm-io-handler
link/src/main/java/io/wcm/handler/link/type/MediaLinkType.java
MediaLinkType.getSyntheticLinkResource
public static @NotNull Resource getSyntheticLinkResource(@NotNull ResourceResolver resourceResolver, @NotNull String mediaRef) { """ Get synthetic link resource for this link type. @param resourceResolver Resource resolver @param mediaRef Media asset reference @return Synthetic link resource """ Map<String, Object> map = new HashMap<>(); map.put(LinkNameConstants.PN_LINK_TYPE, ID); map.put(LinkNameConstants.PN_LINK_MEDIA_REF, mediaRef); return new SyntheticLinkResource(resourceResolver, map); }
java
public static @NotNull Resource getSyntheticLinkResource(@NotNull ResourceResolver resourceResolver, @NotNull String mediaRef) { Map<String, Object> map = new HashMap<>(); map.put(LinkNameConstants.PN_LINK_TYPE, ID); map.put(LinkNameConstants.PN_LINK_MEDIA_REF, mediaRef); return new SyntheticLinkResource(resourceResolver, map); }
[ "public", "static", "@", "NotNull", "Resource", "getSyntheticLinkResource", "(", "@", "NotNull", "ResourceResolver", "resourceResolver", ",", "@", "NotNull", "String", "mediaRef", ")", "{", "Map", "<", "String", ",", "Object", ">", "map", "=", "new", "HashMap", "<>", "(", ")", ";", "map", ".", "put", "(", "LinkNameConstants", ".", "PN_LINK_TYPE", ",", "ID", ")", ";", "map", ".", "put", "(", "LinkNameConstants", ".", "PN_LINK_MEDIA_REF", ",", "mediaRef", ")", ";", "return", "new", "SyntheticLinkResource", "(", "resourceResolver", ",", "map", ")", ";", "}" ]
Get synthetic link resource for this link type. @param resourceResolver Resource resolver @param mediaRef Media asset reference @return Synthetic link resource
[ "Get", "synthetic", "link", "resource", "for", "this", "link", "type", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/link/src/main/java/io/wcm/handler/link/type/MediaLinkType.java#L140-L145
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/BandwidthSchedulesInner.java
BandwidthSchedulesInner.createOrUpdateAsync
public Observable<BandwidthScheduleInner> createOrUpdateAsync(String deviceName, String name, String resourceGroupName, BandwidthScheduleInner parameters) { """ Creates or updates a bandwidth schedule. @param deviceName The device name. @param name The bandwidth schedule name which needs to be added/updated. @param resourceGroupName The resource group name. @param parameters The bandwidth schedule to be added or updated. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, parameters).map(new Func1<ServiceResponse<BandwidthScheduleInner>, BandwidthScheduleInner>() { @Override public BandwidthScheduleInner call(ServiceResponse<BandwidthScheduleInner> response) { return response.body(); } }); }
java
public Observable<BandwidthScheduleInner> createOrUpdateAsync(String deviceName, String name, String resourceGroupName, BandwidthScheduleInner parameters) { return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, parameters).map(new Func1<ServiceResponse<BandwidthScheduleInner>, BandwidthScheduleInner>() { @Override public BandwidthScheduleInner call(ServiceResponse<BandwidthScheduleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BandwidthScheduleInner", ">", "createOrUpdateAsync", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ",", "BandwidthScheduleInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "deviceName", ",", "name", ",", "resourceGroupName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "BandwidthScheduleInner", ">", ",", "BandwidthScheduleInner", ">", "(", ")", "{", "@", "Override", "public", "BandwidthScheduleInner", "call", "(", "ServiceResponse", "<", "BandwidthScheduleInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a bandwidth schedule. @param deviceName The device name. @param name The bandwidth schedule name which needs to be added/updated. @param resourceGroupName The resource group name. @param parameters The bandwidth schedule to be added or updated. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "bandwidth", "schedule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/BandwidthSchedulesInner.java#L351-L358
datasalt/pangool
core/src/main/java/com/datasalt/pangool/io/Mutator.java
Mutator.superSetOf
public static Schema superSetOf(String newName, Schema schema, Field... newFields) { """ Creates a superset of the input Schema, taking all the Fields in the input schema and adding some new ones. The new fields are fully specified in a Field class. The name of the schema is also specified as a parameter. """ List<Field> newSchema = new ArrayList<Field>(); newSchema.addAll(schema.getFields()); for(Field newField: newFields) { newSchema.add(newField); } return new Schema(newName, newSchema); }
java
public static Schema superSetOf(String newName, Schema schema, Field... newFields) { List<Field> newSchema = new ArrayList<Field>(); newSchema.addAll(schema.getFields()); for(Field newField: newFields) { newSchema.add(newField); } return new Schema(newName, newSchema); }
[ "public", "static", "Schema", "superSetOf", "(", "String", "newName", ",", "Schema", "schema", ",", "Field", "...", "newFields", ")", "{", "List", "<", "Field", ">", "newSchema", "=", "new", "ArrayList", "<", "Field", ">", "(", ")", ";", "newSchema", ".", "addAll", "(", "schema", ".", "getFields", "(", ")", ")", ";", "for", "(", "Field", "newField", ":", "newFields", ")", "{", "newSchema", ".", "add", "(", "newField", ")", ";", "}", "return", "new", "Schema", "(", "newName", ",", "newSchema", ")", ";", "}" ]
Creates a superset of the input Schema, taking all the Fields in the input schema and adding some new ones. The new fields are fully specified in a Field class. The name of the schema is also specified as a parameter.
[ "Creates", "a", "superset", "of", "the", "input", "Schema", "taking", "all", "the", "Fields", "in", "the", "input", "schema", "and", "adding", "some", "new", "ones", ".", "The", "new", "fields", "are", "fully", "specified", "in", "a", "Field", "class", ".", "The", "name", "of", "the", "schema", "is", "also", "specified", "as", "a", "parameter", "." ]
train
https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/io/Mutator.java#L82-L89
aol/cyclops
cyclops/src/main/java/cyclops/function/Predicates.java
Predicates.valuePresent
public static <T> Predicate<T> valuePresent() { """ <pre> {@code import static cyclops2.function.Predicates.valuePresent; Seq.of(Maybe.ofNullable(null),Maybe.just(1),null) .filter(valuePresent()); //Seq[Maybe[1]] } </pre> @return A Predicate that checks if it's input is a cyclops2-react Value (which also contains a present value) """ return t -> t instanceof Value ? ((Value) t).toMaybe() .isPresent() : false; }
java
public static <T> Predicate<T> valuePresent() { return t -> t instanceof Value ? ((Value) t).toMaybe() .isPresent() : false; }
[ "public", "static", "<", "T", ">", "Predicate", "<", "T", ">", "valuePresent", "(", ")", "{", "return", "t", "->", "t", "instanceof", "Value", "?", "(", "(", "Value", ")", "t", ")", ".", "toMaybe", "(", ")", ".", "isPresent", "(", ")", ":", "false", ";", "}" ]
<pre> {@code import static cyclops2.function.Predicates.valuePresent; Seq.of(Maybe.ofNullable(null),Maybe.just(1),null) .filter(valuePresent()); //Seq[Maybe[1]] } </pre> @return A Predicate that checks if it's input is a cyclops2-react Value (which also contains a present value)
[ "<pre", ">", "{", "@code", "import", "static", "cyclops2", ".", "function", ".", "Predicates", ".", "valuePresent", ";" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/Predicates.java#L119-L123
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/AggarwalYuEvolutionary.java
AggarwalYuEvolutionary.run
public OutlierResult run(Database database, Relation<V> relation) { """ Performs the evolutionary algorithm on the given database. @param database Database @param relation Relation @return Result """ final int dbsize = relation.size(); ArrayList<ArrayList<DBIDs>> ranges = buildRanges(relation); Heap<Individuum>.UnorderedIter individuums = (new EvolutionarySearch(relation, ranges, m, rnd.getSingleThreadedRandom())).run(); WritableDoubleDataStore outlierScore = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_STATIC); for(; individuums.valid(); individuums.advance()) { DBIDs ids = computeSubspaceForGene(individuums.get().getGene(), ranges); double sparsityC = sparsity(ids.size(), dbsize, k, phi); for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { double prev = outlierScore.doubleValue(iter); if(Double.isNaN(prev) || sparsityC < prev) { outlierScore.putDouble(iter, sparsityC); } } } DoubleMinMax minmax = new DoubleMinMax(); for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { double val = outlierScore.doubleValue(iditer); if(Double.isNaN(val)) { outlierScore.putDouble(iditer, val = 0.); } minmax.put(val); } DoubleRelation scoreResult = new MaterializedDoubleRelation("AggarwalYuEvolutionary", "aggarwal-yu-outlier", outlierScore, relation.getDBIDs()); OutlierScoreMeta meta = new InvertedOutlierScoreMeta(minmax.getMin(), minmax.getMax(), Double.NEGATIVE_INFINITY, 0.0); return new OutlierResult(meta, scoreResult); }
java
public OutlierResult run(Database database, Relation<V> relation) { final int dbsize = relation.size(); ArrayList<ArrayList<DBIDs>> ranges = buildRanges(relation); Heap<Individuum>.UnorderedIter individuums = (new EvolutionarySearch(relation, ranges, m, rnd.getSingleThreadedRandom())).run(); WritableDoubleDataStore outlierScore = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_STATIC); for(; individuums.valid(); individuums.advance()) { DBIDs ids = computeSubspaceForGene(individuums.get().getGene(), ranges); double sparsityC = sparsity(ids.size(), dbsize, k, phi); for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { double prev = outlierScore.doubleValue(iter); if(Double.isNaN(prev) || sparsityC < prev) { outlierScore.putDouble(iter, sparsityC); } } } DoubleMinMax minmax = new DoubleMinMax(); for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { double val = outlierScore.doubleValue(iditer); if(Double.isNaN(val)) { outlierScore.putDouble(iditer, val = 0.); } minmax.put(val); } DoubleRelation scoreResult = new MaterializedDoubleRelation("AggarwalYuEvolutionary", "aggarwal-yu-outlier", outlierScore, relation.getDBIDs()); OutlierScoreMeta meta = new InvertedOutlierScoreMeta(minmax.getMin(), minmax.getMax(), Double.NEGATIVE_INFINITY, 0.0); return new OutlierResult(meta, scoreResult); }
[ "public", "OutlierResult", "run", "(", "Database", "database", ",", "Relation", "<", "V", ">", "relation", ")", "{", "final", "int", "dbsize", "=", "relation", ".", "size", "(", ")", ";", "ArrayList", "<", "ArrayList", "<", "DBIDs", ">", ">", "ranges", "=", "buildRanges", "(", "relation", ")", ";", "Heap", "<", "Individuum", ">", ".", "UnorderedIter", "individuums", "=", "(", "new", "EvolutionarySearch", "(", "relation", ",", "ranges", ",", "m", ",", "rnd", ".", "getSingleThreadedRandom", "(", ")", ")", ")", ".", "run", "(", ")", ";", "WritableDoubleDataStore", "outlierScore", "=", "DataStoreUtil", ".", "makeDoubleStorage", "(", "relation", ".", "getDBIDs", "(", ")", ",", "DataStoreFactory", ".", "HINT_HOT", "|", "DataStoreFactory", ".", "HINT_STATIC", ")", ";", "for", "(", ";", "individuums", ".", "valid", "(", ")", ";", "individuums", ".", "advance", "(", ")", ")", "{", "DBIDs", "ids", "=", "computeSubspaceForGene", "(", "individuums", ".", "get", "(", ")", ".", "getGene", "(", ")", ",", "ranges", ")", ";", "double", "sparsityC", "=", "sparsity", "(", "ids", ".", "size", "(", ")", ",", "dbsize", ",", "k", ",", "phi", ")", ";", "for", "(", "DBIDIter", "iter", "=", "ids", ".", "iter", "(", ")", ";", "iter", ".", "valid", "(", ")", ";", "iter", ".", "advance", "(", ")", ")", "{", "double", "prev", "=", "outlierScore", ".", "doubleValue", "(", "iter", ")", ";", "if", "(", "Double", ".", "isNaN", "(", "prev", ")", "||", "sparsityC", "<", "prev", ")", "{", "outlierScore", ".", "putDouble", "(", "iter", ",", "sparsityC", ")", ";", "}", "}", "}", "DoubleMinMax", "minmax", "=", "new", "DoubleMinMax", "(", ")", ";", "for", "(", "DBIDIter", "iditer", "=", "relation", ".", "iterDBIDs", "(", ")", ";", "iditer", ".", "valid", "(", ")", ";", "iditer", ".", "advance", "(", ")", ")", "{", "double", "val", "=", "outlierScore", ".", "doubleValue", "(", "iditer", ")", ";", "if", "(", "Double", ".", "isNaN", "(", "val", ")", ")", "{", "outlierScore", ".", "putDouble", "(", "iditer", ",", "val", "=", "0.", ")", ";", "}", "minmax", ".", "put", "(", "val", ")", ";", "}", "DoubleRelation", "scoreResult", "=", "new", "MaterializedDoubleRelation", "(", "\"AggarwalYuEvolutionary\"", ",", "\"aggarwal-yu-outlier\"", ",", "outlierScore", ",", "relation", ".", "getDBIDs", "(", ")", ")", ";", "OutlierScoreMeta", "meta", "=", "new", "InvertedOutlierScoreMeta", "(", "minmax", ".", "getMin", "(", ")", ",", "minmax", ".", "getMax", "(", ")", ",", "Double", ".", "NEGATIVE_INFINITY", ",", "0.0", ")", ";", "return", "new", "OutlierResult", "(", "meta", ",", "scoreResult", ")", ";", "}" ]
Performs the evolutionary algorithm on the given database. @param database Database @param relation Relation @return Result
[ "Performs", "the", "evolutionary", "algorithm", "on", "the", "given", "database", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/AggarwalYuEvolutionary.java#L133-L162
Domo42/saga-lib
saga-lib/src/main/java/com/codebullets/sagalib/processing/invocation/SagaExecutionErrorsException.java
SagaExecutionErrorsException.rethrowOrThrowIfMultiple
public static void rethrowOrThrowIfMultiple(final String message, final Collection<Exception> errors) throws Exception { """ Checks the provided errors list for the number of instances. If no error is reported does nothing. In case of a single error the original exception is thrown, in case multiple errors, encapsulate the list into a new thrown {@link SagaExecutionErrorsException} @throws Exception Throws the original exception or a new {@link SagaExecutionErrorsException} """ int exceptionsCount = errors.size(); switch (exceptionsCount) { case 0: // no error -> do nothing break; case 1: // single error -> rethrow original exception throw errors.iterator().next(); default: throw new SagaExecutionErrorsException(message, errors); } }
java
public static void rethrowOrThrowIfMultiple(final String message, final Collection<Exception> errors) throws Exception { int exceptionsCount = errors.size(); switch (exceptionsCount) { case 0: // no error -> do nothing break; case 1: // single error -> rethrow original exception throw errors.iterator().next(); default: throw new SagaExecutionErrorsException(message, errors); } }
[ "public", "static", "void", "rethrowOrThrowIfMultiple", "(", "final", "String", "message", ",", "final", "Collection", "<", "Exception", ">", "errors", ")", "throws", "Exception", "{", "int", "exceptionsCount", "=", "errors", ".", "size", "(", ")", ";", "switch", "(", "exceptionsCount", ")", "{", "case", "0", ":", "// no error -> do nothing", "break", ";", "case", "1", ":", "// single error -> rethrow original exception", "throw", "errors", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "default", ":", "throw", "new", "SagaExecutionErrorsException", "(", "message", ",", "errors", ")", ";", "}", "}" ]
Checks the provided errors list for the number of instances. If no error is reported does nothing. In case of a single error the original exception is thrown, in case multiple errors, encapsulate the list into a new thrown {@link SagaExecutionErrorsException} @throws Exception Throws the original exception or a new {@link SagaExecutionErrorsException}
[ "Checks", "the", "provided", "errors", "list", "for", "the", "number", "of", "instances", ".", "If", "no", "error", "is", "reported", "does", "nothing", ".", "In", "case", "of", "a", "single", "error", "the", "original", "exception", "is", "thrown", "in", "case", "multiple", "errors", "encapsulate", "the", "list", "into", "a", "new", "thrown", "{", "@link", "SagaExecutionErrorsException", "}" ]
train
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/invocation/SagaExecutionErrorsException.java#L73-L85
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastDeserializer.java
FastDeserializer.readString
public String readString() throws IOException { """ Read a string in the standard VoltDB way. That is, four bytes of length info followed by the bytes of characters encoded in UTF-8. @return The String value read from the stream. @throws IOException Rethrows any IOExceptions. """ final int len = readInt(); // check for null string if (len == VoltType.NULL_STRING_LENGTH) { return null; } if (len < VoltType.NULL_STRING_LENGTH) { throw new IOException("String length is negative " + len); } if (len > buffer.remaining()) { throw new IOException("String length is bigger than total buffer " + len); } // now assume not null final byte[] strbytes = new byte[len]; readFully(strbytes); return new String(strbytes, Constants.UTF8ENCODING); }
java
public String readString() throws IOException { final int len = readInt(); // check for null string if (len == VoltType.NULL_STRING_LENGTH) { return null; } if (len < VoltType.NULL_STRING_LENGTH) { throw new IOException("String length is negative " + len); } if (len > buffer.remaining()) { throw new IOException("String length is bigger than total buffer " + len); } // now assume not null final byte[] strbytes = new byte[len]; readFully(strbytes); return new String(strbytes, Constants.UTF8ENCODING); }
[ "public", "String", "readString", "(", ")", "throws", "IOException", "{", "final", "int", "len", "=", "readInt", "(", ")", ";", "// check for null string", "if", "(", "len", "==", "VoltType", ".", "NULL_STRING_LENGTH", ")", "{", "return", "null", ";", "}", "if", "(", "len", "<", "VoltType", ".", "NULL_STRING_LENGTH", ")", "{", "throw", "new", "IOException", "(", "\"String length is negative \"", "+", "len", ")", ";", "}", "if", "(", "len", ">", "buffer", ".", "remaining", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"String length is bigger than total buffer \"", "+", "len", ")", ";", "}", "// now assume not null", "final", "byte", "[", "]", "strbytes", "=", "new", "byte", "[", "len", "]", ";", "readFully", "(", "strbytes", ")", ";", "return", "new", "String", "(", "strbytes", ",", "Constants", ".", "UTF8ENCODING", ")", ";", "}" ]
Read a string in the standard VoltDB way. That is, four bytes of length info followed by the bytes of characters encoded in UTF-8. @return The String value read from the stream. @throws IOException Rethrows any IOExceptions.
[ "Read", "a", "string", "in", "the", "standard", "VoltDB", "way", ".", "That", "is", "four", "bytes", "of", "length", "info", "followed", "by", "the", "bytes", "of", "characters", "encoded", "in", "UTF", "-", "8", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastDeserializer.java#L182-L201
alkacon/opencms-core
src/org/opencms/site/xmlsitemap/CmsXmlSitemapGenerator.java
CmsXmlSitemapGenerator.getLocale
private Locale getLocale(CmsResource resource, List<CmsProperty> propertyList) { """ Gets the locale to use for the given resource.<p> @param resource the resource @param propertyList the properties of the resource @return the locale to use for the given resource """ return OpenCms.getLocaleManager().getDefaultLocale(m_guestCms, m_guestCms.getSitePath(resource)); }
java
private Locale getLocale(CmsResource resource, List<CmsProperty> propertyList) { return OpenCms.getLocaleManager().getDefaultLocale(m_guestCms, m_guestCms.getSitePath(resource)); }
[ "private", "Locale", "getLocale", "(", "CmsResource", "resource", ",", "List", "<", "CmsProperty", ">", "propertyList", ")", "{", "return", "OpenCms", ".", "getLocaleManager", "(", ")", ".", "getDefaultLocale", "(", "m_guestCms", ",", "m_guestCms", ".", "getSitePath", "(", "resource", ")", ")", ";", "}" ]
Gets the locale to use for the given resource.<p> @param resource the resource @param propertyList the properties of the resource @return the locale to use for the given resource
[ "Gets", "the", "locale", "to", "use", "for", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/xmlsitemap/CmsXmlSitemapGenerator.java#L753-L756
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/text/RtfSection.java
RtfSection.updateIndentation
private void updateIndentation(float indentLeft, float indentRight, float indentContent) { """ Updates the left, right and content indentation of all RtfParagraph and RtfSection elements that this RtfSection contains. @param indentLeft The left indentation to add. @param indentRight The right indentation to add. @param indentContent The content indentation to add. """ if(this.title != null) { this.title.setIndentLeft((int) (this.title.getIndentLeft() + indentLeft * RtfElement.TWIPS_FACTOR)); this.title.setIndentRight((int) (this.title.getIndentRight() + indentRight * RtfElement.TWIPS_FACTOR)); } for(int i = 0; i < this.items.size(); i++) { RtfBasicElement rtfElement = (RtfBasicElement) this.items.get(i); if(rtfElement instanceof RtfSection) { ((RtfSection) rtfElement).updateIndentation(indentLeft + indentContent, indentRight, 0); } else if(rtfElement instanceof RtfParagraph) { ((RtfParagraph) rtfElement).setIndentLeft((int) (((RtfParagraph) rtfElement).getIndentLeft() + (indentLeft + indentContent) * RtfElement.TWIPS_FACTOR)); ((RtfParagraph) rtfElement).setIndentRight((int) (((RtfParagraph) rtfElement).getIndentRight() + indentRight * RtfElement.TWIPS_FACTOR)); } } }
java
private void updateIndentation(float indentLeft, float indentRight, float indentContent) { if(this.title != null) { this.title.setIndentLeft((int) (this.title.getIndentLeft() + indentLeft * RtfElement.TWIPS_FACTOR)); this.title.setIndentRight((int) (this.title.getIndentRight() + indentRight * RtfElement.TWIPS_FACTOR)); } for(int i = 0; i < this.items.size(); i++) { RtfBasicElement rtfElement = (RtfBasicElement) this.items.get(i); if(rtfElement instanceof RtfSection) { ((RtfSection) rtfElement).updateIndentation(indentLeft + indentContent, indentRight, 0); } else if(rtfElement instanceof RtfParagraph) { ((RtfParagraph) rtfElement).setIndentLeft((int) (((RtfParagraph) rtfElement).getIndentLeft() + (indentLeft + indentContent) * RtfElement.TWIPS_FACTOR)); ((RtfParagraph) rtfElement).setIndentRight((int) (((RtfParagraph) rtfElement).getIndentRight() + indentRight * RtfElement.TWIPS_FACTOR)); } } }
[ "private", "void", "updateIndentation", "(", "float", "indentLeft", ",", "float", "indentRight", ",", "float", "indentContent", ")", "{", "if", "(", "this", ".", "title", "!=", "null", ")", "{", "this", ".", "title", ".", "setIndentLeft", "(", "(", "int", ")", "(", "this", ".", "title", ".", "getIndentLeft", "(", ")", "+", "indentLeft", "*", "RtfElement", ".", "TWIPS_FACTOR", ")", ")", ";", "this", ".", "title", ".", "setIndentRight", "(", "(", "int", ")", "(", "this", ".", "title", ".", "getIndentRight", "(", ")", "+", "indentRight", "*", "RtfElement", ".", "TWIPS_FACTOR", ")", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "items", ".", "size", "(", ")", ";", "i", "++", ")", "{", "RtfBasicElement", "rtfElement", "=", "(", "RtfBasicElement", ")", "this", ".", "items", ".", "get", "(", "i", ")", ";", "if", "(", "rtfElement", "instanceof", "RtfSection", ")", "{", "(", "(", "RtfSection", ")", "rtfElement", ")", ".", "updateIndentation", "(", "indentLeft", "+", "indentContent", ",", "indentRight", ",", "0", ")", ";", "}", "else", "if", "(", "rtfElement", "instanceof", "RtfParagraph", ")", "{", "(", "(", "RtfParagraph", ")", "rtfElement", ")", ".", "setIndentLeft", "(", "(", "int", ")", "(", "(", "(", "RtfParagraph", ")", "rtfElement", ")", ".", "getIndentLeft", "(", ")", "+", "(", "indentLeft", "+", "indentContent", ")", "*", "RtfElement", ".", "TWIPS_FACTOR", ")", ")", ";", "(", "(", "RtfParagraph", ")", "rtfElement", ")", ".", "setIndentRight", "(", "(", "int", ")", "(", "(", "(", "RtfParagraph", ")", "rtfElement", ")", ".", "getIndentRight", "(", ")", "+", "indentRight", "*", "RtfElement", ".", "TWIPS_FACTOR", ")", ")", ";", "}", "}", "}" ]
Updates the left, right and content indentation of all RtfParagraph and RtfSection elements that this RtfSection contains. @param indentLeft The left indentation to add. @param indentRight The right indentation to add. @param indentContent The content indentation to add.
[ "Updates", "the", "left", "right", "and", "content", "indentation", "of", "all", "RtfParagraph", "and", "RtfSection", "elements", "that", "this", "RtfSection", "contains", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/text/RtfSection.java#L183-L197
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/AbstractFormBuilder.java
AbstractFormBuilder.createLabelFor
protected JLabel createLabelFor(String fieldName, JComponent component) { """ Create a label for the property. @param fieldName the name of the property. @param component the component of the property which is related to the label. @return a {@link JLabel} for the property. """ JLabel label = getComponentFactory().createLabel(""); getFormModel().getFieldFace(fieldName).configure(label); label.setLabelFor(component); FormComponentInterceptor interceptor = getFormComponentInterceptor(); if (interceptor != null) { interceptor.processLabel(fieldName, label); } return label; }
java
protected JLabel createLabelFor(String fieldName, JComponent component) { JLabel label = getComponentFactory().createLabel(""); getFormModel().getFieldFace(fieldName).configure(label); label.setLabelFor(component); FormComponentInterceptor interceptor = getFormComponentInterceptor(); if (interceptor != null) { interceptor.processLabel(fieldName, label); } return label; }
[ "protected", "JLabel", "createLabelFor", "(", "String", "fieldName", ",", "JComponent", "component", ")", "{", "JLabel", "label", "=", "getComponentFactory", "(", ")", ".", "createLabel", "(", "\"\"", ")", ";", "getFormModel", "(", ")", ".", "getFieldFace", "(", "fieldName", ")", ".", "configure", "(", "label", ")", ";", "label", ".", "setLabelFor", "(", "component", ")", ";", "FormComponentInterceptor", "interceptor", "=", "getFormComponentInterceptor", "(", ")", ";", "if", "(", "interceptor", "!=", "null", ")", "{", "interceptor", ".", "processLabel", "(", "fieldName", ",", "label", ")", ";", "}", "return", "label", ";", "}" ]
Create a label for the property. @param fieldName the name of the property. @param component the component of the property which is related to the label. @return a {@link JLabel} for the property.
[ "Create", "a", "label", "for", "the", "property", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/AbstractFormBuilder.java#L184-L195
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java
CachedTSDBService.constructMetricQueryKey
private String constructMetricQueryKey(Long startTimeStampBoundary, Metric metric, MetricQuery query) { """ Constructs a cache key from start time stamp boundary, returned metric tags and metric query. @param startTimeStampBoundary The start time stamp boundary. @param metric The metric to construct the cache key for. @param query The query to use to construct the cache key. @return The cache key. """ StringBuilder sb = new StringBuilder(); sb.append(startTimeStampBoundary).append(":"); sb.append(query.getNamespace()).append(":"); sb.append(query.getScope()).append(":"); sb.append(query.getMetric()).append(":"); Map<String, String> treeMap = new TreeMap<>(); treeMap.putAll(metric.getTags()); sb.append(treeMap).append(":"); sb.append(query.getAggregator()).append(":"); sb.append(query.getDownsampler()).append(":"); sb.append(query.getDownsamplingPeriod()); return sb.toString(); }
java
private String constructMetricQueryKey(Long startTimeStampBoundary, Metric metric, MetricQuery query) { StringBuilder sb = new StringBuilder(); sb.append(startTimeStampBoundary).append(":"); sb.append(query.getNamespace()).append(":"); sb.append(query.getScope()).append(":"); sb.append(query.getMetric()).append(":"); Map<String, String> treeMap = new TreeMap<>(); treeMap.putAll(metric.getTags()); sb.append(treeMap).append(":"); sb.append(query.getAggregator()).append(":"); sb.append(query.getDownsampler()).append(":"); sb.append(query.getDownsamplingPeriod()); return sb.toString(); }
[ "private", "String", "constructMetricQueryKey", "(", "Long", "startTimeStampBoundary", ",", "Metric", "metric", ",", "MetricQuery", "query", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "startTimeStampBoundary", ")", ".", "append", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "query", ".", "getNamespace", "(", ")", ")", ".", "append", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "query", ".", "getScope", "(", ")", ")", ".", "append", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "query", ".", "getMetric", "(", ")", ")", ".", "append", "(", "\":\"", ")", ";", "Map", "<", "String", ",", "String", ">", "treeMap", "=", "new", "TreeMap", "<>", "(", ")", ";", "treeMap", ".", "putAll", "(", "metric", ".", "getTags", "(", ")", ")", ";", "sb", ".", "append", "(", "treeMap", ")", ".", "append", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "query", ".", "getAggregator", "(", ")", ")", ".", "append", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "query", ".", "getDownsampler", "(", ")", ")", ".", "append", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "query", ".", "getDownsamplingPeriod", "(", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Constructs a cache key from start time stamp boundary, returned metric tags and metric query. @param startTimeStampBoundary The start time stamp boundary. @param metric The metric to construct the cache key for. @param query The query to use to construct the cache key. @return The cache key.
[ "Constructs", "a", "cache", "key", "from", "start", "time", "stamp", "boundary", "returned", "metric", "tags", "and", "metric", "query", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java#L280-L296
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructor.java
MapperConstructor.isNullSetting
private boolean isNullSetting(boolean makeDest,MappingType mtd,MappingType mts,StringBuilder result) { """ if it is a null setting returns the null mapping @param makeDest true if destination is a new instance @param mtd mapping type of destination @param mts mapping type of source @param result StringBuilder used for mapping @return true if operation is a null setting, false otherwise """ if( makeDest && (mtd == ALL_FIELDS||mtd == ONLY_VALUED_FIELDS) && mts == ONLY_NULL_FIELDS){ result.append(" "+stringOfSetDestination+"(null);"+newLine); return true; } return false; }
java
private boolean isNullSetting(boolean makeDest,MappingType mtd,MappingType mts,StringBuilder result){ if( makeDest && (mtd == ALL_FIELDS||mtd == ONLY_VALUED_FIELDS) && mts == ONLY_NULL_FIELDS){ result.append(" "+stringOfSetDestination+"(null);"+newLine); return true; } return false; }
[ "private", "boolean", "isNullSetting", "(", "boolean", "makeDest", ",", "MappingType", "mtd", ",", "MappingType", "mts", ",", "StringBuilder", "result", ")", "{", "if", "(", "makeDest", "&&", "(", "mtd", "==", "ALL_FIELDS", "||", "mtd", "==", "ONLY_VALUED_FIELDS", ")", "&&", "mts", "==", "ONLY_NULL_FIELDS", ")", "{", "result", ".", "append", "(", "\" \"", "+", "stringOfSetDestination", "+", "\"(null);\"", "+", "newLine", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
if it is a null setting returns the null mapping @param makeDest true if destination is a new instance @param mtd mapping type of destination @param mts mapping type of source @param result StringBuilder used for mapping @return true if operation is a null setting, false otherwise
[ "if", "it", "is", "a", "null", "setting", "returns", "the", "null", "mapping" ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructor.java#L206-L214
francisdb/serviceloader-maven-plugin
src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java
ServiceloaderMojo.loadServiceClasses
private List<Class<?>> loadServiceClasses(ClassLoader loader) throws MojoExecutionException { """ Loads all interfaces using the provided ClassLoader @param loader the classloader @return thi List of Interface classes @throws MojoExecutionException is the interfaces are not interfaces or can not be found on the classpath """ List<Class<?>> serviceClasses = new ArrayList<Class<?>>(); for (String serviceClassName : getServices()) { try { Class<?> serviceClass = loader.loadClass(serviceClassName); serviceClasses.add(serviceClass); } catch (ClassNotFoundException ex) { throw new MojoExecutionException("Could not load class: " + serviceClassName, ex); } } return serviceClasses; }
java
private List<Class<?>> loadServiceClasses(ClassLoader loader) throws MojoExecutionException { List<Class<?>> serviceClasses = new ArrayList<Class<?>>(); for (String serviceClassName : getServices()) { try { Class<?> serviceClass = loader.loadClass(serviceClassName); serviceClasses.add(serviceClass); } catch (ClassNotFoundException ex) { throw new MojoExecutionException("Could not load class: " + serviceClassName, ex); } } return serviceClasses; }
[ "private", "List", "<", "Class", "<", "?", ">", ">", "loadServiceClasses", "(", "ClassLoader", "loader", ")", "throws", "MojoExecutionException", "{", "List", "<", "Class", "<", "?", ">", ">", "serviceClasses", "=", "new", "ArrayList", "<", "Class", "<", "?", ">", ">", "(", ")", ";", "for", "(", "String", "serviceClassName", ":", "getServices", "(", ")", ")", "{", "try", "{", "Class", "<", "?", ">", "serviceClass", "=", "loader", ".", "loadClass", "(", "serviceClassName", ")", ";", "serviceClasses", ".", "add", "(", "serviceClass", ")", ";", "}", "catch", "(", "ClassNotFoundException", "ex", ")", "{", "throw", "new", "MojoExecutionException", "(", "\"Could not load class: \"", "+", "serviceClassName", ",", "ex", ")", ";", "}", "}", "return", "serviceClasses", ";", "}" ]
Loads all interfaces using the provided ClassLoader @param loader the classloader @return thi List of Interface classes @throws MojoExecutionException is the interfaces are not interfaces or can not be found on the classpath
[ "Loads", "all", "interfaces", "using", "the", "provided", "ClassLoader" ]
train
https://github.com/francisdb/serviceloader-maven-plugin/blob/521a467ed5c00636749f6c6531be85ddf296565e/src/main/java/eu/somatik/maven/serviceloader/ServiceloaderMojo.java#L178-L190
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/Record.java
Record.getField
public BaseField getField(String strTableName, int iFieldSeq) // Lookup this field { """ Get this field in the table/record. @param strTableName the name of the table this field is in. @param iFieldSeq The sequence of the field in the record. @return The field. """ if (this.getRecord(strTableName) != this) return null; return this.getField(iFieldSeq); }
java
public BaseField getField(String strTableName, int iFieldSeq) // Lookup this field { if (this.getRecord(strTableName) != this) return null; return this.getField(iFieldSeq); }
[ "public", "BaseField", "getField", "(", "String", "strTableName", ",", "int", "iFieldSeq", ")", "// Lookup this field", "{", "if", "(", "this", ".", "getRecord", "(", "strTableName", ")", "!=", "this", ")", "return", "null", ";", "return", "this", ".", "getField", "(", "iFieldSeq", ")", ";", "}" ]
Get this field in the table/record. @param strTableName the name of the table this field is in. @param iFieldSeq The sequence of the field in the record. @return The field.
[ "Get", "this", "field", "in", "the", "table", "/", "record", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L1003-L1008
auth0/Auth0.Android
auth0/src/main/java/com/auth0/android/provider/PermissionHandler.java
PermissionHandler.areAllPermissionsGranted
public boolean areAllPermissionsGranted(@NonNull Activity activity, @NonNull String[] permissions) { """ Checks if the given Android Manifest Permissions have been granted by the user to this application before. @param activity the caller activity @param permissions to check availability for @return true if all the Android Manifest Permissions are currently granted, false otherwise. """ for (String p : permissions) { if (!isPermissionGranted(activity, p)) { return false; } } return true; }
java
public boolean areAllPermissionsGranted(@NonNull Activity activity, @NonNull String[] permissions) { for (String p : permissions) { if (!isPermissionGranted(activity, p)) { return false; } } return true; }
[ "public", "boolean", "areAllPermissionsGranted", "(", "@", "NonNull", "Activity", "activity", ",", "@", "NonNull", "String", "[", "]", "permissions", ")", "{", "for", "(", "String", "p", ":", "permissions", ")", "{", "if", "(", "!", "isPermissionGranted", "(", "activity", ",", "p", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Checks if the given Android Manifest Permissions have been granted by the user to this application before. @param activity the caller activity @param permissions to check availability for @return true if all the Android Manifest Permissions are currently granted, false otherwise.
[ "Checks", "if", "the", "given", "Android", "Manifest", "Permissions", "have", "been", "granted", "by", "the", "user", "to", "this", "application", "before", "." ]
train
https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/provider/PermissionHandler.java#L67-L74