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
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/ByteArrayUtil.java
ByteArrayUtil.getBytesIntValue
public static int getBytesIntValue(byte[] bytes, int offset, int length) { """ Retrieves the integer value of a subarray of bytes. The values are considered little endian. The subarray is determined by offset and length. <p> Presumes the bytes to be not null and the length must be between 1 and 4 inclusive. The length of bytes must be larger than or equal to length + offset. @param bytes the little endian byte array that shall be converted to int @param offset the index to start reading the integer value from @param length the number of bytes used to convert to int @return int value """ assert length <= 4 && length > 0; assert bytes != null && bytes.length >= length + offset; byte[] value = Arrays.copyOfRange(bytes, offset, offset + length); return bytesToInt(value); }
java
public static int getBytesIntValue(byte[] bytes, int offset, int length) { assert length <= 4 && length > 0; assert bytes != null && bytes.length >= length + offset; byte[] value = Arrays.copyOfRange(bytes, offset, offset + length); return bytesToInt(value); }
[ "public", "static", "int", "getBytesIntValue", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "length", ")", "{", "assert", "length", "<=", "4", "&&", "length", ">", "0", ";", "assert", "bytes", "!=", "null", "&&", "bytes", ".", "length", ">=", "length", "+", "offset", ";", "byte", "[", "]", "value", "=", "Arrays", ".", "copyOfRange", "(", "bytes", ",", "offset", ",", "offset", "+", "length", ")", ";", "return", "bytesToInt", "(", "value", ")", ";", "}" ]
Retrieves the integer value of a subarray of bytes. The values are considered little endian. The subarray is determined by offset and length. <p> Presumes the bytes to be not null and the length must be between 1 and 4 inclusive. The length of bytes must be larger than or equal to length + offset. @param bytes the little endian byte array that shall be converted to int @param offset the index to start reading the integer value from @param length the number of bytes used to convert to int @return int value
[ "Retrieves", "the", "integer", "value", "of", "a", "subarray", "of", "bytes", ".", "The", "values", "are", "considered", "little", "endian", ".", "The", "subarray", "is", "determined", "by", "offset", "and", "length", ".", "<p", ">", "Presumes", "the", "bytes", "to", "be", "not", "null", "and", "the", "length", "must", "be", "between", "1", "and", "4", "inclusive", ".", "The", "length", "of", "bytes", "must", "be", "larger", "than", "or", "equal", "to", "length", "+", "offset", "." ]
train
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/ByteArrayUtil.java#L75-L80
ManfredTremmel/gwt-bean-validators
gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/Assert.java
Assert.isInstanceOf
@GwtIncompatible("incompatible method") public static void isInstanceOf(final Class<?> type, @Nullable final Object obj) { """ Assert that the provided object is an instance of the provided class. <pre class="code"> Assert.instanceOf(Foo.class, foo); </pre> @param type the type to check against @param obj the object to check @throws IllegalArgumentException if the object is not an instance of type """ Assert.isInstanceOf(type, obj, ""); }
java
@GwtIncompatible("incompatible method") public static void isInstanceOf(final Class<?> type, @Nullable final Object obj) { Assert.isInstanceOf(type, obj, ""); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "void", "isInstanceOf", "(", "final", "Class", "<", "?", ">", "type", ",", "@", "Nullable", "final", "Object", "obj", ")", "{", "Assert", ".", "isInstanceOf", "(", "type", ",", "obj", ",", "\"\"", ")", ";", "}" ]
Assert that the provided object is an instance of the provided class. <pre class="code"> Assert.instanceOf(Foo.class, foo); </pre> @param type the type to check against @param obj the object to check @throws IllegalArgumentException if the object is not an instance of type
[ "Assert", "that", "the", "provided", "object", "is", "an", "instance", "of", "the", "provided", "class", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/Assert.java#L653-L656
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/WordUtils.java
WordUtils.containsAllWords
public static boolean containsAllWords(final CharSequence word, final CharSequence... words) { """ <p>Checks if the String contains all words in the given array.</p> <p> A {@code null} String will return {@code false}. A {@code null}, zero length search array or if one element of array is null will return {@code false}. </p> <pre> WordUtils.containsAllWords(null, *) = false WordUtils.containsAllWords("", *) = false WordUtils.containsAllWords(*, null) = false WordUtils.containsAllWords(*, []) = false WordUtils.containsAllWords("abcd", "ab", "cd") = false WordUtils.containsAllWords("abc def", "def", "abc") = true </pre> @param word The CharSequence to check, may be null @param words The array of String words to search for, may be null @return {@code true} if all search words are found, {@code false} otherwise @since 3.5 """ if (StringUtils.isEmpty(word) || ArrayUtils.isEmpty(words)) { return false; } for (final CharSequence w : words) { if (StringUtils.isBlank(w)) { return false; } final RegExp p = RegExp.compile(".*\\b" + w + "\\b.*"); MatchResult m = p.exec(word.toString()); if (m == null || m.getGroupCount() == 0) { return false; } } return true; }
java
public static boolean containsAllWords(final CharSequence word, final CharSequence... words) { if (StringUtils.isEmpty(word) || ArrayUtils.isEmpty(words)) { return false; } for (final CharSequence w : words) { if (StringUtils.isBlank(w)) { return false; } final RegExp p = RegExp.compile(".*\\b" + w + "\\b.*"); MatchResult m = p.exec(word.toString()); if (m == null || m.getGroupCount() == 0) { return false; } } return true; }
[ "public", "static", "boolean", "containsAllWords", "(", "final", "CharSequence", "word", ",", "final", "CharSequence", "...", "words", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "word", ")", "||", "ArrayUtils", ".", "isEmpty", "(", "words", ")", ")", "{", "return", "false", ";", "}", "for", "(", "final", "CharSequence", "w", ":", "words", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "w", ")", ")", "{", "return", "false", ";", "}", "final", "RegExp", "p", "=", "RegExp", ".", "compile", "(", "\".*\\\\b\"", "+", "w", "+", "\"\\\\b.*\"", ")", ";", "MatchResult", "m", "=", "p", ".", "exec", "(", "word", ".", "toString", "(", ")", ")", ";", "if", "(", "m", "==", "null", "||", "m", ".", "getGroupCount", "(", ")", "==", "0", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
<p>Checks if the String contains all words in the given array.</p> <p> A {@code null} String will return {@code false}. A {@code null}, zero length search array or if one element of array is null will return {@code false}. </p> <pre> WordUtils.containsAllWords(null, *) = false WordUtils.containsAllWords("", *) = false WordUtils.containsAllWords(*, null) = false WordUtils.containsAllWords(*, []) = false WordUtils.containsAllWords("abcd", "ab", "cd") = false WordUtils.containsAllWords("abc def", "def", "abc") = true </pre> @param word The CharSequence to check, may be null @param words The array of String words to search for, may be null @return {@code true} if all search words are found, {@code false} otherwise @since 3.5
[ "<p", ">", "Checks", "if", "the", "String", "contains", "all", "words", "in", "the", "given", "array", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/WordUtils.java#L718-L733
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java
ProcessGroovyMethods.consumeProcessErrorStream
public static Thread consumeProcessErrorStream(Process self, Appendable error) { """ Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer. The processed stream data is appended to the supplied Appendable. A new Thread is started, so this method will return immediately. @param self a Process @param error an Appendable to capture the process stderr @return the Thread @since 1.7.5 """ Thread thread = new Thread(new TextDumper(self.getErrorStream(), error)); thread.start(); return thread; }
java
public static Thread consumeProcessErrorStream(Process self, Appendable error) { Thread thread = new Thread(new TextDumper(self.getErrorStream(), error)); thread.start(); return thread; }
[ "public", "static", "Thread", "consumeProcessErrorStream", "(", "Process", "self", ",", "Appendable", "error", ")", "{", "Thread", "thread", "=", "new", "Thread", "(", "new", "TextDumper", "(", "self", ".", "getErrorStream", "(", ")", ",", "error", ")", ")", ";", "thread", ".", "start", "(", ")", ";", "return", "thread", ";", "}" ]
Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer. The processed stream data is appended to the supplied Appendable. A new Thread is started, so this method will return immediately. @param self a Process @param error an Appendable to capture the process stderr @return the Thread @since 1.7.5
[ "Gets", "the", "error", "stream", "from", "a", "process", "and", "reads", "it", "to", "keep", "the", "process", "from", "blocking", "due", "to", "a", "full", "buffer", ".", "The", "processed", "stream", "data", "is", "appended", "to", "the", "supplied", "Appendable", ".", "A", "new", "Thread", "is", "started", "so", "this", "method", "will", "return", "immediately", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java#L300-L304
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java
LambdaDslObject.minArrayLike
public LambdaDslObject minArrayLike(String name, Integer size, PactDslJsonRootValue value, int numberExamples) { """ Attribute that is an array of values with a minimum size that are not objects where each item must match the following example @param name field name @param size minimum size of the array @param value Value to use to match each item @param numberExamples number of examples to generate """ object.minArrayLike(name, size, value, numberExamples); return this; }
java
public LambdaDslObject minArrayLike(String name, Integer size, PactDslJsonRootValue value, int numberExamples) { object.minArrayLike(name, size, value, numberExamples); return this; }
[ "public", "LambdaDslObject", "minArrayLike", "(", "String", "name", ",", "Integer", "size", ",", "PactDslJsonRootValue", "value", ",", "int", "numberExamples", ")", "{", "object", ".", "minArrayLike", "(", "name", ",", "size", ",", "value", ",", "numberExamples", ")", ";", "return", "this", ";", "}" ]
Attribute that is an array of values with a minimum size that are not objects where each item must match the following example @param name field name @param size minimum size of the array @param value Value to use to match each item @param numberExamples number of examples to generate
[ "Attribute", "that", "is", "an", "array", "of", "values", "with", "a", "minimum", "size", "that", "are", "not", "objects", "where", "each", "item", "must", "match", "the", "following", "example" ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L470-L473
rhiot/rhiot
gateway/components/camel-webcam/src/main/java/io/rhiot/gateway/camel/webcam/WebcamComponent.java
WebcamComponent.getWebcam
public Webcam getWebcam(String name, Dimension dimension) { """ Returns the webcam by name, null if not found. @param name webcam name @return webcam instance """ if (name == null) { return getWebcam(dimension); } Webcam webcam = webcams.get(name); openWebcam(webcam, dimension); return webcam; }
java
public Webcam getWebcam(String name, Dimension dimension) { if (name == null) { return getWebcam(dimension); } Webcam webcam = webcams.get(name); openWebcam(webcam, dimension); return webcam; }
[ "public", "Webcam", "getWebcam", "(", "String", "name", ",", "Dimension", "dimension", ")", "{", "if", "(", "name", "==", "null", ")", "{", "return", "getWebcam", "(", "dimension", ")", ";", "}", "Webcam", "webcam", "=", "webcams", ".", "get", "(", "name", ")", ";", "openWebcam", "(", "webcam", ",", "dimension", ")", ";", "return", "webcam", ";", "}" ]
Returns the webcam by name, null if not found. @param name webcam name @return webcam instance
[ "Returns", "the", "webcam", "by", "name", "null", "if", "not", "found", "." ]
train
https://github.com/rhiot/rhiot/blob/82eac10e365f72bab9248b8c3bd0ec9a2fc0a721/gateway/components/camel-webcam/src/main/java/io/rhiot/gateway/camel/webcam/WebcamComponent.java#L234-L242
Whiley/WhileyCompiler
src/main/java/wyil/interpreter/Interpreter.java
Interpreter.executeDebug
private Status executeDebug(Stmt.Debug stmt, CallStack frame, EnclosingScope scope) { """ Execute a Debug statement at a given point in the function or method body. This will write the provided string out to the debug stream. @param stmt --- Debug statement to executed @param frame --- The current stack frame @return """ // // FIXME: need to do something with this RValue.Array arr = executeExpression(ARRAY_T, stmt.getOperand(), frame); for (RValue item : arr.getElements()) { RValue.Int i = (RValue.Int) item; char c = (char) i.intValue(); debug.print(c); } // return Status.NEXT; }
java
private Status executeDebug(Stmt.Debug stmt, CallStack frame, EnclosingScope scope) { // // FIXME: need to do something with this RValue.Array arr = executeExpression(ARRAY_T, stmt.getOperand(), frame); for (RValue item : arr.getElements()) { RValue.Int i = (RValue.Int) item; char c = (char) i.intValue(); debug.print(c); } // return Status.NEXT; }
[ "private", "Status", "executeDebug", "(", "Stmt", ".", "Debug", "stmt", ",", "CallStack", "frame", ",", "EnclosingScope", "scope", ")", "{", "//", "// FIXME: need to do something with this", "RValue", ".", "Array", "arr", "=", "executeExpression", "(", "ARRAY_T", ",", "stmt", ".", "getOperand", "(", ")", ",", "frame", ")", ";", "for", "(", "RValue", "item", ":", "arr", ".", "getElements", "(", ")", ")", "{", "RValue", ".", "Int", "i", "=", "(", "RValue", ".", "Int", ")", "item", ";", "char", "c", "=", "(", "char", ")", "i", ".", "intValue", "(", ")", ";", "debug", ".", "print", "(", "c", ")", ";", "}", "//", "return", "Status", ".", "NEXT", ";", "}" ]
Execute a Debug statement at a given point in the function or method body. This will write the provided string out to the debug stream. @param stmt --- Debug statement to executed @param frame --- The current stack frame @return
[ "Execute", "a", "Debug", "statement", "at", "a", "given", "point", "in", "the", "function", "or", "method", "body", ".", "This", "will", "write", "the", "provided", "string", "out", "to", "the", "debug", "stream", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L312-L323
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java
ProxyDataSourceBuilder.logSlowQueryByCommons
public ProxyDataSourceBuilder logSlowQueryByCommons(long thresholdTime, TimeUnit timeUnit, CommonsLogLevel logLevel) { """ Register {@link CommonsSlowQueryListener}. @param thresholdTime slow query threshold time @param timeUnit slow query threshold time unit @param logLevel log level for commons @return builder @since 1.4.1 """ return logSlowQueryByCommons(thresholdTime, timeUnit, logLevel, null); }
java
public ProxyDataSourceBuilder logSlowQueryByCommons(long thresholdTime, TimeUnit timeUnit, CommonsLogLevel logLevel) { return logSlowQueryByCommons(thresholdTime, timeUnit, logLevel, null); }
[ "public", "ProxyDataSourceBuilder", "logSlowQueryByCommons", "(", "long", "thresholdTime", ",", "TimeUnit", "timeUnit", ",", "CommonsLogLevel", "logLevel", ")", "{", "return", "logSlowQueryByCommons", "(", "thresholdTime", ",", "timeUnit", ",", "logLevel", ",", "null", ")", ";", "}" ]
Register {@link CommonsSlowQueryListener}. @param thresholdTime slow query threshold time @param timeUnit slow query threshold time unit @param logLevel log level for commons @return builder @since 1.4.1
[ "Register", "{", "@link", "CommonsSlowQueryListener", "}", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java#L246-L248
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/resource/ClassPathResource.java
ClassPathResource.getInputStream
@Nullable public InputStream getInputStream () { """ Get the input stream for the specified path using automatic class loader handling. If no class loader was specified in the constructor, the class loaders are iterated in the following order: <ol> <li>Default class loader (usually the context class loader)</li> <li>The class loader of this class</li> <li>The system class loader</li> </ol> @return <code>null</code> if no such resource exists. """ final URL aURL = getAsURL (); return _getInputStream (m_sPath, aURL, getClassLoader ()); }
java
@Nullable public InputStream getInputStream () { final URL aURL = getAsURL (); return _getInputStream (m_sPath, aURL, getClassLoader ()); }
[ "@", "Nullable", "public", "InputStream", "getInputStream", "(", ")", "{", "final", "URL", "aURL", "=", "getAsURL", "(", ")", ";", "return", "_getInputStream", "(", "m_sPath", ",", "aURL", ",", "getClassLoader", "(", ")", ")", ";", "}" ]
Get the input stream for the specified path using automatic class loader handling. If no class loader was specified in the constructor, the class loaders are iterated in the following order: <ol> <li>Default class loader (usually the context class loader)</li> <li>The class loader of this class</li> <li>The system class loader</li> </ol> @return <code>null</code> if no such resource exists.
[ "Get", "the", "input", "stream", "for", "the", "specified", "path", "using", "automatic", "class", "loader", "handling", ".", "If", "no", "class", "loader", "was", "specified", "in", "the", "constructor", "the", "class", "loaders", "are", "iterated", "in", "the", "following", "order", ":", "<ol", ">", "<li", ">", "Default", "class", "loader", "(", "usually", "the", "context", "class", "loader", ")", "<", "/", "li", ">", "<li", ">", "The", "class", "loader", "of", "this", "class<", "/", "li", ">", "<li", ">", "The", "system", "class", "loader<", "/", "li", ">", "<", "/", "ol", ">" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/resource/ClassPathResource.java#L270-L275
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java
MarshallUtil.unmarshallCollectionUnbounded
public static <E, T extends Collection<E>> T unmarshallCollectionUnbounded(ObjectInput in, UnboundedCollectionBuilder<E, T> builder) throws IOException, ClassNotFoundException { """ Same as {@link #unmarshallCollection(ObjectInput, CollectionBuilder)}. <p> Used when the size of the {@link Collection} is not needed for it construction. @see #unmarshallCollection(ObjectInput, CollectionBuilder). """ final int size = unmarshallSize(in); if (size == NULL_VALUE) { return null; } T collection = Objects.requireNonNull(builder, "UnboundedCollectionBuilder must be non-null").build(); for (int i = 0; i < size; ++i) { //noinspection unchecked collection.add((E) in.readObject()); } return collection; }
java
public static <E, T extends Collection<E>> T unmarshallCollectionUnbounded(ObjectInput in, UnboundedCollectionBuilder<E, T> builder) throws IOException, ClassNotFoundException { final int size = unmarshallSize(in); if (size == NULL_VALUE) { return null; } T collection = Objects.requireNonNull(builder, "UnboundedCollectionBuilder must be non-null").build(); for (int i = 0; i < size; ++i) { //noinspection unchecked collection.add((E) in.readObject()); } return collection; }
[ "public", "static", "<", "E", ",", "T", "extends", "Collection", "<", "E", ">", ">", "T", "unmarshallCollectionUnbounded", "(", "ObjectInput", "in", ",", "UnboundedCollectionBuilder", "<", "E", ",", "T", ">", "builder", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "final", "int", "size", "=", "unmarshallSize", "(", "in", ")", ";", "if", "(", "size", "==", "NULL_VALUE", ")", "{", "return", "null", ";", "}", "T", "collection", "=", "Objects", ".", "requireNonNull", "(", "builder", ",", "\"UnboundedCollectionBuilder must be non-null\"", ")", ".", "build", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "++", "i", ")", "{", "//noinspection unchecked", "collection", ".", "add", "(", "(", "E", ")", "in", ".", "readObject", "(", ")", ")", ";", "}", "return", "collection", ";", "}" ]
Same as {@link #unmarshallCollection(ObjectInput, CollectionBuilder)}. <p> Used when the size of the {@link Collection} is not needed for it construction. @see #unmarshallCollection(ObjectInput, CollectionBuilder).
[ "Same", "as", "{", "@link", "#unmarshallCollection", "(", "ObjectInput", "CollectionBuilder", ")", "}", ".", "<p", ">", "Used", "when", "the", "size", "of", "the", "{", "@link", "Collection", "}", "is", "not", "needed", "for", "it", "construction", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java#L303-L314
line/armeria
core/src/main/java/com/linecorp/armeria/client/ClientDecorationBuilder.java
ClientDecorationBuilder.addRpc
public <T extends Client<I, O>, R extends Client<I, O>, I extends RpcRequest, O extends RpcResponse> ClientDecorationBuilder addRpc(Function<T, R> decorator) { """ Adds the specified RPC-level {@code decorator}. @param decorator the {@link Function} that transforms a {@link Client} to another @param <T> the type of the {@link Client} being decorated @param <R> the type of the {@link Client} produced by the {@code decorator} @param <I> the {@link Request} type of the {@link Client} being decorated @param <O> the {@link Response} type of the {@link Client} being decorated """ @SuppressWarnings("unchecked") final Function<Client<RpcRequest, RpcResponse>, Client<RpcRequest, RpcResponse>> cast = (Function<Client<RpcRequest, RpcResponse>, Client<RpcRequest, RpcResponse>>) decorator; return add0(RpcRequest.class, RpcResponse.class, cast); }
java
public <T extends Client<I, O>, R extends Client<I, O>, I extends RpcRequest, O extends RpcResponse> ClientDecorationBuilder addRpc(Function<T, R> decorator) { @SuppressWarnings("unchecked") final Function<Client<RpcRequest, RpcResponse>, Client<RpcRequest, RpcResponse>> cast = (Function<Client<RpcRequest, RpcResponse>, Client<RpcRequest, RpcResponse>>) decorator; return add0(RpcRequest.class, RpcResponse.class, cast); }
[ "public", "<", "T", "extends", "Client", "<", "I", ",", "O", ">", ",", "R", "extends", "Client", "<", "I", ",", "O", ">", ",", "I", "extends", "RpcRequest", ",", "O", "extends", "RpcResponse", ">", "ClientDecorationBuilder", "addRpc", "(", "Function", "<", "T", ",", "R", ">", "decorator", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "final", "Function", "<", "Client", "<", "RpcRequest", ",", "RpcResponse", ">", ",", "Client", "<", "RpcRequest", ",", "RpcResponse", ">", ">", "cast", "=", "(", "Function", "<", "Client", "<", "RpcRequest", ",", "RpcResponse", ">", ",", "Client", "<", "RpcRequest", ",", "RpcResponse", ">", ">", ")", "decorator", ";", "return", "add0", "(", "RpcRequest", ".", "class", ",", "RpcResponse", ".", "class", ",", "cast", ")", ";", "}" ]
Adds the specified RPC-level {@code decorator}. @param decorator the {@link Function} that transforms a {@link Client} to another @param <T> the type of the {@link Client} being decorated @param <R> the type of the {@link Client} produced by the {@code decorator} @param <I> the {@link Request} type of the {@link Client} being decorated @param <O> the {@link Response} type of the {@link Client} being decorated
[ "Adds", "the", "specified", "RPC", "-", "level", "{", "@code", "decorator", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/ClientDecorationBuilder.java#L117-L123
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/conditions/Conditions.java
Conditions.betweenExclusive
public static Between betweenExclusive( String property, int minimum, int maximum) { """ Returns a {@link ICondition condition} that is satisfied by a {@link org.cornutum.tcases.PropertySet} that contains between a specified minimum (exclusive) and maximum (exclusive) number of instances of a property. """ return new Between( moreThan( property, minimum), lessThan( property, maximum)); }
java
public static Between betweenExclusive( String property, int minimum, int maximum) { return new Between( moreThan( property, minimum), lessThan( property, maximum)); }
[ "public", "static", "Between", "betweenExclusive", "(", "String", "property", ",", "int", "minimum", ",", "int", "maximum", ")", "{", "return", "new", "Between", "(", "moreThan", "(", "property", ",", "minimum", ")", ",", "lessThan", "(", "property", ",", "maximum", ")", ")", ";", "}" ]
Returns a {@link ICondition condition} that is satisfied by a {@link org.cornutum.tcases.PropertySet} that contains between a specified minimum (exclusive) and maximum (exclusive) number of instances of a property.
[ "Returns", "a", "{" ]
train
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/conditions/Conditions.java#L145-L148
EXIficient/exificient-core
src/main/java/com/siemens/ct/exi/core/util/MethodsBag.java
MethodsBag.itosReverse
public final static int itosReverse(int i, int index, char[] buf) { """ Places characters representing the integer i into the character array buf in reverse order. Will fail if i &lt; 0 (zero) @param i integer @param index index @param buf character buffer @return number of written chars """ assert (i >= 0); int q, r; int posChar = index; // Generate two digits per iteration while (i >= 65536) { q = i / 100; // really: r = i - (q * 100); r = i - ((q << 6) + (q << 5) + (q << 2)); i = q; buf[posChar++] = DigitOnes[r]; buf[posChar++] = DigitTens[r]; } // Fall thru to fast mode for smaller numbers // assert(i <= 65536, i); for (;;) { q = (i * 52429) >>> (16 + 3); r = i - ((q << 3) + (q << 1)); // r = i-(q*10) ... buf[posChar++] = digits[r]; i = q; if (i == 0) break; } return (posChar - index); // number of written chars }
java
public final static int itosReverse(int i, int index, char[] buf) { assert (i >= 0); int q, r; int posChar = index; // Generate two digits per iteration while (i >= 65536) { q = i / 100; // really: r = i - (q * 100); r = i - ((q << 6) + (q << 5) + (q << 2)); i = q; buf[posChar++] = DigitOnes[r]; buf[posChar++] = DigitTens[r]; } // Fall thru to fast mode for smaller numbers // assert(i <= 65536, i); for (;;) { q = (i * 52429) >>> (16 + 3); r = i - ((q << 3) + (q << 1)); // r = i-(q*10) ... buf[posChar++] = digits[r]; i = q; if (i == 0) break; } return (posChar - index); // number of written chars }
[ "public", "final", "static", "int", "itosReverse", "(", "int", "i", ",", "int", "index", ",", "char", "[", "]", "buf", ")", "{", "assert", "(", "i", ">=", "0", ")", ";", "int", "q", ",", "r", ";", "int", "posChar", "=", "index", ";", "// Generate two digits per iteration", "while", "(", "i", ">=", "65536", ")", "{", "q", "=", "i", "/", "100", ";", "// really: r = i - (q * 100);", "r", "=", "i", "-", "(", "(", "q", "<<", "6", ")", "+", "(", "q", "<<", "5", ")", "+", "(", "q", "<<", "2", ")", ")", ";", "i", "=", "q", ";", "buf", "[", "posChar", "++", "]", "=", "DigitOnes", "[", "r", "]", ";", "buf", "[", "posChar", "++", "]", "=", "DigitTens", "[", "r", "]", ";", "}", "// Fall thru to fast mode for smaller numbers", "// assert(i <= 65536, i);", "for", "(", ";", ";", ")", "{", "q", "=", "(", "i", "*", "52429", ")", ">>>", "(", "16", "+", "3", ")", ";", "r", "=", "i", "-", "(", "(", "q", "<<", "3", ")", "+", "(", "q", "<<", "1", ")", ")", ";", "// r = i-(q*10) ...", "buf", "[", "posChar", "++", "]", "=", "digits", "[", "r", "]", ";", "i", "=", "q", ";", "if", "(", "i", "==", "0", ")", "break", ";", "}", "return", "(", "posChar", "-", "index", ")", ";", "// number of written chars", "}" ]
Places characters representing the integer i into the character array buf in reverse order. Will fail if i &lt; 0 (zero) @param i integer @param index index @param buf character buffer @return number of written chars
[ "Places", "characters", "representing", "the", "integer", "i", "into", "the", "character", "array", "buf", "in", "reverse", "order", "." ]
train
https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/util/MethodsBag.java#L454-L481
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/trento_p/net/Pipe.java
Pipe.setFeatureField
private Number setFeatureField( SimpleFeature pipe, String key ) { """ Check if there is the field in a SimpleFeature and if it's a Number. @param pipe the feature. @param key the key string of the field. @return the Number associated at this key. """ Number field = ((Number) pipe.getAttribute(key)); if (field == null) { pm.errorMessage(msg.message("trentoP.error.number") + key); throw new IllegalArgumentException(msg.message("trentoP.error.number") + key); } // return the Number return field; }
java
private Number setFeatureField( SimpleFeature pipe, String key ) { Number field = ((Number) pipe.getAttribute(key)); if (field == null) { pm.errorMessage(msg.message("trentoP.error.number") + key); throw new IllegalArgumentException(msg.message("trentoP.error.number") + key); } // return the Number return field; }
[ "private", "Number", "setFeatureField", "(", "SimpleFeature", "pipe", ",", "String", "key", ")", "{", "Number", "field", "=", "(", "(", "Number", ")", "pipe", ".", "getAttribute", "(", "key", ")", ")", ";", "if", "(", "field", "==", "null", ")", "{", "pm", ".", "errorMessage", "(", "msg", ".", "message", "(", "\"trentoP.error.number\"", ")", "+", "key", ")", ";", "throw", "new", "IllegalArgumentException", "(", "msg", ".", "message", "(", "\"trentoP.error.number\"", ")", "+", "key", ")", ";", "}", "// return the Number", "return", "field", ";", "}" ]
Check if there is the field in a SimpleFeature and if it's a Number. @param pipe the feature. @param key the key string of the field. @return the Number associated at this key.
[ "Check", "if", "there", "is", "the", "field", "in", "a", "SimpleFeature", "and", "if", "it", "s", "a", "Number", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/trento_p/net/Pipe.java#L576-L585
ldapchai/ldapchai
src/main/java/com/novell/ldapchai/impl/edir/NmasCrFactory.java
NmasCrFactory.readAssignedChallengeSet
public static ChallengeSet readAssignedChallengeSet( final ChaiUser theUser, final Locale locale ) throws ChaiUnavailableException, ChaiOperationException, ChaiValidationException { """ This method will first read the user's assigned password challenge set policy. @param theUser ChaiUser to read policy for @param locale Desired locale @return A valid ChallengeSet if found, otherwise null. @throws ChaiOperationException If there is an error during the operation @throws ChaiUnavailableException If the directory server(s) are unavailable @throws ChaiValidationException when there is a logical problem with the challenge set data, such as more randoms required then exist """ final ChaiPasswordPolicy passwordPolicy = theUser.getPasswordPolicy(); if ( passwordPolicy == null ) { LOGGER.trace( "user does not have an assigned password policy, return null for readAssignedChallengeSet()" ); return null; } return readAssignedChallengeSet( theUser.getChaiProvider(), passwordPolicy, locale ); }
java
public static ChallengeSet readAssignedChallengeSet( final ChaiUser theUser, final Locale locale ) throws ChaiUnavailableException, ChaiOperationException, ChaiValidationException { final ChaiPasswordPolicy passwordPolicy = theUser.getPasswordPolicy(); if ( passwordPolicy == null ) { LOGGER.trace( "user does not have an assigned password policy, return null for readAssignedChallengeSet()" ); return null; } return readAssignedChallengeSet( theUser.getChaiProvider(), passwordPolicy, locale ); }
[ "public", "static", "ChallengeSet", "readAssignedChallengeSet", "(", "final", "ChaiUser", "theUser", ",", "final", "Locale", "locale", ")", "throws", "ChaiUnavailableException", ",", "ChaiOperationException", ",", "ChaiValidationException", "{", "final", "ChaiPasswordPolicy", "passwordPolicy", "=", "theUser", ".", "getPasswordPolicy", "(", ")", ";", "if", "(", "passwordPolicy", "==", "null", ")", "{", "LOGGER", ".", "trace", "(", "\"user does not have an assigned password policy, return null for readAssignedChallengeSet()\"", ")", ";", "return", "null", ";", "}", "return", "readAssignedChallengeSet", "(", "theUser", ".", "getChaiProvider", "(", ")", ",", "passwordPolicy", ",", "locale", ")", ";", "}" ]
This method will first read the user's assigned password challenge set policy. @param theUser ChaiUser to read policy for @param locale Desired locale @return A valid ChallengeSet if found, otherwise null. @throws ChaiOperationException If there is an error during the operation @throws ChaiUnavailableException If the directory server(s) are unavailable @throws ChaiValidationException when there is a logical problem with the challenge set data, such as more randoms required then exist
[ "This", "method", "will", "first", "read", "the", "user", "s", "assigned", "password", "challenge", "set", "policy", "." ]
train
https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/impl/edir/NmasCrFactory.java#L164-L176
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/Context.java
Context.getConnection
public static Connection getConnection() throws EFapsException { """ Returns a opened connection resource. If a previous close connection resource already exists, this already existing connection resource is returned. @return opened connection resource @throws EFapsException if connection resource cannot be created """ Connection con = null; try { con = Context.DATASOURCE.getConnection(); con.setAutoCommit(false); } catch (final SQLException e) { throw new EFapsException(Context.class, "getConnection.SQLException", e); } return con; }
java
public static Connection getConnection() throws EFapsException { Connection con = null; try { con = Context.DATASOURCE.getConnection(); con.setAutoCommit(false); } catch (final SQLException e) { throw new EFapsException(Context.class, "getConnection.SQLException", e); } return con; }
[ "public", "static", "Connection", "getConnection", "(", ")", "throws", "EFapsException", "{", "Connection", "con", "=", "null", ";", "try", "{", "con", "=", "Context", ".", "DATASOURCE", ".", "getConnection", "(", ")", ";", "con", ".", "setAutoCommit", "(", "false", ")", ";", "}", "catch", "(", "final", "SQLException", "e", ")", "{", "throw", "new", "EFapsException", "(", "Context", ".", "class", ",", "\"getConnection.SQLException\"", ",", "e", ")", ";", "}", "return", "con", ";", "}" ]
Returns a opened connection resource. If a previous close connection resource already exists, this already existing connection resource is returned. @return opened connection resource @throws EFapsException if connection resource cannot be created
[ "Returns", "a", "opened", "connection", "resource", ".", "If", "a", "previous", "close", "connection", "resource", "already", "exists", "this", "already", "existing", "connection", "resource", "is", "returned", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/Context.java#L853-L864
olavloite/spanner-jdbc
src/main/java/nl/topicus/jdbc/util/Base64.java
Base64.encodeBytes
public static String encodeBytes(byte[] source, int off, int len, int options) { """ Encodes a byte array into Base64 notation. <p> Valid options: <pre> GZIP: gzip-compresses object before encoding it. DONT_BREAK_LINES: don't break lines at 76 characters <i>Note: Technically, this makes your encoding non-compliant.</i> </pre> <p> Example: <code>encodeBytes( myData, Base64.GZIP )</code> or <p> Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code> @param source The data to convert @param off Offset in array where conversion should begin @param len Length of data to convert @param options Specified options @return Base64 notation @see Base64#DONT_BREAK_LINES @since 2.0 """ // Isolate options int dontBreakLines = (options & DONT_BREAK_LINES); return encodeBytes(source, off, len, dontBreakLines == 0); }
java
public static String encodeBytes(byte[] source, int off, int len, int options) { // Isolate options int dontBreakLines = (options & DONT_BREAK_LINES); return encodeBytes(source, off, len, dontBreakLines == 0); }
[ "public", "static", "String", "encodeBytes", "(", "byte", "[", "]", "source", ",", "int", "off", ",", "int", "len", ",", "int", "options", ")", "{", "// Isolate options\r", "int", "dontBreakLines", "=", "(", "options", "&", "DONT_BREAK_LINES", ")", ";", "return", "encodeBytes", "(", "source", ",", "off", ",", "len", ",", "dontBreakLines", "==", "0", ")", ";", "}" ]
Encodes a byte array into Base64 notation. <p> Valid options: <pre> GZIP: gzip-compresses object before encoding it. DONT_BREAK_LINES: don't break lines at 76 characters <i>Note: Technically, this makes your encoding non-compliant.</i> </pre> <p> Example: <code>encodeBytes( myData, Base64.GZIP )</code> or <p> Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code> @param source The data to convert @param off Offset in array where conversion should begin @param len Length of data to convert @param options Specified options @return Base64 notation @see Base64#DONT_BREAK_LINES @since 2.0
[ "Encodes", "a", "byte", "array", "into", "Base64", "notation", ".", "<p", ">", "Valid", "options", ":" ]
train
https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/util/Base64.java#L351-L355
craftercms/core
src/main/java/org/craftercms/core/util/XmlUtils.java
XmlUtils.selectSingleNodeValue
public static String selectSingleNodeValue(Node node, String xpathQuery) { """ Executes the specified XPath query as a single node query, returning the text value of the resulting single node. """ Node resultNode = node.selectSingleNode(xpathQuery); if (resultNode != null) { return resultNode.getText(); } else { return null; } }
java
public static String selectSingleNodeValue(Node node, String xpathQuery) { Node resultNode = node.selectSingleNode(xpathQuery); if (resultNode != null) { return resultNode.getText(); } else { return null; } }
[ "public", "static", "String", "selectSingleNodeValue", "(", "Node", "node", ",", "String", "xpathQuery", ")", "{", "Node", "resultNode", "=", "node", ".", "selectSingleNode", "(", "xpathQuery", ")", ";", "if", "(", "resultNode", "!=", "null", ")", "{", "return", "resultNode", ".", "getText", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Executes the specified XPath query as a single node query, returning the text value of the resulting single node.
[ "Executes", "the", "specified", "XPath", "query", "as", "a", "single", "node", "query", "returning", "the", "text", "value", "of", "the", "resulting", "single", "node", "." ]
train
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/XmlUtils.java#L58-L65
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/annotation/AnnotationUtil.java
AnnotationUtil.areEqual
public static boolean areEqual(Object o1, Object o2) { """ Computes whether 2 annotation values are equal. @param o1 One object @param o2 Another object @return Whether both objects are equal """ return !o1.getClass().isArray() ? o1.equals(o2) : o1.getClass() == boolean[].class ? Arrays.equals((boolean[]) o1, (boolean[]) o2) : o1.getClass() == byte[].class ? Arrays.equals((byte[]) o1, (byte[]) o2) : o1.getClass() == char[].class ? Arrays.equals((char[]) o1, (char[]) o2) : o1.getClass() == double[].class ? Arrays.equals( (double[]) o1, (double[]) o2 ) : o1.getClass() == float[].class ? Arrays.equals( (float[]) o1, (float[]) o2 ) : o1.getClass() == int[].class ? Arrays.equals( (int[]) o1, (int[]) o2 ) : o1.getClass() == long[].class ? Arrays.equals( (long[]) o1, (long[]) o2 ) : o1.getClass() == short[].class ? Arrays.equals( (short[]) o1, (short[]) o2 ) : Arrays.equals( (Object[]) o1, (Object[]) o2 ); }
java
public static boolean areEqual(Object o1, Object o2) { return !o1.getClass().isArray() ? o1.equals(o2) : o1.getClass() == boolean[].class ? Arrays.equals((boolean[]) o1, (boolean[]) o2) : o1.getClass() == byte[].class ? Arrays.equals((byte[]) o1, (byte[]) o2) : o1.getClass() == char[].class ? Arrays.equals((char[]) o1, (char[]) o2) : o1.getClass() == double[].class ? Arrays.equals( (double[]) o1, (double[]) o2 ) : o1.getClass() == float[].class ? Arrays.equals( (float[]) o1, (float[]) o2 ) : o1.getClass() == int[].class ? Arrays.equals( (int[]) o1, (int[]) o2 ) : o1.getClass() == long[].class ? Arrays.equals( (long[]) o1, (long[]) o2 ) : o1.getClass() == short[].class ? Arrays.equals( (short[]) o1, (short[]) o2 ) : Arrays.equals( (Object[]) o1, (Object[]) o2 ); }
[ "public", "static", "boolean", "areEqual", "(", "Object", "o1", ",", "Object", "o2", ")", "{", "return", "!", "o1", ".", "getClass", "(", ")", ".", "isArray", "(", ")", "?", "o1", ".", "equals", "(", "o2", ")", ":", "o1", ".", "getClass", "(", ")", "==", "boolean", "[", "]", ".", "class", "?", "Arrays", ".", "equals", "(", "(", "boolean", "[", "]", ")", "o1", ",", "(", "boolean", "[", "]", ")", "o2", ")", ":", "o1", ".", "getClass", "(", ")", "==", "byte", "[", "]", ".", "class", "?", "Arrays", ".", "equals", "(", "(", "byte", "[", "]", ")", "o1", ",", "(", "byte", "[", "]", ")", "o2", ")", ":", "o1", ".", "getClass", "(", ")", "==", "char", "[", "]", ".", "class", "?", "Arrays", ".", "equals", "(", "(", "char", "[", "]", ")", "o1", ",", "(", "char", "[", "]", ")", "o2", ")", ":", "o1", ".", "getClass", "(", ")", "==", "double", "[", "]", ".", "class", "?", "Arrays", ".", "equals", "(", "(", "double", "[", "]", ")", "o1", ",", "(", "double", "[", "]", ")", "o2", ")", ":", "o1", ".", "getClass", "(", ")", "==", "float", "[", "]", ".", "class", "?", "Arrays", ".", "equals", "(", "(", "float", "[", "]", ")", "o1", ",", "(", "float", "[", "]", ")", "o2", ")", ":", "o1", ".", "getClass", "(", ")", "==", "int", "[", "]", ".", "class", "?", "Arrays", ".", "equals", "(", "(", "int", "[", "]", ")", "o1", ",", "(", "int", "[", "]", ")", "o2", ")", ":", "o1", ".", "getClass", "(", ")", "==", "long", "[", "]", ".", "class", "?", "Arrays", ".", "equals", "(", "(", "long", "[", "]", ")", "o1", ",", "(", "long", "[", "]", ")", "o2", ")", ":", "o1", ".", "getClass", "(", ")", "==", "short", "[", "]", ".", "class", "?", "Arrays", ".", "equals", "(", "(", "short", "[", "]", ")", "o1", ",", "(", "short", "[", "]", ")", "o2", ")", ":", "Arrays", ".", "equals", "(", "(", "Object", "[", "]", ")", "o1", ",", "(", "Object", "[", "]", ")", "o2", ")", ";", "}" ]
Computes whether 2 annotation values are equal. @param o1 One object @param o2 Another object @return Whether both objects are equal
[ "Computes", "whether", "2", "annotation", "values", "are", "equal", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/annotation/AnnotationUtil.java#L186-L216
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProjectApi.java
ProjectApi.getHook
public ProjectHook getHook(Object projectIdOrPath, Integer hookId) throws GitLabApiException { """ Get a specific hook for project. <pre><code>GET /projects/:id/hooks/:hook_id</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param hookId the ID of the hook to get @return the project hook for the specified project ID/hook ID pair @throws GitLabApiException if any exception occurs """ Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "hooks", hookId); return (response.readEntity(ProjectHook.class)); }
java
public ProjectHook getHook(Object projectIdOrPath, Integer hookId) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "hooks", hookId); return (response.readEntity(ProjectHook.class)); }
[ "public", "ProjectHook", "getHook", "(", "Object", "projectIdOrPath", ",", "Integer", "hookId", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"hooks\"", ",", "hookId", ")", ";", "return", "(", "response", ".", "readEntity", "(", "ProjectHook", ".", "class", ")", ")", ";", "}" ]
Get a specific hook for project. <pre><code>GET /projects/:id/hooks/:hook_id</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param hookId the ID of the hook to get @return the project hook for the specified project ID/hook ID pair @throws GitLabApiException if any exception occurs
[ "Get", "a", "specific", "hook", "for", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L1613-L1616
groupon/monsoon
impl/src/main/java/com/groupon/lex/metrics/misc/MonitorMonitor.java
MonitorMonitor.get_metrics_
private Map<MetricName, MetricValue> get_metrics_(DateTime now, Context ctx) { """ Get metrics for the monitor. @return All metrics for the monitor. """ final Consumer<Alert> alert_manager = ctx.getAlertManager(); final long failed_collections = registry_.getFailedCollections(); final boolean has_config = registry_.hasConfig(); final Optional<Duration> scrape_duration = registry_.getScrapeDuration(); final Optional<Duration> rule_eval_duration = registry_.getRuleEvalDuration(); final Optional<Duration> processor_duration = registry_.getProcessorDuration(); first_scrape_ts_.compareAndSet(null, now); // First time, register the timestamp. final Duration uptime = new Duration(first_scrape_ts_.get(), now); final Optional<DateTime> last_scrape = last_scrape_; last_scrape_ = Optional.of(now); final long metric_count = ctx.getTSData().getCurrentCollection().getTSValues().stream() .map(TimeSeriesValue::getMetrics) .collect(Collectors.summingLong(Map::size)); alert_manager.accept(new Alert(now, MONITOR_FAIL_ALERT, () -> "builtin rule", Optional.of(failed_collections != 0), MON_ALERT_DURATION, "builtin rule: some collectors failed", EMPTY_MAP)); alert_manager.accept(new Alert(now, HAS_CONFIG_ALERT, () -> "builtin rule", Optional.of(!has_config), Duration.ZERO, "builtin rule: monitor has no configuration file", EMPTY_MAP)); Map<MetricName, MetricValue> result = new HashMap<>(); result.put(FAILED_COLLECTIONS_METRIC, MetricValue.fromIntValue(failed_collections)); result.put(GROUP_COUNT_METRIC, MetricValue.fromIntValue(ctx.getTSData().getCurrentCollection().getGroups(x -> true).size())); result.put(METRIC_COUNT_METRIC, MetricValue.fromIntValue(metric_count)); result.put(CONFIG_PRESENT_METRIC, MetricValue.fromBoolean(has_config)); result.put(SCRAPE_DURATION, opt_duration_to_metricvalue_(scrape_duration)); result.put(RULE_EVAL_DURATION, opt_duration_to_metricvalue_(rule_eval_duration)); result.put(PROCESSOR_DURATION, opt_duration_to_metricvalue_(processor_duration)); result.put(UPTIME_DURATION, duration_to_metricvalue_(uptime)); result.put(SCRAPE_COUNT, MetricValue.fromIntValue(++scrape_count_)); result.put(SCRAPE_INTERVAL, opt_duration_to_metricvalue_(last_scrape.map(prev -> new Duration(prev, now)))); result.put(SCRAPE_TS, MetricValue.fromIntValue(now.getMillis())); return result; }
java
private Map<MetricName, MetricValue> get_metrics_(DateTime now, Context ctx) { final Consumer<Alert> alert_manager = ctx.getAlertManager(); final long failed_collections = registry_.getFailedCollections(); final boolean has_config = registry_.hasConfig(); final Optional<Duration> scrape_duration = registry_.getScrapeDuration(); final Optional<Duration> rule_eval_duration = registry_.getRuleEvalDuration(); final Optional<Duration> processor_duration = registry_.getProcessorDuration(); first_scrape_ts_.compareAndSet(null, now); // First time, register the timestamp. final Duration uptime = new Duration(first_scrape_ts_.get(), now); final Optional<DateTime> last_scrape = last_scrape_; last_scrape_ = Optional.of(now); final long metric_count = ctx.getTSData().getCurrentCollection().getTSValues().stream() .map(TimeSeriesValue::getMetrics) .collect(Collectors.summingLong(Map::size)); alert_manager.accept(new Alert(now, MONITOR_FAIL_ALERT, () -> "builtin rule", Optional.of(failed_collections != 0), MON_ALERT_DURATION, "builtin rule: some collectors failed", EMPTY_MAP)); alert_manager.accept(new Alert(now, HAS_CONFIG_ALERT, () -> "builtin rule", Optional.of(!has_config), Duration.ZERO, "builtin rule: monitor has no configuration file", EMPTY_MAP)); Map<MetricName, MetricValue> result = new HashMap<>(); result.put(FAILED_COLLECTIONS_METRIC, MetricValue.fromIntValue(failed_collections)); result.put(GROUP_COUNT_METRIC, MetricValue.fromIntValue(ctx.getTSData().getCurrentCollection().getGroups(x -> true).size())); result.put(METRIC_COUNT_METRIC, MetricValue.fromIntValue(metric_count)); result.put(CONFIG_PRESENT_METRIC, MetricValue.fromBoolean(has_config)); result.put(SCRAPE_DURATION, opt_duration_to_metricvalue_(scrape_duration)); result.put(RULE_EVAL_DURATION, opt_duration_to_metricvalue_(rule_eval_duration)); result.put(PROCESSOR_DURATION, opt_duration_to_metricvalue_(processor_duration)); result.put(UPTIME_DURATION, duration_to_metricvalue_(uptime)); result.put(SCRAPE_COUNT, MetricValue.fromIntValue(++scrape_count_)); result.put(SCRAPE_INTERVAL, opt_duration_to_metricvalue_(last_scrape.map(prev -> new Duration(prev, now)))); result.put(SCRAPE_TS, MetricValue.fromIntValue(now.getMillis())); return result; }
[ "private", "Map", "<", "MetricName", ",", "MetricValue", ">", "get_metrics_", "(", "DateTime", "now", ",", "Context", "ctx", ")", "{", "final", "Consumer", "<", "Alert", ">", "alert_manager", "=", "ctx", ".", "getAlertManager", "(", ")", ";", "final", "long", "failed_collections", "=", "registry_", ".", "getFailedCollections", "(", ")", ";", "final", "boolean", "has_config", "=", "registry_", ".", "hasConfig", "(", ")", ";", "final", "Optional", "<", "Duration", ">", "scrape_duration", "=", "registry_", ".", "getScrapeDuration", "(", ")", ";", "final", "Optional", "<", "Duration", ">", "rule_eval_duration", "=", "registry_", ".", "getRuleEvalDuration", "(", ")", ";", "final", "Optional", "<", "Duration", ">", "processor_duration", "=", "registry_", ".", "getProcessorDuration", "(", ")", ";", "first_scrape_ts_", ".", "compareAndSet", "(", "null", ",", "now", ")", ";", "// First time, register the timestamp.", "final", "Duration", "uptime", "=", "new", "Duration", "(", "first_scrape_ts_", ".", "get", "(", ")", ",", "now", ")", ";", "final", "Optional", "<", "DateTime", ">", "last_scrape", "=", "last_scrape_", ";", "last_scrape_", "=", "Optional", ".", "of", "(", "now", ")", ";", "final", "long", "metric_count", "=", "ctx", ".", "getTSData", "(", ")", ".", "getCurrentCollection", "(", ")", ".", "getTSValues", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "TimeSeriesValue", "::", "getMetrics", ")", ".", "collect", "(", "Collectors", ".", "summingLong", "(", "Map", "::", "size", ")", ")", ";", "alert_manager", ".", "accept", "(", "new", "Alert", "(", "now", ",", "MONITOR_FAIL_ALERT", ",", "(", ")", "->", "\"builtin rule\"", ",", "Optional", ".", "of", "(", "failed_collections", "!=", "0", ")", ",", "MON_ALERT_DURATION", ",", "\"builtin rule: some collectors failed\"", ",", "EMPTY_MAP", ")", ")", ";", "alert_manager", ".", "accept", "(", "new", "Alert", "(", "now", ",", "HAS_CONFIG_ALERT", ",", "(", ")", "->", "\"builtin rule\"", ",", "Optional", ".", "of", "(", "!", "has_config", ")", ",", "Duration", ".", "ZERO", ",", "\"builtin rule: monitor has no configuration file\"", ",", "EMPTY_MAP", ")", ")", ";", "Map", "<", "MetricName", ",", "MetricValue", ">", "result", "=", "new", "HashMap", "<>", "(", ")", ";", "result", ".", "put", "(", "FAILED_COLLECTIONS_METRIC", ",", "MetricValue", ".", "fromIntValue", "(", "failed_collections", ")", ")", ";", "result", ".", "put", "(", "GROUP_COUNT_METRIC", ",", "MetricValue", ".", "fromIntValue", "(", "ctx", ".", "getTSData", "(", ")", ".", "getCurrentCollection", "(", ")", ".", "getGroups", "(", "x", "->", "true", ")", ".", "size", "(", ")", ")", ")", ";", "result", ".", "put", "(", "METRIC_COUNT_METRIC", ",", "MetricValue", ".", "fromIntValue", "(", "metric_count", ")", ")", ";", "result", ".", "put", "(", "CONFIG_PRESENT_METRIC", ",", "MetricValue", ".", "fromBoolean", "(", "has_config", ")", ")", ";", "result", ".", "put", "(", "SCRAPE_DURATION", ",", "opt_duration_to_metricvalue_", "(", "scrape_duration", ")", ")", ";", "result", ".", "put", "(", "RULE_EVAL_DURATION", ",", "opt_duration_to_metricvalue_", "(", "rule_eval_duration", ")", ")", ";", "result", ".", "put", "(", "PROCESSOR_DURATION", ",", "opt_duration_to_metricvalue_", "(", "processor_duration", ")", ")", ";", "result", ".", "put", "(", "UPTIME_DURATION", ",", "duration_to_metricvalue_", "(", "uptime", ")", ")", ";", "result", ".", "put", "(", "SCRAPE_COUNT", ",", "MetricValue", ".", "fromIntValue", "(", "++", "scrape_count_", ")", ")", ";", "result", ".", "put", "(", "SCRAPE_INTERVAL", ",", "opt_duration_to_metricvalue_", "(", "last_scrape", ".", "map", "(", "prev", "->", "new", "Duration", "(", "prev", ",", "now", ")", ")", ")", ")", ";", "result", ".", "put", "(", "SCRAPE_TS", ",", "MetricValue", ".", "fromIntValue", "(", "now", ".", "getMillis", "(", ")", ")", ")", ";", "return", "result", ";", "}" ]
Get metrics for the monitor. @return All metrics for the monitor.
[ "Get", "metrics", "for", "the", "monitor", "." ]
train
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/misc/MonitorMonitor.java#L96-L129
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.listCustomPrebuiltModels
public List<CustomPrebuiltModel> listCustomPrebuiltModels(UUID appId, String versionId) { """ Gets all custom prebuilt models information of this application. @param appId The application ID. @param versionId The version 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 List&lt;CustomPrebuiltModel&gt; object if successful. """ return listCustomPrebuiltModelsWithServiceResponseAsync(appId, versionId).toBlocking().single().body(); }
java
public List<CustomPrebuiltModel> listCustomPrebuiltModels(UUID appId, String versionId) { return listCustomPrebuiltModelsWithServiceResponseAsync(appId, versionId).toBlocking().single().body(); }
[ "public", "List", "<", "CustomPrebuiltModel", ">", "listCustomPrebuiltModels", "(", "UUID", "appId", ",", "String", "versionId", ")", "{", "return", "listCustomPrebuiltModelsWithServiceResponseAsync", "(", "appId", ",", "versionId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets all custom prebuilt models information of this application. @param appId The application ID. @param versionId The version 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 List&lt;CustomPrebuiltModel&gt; object if successful.
[ "Gets", "all", "custom", "prebuilt", "models", "information", "of", "this", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L6064-L6066
docker-java/docker-java
src/main/java/com/github/dockerjava/core/command/WaitContainerResultCallback.java
WaitContainerResultCallback.awaitStatusCode
public Integer awaitStatusCode(long timeout, TimeUnit timeUnit) { """ Awaits the status code from the container. @throws DockerClientException if the wait operation fails. """ try { if (!awaitCompletion(timeout, timeUnit)) { throw new DockerClientException("Awaiting status code timeout."); } } catch (InterruptedException e) { throw new DockerClientException("Awaiting status code interrupted: ", e); } return getStatusCode(); }
java
public Integer awaitStatusCode(long timeout, TimeUnit timeUnit) { try { if (!awaitCompletion(timeout, timeUnit)) { throw new DockerClientException("Awaiting status code timeout."); } } catch (InterruptedException e) { throw new DockerClientException("Awaiting status code interrupted: ", e); } return getStatusCode(); }
[ "public", "Integer", "awaitStatusCode", "(", "long", "timeout", ",", "TimeUnit", "timeUnit", ")", "{", "try", "{", "if", "(", "!", "awaitCompletion", "(", "timeout", ",", "timeUnit", ")", ")", "{", "throw", "new", "DockerClientException", "(", "\"Awaiting status code timeout.\"", ")", ";", "}", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "DockerClientException", "(", "\"Awaiting status code interrupted: \"", ",", "e", ")", ";", "}", "return", "getStatusCode", "(", ")", ";", "}" ]
Awaits the status code from the container. @throws DockerClientException if the wait operation fails.
[ "Awaits", "the", "status", "code", "from", "the", "container", "." ]
train
https://github.com/docker-java/docker-java/blob/c5c89327108abdc50aa41d7711d4743b8bac75fe/src/main/java/com/github/dockerjava/core/command/WaitContainerResultCallback.java#L57-L67
liyiorg/weixin-popular
src/main/java/weixin/popular/api/BizwifiAPI.java
BizwifiAPI.barSet
public static BaseResult barSet(String accessToken, BarSet barSet) { """ 设置微信首页欢迎语 设置微信首页欢迎语,可选择“欢迎光临XXX”或“已连接XXXWiFi”,XXX为公众号名称或门店名称。 @param accessToken accessToken @param barSet barSet @return BaseResult """ return barSet(accessToken, JsonUtil.toJSONString(barSet)); }
java
public static BaseResult barSet(String accessToken, BarSet barSet) { return barSet(accessToken, JsonUtil.toJSONString(barSet)); }
[ "public", "static", "BaseResult", "barSet", "(", "String", "accessToken", ",", "BarSet", "barSet", ")", "{", "return", "barSet", "(", "accessToken", ",", "JsonUtil", ".", "toJSONString", "(", "barSet", ")", ")", ";", "}" ]
设置微信首页欢迎语 设置微信首页欢迎语,可选择“欢迎光临XXX”或“已连接XXXWiFi”,XXX为公众号名称或门店名称。 @param accessToken accessToken @param barSet barSet @return BaseResult
[ "设置微信首页欢迎语", "设置微信首页欢迎语,可选择“欢迎光临XXX”或“已连接XXXWiFi”,XXX为公众号名称或门店名称。" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L509-L511
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.closePolygonRing
public void closePolygonRing(List<LatLng> points) { """ Close the polygon ring (exterior or hole) points if needed @param points ring points @since 1.3.2 """ if (!PolyUtil.isClosedPolygon(points)) { LatLng first = points.get(0); points.add(new LatLng(first.latitude, first.longitude)); } }
java
public void closePolygonRing(List<LatLng> points) { if (!PolyUtil.isClosedPolygon(points)) { LatLng first = points.get(0); points.add(new LatLng(first.latitude, first.longitude)); } }
[ "public", "void", "closePolygonRing", "(", "List", "<", "LatLng", ">", "points", ")", "{", "if", "(", "!", "PolyUtil", ".", "isClosedPolygon", "(", "points", ")", ")", "{", "LatLng", "first", "=", "points", ".", "get", "(", "0", ")", ";", "points", ".", "add", "(", "new", "LatLng", "(", "first", ".", "latitude", ",", "first", ".", "longitude", ")", ")", ";", "}", "}" ]
Close the polygon ring (exterior or hole) points if needed @param points ring points @since 1.3.2
[ "Close", "the", "polygon", "ring", "(", "exterior", "or", "hole", ")", "points", "if", "needed" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L714-L719
redbox-mint/redbox
plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java
CurationManager.workflowCuration
private void workflowCuration(JsonSimple response, JsonSimple message) { """ Assess a workflow event to see how it effects curation @param response The response object @param message The incoming message """ String oid = message.getString(null, "oid"); if (!workflowCompleted(oid)) { return; } // Resolve relationships before we continue try { JSONArray relations = mapRelations(oid); // Unless there was an error, we should be good to go if (relations != null) { JsonObject request = createTask(response, oid, "curation-request"); if (!relations.isEmpty()) { request.put("relationships", relations); } } } catch (Exception ex) { log.error("Error processing relations: ", ex); return; } }
java
private void workflowCuration(JsonSimple response, JsonSimple message) { String oid = message.getString(null, "oid"); if (!workflowCompleted(oid)) { return; } // Resolve relationships before we continue try { JSONArray relations = mapRelations(oid); // Unless there was an error, we should be good to go if (relations != null) { JsonObject request = createTask(response, oid, "curation-request"); if (!relations.isEmpty()) { request.put("relationships", relations); } } } catch (Exception ex) { log.error("Error processing relations: ", ex); return; } }
[ "private", "void", "workflowCuration", "(", "JsonSimple", "response", ",", "JsonSimple", "message", ")", "{", "String", "oid", "=", "message", ".", "getString", "(", "null", ",", "\"oid\"", ")", ";", "if", "(", "!", "workflowCompleted", "(", "oid", ")", ")", "{", "return", ";", "}", "// Resolve relationships before we continue", "try", "{", "JSONArray", "relations", "=", "mapRelations", "(", "oid", ")", ";", "// Unless there was an error, we should be good to go", "if", "(", "relations", "!=", "null", ")", "{", "JsonObject", "request", "=", "createTask", "(", "response", ",", "oid", ",", "\"curation-request\"", ")", ";", "if", "(", "!", "relations", ".", "isEmpty", "(", ")", ")", "{", "request", ".", "put", "(", "\"relationships\"", ",", "relations", ")", ";", "}", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "log", ".", "error", "(", "\"Error processing relations: \"", ",", "ex", ")", ";", "return", ";", "}", "}" ]
Assess a workflow event to see how it effects curation @param response The response object @param message The incoming message
[ "Assess", "a", "workflow", "event", "to", "see", "how", "it", "effects", "curation" ]
train
https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java#L236-L258
js-lib-com/template.xhtml
src/main/java/js/template/xhtml/Content.java
Content.getObject
Object getObject(Object scope, String propertyPath) throws TemplateException { """ Retrieve content object. Delegates {@link #getValue(Object, String)} to obtain the requested value. If value is null warn the event; in any case return value. @param scope scope object, @param propertyPath object property path. @return content object or null. @throws TemplateException if requested value is undefined. """ Object object = getValue(scope, propertyPath); if(object == null) { warn(scope.getClass(), propertyPath); } return object; }
java
Object getObject(Object scope, String propertyPath) throws TemplateException { Object object = getValue(scope, propertyPath); if(object == null) { warn(scope.getClass(), propertyPath); } return object; }
[ "Object", "getObject", "(", "Object", "scope", ",", "String", "propertyPath", ")", "throws", "TemplateException", "{", "Object", "object", "=", "getValue", "(", "scope", ",", "propertyPath", ")", ";", "if", "(", "object", "==", "null", ")", "{", "warn", "(", "scope", ".", "getClass", "(", ")", ",", "propertyPath", ")", ";", "}", "return", "object", ";", "}" ]
Retrieve content object. Delegates {@link #getValue(Object, String)} to obtain the requested value. If value is null warn the event; in any case return value. @param scope scope object, @param propertyPath object property path. @return content object or null. @throws TemplateException if requested value is undefined.
[ "Retrieve", "content", "object", ".", "Delegates", "{", "@link", "#getValue", "(", "Object", "String", ")", "}", "to", "obtain", "the", "requested", "value", ".", "If", "value", "is", "null", "warn", "the", "event", ";", "in", "any", "case", "return", "value", "." ]
train
https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/Content.java#L140-L147
square/mortar
mortar/src/main/java/mortar/MortarScope.java
MortarScope.getService
public <T> T getService(String serviceName) { """ Returns the service associated with the given name. @throws IllegalArgumentException if no such service can be found @throws IllegalStateException if this scope is dead @see #hasService """ T service = findService(serviceName, true); if (service == null) { throw new IllegalArgumentException(format("No service found named \"%s\"", serviceName)); } return service; }
java
public <T> T getService(String serviceName) { T service = findService(serviceName, true); if (service == null) { throw new IllegalArgumentException(format("No service found named \"%s\"", serviceName)); } return service; }
[ "public", "<", "T", ">", "T", "getService", "(", "String", "serviceName", ")", "{", "T", "service", "=", "findService", "(", "serviceName", ",", "true", ")", ";", "if", "(", "service", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "format", "(", "\"No service found named \\\"%s\\\"\"", ",", "serviceName", ")", ")", ";", "}", "return", "service", ";", "}" ]
Returns the service associated with the given name. @throws IllegalArgumentException if no such service can be found @throws IllegalStateException if this scope is dead @see #hasService
[ "Returns", "the", "service", "associated", "with", "the", "given", "name", "." ]
train
https://github.com/square/mortar/blob/c968b99eb96ba56c47e29912c07841be8e2cf97a/mortar/src/main/java/mortar/MortarScope.java#L115-L122
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/StereoMatch.java
StereoMatch.checkTetrahedral
private boolean checkTetrahedral(int u, int[] mapping) { """ Verify the tetrahedral stereochemistry (clockwise/anticlockwise) of atom {@code u} is preserved in the target when the {@code mapping} is used. @param u tetrahedral index in the target @param mapping mapping of vertices @return the tetrahedral configuration is preserved """ int v = mapping[u]; if (targetTypes[v] != Type.Tetrahedral) return false; ITetrahedralChirality queryElement = (ITetrahedralChirality) queryElements[u]; ITetrahedralChirality targetElement = (ITetrahedralChirality) targetElements[v]; // access neighbors of each element, then map the query to the target int[] us = neighbors(queryElement, queryMap); int[] vs = neighbors(targetElement, targetMap); us = map(u, v, us, mapping); if (us == null) return false; int p = permutationParity(us) * parity(queryElement.getStereo()); int q = permutationParity(vs) * parity(targetElement.getStereo()); return p == q; }
java
private boolean checkTetrahedral(int u, int[] mapping) { int v = mapping[u]; if (targetTypes[v] != Type.Tetrahedral) return false; ITetrahedralChirality queryElement = (ITetrahedralChirality) queryElements[u]; ITetrahedralChirality targetElement = (ITetrahedralChirality) targetElements[v]; // access neighbors of each element, then map the query to the target int[] us = neighbors(queryElement, queryMap); int[] vs = neighbors(targetElement, targetMap); us = map(u, v, us, mapping); if (us == null) return false; int p = permutationParity(us) * parity(queryElement.getStereo()); int q = permutationParity(vs) * parity(targetElement.getStereo()); return p == q; }
[ "private", "boolean", "checkTetrahedral", "(", "int", "u", ",", "int", "[", "]", "mapping", ")", "{", "int", "v", "=", "mapping", "[", "u", "]", ";", "if", "(", "targetTypes", "[", "v", "]", "!=", "Type", ".", "Tetrahedral", ")", "return", "false", ";", "ITetrahedralChirality", "queryElement", "=", "(", "ITetrahedralChirality", ")", "queryElements", "[", "u", "]", ";", "ITetrahedralChirality", "targetElement", "=", "(", "ITetrahedralChirality", ")", "targetElements", "[", "v", "]", ";", "// access neighbors of each element, then map the query to the target", "int", "[", "]", "us", "=", "neighbors", "(", "queryElement", ",", "queryMap", ")", ";", "int", "[", "]", "vs", "=", "neighbors", "(", "targetElement", ",", "targetMap", ")", ";", "us", "=", "map", "(", "u", ",", "v", ",", "us", ",", "mapping", ")", ";", "if", "(", "us", "==", "null", ")", "return", "false", ";", "int", "p", "=", "permutationParity", "(", "us", ")", "*", "parity", "(", "queryElement", ".", "getStereo", "(", ")", ")", ";", "int", "q", "=", "permutationParity", "(", "vs", ")", "*", "parity", "(", "targetElement", ".", "getStereo", "(", ")", ")", ";", "return", "p", "==", "q", ";", "}" ]
Verify the tetrahedral stereochemistry (clockwise/anticlockwise) of atom {@code u} is preserved in the target when the {@code mapping} is used. @param u tetrahedral index in the target @param mapping mapping of vertices @return the tetrahedral configuration is preserved
[ "Verify", "the", "tetrahedral", "stereochemistry", "(", "clockwise", "/", "anticlockwise", ")", "of", "atom", "{", "@code", "u", "}", "is", "preserved", "in", "the", "target", "when", "the", "{", "@code", "mapping", "}", "is", "used", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/StereoMatch.java#L130-L148
nohana/Amalgam
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
CursorUtils.isNull
public static boolean isNull(Cursor cursor, String columnName) { """ Checks if the column value is null or not. @see android.database.Cursor#isNull(int). @see android.database.Cursor#getColumnIndex(String). @param cursor the cursor. @param columnName the column name. @return true if the column value is null. """ return cursor != null && cursor.isNull(cursor.getColumnIndex(columnName)); }
java
public static boolean isNull(Cursor cursor, String columnName) { return cursor != null && cursor.isNull(cursor.getColumnIndex(columnName)); }
[ "public", "static", "boolean", "isNull", "(", "Cursor", "cursor", ",", "String", "columnName", ")", "{", "return", "cursor", "!=", "null", "&&", "cursor", ".", "isNull", "(", "cursor", ".", "getColumnIndex", "(", "columnName", ")", ")", ";", "}" ]
Checks if the column value is null or not. @see android.database.Cursor#isNull(int). @see android.database.Cursor#getColumnIndex(String). @param cursor the cursor. @param columnName the column name. @return true if the column value is null.
[ "Checks", "if", "the", "column", "value", "is", "null", "or", "not", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L193-L196
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java
GeneratedDConnectionDaoImpl.queryByUpdatedDate
public Iterable<DConnection> queryByUpdatedDate(java.util.Date updatedDate) { """ query-by method for field updatedDate @param updatedDate the specified attribute @return an Iterable of DConnections for the specified updatedDate """ return queryByField(null, DConnectionMapper.Field.UPDATEDDATE.getFieldName(), updatedDate); }
java
public Iterable<DConnection> queryByUpdatedDate(java.util.Date updatedDate) { return queryByField(null, DConnectionMapper.Field.UPDATEDDATE.getFieldName(), updatedDate); }
[ "public", "Iterable", "<", "DConnection", ">", "queryByUpdatedDate", "(", "java", ".", "util", ".", "Date", "updatedDate", ")", "{", "return", "queryByField", "(", "null", ",", "DConnectionMapper", ".", "Field", ".", "UPDATEDDATE", ".", "getFieldName", "(", ")", ",", "updatedDate", ")", ";", "}" ]
query-by method for field updatedDate @param updatedDate the specified attribute @return an Iterable of DConnections for the specified updatedDate
[ "query", "-", "by", "method", "for", "field", "updatedDate" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L160-L162
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/widget/toast/MessageToast.java
MessageToast.addLinkLabel
public void addLinkLabel (String text, LinkLabel.LinkLabelListener labelListener) { """ Adds new link label below toast message. @param text link label text @param labelListener will be called upon label click. Note that toast won't be closed automatically so {@link Toast#fadeOut()} must be called """ LinkLabel label = new LinkLabel(text); label.setListener(labelListener); linkLabelTable.add(label).spaceRight(12); }
java
public void addLinkLabel (String text, LinkLabel.LinkLabelListener labelListener) { LinkLabel label = new LinkLabel(text); label.setListener(labelListener); linkLabelTable.add(label).spaceRight(12); }
[ "public", "void", "addLinkLabel", "(", "String", "text", ",", "LinkLabel", ".", "LinkLabelListener", "labelListener", ")", "{", "LinkLabel", "label", "=", "new", "LinkLabel", "(", "text", ")", ";", "label", ".", "setListener", "(", "labelListener", ")", ";", "linkLabelTable", ".", "add", "(", "label", ")", ".", "spaceRight", "(", "12", ")", ";", "}" ]
Adds new link label below toast message. @param text link label text @param labelListener will be called upon label click. Note that toast won't be closed automatically so {@link Toast#fadeOut()} must be called
[ "Adds", "new", "link", "label", "below", "toast", "message", "." ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/widget/toast/MessageToast.java#L44-L48
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ImplementationImpl.java
ImplementationImpl.newTransaction
public Transaction newTransaction() { """ Create a <code>Transaction</code> object and associate it with the current thread. @return The newly created <code>Transaction</code> instance. @see Transaction """ if ((getCurrentDatabase() == null)) { throw new DatabaseClosedException("Database is NULL, must have a DB in order to create a transaction"); } TransactionImpl tx = new TransactionImpl(this); try { getConfigurator().configure(tx); } catch (ConfigurationException e) { throw new ODMGRuntimeException("Error in configuration of TransactionImpl instance: " + e.getMessage()); } return tx; }
java
public Transaction newTransaction() { if ((getCurrentDatabase() == null)) { throw new DatabaseClosedException("Database is NULL, must have a DB in order to create a transaction"); } TransactionImpl tx = new TransactionImpl(this); try { getConfigurator().configure(tx); } catch (ConfigurationException e) { throw new ODMGRuntimeException("Error in configuration of TransactionImpl instance: " + e.getMessage()); } return tx; }
[ "public", "Transaction", "newTransaction", "(", ")", "{", "if", "(", "(", "getCurrentDatabase", "(", ")", "==", "null", ")", ")", "{", "throw", "new", "DatabaseClosedException", "(", "\"Database is NULL, must have a DB in order to create a transaction\"", ")", ";", "}", "TransactionImpl", "tx", "=", "new", "TransactionImpl", "(", "this", ")", ";", "try", "{", "getConfigurator", "(", ")", ".", "configure", "(", "tx", ")", ";", "}", "catch", "(", "ConfigurationException", "e", ")", "{", "throw", "new", "ODMGRuntimeException", "(", "\"Error in configuration of TransactionImpl instance: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "tx", ";", "}" ]
Create a <code>Transaction</code> object and associate it with the current thread. @return The newly created <code>Transaction</code> instance. @see Transaction
[ "Create", "a", "<code", ">", "Transaction<", "/", "code", ">", "object", "and", "associate", "it", "with", "the", "current", "thread", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ImplementationImpl.java#L144-L160
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/creational/builder/mapped/FileMappedKeyDirector.java
FileMappedKeyDirector.crawl
protected void crawl(File file, MappedKeyEngineer<K,V> engineer) { """ Director method to construct a document @param file the file the walk through @param engineer the mapped key engineer """ if (!file.exists()) { Debugger.println(file + " does not exist."); return; } if (file.isDirectory()) { File[] files = IO.listFiles(file, listPattern); for (int i = 0; i < files.length; i++) { //recursive if(!this.mustSkip(files[i])) crawl(files[i],engineer); } } else { try { engineer.construct(file.getPath(), this.constructMapToText(file.getPath())); crawledPaths.add(file.getPath()); } catch(NoDataFoundException e) { //print warning if found not Debugger.printWarn(e); } } }
java
protected void crawl(File file, MappedKeyEngineer<K,V> engineer) { if (!file.exists()) { Debugger.println(file + " does not exist."); return; } if (file.isDirectory()) { File[] files = IO.listFiles(file, listPattern); for (int i = 0; i < files.length; i++) { //recursive if(!this.mustSkip(files[i])) crawl(files[i],engineer); } } else { try { engineer.construct(file.getPath(), this.constructMapToText(file.getPath())); crawledPaths.add(file.getPath()); } catch(NoDataFoundException e) { //print warning if found not Debugger.printWarn(e); } } }
[ "protected", "void", "crawl", "(", "File", "file", ",", "MappedKeyEngineer", "<", "K", ",", "V", ">", "engineer", ")", "{", "if", "(", "!", "file", ".", "exists", "(", ")", ")", "{", "Debugger", ".", "println", "(", "file", "+", "\" does not exist.\"", ")", ";", "return", ";", "}", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "File", "[", "]", "files", "=", "IO", ".", "listFiles", "(", "file", ",", "listPattern", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "files", ".", "length", ";", "i", "++", ")", "{", "//recursive\r", "if", "(", "!", "this", ".", "mustSkip", "(", "files", "[", "i", "]", ")", ")", "crawl", "(", "files", "[", "i", "]", ",", "engineer", ")", ";", "}", "}", "else", "{", "try", "{", "engineer", ".", "construct", "(", "file", ".", "getPath", "(", ")", ",", "this", ".", "constructMapToText", "(", "file", ".", "getPath", "(", ")", ")", ")", ";", "crawledPaths", ".", "add", "(", "file", ".", "getPath", "(", ")", ")", ";", "}", "catch", "(", "NoDataFoundException", "e", ")", "{", "//print warning if found not \r", "Debugger", ".", "printWarn", "(", "e", ")", ";", "}", "}", "}" ]
Director method to construct a document @param file the file the walk through @param engineer the mapped key engineer
[ "Director", "method", "to", "construct", "a", "document" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/creational/builder/mapped/FileMappedKeyDirector.java#L40-L72
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
QueryReferenceBroker.retrieveProxyCollections
public void retrieveProxyCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException { """ Retrieve all Collection attributes of a given instance, and make all of the Proxy Collections @param newObj the instance to be loaded or refreshed @param cld the ClassDescriptor of the instance @param forced if set to true, loading is forced even if cld differs """ doRetrieveCollections(newObj, cld, forced, true); }
java
public void retrieveProxyCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException { doRetrieveCollections(newObj, cld, forced, true); }
[ "public", "void", "retrieveProxyCollections", "(", "Object", "newObj", ",", "ClassDescriptor", "cld", ",", "boolean", "forced", ")", "throws", "PersistenceBrokerException", "{", "doRetrieveCollections", "(", "newObj", ",", "cld", ",", "forced", ",", "true", ")", ";", "}" ]
Retrieve all Collection attributes of a given instance, and make all of the Proxy Collections @param newObj the instance to be loaded or refreshed @param cld the ClassDescriptor of the instance @param forced if set to true, loading is forced even if cld differs
[ "Retrieve", "all", "Collection", "attributes", "of", "a", "given", "instance", "and", "make", "all", "of", "the", "Proxy", "Collections" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L951-L954
LableOrg/java-uniqueid
uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ResourceClaim.java
ResourceClaim.acquireLock
static String acquireLock(ZooKeeper zookeeper, String lockNode) throws KeeperException, InterruptedException { """ Try to acquire a lock on for choosing a resource. This method will wait until it has acquired the lock. @param zookeeper ZooKeeper connection to use. @param lockNode Path to the znode representing the locking queue. @return Name of the first node in the queue. """ // Inspired by the queueing algorithm suggested here: // http://zookeeper.apache.org/doc/trunk/recipes.html#sc_recipes_Queues // Acquire a place in the queue by creating an ephemeral, sequential znode. String placeInLine = takeQueueTicket(zookeeper, lockNode); logger.debug("Acquiring lock, waiting in queue: {}.", placeInLine); // Wait in the queue until our turn has come. return waitInLine(zookeeper, lockNode, placeInLine); }
java
static String acquireLock(ZooKeeper zookeeper, String lockNode) throws KeeperException, InterruptedException { // Inspired by the queueing algorithm suggested here: // http://zookeeper.apache.org/doc/trunk/recipes.html#sc_recipes_Queues // Acquire a place in the queue by creating an ephemeral, sequential znode. String placeInLine = takeQueueTicket(zookeeper, lockNode); logger.debug("Acquiring lock, waiting in queue: {}.", placeInLine); // Wait in the queue until our turn has come. return waitInLine(zookeeper, lockNode, placeInLine); }
[ "static", "String", "acquireLock", "(", "ZooKeeper", "zookeeper", ",", "String", "lockNode", ")", "throws", "KeeperException", ",", "InterruptedException", "{", "// Inspired by the queueing algorithm suggested here:", "// http://zookeeper.apache.org/doc/trunk/recipes.html#sc_recipes_Queues", "// Acquire a place in the queue by creating an ephemeral, sequential znode.", "String", "placeInLine", "=", "takeQueueTicket", "(", "zookeeper", ",", "lockNode", ")", ";", "logger", ".", "debug", "(", "\"Acquiring lock, waiting in queue: {}.\"", ",", "placeInLine", ")", ";", "// Wait in the queue until our turn has come.", "return", "waitInLine", "(", "zookeeper", ",", "lockNode", ",", "placeInLine", ")", ";", "}" ]
Try to acquire a lock on for choosing a resource. This method will wait until it has acquired the lock. @param zookeeper ZooKeeper connection to use. @param lockNode Path to the znode representing the locking queue. @return Name of the first node in the queue.
[ "Try", "to", "acquire", "a", "lock", "on", "for", "choosing", "a", "resource", ".", "This", "method", "will", "wait", "until", "it", "has", "acquired", "the", "lock", "." ]
train
https://github.com/LableOrg/java-uniqueid/blob/554e30b2277765f365e7c7f598108de0ab5744f4/uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ResourceClaim.java#L165-L175
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/pq/pqpolicy_stats.java
pqpolicy_stats.get
public static pqpolicy_stats get(nitro_service service, String policyname) throws Exception { """ Use this API to fetch statistics of pqpolicy_stats resource of given name . """ pqpolicy_stats obj = new pqpolicy_stats(); obj.set_policyname(policyname); pqpolicy_stats response = (pqpolicy_stats) obj.stat_resource(service); return response; }
java
public static pqpolicy_stats get(nitro_service service, String policyname) throws Exception{ pqpolicy_stats obj = new pqpolicy_stats(); obj.set_policyname(policyname); pqpolicy_stats response = (pqpolicy_stats) obj.stat_resource(service); return response; }
[ "public", "static", "pqpolicy_stats", "get", "(", "nitro_service", "service", ",", "String", "policyname", ")", "throws", "Exception", "{", "pqpolicy_stats", "obj", "=", "new", "pqpolicy_stats", "(", ")", ";", "obj", ".", "set_policyname", "(", "policyname", ")", ";", "pqpolicy_stats", "response", "=", "(", "pqpolicy_stats", ")", "obj", ".", "stat_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch statistics of pqpolicy_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "pqpolicy_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/pq/pqpolicy_stats.java#L309-L314
spotbugs/spotbugs
eclipsePlugin/src/edu/umd/cs/findbugs/plugin/eclipse/quickfix/CreateAndOddnessCheckResolution.java
CreateAndOddnessCheckResolution.createCorrectOddnessCheck
@Override protected InfixExpression createCorrectOddnessCheck(ASTRewrite rewrite, Expression numberExpression) { """ Creates the new <CODE>InfixExpression</CODE> <CODE>(x &amp; 1) == 1</CODE>. """ Assert.isNotNull(rewrite); Assert.isNotNull(numberExpression); final AST ast = rewrite.getAST(); InfixExpression andOddnessCheck = ast.newInfixExpression(); ParenthesizedExpression parenthesizedExpression = ast.newParenthesizedExpression(); InfixExpression andExpression = ast.newInfixExpression(); andExpression.setLeftOperand((Expression) rewrite.createMoveTarget(numberExpression)); andExpression.setOperator(AND); andExpression.setRightOperand(ast.newNumberLiteral("1")); parenthesizedExpression.setExpression(andExpression); andOddnessCheck.setLeftOperand(parenthesizedExpression); andOddnessCheck.setOperator(EQUALS); andOddnessCheck.setRightOperand(ast.newNumberLiteral("1")); return andOddnessCheck; }
java
@Override protected InfixExpression createCorrectOddnessCheck(ASTRewrite rewrite, Expression numberExpression) { Assert.isNotNull(rewrite); Assert.isNotNull(numberExpression); final AST ast = rewrite.getAST(); InfixExpression andOddnessCheck = ast.newInfixExpression(); ParenthesizedExpression parenthesizedExpression = ast.newParenthesizedExpression(); InfixExpression andExpression = ast.newInfixExpression(); andExpression.setLeftOperand((Expression) rewrite.createMoveTarget(numberExpression)); andExpression.setOperator(AND); andExpression.setRightOperand(ast.newNumberLiteral("1")); parenthesizedExpression.setExpression(andExpression); andOddnessCheck.setLeftOperand(parenthesizedExpression); andOddnessCheck.setOperator(EQUALS); andOddnessCheck.setRightOperand(ast.newNumberLiteral("1")); return andOddnessCheck; }
[ "@", "Override", "protected", "InfixExpression", "createCorrectOddnessCheck", "(", "ASTRewrite", "rewrite", ",", "Expression", "numberExpression", ")", "{", "Assert", ".", "isNotNull", "(", "rewrite", ")", ";", "Assert", ".", "isNotNull", "(", "numberExpression", ")", ";", "final", "AST", "ast", "=", "rewrite", ".", "getAST", "(", ")", ";", "InfixExpression", "andOddnessCheck", "=", "ast", ".", "newInfixExpression", "(", ")", ";", "ParenthesizedExpression", "parenthesizedExpression", "=", "ast", ".", "newParenthesizedExpression", "(", ")", ";", "InfixExpression", "andExpression", "=", "ast", ".", "newInfixExpression", "(", ")", ";", "andExpression", ".", "setLeftOperand", "(", "(", "Expression", ")", "rewrite", ".", "createMoveTarget", "(", "numberExpression", ")", ")", ";", "andExpression", ".", "setOperator", "(", "AND", ")", ";", "andExpression", ".", "setRightOperand", "(", "ast", ".", "newNumberLiteral", "(", "\"1\"", ")", ")", ";", "parenthesizedExpression", ".", "setExpression", "(", "andExpression", ")", ";", "andOddnessCheck", ".", "setLeftOperand", "(", "parenthesizedExpression", ")", ";", "andOddnessCheck", ".", "setOperator", "(", "EQUALS", ")", ";", "andOddnessCheck", ".", "setRightOperand", "(", "ast", ".", "newNumberLiteral", "(", "\"1\"", ")", ")", ";", "return", "andOddnessCheck", ";", "}" ]
Creates the new <CODE>InfixExpression</CODE> <CODE>(x &amp; 1) == 1</CODE>.
[ "Creates", "the", "new", "<CODE", ">", "InfixExpression<", "/", "CODE", ">", "<CODE", ">", "(", "x", "&amp", ";", "1", ")", "==", "1<", "/", "CODE", ">", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/edu/umd/cs/findbugs/plugin/eclipse/quickfix/CreateAndOddnessCheckResolution.java#L50-L70
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/Cooccurrence.java
Cooccurrence.setFirstIds
public void setFirstIds(int i, String v) { """ indexed setter for firstIds - sets an indexed value - A list of string ids to identify the first occurrence @generated @param i index in the array to set @param v value to set into the array """ if (Cooccurrence_Type.featOkTst && ((Cooccurrence_Type)jcasType).casFeat_firstIds == null) jcasType.jcas.throwFeatMissing("firstIds", "ch.epfl.bbp.uima.types.Cooccurrence"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Cooccurrence_Type)jcasType).casFeatCode_firstIds), i); jcasType.ll_cas.ll_setStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Cooccurrence_Type)jcasType).casFeatCode_firstIds), i, v);}
java
public void setFirstIds(int i, String v) { if (Cooccurrence_Type.featOkTst && ((Cooccurrence_Type)jcasType).casFeat_firstIds == null) jcasType.jcas.throwFeatMissing("firstIds", "ch.epfl.bbp.uima.types.Cooccurrence"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Cooccurrence_Type)jcasType).casFeatCode_firstIds), i); jcasType.ll_cas.ll_setStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Cooccurrence_Type)jcasType).casFeatCode_firstIds), i, v);}
[ "public", "void", "setFirstIds", "(", "int", "i", ",", "String", "v", ")", "{", "if", "(", "Cooccurrence_Type", ".", "featOkTst", "&&", "(", "(", "Cooccurrence_Type", ")", "jcasType", ")", ".", "casFeat_firstIds", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"firstIds\"", ",", "\"ch.epfl.bbp.uima.types.Cooccurrence\"", ")", ";", "jcasType", ".", "jcas", ".", "checkArrayBounds", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "Cooccurrence_Type", ")", "jcasType", ")", ".", "casFeatCode_firstIds", ")", ",", "i", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setStringArrayValue", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "Cooccurrence_Type", ")", "jcasType", ")", ".", "casFeatCode_firstIds", ")", ",", "i", ",", "v", ")", ";", "}" ]
indexed setter for firstIds - sets an indexed value - A list of string ids to identify the first occurrence @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "firstIds", "-", "sets", "an", "indexed", "value", "-", "A", "list", "of", "string", "ids", "to", "identify", "the", "first", "occurrence" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/Cooccurrence.java#L205-L209
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/parser/MetaTypeTypeInfo.java
MetaTypeTypeInfo.canAccessPrivateMembers
private boolean canAccessPrivateMembers( IType ownersClass, IType whosAskin ) { """ A private feature is accessible from its declaring class and any inner class defined in its declaring class. """ return getOwnersType() == whosAskin || getTopLevelTypeName( whosAskin ).equals( getTopLevelTypeName( ownersClass ) ); }
java
private boolean canAccessPrivateMembers( IType ownersClass, IType whosAskin ) { return getOwnersType() == whosAskin || getTopLevelTypeName( whosAskin ).equals( getTopLevelTypeName( ownersClass ) ); }
[ "private", "boolean", "canAccessPrivateMembers", "(", "IType", "ownersClass", ",", "IType", "whosAskin", ")", "{", "return", "getOwnersType", "(", ")", "==", "whosAskin", "||", "getTopLevelTypeName", "(", "whosAskin", ")", ".", "equals", "(", "getTopLevelTypeName", "(", "ownersClass", ")", ")", ";", "}" ]
A private feature is accessible from its declaring class and any inner class defined in its declaring class.
[ "A", "private", "feature", "is", "accessible", "from", "its", "declaring", "class", "and", "any", "inner", "class", "defined", "in", "its", "declaring", "class", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/MetaTypeTypeInfo.java#L302-L306
enioka/jqm
jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/GlobalParameter.java
GlobalParameter.getParameter
public static String getParameter(DbConn cnx, String key, String defaultValue) { """ Retrieve the value of a single-valued parameter. @param key @param defaultValue @param cnx """ try { return cnx.runSelectSingle("globalprm_select_by_key", 3, String.class, key); } catch (NoResultException e) { return defaultValue; } }
java
public static String getParameter(DbConn cnx, String key, String defaultValue) { try { return cnx.runSelectSingle("globalprm_select_by_key", 3, String.class, key); } catch (NoResultException e) { return defaultValue; } }
[ "public", "static", "String", "getParameter", "(", "DbConn", "cnx", ",", "String", "key", ",", "String", "defaultValue", ")", "{", "try", "{", "return", "cnx", ".", "runSelectSingle", "(", "\"globalprm_select_by_key\"", ",", "3", ",", "String", ".", "class", ",", "key", ")", ";", "}", "catch", "(", "NoResultException", "e", ")", "{", "return", "defaultValue", ";", "}", "}" ]
Retrieve the value of a single-valued parameter. @param key @param defaultValue @param cnx
[ "Retrieve", "the", "value", "of", "a", "single", "-", "valued", "parameter", "." ]
train
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/GlobalParameter.java#L154-L164
liuyukuai/commons
commons-core/src/main/java/com/itxiaoer/commons/core/beans/ProcessUtils.java
ProcessUtils.process
public static <T, R> R process(Class<R> clazz, T src) { """ 拷贝单个对象 @param clazz 目标类型 @param src 原对象 @param <T> 原数据类型 @param <R> 目标数据类型 @return 目标对象 """ return process(clazz, src, (r, s) -> { }); }
java
public static <T, R> R process(Class<R> clazz, T src) { return process(clazz, src, (r, s) -> { }); }
[ "public", "static", "<", "T", ",", "R", ">", "R", "process", "(", "Class", "<", "R", ">", "clazz", ",", "T", "src", ")", "{", "return", "process", "(", "clazz", ",", "src", ",", "(", "r", ",", "s", ")", "->", "{", "}", ")", ";", "}" ]
拷贝单个对象 @param clazz 目标类型 @param src 原对象 @param <T> 原数据类型 @param <R> 目标数据类型 @return 目标对象
[ "拷贝单个对象" ]
train
https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/beans/ProcessUtils.java#L75-L78
beanshell/beanshell
src/main/java/bsh/org/objectweb/asm/TypeReference.java
TypeReference.putTarget
static void putTarget(final int targetTypeAndInfo, final ByteVector output) { """ Puts the given target_type and target_info JVMS structures into the given ByteVector. @param targetTypeAndInfo a target_type and a target_info structures encoded as in {@link #targetTypeAndInfo}. LOCAL_VARIABLE and RESOURCE_VARIABLE target types are not supported. @param output where the type reference must be put. """ switch (targetTypeAndInfo >>> 24) { case CLASS_TYPE_PARAMETER: case METHOD_TYPE_PARAMETER: case METHOD_FORMAL_PARAMETER: output.putShort(targetTypeAndInfo >>> 16); break; case FIELD: case METHOD_RETURN: case METHOD_RECEIVER: output.putByte(targetTypeAndInfo >>> 24); break; case CAST: case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: case METHOD_INVOCATION_TYPE_ARGUMENT: case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: case METHOD_REFERENCE_TYPE_ARGUMENT: output.putInt(targetTypeAndInfo); break; case CLASS_EXTENDS: case CLASS_TYPE_PARAMETER_BOUND: case METHOD_TYPE_PARAMETER_BOUND: case THROWS: case EXCEPTION_PARAMETER: case INSTANCEOF: case NEW: case CONSTRUCTOR_REFERENCE: case METHOD_REFERENCE: output.put12(targetTypeAndInfo >>> 24, (targetTypeAndInfo & 0xFFFF00) >> 8); break; default: throw new IllegalArgumentException(); } }
java
static void putTarget(final int targetTypeAndInfo, final ByteVector output) { switch (targetTypeAndInfo >>> 24) { case CLASS_TYPE_PARAMETER: case METHOD_TYPE_PARAMETER: case METHOD_FORMAL_PARAMETER: output.putShort(targetTypeAndInfo >>> 16); break; case FIELD: case METHOD_RETURN: case METHOD_RECEIVER: output.putByte(targetTypeAndInfo >>> 24); break; case CAST: case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: case METHOD_INVOCATION_TYPE_ARGUMENT: case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: case METHOD_REFERENCE_TYPE_ARGUMENT: output.putInt(targetTypeAndInfo); break; case CLASS_EXTENDS: case CLASS_TYPE_PARAMETER_BOUND: case METHOD_TYPE_PARAMETER_BOUND: case THROWS: case EXCEPTION_PARAMETER: case INSTANCEOF: case NEW: case CONSTRUCTOR_REFERENCE: case METHOD_REFERENCE: output.put12(targetTypeAndInfo >>> 24, (targetTypeAndInfo & 0xFFFF00) >> 8); break; default: throw new IllegalArgumentException(); } }
[ "static", "void", "putTarget", "(", "final", "int", "targetTypeAndInfo", ",", "final", "ByteVector", "output", ")", "{", "switch", "(", "targetTypeAndInfo", ">>>", "24", ")", "{", "case", "CLASS_TYPE_PARAMETER", ":", "case", "METHOD_TYPE_PARAMETER", ":", "case", "METHOD_FORMAL_PARAMETER", ":", "output", ".", "putShort", "(", "targetTypeAndInfo", ">>>", "16", ")", ";", "break", ";", "case", "FIELD", ":", "case", "METHOD_RETURN", ":", "case", "METHOD_RECEIVER", ":", "output", ".", "putByte", "(", "targetTypeAndInfo", ">>>", "24", ")", ";", "break", ";", "case", "CAST", ":", "case", "CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT", ":", "case", "METHOD_INVOCATION_TYPE_ARGUMENT", ":", "case", "CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT", ":", "case", "METHOD_REFERENCE_TYPE_ARGUMENT", ":", "output", ".", "putInt", "(", "targetTypeAndInfo", ")", ";", "break", ";", "case", "CLASS_EXTENDS", ":", "case", "CLASS_TYPE_PARAMETER_BOUND", ":", "case", "METHOD_TYPE_PARAMETER_BOUND", ":", "case", "THROWS", ":", "case", "EXCEPTION_PARAMETER", ":", "case", "INSTANCEOF", ":", "case", "NEW", ":", "case", "CONSTRUCTOR_REFERENCE", ":", "case", "METHOD_REFERENCE", ":", "output", ".", "put12", "(", "targetTypeAndInfo", ">>>", "24", ",", "(", "targetTypeAndInfo", "&", "0xFFFF00", ")", ">>", "8", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "}" ]
Puts the given target_type and target_info JVMS structures into the given ByteVector. @param targetTypeAndInfo a target_type and a target_info structures encoded as in {@link #targetTypeAndInfo}. LOCAL_VARIABLE and RESOURCE_VARIABLE target types are not supported. @param output where the type reference must be put.
[ "Puts", "the", "given", "target_type", "and", "target_info", "JVMS", "structures", "into", "the", "given", "ByteVector", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/org/objectweb/asm/TypeReference.java#L402-L435
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/ui/CmsInlineEditOverlay.java
CmsInlineEditOverlay.setButtonPosition
public void setButtonPosition(CmsInlineEntityWidget widget, int absoluteTop) { """ Updates the position of the given button widget.<p> @param widget the button widget @param absoluteTop the top absolute top position """ if (m_buttonPanel.getWidgetIndex(widget) > -1) { int buttonBarTop = CmsClientStringUtil.parseInt(m_buttonBar.getStyle().getTop()); if (absoluteTop < buttonBarTop) { absoluteTop = buttonBarTop; } int positionTop = getAvailablePosition(widget, absoluteTop) - buttonBarTop; widget.getElement().getStyle().setTop(positionTop, Unit.PX); if (CmsClientStringUtil.parseInt(m_buttonBar.getStyle().getHeight()) < (positionTop + 20)) { increaseOverlayHeight(positionTop + 20); } } }
java
public void setButtonPosition(CmsInlineEntityWidget widget, int absoluteTop) { if (m_buttonPanel.getWidgetIndex(widget) > -1) { int buttonBarTop = CmsClientStringUtil.parseInt(m_buttonBar.getStyle().getTop()); if (absoluteTop < buttonBarTop) { absoluteTop = buttonBarTop; } int positionTop = getAvailablePosition(widget, absoluteTop) - buttonBarTop; widget.getElement().getStyle().setTop(positionTop, Unit.PX); if (CmsClientStringUtil.parseInt(m_buttonBar.getStyle().getHeight()) < (positionTop + 20)) { increaseOverlayHeight(positionTop + 20); } } }
[ "public", "void", "setButtonPosition", "(", "CmsInlineEntityWidget", "widget", ",", "int", "absoluteTop", ")", "{", "if", "(", "m_buttonPanel", ".", "getWidgetIndex", "(", "widget", ")", ">", "-", "1", ")", "{", "int", "buttonBarTop", "=", "CmsClientStringUtil", ".", "parseInt", "(", "m_buttonBar", ".", "getStyle", "(", ")", ".", "getTop", "(", ")", ")", ";", "if", "(", "absoluteTop", "<", "buttonBarTop", ")", "{", "absoluteTop", "=", "buttonBarTop", ";", "}", "int", "positionTop", "=", "getAvailablePosition", "(", "widget", ",", "absoluteTop", ")", "-", "buttonBarTop", ";", "widget", ".", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "setTop", "(", "positionTop", ",", "Unit", ".", "PX", ")", ";", "if", "(", "CmsClientStringUtil", ".", "parseInt", "(", "m_buttonBar", ".", "getStyle", "(", ")", ".", "getHeight", "(", ")", ")", "<", "(", "positionTop", "+", "20", ")", ")", "{", "increaseOverlayHeight", "(", "positionTop", "+", "20", ")", ";", "}", "}", "}" ]
Updates the position of the given button widget.<p> @param widget the button widget @param absoluteTop the top absolute top position
[ "Updates", "the", "position", "of", "the", "given", "button", "widget", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/ui/CmsInlineEditOverlay.java#L309-L322
mgm-tp/jfunk
jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java
MathRandom.getDate
public Date getDate(final Date min, final Date max) { """ Returns a random date in the range of [min, max]. @param min minimum value for generated date @param max maximum value for generated date """ return getDate(min.getTime(), max.getTime()); }
java
public Date getDate(final Date min, final Date max) { return getDate(min.getTime(), max.getTime()); }
[ "public", "Date", "getDate", "(", "final", "Date", "min", ",", "final", "Date", "max", ")", "{", "return", "getDate", "(", "min", ".", "getTime", "(", ")", ",", "max", ".", "getTime", "(", ")", ")", ";", "}" ]
Returns a random date in the range of [min, max]. @param min minimum value for generated date @param max maximum value for generated date
[ "Returns", "a", "random", "date", "in", "the", "range", "of", "[", "min", "max", "]", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java#L153-L155
stephenc/simple-java-mail
src/main/java/org/codemonkey/simplejavamail/Mailer.java
Mailer.createMailSession
public Session createMailSession(final String host, final int port, final String username, final String password) { """ Actually instantiates and configures the {@link Session} instance. Delegates resolving transport protocol specific properties to the {@link #transportStrategy} in two ways: <ol> <li>request an initial property list which the strategy may pre-populate</li> <li>by requesting the property names according to the respective transport protocol it handles (for the host property name it would be <em>"mail.smtp.host"</em> for SMTP and <em>"mail.smtps.host"</em> for SMTPS)</li> </ol> @param host The address URL of the SMTP server to be used. @param port The port of the SMTP server. @param username An optional username, may be <code>null</code>. @param password An optional password, may be <code>null</code>. @return A fully configured <code>Session</code> instance complete with transport protocol settings. @see TransportStrategy#generateProperties() @see TransportStrategy#propertyNameHost() @see TransportStrategy#propertyNamePort() @see TransportStrategy#propertyNameUsername() @see TransportStrategy#propertyNameAuthenticate() """ Properties props = transportStrategy.generateProperties(); props.put(transportStrategy.propertyNameHost(), host); props.put(transportStrategy.propertyNamePort(), String.valueOf(port)); if (username != null) { props.put(transportStrategy.propertyNameUsername(), username); } if (password != null) { props.put(transportStrategy.propertyNameAuthenticate(), "true"); return Session.getInstance(props, new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); } else { return Session.getInstance(props); } }
java
public Session createMailSession(final String host, final int port, final String username, final String password) { Properties props = transportStrategy.generateProperties(); props.put(transportStrategy.propertyNameHost(), host); props.put(transportStrategy.propertyNamePort(), String.valueOf(port)); if (username != null) { props.put(transportStrategy.propertyNameUsername(), username); } if (password != null) { props.put(transportStrategy.propertyNameAuthenticate(), "true"); return Session.getInstance(props, new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); } else { return Session.getInstance(props); } }
[ "public", "Session", "createMailSession", "(", "final", "String", "host", ",", "final", "int", "port", ",", "final", "String", "username", ",", "final", "String", "password", ")", "{", "Properties", "props", "=", "transportStrategy", ".", "generateProperties", "(", ")", ";", "props", ".", "put", "(", "transportStrategy", ".", "propertyNameHost", "(", ")", ",", "host", ")", ";", "props", ".", "put", "(", "transportStrategy", ".", "propertyNamePort", "(", ")", ",", "String", ".", "valueOf", "(", "port", ")", ")", ";", "if", "(", "username", "!=", "null", ")", "{", "props", ".", "put", "(", "transportStrategy", ".", "propertyNameUsername", "(", ")", ",", "username", ")", ";", "}", "if", "(", "password", "!=", "null", ")", "{", "props", ".", "put", "(", "transportStrategy", ".", "propertyNameAuthenticate", "(", ")", ",", "\"true\"", ")", ";", "return", "Session", ".", "getInstance", "(", "props", ",", "new", "Authenticator", "(", ")", "{", "@", "Override", "protected", "PasswordAuthentication", "getPasswordAuthentication", "(", ")", "{", "return", "new", "PasswordAuthentication", "(", "username", ",", "password", ")", ";", "}", "}", ")", ";", "}", "else", "{", "return", "Session", ".", "getInstance", "(", "props", ")", ";", "}", "}" ]
Actually instantiates and configures the {@link Session} instance. Delegates resolving transport protocol specific properties to the {@link #transportStrategy} in two ways: <ol> <li>request an initial property list which the strategy may pre-populate</li> <li>by requesting the property names according to the respective transport protocol it handles (for the host property name it would be <em>"mail.smtp.host"</em> for SMTP and <em>"mail.smtps.host"</em> for SMTPS)</li> </ol> @param host The address URL of the SMTP server to be used. @param port The port of the SMTP server. @param username An optional username, may be <code>null</code>. @param password An optional password, may be <code>null</code>. @return A fully configured <code>Session</code> instance complete with transport protocol settings. @see TransportStrategy#generateProperties() @see TransportStrategy#propertyNameHost() @see TransportStrategy#propertyNamePort() @see TransportStrategy#propertyNameUsername() @see TransportStrategy#propertyNameAuthenticate()
[ "Actually", "instantiates", "and", "configures", "the", "{", "@link", "Session", "}", "instance", ".", "Delegates", "resolving", "transport", "protocol", "specific", "properties", "to", "the", "{", "@link", "#transportStrategy", "}", "in", "two", "ways", ":", "<ol", ">", "<li", ">", "request", "an", "initial", "property", "list", "which", "the", "strategy", "may", "pre", "-", "populate<", "/", "li", ">", "<li", ">", "by", "requesting", "the", "property", "names", "according", "to", "the", "respective", "transport", "protocol", "it", "handles", "(", "for", "the", "host", "property", "name", "it", "would", "be", "<em", ">", "mail", ".", "smtp", ".", "host", "<", "/", "em", ">", "for", "SMTP", "and", "<em", ">", "mail", ".", "smtps", ".", "host", "<", "/", "em", ">", "for", "SMTPS", ")", "<", "/", "li", ">", "<", "/", "ol", ">" ]
train
https://github.com/stephenc/simple-java-mail/blob/8c5897e6bbc23c11e7c7eb5064f407625c653923/src/main/java/org/codemonkey/simplejavamail/Mailer.java#L152-L172
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/CookieManager.java
CookieManager.pathMatches
private static boolean pathMatches(URI uri, HttpCookie cookie) { """ Return true iff. the path from {@code cookie} matches the path from {@code uri}. """ return normalizePath(uri.getPath()).startsWith(normalizePath(cookie.getPath())); }
java
private static boolean pathMatches(URI uri, HttpCookie cookie) { return normalizePath(uri.getPath()).startsWith(normalizePath(cookie.getPath())); }
[ "private", "static", "boolean", "pathMatches", "(", "URI", "uri", ",", "HttpCookie", "cookie", ")", "{", "return", "normalizePath", "(", "uri", ".", "getPath", "(", ")", ")", ".", "startsWith", "(", "normalizePath", "(", "cookie", ".", "getPath", "(", ")", ")", ")", ";", "}" ]
Return true iff. the path from {@code cookie} matches the path from {@code uri}.
[ "Return", "true", "iff", ".", "the", "path", "from", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/CookieManager.java#L394-L396
ReactiveX/RxNetty
rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/TrailingHeaders.java
TrailingHeaders.setHeader
public TrailingHeaders setHeader(CharSequence name, Iterable<Object> values) { """ Overwrites the current value, if any, of the passed trailing header to the passed values for this request. @param name Name of the header. @param values Values of the header. @return {@code this}. """ lastHttpContent.trailingHeaders().set(name, values); return this; }
java
public TrailingHeaders setHeader(CharSequence name, Iterable<Object> values) { lastHttpContent.trailingHeaders().set(name, values); return this; }
[ "public", "TrailingHeaders", "setHeader", "(", "CharSequence", "name", ",", "Iterable", "<", "Object", ">", "values", ")", "{", "lastHttpContent", ".", "trailingHeaders", "(", ")", ".", "set", "(", "name", ",", "values", ")", ";", "return", "this", ";", "}" ]
Overwrites the current value, if any, of the passed trailing header to the passed values for this request. @param name Name of the header. @param values Values of the header. @return {@code this}.
[ "Overwrites", "the", "current", "value", "if", "any", "of", "the", "passed", "trailing", "header", "to", "the", "passed", "values", "for", "this", "request", "." ]
train
https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/TrailingHeaders.java#L88-L91
morimekta/utils
io-util/src/main/java/net/morimekta/util/json/JsonWriter.java
JsonWriter.keyUnescaped
public JsonWriter keyUnescaped(CharSequence key) { """ Write the string as object key without escaping. @param key The string key. @return The JSON Writer. """ startKey(); if (key == null) { throw new IllegalArgumentException("Expected map key, but got null."); } writer.write('\"'); writer.write(key.toString()); writer.write('\"'); writer.write(':'); return this; }
java
public JsonWriter keyUnescaped(CharSequence key) { startKey(); if (key == null) { throw new IllegalArgumentException("Expected map key, but got null."); } writer.write('\"'); writer.write(key.toString()); writer.write('\"'); writer.write(':'); return this; }
[ "public", "JsonWriter", "keyUnescaped", "(", "CharSequence", "key", ")", "{", "startKey", "(", ")", ";", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Expected map key, but got null.\"", ")", ";", "}", "writer", ".", "write", "(", "'", "'", ")", ";", "writer", ".", "write", "(", "key", ".", "toString", "(", ")", ")", ";", "writer", ".", "write", "(", "'", "'", ")", ";", "writer", ".", "write", "(", "'", "'", ")", ";", "return", "this", ";", "}" ]
Write the string as object key without escaping. @param key The string key. @return The JSON Writer.
[ "Write", "the", "string", "as", "object", "key", "without", "escaping", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/json/JsonWriter.java#L256-L269
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Model.java
Model.validateRange
protected static ValidationBuilder validateRange(String attributeName, Number min, Number max) { """ Validates range. Accepted types are all java.lang.Number subclasses: Byte, Short, Integer, Long, Float, Double BigDecimal. @param attributeName attribute to validate - should be within range. @param min min value of range. @param max max value of range. """ return ModelDelegate.validateRange(modelClass(), attributeName, min, max); }
java
protected static ValidationBuilder validateRange(String attributeName, Number min, Number max) { return ModelDelegate.validateRange(modelClass(), attributeName, min, max); }
[ "protected", "static", "ValidationBuilder", "validateRange", "(", "String", "attributeName", ",", "Number", "min", ",", "Number", "max", ")", "{", "return", "ModelDelegate", ".", "validateRange", "(", "modelClass", "(", ")", ",", "attributeName", ",", "min", ",", "max", ")", ";", "}" ]
Validates range. Accepted types are all java.lang.Number subclasses: Byte, Short, Integer, Long, Float, Double BigDecimal. @param attributeName attribute to validate - should be within range. @param min min value of range. @param max max value of range.
[ "Validates", "range", ".", "Accepted", "types", "are", "all", "java", ".", "lang", ".", "Number", "subclasses", ":", "Byte", "Short", "Integer", "Long", "Float", "Double", "BigDecimal", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L2028-L2030
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java
DerInputStream.getEnumerated
public int getEnumerated() throws IOException { """ Get an enumerated from the input stream. @return the integer held in this DER input stream. """ if (buffer.read() != DerValue.tag_Enumerated) { throw new IOException("DER input, Enumerated tag error"); } return buffer.getInteger(getLength(buffer)); }
java
public int getEnumerated() throws IOException { if (buffer.read() != DerValue.tag_Enumerated) { throw new IOException("DER input, Enumerated tag error"); } return buffer.getInteger(getLength(buffer)); }
[ "public", "int", "getEnumerated", "(", ")", "throws", "IOException", "{", "if", "(", "buffer", ".", "read", "(", ")", "!=", "DerValue", ".", "tag_Enumerated", ")", "{", "throw", "new", "IOException", "(", "\"DER input, Enumerated tag error\"", ")", ";", "}", "return", "buffer", ".", "getInteger", "(", "getLength", "(", "buffer", ")", ")", ";", "}" ]
Get an enumerated from the input stream. @return the integer held in this DER input stream.
[ "Get", "an", "enumerated", "from", "the", "input", "stream", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L204-L209
iovation/launchkey-java
sdk/src/main/java/com/iovation/launchkey/sdk/crypto/JCECrypto.java
JCECrypto.getRSAPublicKeyFromPEM
public static RSAPublicKey getRSAPublicKeyFromPEM(Provider provider, String pem) { """ Get an RSA public key utilizing the provided provider and PEM formatted string @param provider Provider to generate the key @param pem PEM formatted key string @return RSA public key """ try { KeyFactory keyFactory = KeyFactory.getInstance("RSA", provider); return (RSAPublicKey) keyFactory.generatePublic(new X509EncodedKeySpec(getKeyBytesFromPEM(pem))); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Algorithm SHA256withRSA is not available", e); } catch (InvalidKeySpecException e) { throw new IllegalArgumentException("Invalid PEM provided", e); } }
java
public static RSAPublicKey getRSAPublicKeyFromPEM(Provider provider, String pem) { try { KeyFactory keyFactory = KeyFactory.getInstance("RSA", provider); return (RSAPublicKey) keyFactory.generatePublic(new X509EncodedKeySpec(getKeyBytesFromPEM(pem))); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Algorithm SHA256withRSA is not available", e); } catch (InvalidKeySpecException e) { throw new IllegalArgumentException("Invalid PEM provided", e); } }
[ "public", "static", "RSAPublicKey", "getRSAPublicKeyFromPEM", "(", "Provider", "provider", ",", "String", "pem", ")", "{", "try", "{", "KeyFactory", "keyFactory", "=", "KeyFactory", ".", "getInstance", "(", "\"RSA\"", ",", "provider", ")", ";", "return", "(", "RSAPublicKey", ")", "keyFactory", ".", "generatePublic", "(", "new", "X509EncodedKeySpec", "(", "getKeyBytesFromPEM", "(", "pem", ")", ")", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Algorithm SHA256withRSA is not available\"", ",", "e", ")", ";", "}", "catch", "(", "InvalidKeySpecException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid PEM provided\"", ",", "e", ")", ";", "}", "}" ]
Get an RSA public key utilizing the provided provider and PEM formatted string @param provider Provider to generate the key @param pem PEM formatted key string @return RSA public key
[ "Get", "an", "RSA", "public", "key", "utilizing", "the", "provided", "provider", "and", "PEM", "formatted", "string" ]
train
https://github.com/iovation/launchkey-java/blob/ceecc70b9b04af07ddc14c57d4bcc933a4e0379c/sdk/src/main/java/com/iovation/launchkey/sdk/crypto/JCECrypto.java#L114-L123
wildfly-extras/wildfly-camel
config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java
IllegalArgumentAssertion.assertFalse
public static Boolean assertFalse(Boolean value, String message) { """ Throws an IllegalArgumentException when the given value is not false. @param value the value to assert if false @param message the message to display if the value is false @return the value """ if (Boolean.valueOf(value)) throw new IllegalArgumentException(message); return value; }
java
public static Boolean assertFalse(Boolean value, String message) { if (Boolean.valueOf(value)) throw new IllegalArgumentException(message); return value; }
[ "public", "static", "Boolean", "assertFalse", "(", "Boolean", "value", ",", "String", "message", ")", "{", "if", "(", "Boolean", ".", "valueOf", "(", "value", ")", ")", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "return", "value", ";", "}" ]
Throws an IllegalArgumentException when the given value is not false. @param value the value to assert if false @param message the message to display if the value is false @return the value
[ "Throws", "an", "IllegalArgumentException", "when", "the", "given", "value", "is", "not", "false", "." ]
train
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java#L66-L70
metamx/java-util
src/main/java/com/metamx/common/StreamUtils.java
StreamUtils.copyWithTimeout
public static long copyWithTimeout(InputStream is, OutputStream os, long timeout) throws IOException, TimeoutException { """ Copy from the input stream to the output stream and tries to exit if the copy exceeds the timeout. The timeout is best effort. Specifically, `is.read` will not be interrupted. @param is The input stream to read bytes from. @param os The output stream to write bytes to. @param timeout The timeout (in ms) for the copy operation @return The total size of bytes written to `os` @throws IOException @throws TimeoutException If `tiemout` is exceeded """ byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int n; long startTime = System.currentTimeMillis(); long size = 0; while (-1 != (n = is.read(buffer))) { if (System.currentTimeMillis() - startTime > timeout) { throw new TimeoutException(String.format("Copy time has exceeded %,d millis", timeout)); } os.write(buffer, 0, n); size += n; } return size; }
java
public static long copyWithTimeout(InputStream is, OutputStream os, long timeout) throws IOException, TimeoutException { byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int n; long startTime = System.currentTimeMillis(); long size = 0; while (-1 != (n = is.read(buffer))) { if (System.currentTimeMillis() - startTime > timeout) { throw new TimeoutException(String.format("Copy time has exceeded %,d millis", timeout)); } os.write(buffer, 0, n); size += n; } return size; }
[ "public", "static", "long", "copyWithTimeout", "(", "InputStream", "is", ",", "OutputStream", "os", ",", "long", "timeout", ")", "throws", "IOException", ",", "TimeoutException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "DEFAULT_BUFFER_SIZE", "]", ";", "int", "n", ";", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "size", "=", "0", ";", "while", "(", "-", "1", "!=", "(", "n", "=", "is", ".", "read", "(", "buffer", ")", ")", ")", "{", "if", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "startTime", ">", "timeout", ")", "{", "throw", "new", "TimeoutException", "(", "String", ".", "format", "(", "\"Copy time has exceeded %,d millis\"", ",", "timeout", ")", ")", ";", "}", "os", ".", "write", "(", "buffer", ",", "0", ",", "n", ")", ";", "size", "+=", "n", ";", "}", "return", "size", ";", "}" ]
Copy from the input stream to the output stream and tries to exit if the copy exceeds the timeout. The timeout is best effort. Specifically, `is.read` will not be interrupted. @param is The input stream to read bytes from. @param os The output stream to write bytes to. @param timeout The timeout (in ms) for the copy operation @return The total size of bytes written to `os` @throws IOException @throws TimeoutException If `tiemout` is exceeded
[ "Copy", "from", "the", "input", "stream", "to", "the", "output", "stream", "and", "tries", "to", "exit", "if", "the", "copy", "exceeds", "the", "timeout", ".", "The", "timeout", "is", "best", "effort", ".", "Specifically", "is", ".", "read", "will", "not", "be", "interrupted", "." ]
train
https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/StreamUtils.java#L132-L146
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java
AbstractMetricGroup.addMetric
protected void addMetric(String name, Metric metric) { """ Adds the given metric to the group and registers it at the registry, if the group is not yet closed, and if no metric with the same name has been registered before. @param name the name to register the metric under @param metric the metric to register """ if (metric == null) { LOG.warn("Ignoring attempted registration of a metric due to being null for name {}.", name); return; } // add the metric only if the group is still open synchronized (this) { if (!closed) { // immediately put without a 'contains' check to optimize the common case (no collision) // collisions are resolved later Metric prior = metrics.put(name, metric); // check for collisions with other metric names if (prior == null) { // no other metric with this name yet if (groups.containsKey(name)) { // we warn here, rather than failing, because metrics are tools that should not fail the // program when used incorrectly LOG.warn("Name collision: Adding a metric with the same name as a metric subgroup: '" + name + "'. Metric might not get properly reported. " + Arrays.toString(scopeComponents)); } registry.register(metric, name, this); } else { // we had a collision. put back the original value metrics.put(name, prior); // we warn here, rather than failing, because metrics are tools that should not fail the // program when used incorrectly LOG.warn("Name collision: Group already contains a Metric with the name '" + name + "'. Metric will not be reported." + Arrays.toString(scopeComponents)); } } } }
java
protected void addMetric(String name, Metric metric) { if (metric == null) { LOG.warn("Ignoring attempted registration of a metric due to being null for name {}.", name); return; } // add the metric only if the group is still open synchronized (this) { if (!closed) { // immediately put without a 'contains' check to optimize the common case (no collision) // collisions are resolved later Metric prior = metrics.put(name, metric); // check for collisions with other metric names if (prior == null) { // no other metric with this name yet if (groups.containsKey(name)) { // we warn here, rather than failing, because metrics are tools that should not fail the // program when used incorrectly LOG.warn("Name collision: Adding a metric with the same name as a metric subgroup: '" + name + "'. Metric might not get properly reported. " + Arrays.toString(scopeComponents)); } registry.register(metric, name, this); } else { // we had a collision. put back the original value metrics.put(name, prior); // we warn here, rather than failing, because metrics are tools that should not fail the // program when used incorrectly LOG.warn("Name collision: Group already contains a Metric with the name '" + name + "'. Metric will not be reported." + Arrays.toString(scopeComponents)); } } } }
[ "protected", "void", "addMetric", "(", "String", "name", ",", "Metric", "metric", ")", "{", "if", "(", "metric", "==", "null", ")", "{", "LOG", ".", "warn", "(", "\"Ignoring attempted registration of a metric due to being null for name {}.\"", ",", "name", ")", ";", "return", ";", "}", "// add the metric only if the group is still open", "synchronized", "(", "this", ")", "{", "if", "(", "!", "closed", ")", "{", "// immediately put without a 'contains' check to optimize the common case (no collision)", "// collisions are resolved later", "Metric", "prior", "=", "metrics", ".", "put", "(", "name", ",", "metric", ")", ";", "// check for collisions with other metric names", "if", "(", "prior", "==", "null", ")", "{", "// no other metric with this name yet", "if", "(", "groups", ".", "containsKey", "(", "name", ")", ")", "{", "// we warn here, rather than failing, because metrics are tools that should not fail the", "// program when used incorrectly", "LOG", ".", "warn", "(", "\"Name collision: Adding a metric with the same name as a metric subgroup: '\"", "+", "name", "+", "\"'. Metric might not get properly reported. \"", "+", "Arrays", ".", "toString", "(", "scopeComponents", ")", ")", ";", "}", "registry", ".", "register", "(", "metric", ",", "name", ",", "this", ")", ";", "}", "else", "{", "// we had a collision. put back the original value", "metrics", ".", "put", "(", "name", ",", "prior", ")", ";", "// we warn here, rather than failing, because metrics are tools that should not fail the", "// program when used incorrectly", "LOG", ".", "warn", "(", "\"Name collision: Group already contains a Metric with the name '\"", "+", "name", "+", "\"'. Metric will not be reported.\"", "+", "Arrays", ".", "toString", "(", "scopeComponents", ")", ")", ";", "}", "}", "}", "}" ]
Adds the given metric to the group and registers it at the registry, if the group is not yet closed, and if no metric with the same name has been registered before. @param name the name to register the metric under @param metric the metric to register
[ "Adds", "the", "given", "metric", "to", "the", "group", "and", "registers", "it", "at", "the", "registry", "if", "the", "group", "is", "not", "yet", "closed", "and", "if", "no", "metric", "with", "the", "same", "name", "has", "been", "registered", "before", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java#L373-L409
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/WriterUtils.java
WriterUtils.getCodecFactory
public static CodecFactory getCodecFactory(Optional<String> codecName, Optional<String> deflateLevel) { """ Creates a {@link CodecFactory} based on the specified codec name and deflate level. If codecName is absent, then a {@link CodecFactory#deflateCodec(int)} is returned. Otherwise the codecName is converted into a {@link CodecFactory} via the {@link CodecFactory#fromString(String)} method. @param codecName the name of the codec to use (e.g. deflate, snappy, xz, etc.). @param deflateLevel must be an integer from [0-9], and is only applicable if the codecName is "deflate". @return a {@link CodecFactory}. """ if (!codecName.isPresent()) { return CodecFactory.deflateCodec(ConfigurationKeys.DEFAULT_DEFLATE_LEVEL); } else if (codecName.get().equalsIgnoreCase(DataFileConstants.DEFLATE_CODEC)) { if (!deflateLevel.isPresent()) { return CodecFactory.deflateCodec(ConfigurationKeys.DEFAULT_DEFLATE_LEVEL); } return CodecFactory.deflateCodec(Integer.parseInt(deflateLevel.get())); } else { return CodecFactory.fromString(codecName.get().toLowerCase()); } }
java
public static CodecFactory getCodecFactory(Optional<String> codecName, Optional<String> deflateLevel) { if (!codecName.isPresent()) { return CodecFactory.deflateCodec(ConfigurationKeys.DEFAULT_DEFLATE_LEVEL); } else if (codecName.get().equalsIgnoreCase(DataFileConstants.DEFLATE_CODEC)) { if (!deflateLevel.isPresent()) { return CodecFactory.deflateCodec(ConfigurationKeys.DEFAULT_DEFLATE_LEVEL); } return CodecFactory.deflateCodec(Integer.parseInt(deflateLevel.get())); } else { return CodecFactory.fromString(codecName.get().toLowerCase()); } }
[ "public", "static", "CodecFactory", "getCodecFactory", "(", "Optional", "<", "String", ">", "codecName", ",", "Optional", "<", "String", ">", "deflateLevel", ")", "{", "if", "(", "!", "codecName", ".", "isPresent", "(", ")", ")", "{", "return", "CodecFactory", ".", "deflateCodec", "(", "ConfigurationKeys", ".", "DEFAULT_DEFLATE_LEVEL", ")", ";", "}", "else", "if", "(", "codecName", ".", "get", "(", ")", ".", "equalsIgnoreCase", "(", "DataFileConstants", ".", "DEFLATE_CODEC", ")", ")", "{", "if", "(", "!", "deflateLevel", ".", "isPresent", "(", ")", ")", "{", "return", "CodecFactory", ".", "deflateCodec", "(", "ConfigurationKeys", ".", "DEFAULT_DEFLATE_LEVEL", ")", ";", "}", "return", "CodecFactory", ".", "deflateCodec", "(", "Integer", ".", "parseInt", "(", "deflateLevel", ".", "get", "(", ")", ")", ")", ";", "}", "else", "{", "return", "CodecFactory", ".", "fromString", "(", "codecName", ".", "get", "(", ")", ".", "toLowerCase", "(", ")", ")", ";", "}", "}" ]
Creates a {@link CodecFactory} based on the specified codec name and deflate level. If codecName is absent, then a {@link CodecFactory#deflateCodec(int)} is returned. Otherwise the codecName is converted into a {@link CodecFactory} via the {@link CodecFactory#fromString(String)} method. @param codecName the name of the codec to use (e.g. deflate, snappy, xz, etc.). @param deflateLevel must be an integer from [0-9], and is only applicable if the codecName is "deflate". @return a {@link CodecFactory}.
[ "Creates", "a", "{", "@link", "CodecFactory", "}", "based", "on", "the", "specified", "codec", "name", "and", "deflate", "level", ".", "If", "codecName", "is", "absent", "then", "a", "{", "@link", "CodecFactory#deflateCodec", "(", "int", ")", "}", "is", "returned", ".", "Otherwise", "the", "codecName", "is", "converted", "into", "a", "{", "@link", "CodecFactory", "}", "via", "the", "{", "@link", "CodecFactory#fromString", "(", "String", ")", "}", "method", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/WriterUtils.java#L254-L265
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.containsSubflowState
public boolean containsSubflowState(final Flow flow, final String stateId) { """ Contains subflow state. @param flow the flow @param stateId the state id @return the boolean """ if (containsFlowState(flow, stateId)) { return getState(flow, stateId, SubflowState.class) != null; } return false; }
java
public boolean containsSubflowState(final Flow flow, final String stateId) { if (containsFlowState(flow, stateId)) { return getState(flow, stateId, SubflowState.class) != null; } return false; }
[ "public", "boolean", "containsSubflowState", "(", "final", "Flow", "flow", ",", "final", "String", "stateId", ")", "{", "if", "(", "containsFlowState", "(", "flow", ",", "stateId", ")", ")", "{", "return", "getState", "(", "flow", ",", "stateId", ",", "SubflowState", ".", "class", ")", "!=", "null", ";", "}", "return", "false", ";", "}" ]
Contains subflow state. @param flow the flow @param stateId the state id @return the boolean
[ "Contains", "subflow", "state", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L561-L566
gfk-ba/senbot
SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ElementService.java
ElementService.isElementVisible
public void isElementVisible(By locator, boolean visible) { """ Check if the passed element is visible/invisible @param by {@link By} to be matched @param visible should the element be visible (true) or invisible (false) """ waitForLoaders(); if (visible) { try { WebElement found = new WebDriverWait(getWebDriver(), getSeleniumManager().getTimeout()) .until(ExpectedConditions.visibilityOfElementLocated(locator)); } catch (WebDriverException e) { fail("The element " + locator.toString() + " is not found or invisible where it is expected as present and visible"); } } else { try { boolean invisible = new WebDriverWait(getWebDriver(), getSeleniumManager().getTimeout()) .until(ExpectedConditions.invisibilityOfElementLocated(locator)); } catch (WebDriverException e) { fail("The element " + locator.toString() + " is visible where it is expected as invisible"); } } }
java
public void isElementVisible(By locator, boolean visible) { waitForLoaders(); if (visible) { try { WebElement found = new WebDriverWait(getWebDriver(), getSeleniumManager().getTimeout()) .until(ExpectedConditions.visibilityOfElementLocated(locator)); } catch (WebDriverException e) { fail("The element " + locator.toString() + " is not found or invisible where it is expected as present and visible"); } } else { try { boolean invisible = new WebDriverWait(getWebDriver(), getSeleniumManager().getTimeout()) .until(ExpectedConditions.invisibilityOfElementLocated(locator)); } catch (WebDriverException e) { fail("The element " + locator.toString() + " is visible where it is expected as invisible"); } } }
[ "public", "void", "isElementVisible", "(", "By", "locator", ",", "boolean", "visible", ")", "{", "waitForLoaders", "(", ")", ";", "if", "(", "visible", ")", "{", "try", "{", "WebElement", "found", "=", "new", "WebDriverWait", "(", "getWebDriver", "(", ")", ",", "getSeleniumManager", "(", ")", ".", "getTimeout", "(", ")", ")", ".", "until", "(", "ExpectedConditions", ".", "visibilityOfElementLocated", "(", "locator", ")", ")", ";", "}", "catch", "(", "WebDriverException", "e", ")", "{", "fail", "(", "\"The element \"", "+", "locator", ".", "toString", "(", ")", "+", "\" is not found or invisible where it is expected as present and visible\"", ")", ";", "}", "}", "else", "{", "try", "{", "boolean", "invisible", "=", "new", "WebDriverWait", "(", "getWebDriver", "(", ")", ",", "getSeleniumManager", "(", ")", ".", "getTimeout", "(", ")", ")", ".", "until", "(", "ExpectedConditions", ".", "invisibilityOfElementLocated", "(", "locator", ")", ")", ";", "}", "catch", "(", "WebDriverException", "e", ")", "{", "fail", "(", "\"The element \"", "+", "locator", ".", "toString", "(", ")", "+", "\" is visible where it is expected as invisible\"", ")", ";", "}", "}", "}" ]
Check if the passed element is visible/invisible @param by {@link By} to be matched @param visible should the element be visible (true) or invisible (false)
[ "Check", "if", "the", "passed", "element", "is", "visible", "/", "invisible" ]
train
https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ElementService.java#L219-L237
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsMessageImpl.java
JmsMessageImpl.checkPropName
static void checkPropName(String name, String callingMethodName) throws IllegalArgumentException { """ This method checks the property name to see whether it is null or empty, and throws an IllegalArgumentException if it is. Note that this is used from MapMessage for the body, as well as from this class for the header. """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkPropName", new Object[] { name, callingMethodName }); if ((name == null) || ("".equals(name))) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Invalid field name: " + name + " as parameter to " + callingMethodName); throw (IllegalArgumentException) JmsErrorUtils.newThrowable(IllegalArgumentException.class, "INVALID_FIELD_NAME_CWSIA0106", null, // no inserts for CWSIA0106 tc ); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkPropName"); }
java
static void checkPropName(String name, String callingMethodName) throws IllegalArgumentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkPropName", new Object[] { name, callingMethodName }); if ((name == null) || ("".equals(name))) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Invalid field name: " + name + " as parameter to " + callingMethodName); throw (IllegalArgumentException) JmsErrorUtils.newThrowable(IllegalArgumentException.class, "INVALID_FIELD_NAME_CWSIA0106", null, // no inserts for CWSIA0106 tc ); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkPropName"); }
[ "static", "void", "checkPropName", "(", "String", "name", ",", "String", "callingMethodName", ")", "throws", "IllegalArgumentException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"checkPropName\"", ",", "new", "Object", "[", "]", "{", "name", ",", "callingMethodName", "}", ")", ";", "if", "(", "(", "name", "==", "null", ")", "||", "(", "\"\"", ".", "equals", "(", "name", ")", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "tc", ",", "\"Invalid field name: \"", "+", "name", "+", "\" as parameter to \"", "+", "callingMethodName", ")", ";", "throw", "(", "IllegalArgumentException", ")", "JmsErrorUtils", ".", "newThrowable", "(", "IllegalArgumentException", ".", "class", ",", "\"INVALID_FIELD_NAME_CWSIA0106\"", ",", "null", ",", "// no inserts for CWSIA0106", "tc", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"checkPropName\"", ")", ";", "}" ]
This method checks the property name to see whether it is null or empty, and throws an IllegalArgumentException if it is. Note that this is used from MapMessage for the body, as well as from this class for the header.
[ "This", "method", "checks", "the", "property", "name", "to", "see", "whether", "it", "is", "null", "or", "empty", "and", "throws", "an", "IllegalArgumentException", "if", "it", "is", ".", "Note", "that", "this", "is", "used", "from", "MapMessage", "for", "the", "body", "as", "well", "as", "from", "this", "class", "for", "the", "header", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsMessageImpl.java#L1939-L1955
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/FullDTDReader.java
FullDTDReader.handleIncompleteEntityProblem
@Override protected void handleIncompleteEntityProblem(WstxInputSource closing) throws XMLStreamException { """ Handling of PE matching problems is actually intricate; one type will be a WFC ("PE Between Declarations", which refers to PEs that start from outside declarations), and another just a VC ("Proper Declaration/PE Nesting", when PE is contained within declaration) """ // Did it start outside of declaration? if (closing.getScopeId() == 0) { // yup // and being WFC, need not be validating _reportWFCViolation(entityDesc(closing) + ": " +"Incomplete PE: has to fully contain a declaration (as per xml 1.0.3, section 2.8, WFC 'PE Between Declarations')"); } else { // whereas the other one is only sent in validating mode.. if (mCfgFullyValidating) { _reportVCViolation(entityDesc(closing) + ": " +"Incomplete PE: has to be fully contained in a declaration (as per xml 1.0.3, section 2.8, VC 'Proper Declaration/PE Nesting')"); } } }
java
@Override protected void handleIncompleteEntityProblem(WstxInputSource closing) throws XMLStreamException { // Did it start outside of declaration? if (closing.getScopeId() == 0) { // yup // and being WFC, need not be validating _reportWFCViolation(entityDesc(closing) + ": " +"Incomplete PE: has to fully contain a declaration (as per xml 1.0.3, section 2.8, WFC 'PE Between Declarations')"); } else { // whereas the other one is only sent in validating mode.. if (mCfgFullyValidating) { _reportVCViolation(entityDesc(closing) + ": " +"Incomplete PE: has to be fully contained in a declaration (as per xml 1.0.3, section 2.8, VC 'Proper Declaration/PE Nesting')"); } } }
[ "@", "Override", "protected", "void", "handleIncompleteEntityProblem", "(", "WstxInputSource", "closing", ")", "throws", "XMLStreamException", "{", "// Did it start outside of declaration?", "if", "(", "closing", ".", "getScopeId", "(", ")", "==", "0", ")", "{", "// yup", "// and being WFC, need not be validating", "_reportWFCViolation", "(", "entityDesc", "(", "closing", ")", "+", "\": \"", "+", "\"Incomplete PE: has to fully contain a declaration (as per xml 1.0.3, section 2.8, WFC 'PE Between Declarations')\"", ")", ";", "}", "else", "{", "// whereas the other one is only sent in validating mode..", "if", "(", "mCfgFullyValidating", ")", "{", "_reportVCViolation", "(", "entityDesc", "(", "closing", ")", "+", "\": \"", "+", "\"Incomplete PE: has to be fully contained in a declaration (as per xml 1.0.3, section 2.8, VC 'Proper Declaration/PE Nesting')\"", ")", ";", "}", "}", "}" ]
Handling of PE matching problems is actually intricate; one type will be a WFC ("PE Between Declarations", which refers to PEs that start from outside declarations), and another just a VC ("Proper Declaration/PE Nesting", when PE is contained within declaration)
[ "Handling", "of", "PE", "matching", "problems", "is", "actually", "intricate", ";", "one", "type", "will", "be", "a", "WFC", "(", "PE", "Between", "Declarations", "which", "refers", "to", "PEs", "that", "start", "from", "outside", "declarations", ")", "and", "another", "just", "a", "VC", "(", "Proper", "Declaration", "/", "PE", "Nesting", "when", "PE", "is", "contained", "within", "declaration", ")" ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/FullDTDReader.java#L3435-L3451
h2oai/h2o-3
h2o-core/src/main/java/water/TaskGetKey.java
TaskGetKey.onAck
@Override public void onAck() { """ Received an ACK; executes on the node asking&receiving the Value """ if( _val != null ) { // Set transient fields after deserializing assert !_xkey.home() && _val._key == null; _val._key = _xkey; } // Now update the local store, caching the result. // We only started down the TGK path because we missed locally, so we only // expect to find a NULL in the local store. If somebody else installed // another value (e.g. a racing TGK, or racing local Put) this value must // be more recent than our NULL - but is UNORDERED relative to the Value // returned from the Home. We'll take the local Value to preserve ordering // and rely on invalidates from Home to force refreshes as needed. // Hence we can do a blind putIfMatch here over a null or empty Value // If it fails, what is there is also the TGK result. Value old = H2O.STORE.get(_xkey); if( old != null && !old.isEmpty() ) old=null; Value res = H2O.putIfMatch(_xkey,_val,old); if( res != old ) _val = res; TGKS.remove(_xkey); // Clear from dup cache }
java
@Override public void onAck() { if( _val != null ) { // Set transient fields after deserializing assert !_xkey.home() && _val._key == null; _val._key = _xkey; } // Now update the local store, caching the result. // We only started down the TGK path because we missed locally, so we only // expect to find a NULL in the local store. If somebody else installed // another value (e.g. a racing TGK, or racing local Put) this value must // be more recent than our NULL - but is UNORDERED relative to the Value // returned from the Home. We'll take the local Value to preserve ordering // and rely on invalidates from Home to force refreshes as needed. // Hence we can do a blind putIfMatch here over a null or empty Value // If it fails, what is there is also the TGK result. Value old = H2O.STORE.get(_xkey); if( old != null && !old.isEmpty() ) old=null; Value res = H2O.putIfMatch(_xkey,_val,old); if( res != old ) _val = res; TGKS.remove(_xkey); // Clear from dup cache }
[ "@", "Override", "public", "void", "onAck", "(", ")", "{", "if", "(", "_val", "!=", "null", ")", "{", "// Set transient fields after deserializing", "assert", "!", "_xkey", ".", "home", "(", ")", "&&", "_val", ".", "_key", "==", "null", ";", "_val", ".", "_key", "=", "_xkey", ";", "}", "// Now update the local store, caching the result.", "// We only started down the TGK path because we missed locally, so we only", "// expect to find a NULL in the local store. If somebody else installed", "// another value (e.g. a racing TGK, or racing local Put) this value must", "// be more recent than our NULL - but is UNORDERED relative to the Value", "// returned from the Home. We'll take the local Value to preserve ordering", "// and rely on invalidates from Home to force refreshes as needed.", "// Hence we can do a blind putIfMatch here over a null or empty Value", "// If it fails, what is there is also the TGK result.", "Value", "old", "=", "H2O", ".", "STORE", ".", "get", "(", "_xkey", ")", ";", "if", "(", "old", "!=", "null", "&&", "!", "old", ".", "isEmpty", "(", ")", ")", "old", "=", "null", ";", "Value", "res", "=", "H2O", ".", "putIfMatch", "(", "_xkey", ",", "_val", ",", "old", ")", ";", "if", "(", "res", "!=", "old", ")", "_val", "=", "res", ";", "TGKS", ".", "remove", "(", "_xkey", ")", ";", "// Clear from dup cache", "}" ]
Received an ACK; executes on the node asking&receiving the Value
[ "Received", "an", "ACK", ";", "executes", "on", "the", "node", "asking&receiving", "the", "Value" ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/TaskGetKey.java#L60-L81
akarnokd/ixjava
src/main/java/ix/Ix.java
Ix.as
public final <R> R as(IxFunction<? super Ix<T>, R> transformer) { """ Calls the given transformers with this and returns its value allowing fluent conversions to non-Ix types. @param <R> the result type @param transformer the function receiving this Ix instance and returns a value @return the value returned by the transformer function @throws NullPointerException if transformer is null @since 1.0 """ return transformer.apply(this); }
java
public final <R> R as(IxFunction<? super Ix<T>, R> transformer) { return transformer.apply(this); }
[ "public", "final", "<", "R", ">", "R", "as", "(", "IxFunction", "<", "?", "super", "Ix", "<", "T", ">", ",", "R", ">", "transformer", ")", "{", "return", "transformer", ".", "apply", "(", "this", ")", ";", "}" ]
Calls the given transformers with this and returns its value allowing fluent conversions to non-Ix types. @param <R> the result type @param transformer the function receiving this Ix instance and returns a value @return the value returned by the transformer function @throws NullPointerException if transformer is null @since 1.0
[ "Calls", "the", "given", "transformers", "with", "this", "and", "returns", "its", "value", "allowing", "fluent", "conversions", "to", "non", "-", "Ix", "types", "." ]
train
https://github.com/akarnokd/ixjava/blob/add721bba550c36541faa450e40a975bb65e78d7/src/main/java/ix/Ix.java#L759-L761
mediathekview/MServer
src/main/java/mServer/crawler/sender/arte/ArteVideoDetailsDeserializer.java
ArteVideoDetailsDeserializer.getBroadcastDateIgnoringCatchupRights
private static String getBroadcastDateIgnoringCatchupRights(JsonArray broadcastArray, String broadcastType) { """ * liefert die erste Ausstrahlung des Typs ohne Berücksichtigung der CatchupRights """ String broadcastDate = ""; for(int i = 0; i < broadcastArray.size(); i++) { JsonObject broadcastObject = broadcastArray.get(i).getAsJsonObject(); if(broadcastObject.has(JSON_ELEMENT_BROADCASTTYPE) && broadcastObject.has(JSON_ELEMENT_BROADCAST)) { String type = broadcastObject.get(JSON_ELEMENT_BROADCASTTYPE).getAsString(); if(type.equals(broadcastType)) { if (!broadcastObject.get(JSON_ELEMENT_BROADCAST).isJsonNull()) { broadcastDate = (broadcastObject.get(JSON_ELEMENT_BROADCAST).getAsString()); } } } } return broadcastDate; }
java
private static String getBroadcastDateIgnoringCatchupRights(JsonArray broadcastArray, String broadcastType) { String broadcastDate = ""; for(int i = 0; i < broadcastArray.size(); i++) { JsonObject broadcastObject = broadcastArray.get(i).getAsJsonObject(); if(broadcastObject.has(JSON_ELEMENT_BROADCASTTYPE) && broadcastObject.has(JSON_ELEMENT_BROADCAST)) { String type = broadcastObject.get(JSON_ELEMENT_BROADCASTTYPE).getAsString(); if(type.equals(broadcastType)) { if (!broadcastObject.get(JSON_ELEMENT_BROADCAST).isJsonNull()) { broadcastDate = (broadcastObject.get(JSON_ELEMENT_BROADCAST).getAsString()); } } } } return broadcastDate; }
[ "private", "static", "String", "getBroadcastDateIgnoringCatchupRights", "(", "JsonArray", "broadcastArray", ",", "String", "broadcastType", ")", "{", "String", "broadcastDate", "=", "\"\"", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "broadcastArray", ".", "size", "(", ")", ";", "i", "++", ")", "{", "JsonObject", "broadcastObject", "=", "broadcastArray", ".", "get", "(", "i", ")", ".", "getAsJsonObject", "(", ")", ";", "if", "(", "broadcastObject", ".", "has", "(", "JSON_ELEMENT_BROADCASTTYPE", ")", "&&", "broadcastObject", ".", "has", "(", "JSON_ELEMENT_BROADCAST", ")", ")", "{", "String", "type", "=", "broadcastObject", ".", "get", "(", "JSON_ELEMENT_BROADCASTTYPE", ")", ".", "getAsString", "(", ")", ";", "if", "(", "type", ".", "equals", "(", "broadcastType", ")", ")", "{", "if", "(", "!", "broadcastObject", ".", "get", "(", "JSON_ELEMENT_BROADCAST", ")", ".", "isJsonNull", "(", ")", ")", "{", "broadcastDate", "=", "(", "broadcastObject", ".", "get", "(", "JSON_ELEMENT_BROADCAST", ")", ".", "getAsString", "(", ")", ")", ";", "}", "}", "}", "}", "return", "broadcastDate", ";", "}" ]
* liefert die erste Ausstrahlung des Typs ohne Berücksichtigung der CatchupRights
[ "*", "liefert", "die", "erste", "Ausstrahlung", "des", "Typs", "ohne", "Berücksichtigung", "der", "CatchupRights" ]
train
https://github.com/mediathekview/MServer/blob/ba8d03e6a1a303db3807a1327f553f1decd30388/src/main/java/mServer/crawler/sender/arte/ArteVideoDetailsDeserializer.java#L285-L304
JoeKerouac/utils
src/main/java/com/joe/utils/cluster/redis/RedisClusterManagerFactory.java
RedisClusterManagerFactory.newInstance
public static RedisClusterManager newInstance(String host, int port, String password) { """ 创建一个新的redis实现的分布式管理器 @param host redis的主机地址,例如192.168.1.100 @param port redis的端口,例如8080 @param password 密码 @return redis实现的分布式锁管理器 """ return newInstance(buildRedisConfig(host, port, password)); }
java
public static RedisClusterManager newInstance(String host, int port, String password) { return newInstance(buildRedisConfig(host, port, password)); }
[ "public", "static", "RedisClusterManager", "newInstance", "(", "String", "host", ",", "int", "port", ",", "String", "password", ")", "{", "return", "newInstance", "(", "buildRedisConfig", "(", "host", ",", "port", ",", "password", ")", ")", ";", "}" ]
创建一个新的redis实现的分布式管理器 @param host redis的主机地址,例如192.168.1.100 @param port redis的端口,例如8080 @param password 密码 @return redis实现的分布式锁管理器
[ "创建一个新的redis实现的分布式管理器" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/cluster/redis/RedisClusterManagerFactory.java#L84-L86
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/renderer/VerticalTableHeaderCellRenderer.java
VerticalTableHeaderCellRenderer.getIcon
@Override protected Icon getIcon(JTable table, int column) { """ Overridden to return a rotated version of the sort icon. @param table the <code>JTable</code>. @param column the colummn index. @return the sort icon, or null if the column is unsorted. """ SortKey sortKey = getSortKey(table, column); if (sortKey != null && table.convertColumnIndexToView(sortKey.getColumn()) == column) { SortOrder sortOrder = sortKey.getSortOrder(); switch (sortOrder) { case ASCENDING: return VerticalSortIcon.ASCENDING; case DESCENDING: return VerticalSortIcon.DESCENDING; case UNSORTED: return VerticalSortIcon.ASCENDING; } } return null; }
java
@Override protected Icon getIcon(JTable table, int column) { SortKey sortKey = getSortKey(table, column); if (sortKey != null && table.convertColumnIndexToView(sortKey.getColumn()) == column) { SortOrder sortOrder = sortKey.getSortOrder(); switch (sortOrder) { case ASCENDING: return VerticalSortIcon.ASCENDING; case DESCENDING: return VerticalSortIcon.DESCENDING; case UNSORTED: return VerticalSortIcon.ASCENDING; } } return null; }
[ "@", "Override", "protected", "Icon", "getIcon", "(", "JTable", "table", ",", "int", "column", ")", "{", "SortKey", "sortKey", "=", "getSortKey", "(", "table", ",", "column", ")", ";", "if", "(", "sortKey", "!=", "null", "&&", "table", ".", "convertColumnIndexToView", "(", "sortKey", ".", "getColumn", "(", ")", ")", "==", "column", ")", "{", "SortOrder", "sortOrder", "=", "sortKey", ".", "getSortOrder", "(", ")", ";", "switch", "(", "sortOrder", ")", "{", "case", "ASCENDING", ":", "return", "VerticalSortIcon", ".", "ASCENDING", ";", "case", "DESCENDING", ":", "return", "VerticalSortIcon", ".", "DESCENDING", ";", "case", "UNSORTED", ":", "return", "VerticalSortIcon", ".", "ASCENDING", ";", "}", "}", "return", "null", ";", "}" ]
Overridden to return a rotated version of the sort icon. @param table the <code>JTable</code>. @param column the colummn index. @return the sort icon, or null if the column is unsorted.
[ "Overridden", "to", "return", "a", "rotated", "version", "of", "the", "sort", "icon", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/renderer/VerticalTableHeaderCellRenderer.java#L48-L63
alkacon/opencms-core
src/org/opencms/util/CmsRequestUtil.java
CmsRequestUtil.getJsonParameterMap
public static JSONObject getJsonParameterMap(Map<String, String[]> params) { """ Converts the given parameter map into an JSON object.<p> @param params the parameters map to convert @return the JSON representation of the given parameter map """ JSONObject result = new JSONObject(); for (Map.Entry<String, String[]> entry : params.entrySet()) { String paramKey = entry.getKey(); JSONArray paramValue = new JSONArray(); for (int i = 0, l = entry.getValue().length; i < l; i++) { paramValue.put(entry.getValue()[i]); } try { result.putOpt(paramKey, paramValue); } catch (JSONException e) { // should never happen LOG.warn(e.getLocalizedMessage(), e); } } return result; }
java
public static JSONObject getJsonParameterMap(Map<String, String[]> params) { JSONObject result = new JSONObject(); for (Map.Entry<String, String[]> entry : params.entrySet()) { String paramKey = entry.getKey(); JSONArray paramValue = new JSONArray(); for (int i = 0, l = entry.getValue().length; i < l; i++) { paramValue.put(entry.getValue()[i]); } try { result.putOpt(paramKey, paramValue); } catch (JSONException e) { // should never happen LOG.warn(e.getLocalizedMessage(), e); } } return result; }
[ "public", "static", "JSONObject", "getJsonParameterMap", "(", "Map", "<", "String", ",", "String", "[", "]", ">", "params", ")", "{", "JSONObject", "result", "=", "new", "JSONObject", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", "[", "]", ">", "entry", ":", "params", ".", "entrySet", "(", ")", ")", "{", "String", "paramKey", "=", "entry", ".", "getKey", "(", ")", ";", "JSONArray", "paramValue", "=", "new", "JSONArray", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "entry", ".", "getValue", "(", ")", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "paramValue", ".", "put", "(", "entry", ".", "getValue", "(", ")", "[", "i", "]", ")", ";", "}", "try", "{", "result", ".", "putOpt", "(", "paramKey", ",", "paramValue", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "// should never happen", "LOG", ".", "warn", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "}", "}", "return", "result", ";", "}" ]
Converts the given parameter map into an JSON object.<p> @param params the parameters map to convert @return the JSON representation of the given parameter map
[ "Converts", "the", "given", "parameter", "map", "into", "an", "JSON", "object", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsRequestUtil.java#L577-L594
phax/ph-css
ph-css/src/main/java/com/helger/css/handler/CSSHandler.java
CSSHandler.readCascadingStyleSheetFromNode
@Nonnull @Deprecated public static CascadingStyleSheet readCascadingStyleSheetFromNode (@Nonnull final ECSSVersion eVersion, @Nonnull final CSSNode aNode) { """ Create a {@link CascadingStyleSheet} object from a parsed object. @param eVersion The CSS version to use. May not be <code>null</code>. @param aNode The parsed CSS object to read. May not be <code>null</code>. @return Never <code>null</code>. """ return readCascadingStyleSheetFromNode (eVersion, aNode, CSSReader.getDefaultInterpretErrorHandler ()); }
java
@Nonnull @Deprecated public static CascadingStyleSheet readCascadingStyleSheetFromNode (@Nonnull final ECSSVersion eVersion, @Nonnull final CSSNode aNode) { return readCascadingStyleSheetFromNode (eVersion, aNode, CSSReader.getDefaultInterpretErrorHandler ()); }
[ "@", "Nonnull", "@", "Deprecated", "public", "static", "CascadingStyleSheet", "readCascadingStyleSheetFromNode", "(", "@", "Nonnull", "final", "ECSSVersion", "eVersion", ",", "@", "Nonnull", "final", "CSSNode", "aNode", ")", "{", "return", "readCascadingStyleSheetFromNode", "(", "eVersion", ",", "aNode", ",", "CSSReader", ".", "getDefaultInterpretErrorHandler", "(", ")", ")", ";", "}" ]
Create a {@link CascadingStyleSheet} object from a parsed object. @param eVersion The CSS version to use. May not be <code>null</code>. @param aNode The parsed CSS object to read. May not be <code>null</code>. @return Never <code>null</code>.
[ "Create", "a", "{", "@link", "CascadingStyleSheet", "}", "object", "from", "a", "parsed", "object", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/handler/CSSHandler.java#L55-L61
VoltDB/voltdb
src/frontend/org/voltdb/planner/PlanAssembler.java
PlanAssembler.handleOrderBy
private static AbstractPlanNode handleOrderBy(AbstractParsedStmt parsedStmt, AbstractPlanNode root) { """ Create an order by node as required by the statement and make it a parent of root. @param parsedStmt Parsed statement, for context @param root The root of the plan needing ordering @return new orderByNode (the new root) or the original root if no orderByNode was required. """ assert (parsedStmt instanceof ParsedSelectStmt || parsedStmt instanceof ParsedUnionStmt || parsedStmt instanceof ParsedDeleteStmt); if (! isOrderByNodeRequired(parsedStmt, root)) { return root; } OrderByPlanNode orderByNode = buildOrderByPlanNode(parsedStmt.orderByColumns()); orderByNode.addAndLinkChild(root); return orderByNode; }
java
private static AbstractPlanNode handleOrderBy(AbstractParsedStmt parsedStmt, AbstractPlanNode root) { assert (parsedStmt instanceof ParsedSelectStmt || parsedStmt instanceof ParsedUnionStmt || parsedStmt instanceof ParsedDeleteStmt); if (! isOrderByNodeRequired(parsedStmt, root)) { return root; } OrderByPlanNode orderByNode = buildOrderByPlanNode(parsedStmt.orderByColumns()); orderByNode.addAndLinkChild(root); return orderByNode; }
[ "private", "static", "AbstractPlanNode", "handleOrderBy", "(", "AbstractParsedStmt", "parsedStmt", ",", "AbstractPlanNode", "root", ")", "{", "assert", "(", "parsedStmt", "instanceof", "ParsedSelectStmt", "||", "parsedStmt", "instanceof", "ParsedUnionStmt", "||", "parsedStmt", "instanceof", "ParsedDeleteStmt", ")", ";", "if", "(", "!", "isOrderByNodeRequired", "(", "parsedStmt", ",", "root", ")", ")", "{", "return", "root", ";", "}", "OrderByPlanNode", "orderByNode", "=", "buildOrderByPlanNode", "(", "parsedStmt", ".", "orderByColumns", "(", ")", ")", ";", "orderByNode", ".", "addAndLinkChild", "(", "root", ")", ";", "return", "orderByNode", ";", "}" ]
Create an order by node as required by the statement and make it a parent of root. @param parsedStmt Parsed statement, for context @param root The root of the plan needing ordering @return new orderByNode (the new root) or the original root if no orderByNode was required.
[ "Create", "an", "order", "by", "node", "as", "required", "by", "the", "statement", "and", "make", "it", "a", "parent", "of", "root", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/PlanAssembler.java#L2110-L2121
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java
StreamUtils.closeStreams
private static void closeStreams( InputStream src, OutputStream dest ) { """ Closes the streams and reports Exceptions to System.err @param src The InputStream to close. @param dest The OutputStream to close. """ try { src.close(); } catch( IOException e ) { e.printStackTrace(); } try { dest.close(); } catch( IOException e ) { e.printStackTrace(); } }
java
private static void closeStreams( InputStream src, OutputStream dest ) { try { src.close(); } catch( IOException e ) { e.printStackTrace(); } try { dest.close(); } catch( IOException e ) { e.printStackTrace(); } }
[ "private", "static", "void", "closeStreams", "(", "InputStream", "src", ",", "OutputStream", "dest", ")", "{", "try", "{", "src", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "try", "{", "dest", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Closes the streams and reports Exceptions to System.err @param src The InputStream to close. @param dest The OutputStream to close.
[ "Closes", "the", "streams", "and", "reports", "Exceptions", "to", "System", ".", "err" ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L145-L164
graphql-java/graphql-java
src/main/java/graphql/execution/ExecutionStrategy.java
ExecutionStrategy.completeValue
protected FieldValueInfo completeValue(ExecutionContext executionContext, ExecutionStrategyParameters parameters) throws NonNullableFieldWasNullException { """ Called to complete a value for a field based on the type of the field. <p> If the field is a scalar type, then it will be coerced and returned. However if the field type is an complex object type, then the execution strategy will be called recursively again to execute the fields of that type before returning. <p> Graphql fragments mean that for any give logical field can have one or more {@link Field} values associated with it in the query, hence the fieldList. However the first entry is representative of the field for most purposes. @param executionContext contains the top level execution parameters @param parameters contains the parameters holding the fields to be executed and source object @return a {@link FieldValueInfo} @throws NonNullableFieldWasNullException if a non null field resolves to a null value """ ExecutionStepInfo executionStepInfo = parameters.getExecutionStepInfo(); Object result = UnboxPossibleOptional.unboxPossibleOptional(parameters.getSource()); GraphQLType fieldType = executionStepInfo.getUnwrappedNonNullType(); CompletableFuture<ExecutionResult> fieldValue; if (result == null) { fieldValue = completeValueForNull(parameters); return FieldValueInfo.newFieldValueInfo(NULL).fieldValue(fieldValue).build(); } else if (isList(fieldType)) { return completeValueForList(executionContext, parameters, result); } else if (fieldType instanceof GraphQLScalarType) { fieldValue = completeValueForScalar(executionContext, parameters, (GraphQLScalarType) fieldType, result); return FieldValueInfo.newFieldValueInfo(SCALAR).fieldValue(fieldValue).build(); } else if (fieldType instanceof GraphQLEnumType) { fieldValue = completeValueForEnum(executionContext, parameters, (GraphQLEnumType) fieldType, result); return FieldValueInfo.newFieldValueInfo(ENUM).fieldValue(fieldValue).build(); } // when we are here, we have a complex type: Interface, Union or Object // and we must go deeper // GraphQLObjectType resolvedObjectType; try { resolvedObjectType = resolveType(executionContext, parameters, fieldType); fieldValue = completeValueForObject(executionContext, parameters, resolvedObjectType, result); } catch (UnresolvedTypeException ex) { // consider the result to be null and add the error on the context handleUnresolvedTypeProblem(executionContext, parameters, ex); // and validate the field is nullable, if non-nullable throw exception parameters.getNonNullFieldValidator().validate(parameters.getPath(), null); // complete the field as null fieldValue = completedFuture(new ExecutionResultImpl(null, null)); } return FieldValueInfo.newFieldValueInfo(OBJECT).fieldValue(fieldValue).build(); }
java
protected FieldValueInfo completeValue(ExecutionContext executionContext, ExecutionStrategyParameters parameters) throws NonNullableFieldWasNullException { ExecutionStepInfo executionStepInfo = parameters.getExecutionStepInfo(); Object result = UnboxPossibleOptional.unboxPossibleOptional(parameters.getSource()); GraphQLType fieldType = executionStepInfo.getUnwrappedNonNullType(); CompletableFuture<ExecutionResult> fieldValue; if (result == null) { fieldValue = completeValueForNull(parameters); return FieldValueInfo.newFieldValueInfo(NULL).fieldValue(fieldValue).build(); } else if (isList(fieldType)) { return completeValueForList(executionContext, parameters, result); } else if (fieldType instanceof GraphQLScalarType) { fieldValue = completeValueForScalar(executionContext, parameters, (GraphQLScalarType) fieldType, result); return FieldValueInfo.newFieldValueInfo(SCALAR).fieldValue(fieldValue).build(); } else if (fieldType instanceof GraphQLEnumType) { fieldValue = completeValueForEnum(executionContext, parameters, (GraphQLEnumType) fieldType, result); return FieldValueInfo.newFieldValueInfo(ENUM).fieldValue(fieldValue).build(); } // when we are here, we have a complex type: Interface, Union or Object // and we must go deeper // GraphQLObjectType resolvedObjectType; try { resolvedObjectType = resolveType(executionContext, parameters, fieldType); fieldValue = completeValueForObject(executionContext, parameters, resolvedObjectType, result); } catch (UnresolvedTypeException ex) { // consider the result to be null and add the error on the context handleUnresolvedTypeProblem(executionContext, parameters, ex); // and validate the field is nullable, if non-nullable throw exception parameters.getNonNullFieldValidator().validate(parameters.getPath(), null); // complete the field as null fieldValue = completedFuture(new ExecutionResultImpl(null, null)); } return FieldValueInfo.newFieldValueInfo(OBJECT).fieldValue(fieldValue).build(); }
[ "protected", "FieldValueInfo", "completeValue", "(", "ExecutionContext", "executionContext", ",", "ExecutionStrategyParameters", "parameters", ")", "throws", "NonNullableFieldWasNullException", "{", "ExecutionStepInfo", "executionStepInfo", "=", "parameters", ".", "getExecutionStepInfo", "(", ")", ";", "Object", "result", "=", "UnboxPossibleOptional", ".", "unboxPossibleOptional", "(", "parameters", ".", "getSource", "(", ")", ")", ";", "GraphQLType", "fieldType", "=", "executionStepInfo", ".", "getUnwrappedNonNullType", "(", ")", ";", "CompletableFuture", "<", "ExecutionResult", ">", "fieldValue", ";", "if", "(", "result", "==", "null", ")", "{", "fieldValue", "=", "completeValueForNull", "(", "parameters", ")", ";", "return", "FieldValueInfo", ".", "newFieldValueInfo", "(", "NULL", ")", ".", "fieldValue", "(", "fieldValue", ")", ".", "build", "(", ")", ";", "}", "else", "if", "(", "isList", "(", "fieldType", ")", ")", "{", "return", "completeValueForList", "(", "executionContext", ",", "parameters", ",", "result", ")", ";", "}", "else", "if", "(", "fieldType", "instanceof", "GraphQLScalarType", ")", "{", "fieldValue", "=", "completeValueForScalar", "(", "executionContext", ",", "parameters", ",", "(", "GraphQLScalarType", ")", "fieldType", ",", "result", ")", ";", "return", "FieldValueInfo", ".", "newFieldValueInfo", "(", "SCALAR", ")", ".", "fieldValue", "(", "fieldValue", ")", ".", "build", "(", ")", ";", "}", "else", "if", "(", "fieldType", "instanceof", "GraphQLEnumType", ")", "{", "fieldValue", "=", "completeValueForEnum", "(", "executionContext", ",", "parameters", ",", "(", "GraphQLEnumType", ")", "fieldType", ",", "result", ")", ";", "return", "FieldValueInfo", ".", "newFieldValueInfo", "(", "ENUM", ")", ".", "fieldValue", "(", "fieldValue", ")", ".", "build", "(", ")", ";", "}", "// when we are here, we have a complex type: Interface, Union or Object", "// and we must go deeper", "//", "GraphQLObjectType", "resolvedObjectType", ";", "try", "{", "resolvedObjectType", "=", "resolveType", "(", "executionContext", ",", "parameters", ",", "fieldType", ")", ";", "fieldValue", "=", "completeValueForObject", "(", "executionContext", ",", "parameters", ",", "resolvedObjectType", ",", "result", ")", ";", "}", "catch", "(", "UnresolvedTypeException", "ex", ")", "{", "// consider the result to be null and add the error on the context", "handleUnresolvedTypeProblem", "(", "executionContext", ",", "parameters", ",", "ex", ")", ";", "// and validate the field is nullable, if non-nullable throw exception", "parameters", ".", "getNonNullFieldValidator", "(", ")", ".", "validate", "(", "parameters", ".", "getPath", "(", ")", ",", "null", ")", ";", "// complete the field as null", "fieldValue", "=", "completedFuture", "(", "new", "ExecutionResultImpl", "(", "null", ",", "null", ")", ")", ";", "}", "return", "FieldValueInfo", ".", "newFieldValueInfo", "(", "OBJECT", ")", ".", "fieldValue", "(", "fieldValue", ")", ".", "build", "(", ")", ";", "}" ]
Called to complete a value for a field based on the type of the field. <p> If the field is a scalar type, then it will be coerced and returned. However if the field type is an complex object type, then the execution strategy will be called recursively again to execute the fields of that type before returning. <p> Graphql fragments mean that for any give logical field can have one or more {@link Field} values associated with it in the query, hence the fieldList. However the first entry is representative of the field for most purposes. @param executionContext contains the top level execution parameters @param parameters contains the parameters holding the fields to be executed and source object @return a {@link FieldValueInfo} @throws NonNullableFieldWasNullException if a non null field resolves to a null value
[ "Called", "to", "complete", "a", "value", "for", "a", "field", "based", "on", "the", "type", "of", "the", "field", ".", "<p", ">", "If", "the", "field", "is", "a", "scalar", "type", "then", "it", "will", "be", "coerced", "and", "returned", ".", "However", "if", "the", "field", "type", "is", "an", "complex", "object", "type", "then", "the", "execution", "strategy", "will", "be", "called", "recursively", "again", "to", "execute", "the", "fields", "of", "that", "type", "before", "returning", ".", "<p", ">", "Graphql", "fragments", "mean", "that", "for", "any", "give", "logical", "field", "can", "have", "one", "or", "more", "{", "@link", "Field", "}", "values", "associated", "with", "it", "in", "the", "query", "hence", "the", "fieldList", ".", "However", "the", "first", "entry", "is", "representative", "of", "the", "field", "for", "most", "purposes", "." ]
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/execution/ExecutionStrategy.java#L400-L435
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java
TmdbAuthentication.getSessionToken
public TokenSession getSessionToken(TokenAuthorisation token) throws MovieDbException { """ This method is used to generate a session id for user based authentication. A session id is required in order to use any of the write methods. @param token @return @throws MovieDbException """ TmdbParameters parameters = new TmdbParameters(); if (!token.getSuccess()) { throw new MovieDbException(ApiExceptionType.AUTH_FAILURE, "Authorisation token was not successful!"); } parameters.add(Param.TOKEN, token.getRequestToken()); URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.SESSION_NEW).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, TokenSession.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Session Token", url, ex); } }
java
public TokenSession getSessionToken(TokenAuthorisation token) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); if (!token.getSuccess()) { throw new MovieDbException(ApiExceptionType.AUTH_FAILURE, "Authorisation token was not successful!"); } parameters.add(Param.TOKEN, token.getRequestToken()); URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.SESSION_NEW).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, TokenSession.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Session Token", url, ex); } }
[ "public", "TokenSession", "getSessionToken", "(", "TokenAuthorisation", "token", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "if", "(", "!", "token", ".", "getSuccess", "(", ")", ")", "{", "throw", "new", "MovieDbException", "(", "ApiExceptionType", ".", "AUTH_FAILURE", ",", "\"Authorisation token was not successful!\"", ")", ";", "}", "parameters", ".", "add", "(", "Param", ".", "TOKEN", ",", "token", ".", "getRequestToken", "(", ")", ")", ";", "URL", "url", "=", "new", "ApiUrl", "(", "apiKey", ",", "MethodBase", ".", "AUTH", ")", ".", "subMethod", "(", "MethodSub", ".", "SESSION_NEW", ")", ".", "buildUrl", "(", "parameters", ")", ";", "String", "webpage", "=", "httpTools", ".", "getRequest", "(", "url", ")", ";", "try", "{", "return", "MAPPER", ".", "readValue", "(", "webpage", ",", "TokenSession", ".", "class", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "MovieDbException", "(", "ApiExceptionType", ".", "MAPPING_FAILED", ",", "\"Failed to get Session Token\"", ",", "url", ",", "ex", ")", ";", "}", "}" ]
This method is used to generate a session id for user based authentication. A session id is required in order to use any of the write methods. @param token @return @throws MovieDbException
[ "This", "method", "is", "used", "to", "generate", "a", "session", "id", "for", "user", "based", "authentication", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java#L90-L106
lessthanoptimal/ejml
main/ejml-core/src/org/ejml/ops/MatrixIO.java
MatrixIO.saveBin
public static void saveBin(DMatrix A, String fileName) throws IOException { """ Saves a matrix to disk using Java binary serialization. @param A The matrix being saved. @param fileName Name of the file its being saved at. @throws java.io.IOException """ FileOutputStream fileStream = new FileOutputStream(fileName); ObjectOutputStream stream = new ObjectOutputStream(fileStream); try { stream.writeObject(A); stream.flush(); } finally { // clean up try { stream.close(); } finally { fileStream.close(); } } }
java
public static void saveBin(DMatrix A, String fileName) throws IOException { FileOutputStream fileStream = new FileOutputStream(fileName); ObjectOutputStream stream = new ObjectOutputStream(fileStream); try { stream.writeObject(A); stream.flush(); } finally { // clean up try { stream.close(); } finally { fileStream.close(); } } }
[ "public", "static", "void", "saveBin", "(", "DMatrix", "A", ",", "String", "fileName", ")", "throws", "IOException", "{", "FileOutputStream", "fileStream", "=", "new", "FileOutputStream", "(", "fileName", ")", ";", "ObjectOutputStream", "stream", "=", "new", "ObjectOutputStream", "(", "fileStream", ")", ";", "try", "{", "stream", ".", "writeObject", "(", "A", ")", ";", "stream", ".", "flush", "(", ")", ";", "}", "finally", "{", "// clean up", "try", "{", "stream", ".", "close", "(", ")", ";", "}", "finally", "{", "fileStream", ".", "close", "(", ")", ";", "}", "}", "}" ]
Saves a matrix to disk using Java binary serialization. @param A The matrix being saved. @param fileName Name of the file its being saved at. @throws java.io.IOException
[ "Saves", "a", "matrix", "to", "disk", "using", "Java", "binary", "serialization", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/MatrixIO.java#L48-L66
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java
JdbcCpoXaAdapter.deleteObject
@Override public <T> long deleteObject(String name, T obj) throws CpoException { """ Removes the Object from the datasource. The assumption is that the object exists in the datasource. This method stores the object in the datasource <p> <pre>Example: <code> <p> class SomeObject so = new SomeObject(); class CpoAdapter cpo = null; <p> try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } <p> if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.deleteObject("DeleteById",so); } catch (CpoException ce) { // Handle the error } } </code> </pre> @param name The String name of the DELETE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used. @param obj This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource an exception will be thrown. @return The number of objects deleted from the datasource @throws CpoException Thrown if there are errors accessing the datasource """ return getCurrentResource().deleteObject( name, obj); }
java
@Override public <T> long deleteObject(String name, T obj) throws CpoException { return getCurrentResource().deleteObject( name, obj); }
[ "@", "Override", "public", "<", "T", ">", "long", "deleteObject", "(", "String", "name", ",", "T", "obj", ")", "throws", "CpoException", "{", "return", "getCurrentResource", "(", ")", ".", "deleteObject", "(", "name", ",", "obj", ")", ";", "}" ]
Removes the Object from the datasource. The assumption is that the object exists in the datasource. This method stores the object in the datasource <p> <pre>Example: <code> <p> class SomeObject so = new SomeObject(); class CpoAdapter cpo = null; <p> try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } <p> if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.deleteObject("DeleteById",so); } catch (CpoException ce) { // Handle the error } } </code> </pre> @param name The String name of the DELETE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used. @param obj This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource an exception will be thrown. @return The number of objects deleted from the datasource @throws CpoException Thrown if there are errors accessing the datasource
[ "Removes", "the", "Object", "from", "the", "datasource", ".", "The", "assumption", "is", "that", "the", "object", "exists", "in", "the", "datasource", ".", "This", "method", "stores", "the", "object", "in", "the", "datasource", "<p", ">", "<pre", ">", "Example", ":", "<code", ">", "<p", ">", "class", "SomeObject", "so", "=", "new", "SomeObject", "()", ";", "class", "CpoAdapter", "cpo", "=", "null", ";", "<p", ">", "try", "{", "cpo", "=", "new", "JdbcCpoAdapter", "(", "new", "JdbcDataSourceInfo", "(", "driver", "url", "user", "password", "1", "1", "false", "))", ";", "}", "catch", "(", "CpoException", "ce", ")", "{", "//", "Handle", "the", "error", "cpo", "=", "null", ";", "}", "<p", ">", "if", "(", "cpo!", "=", "null", ")", "{", "so", ".", "setId", "(", "1", ")", ";", "so", ".", "setName", "(", "SomeName", ")", ";", "try", "{", "cpo", ".", "deleteObject", "(", "DeleteById", "so", ")", ";", "}", "catch", "(", "CpoException", "ce", ")", "{", "//", "Handle", "the", "error", "}", "}", "<", "/", "code", ">", "<", "/", "pre", ">" ]
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L484-L487
jparsec/jparsec
jparsec/src/main/java/org/jparsec/pattern/Patterns.java
Patterns.hasExact
public static Pattern hasExact(final int n) { """ Returns a {@link Pattern} object that matches if the input has exactly {@code n} characters left. Match length is {@code n} if succeed. """ Checks.checkNonNegative(n, "n < 0"); return new Pattern() { @Override public int match(CharSequence src, int begin, int end) { if ((begin + n) != end) return MISMATCH; else return n; } @Override public String toString() { return ".{" + n + "}"; } }; }
java
public static Pattern hasExact(final int n) { Checks.checkNonNegative(n, "n < 0"); return new Pattern() { @Override public int match(CharSequence src, int begin, int end) { if ((begin + n) != end) return MISMATCH; else return n; } @Override public String toString() { return ".{" + n + "}"; } }; }
[ "public", "static", "Pattern", "hasExact", "(", "final", "int", "n", ")", "{", "Checks", ".", "checkNonNegative", "(", "n", ",", "\"n < 0\"", ")", ";", "return", "new", "Pattern", "(", ")", "{", "@", "Override", "public", "int", "match", "(", "CharSequence", "src", ",", "int", "begin", ",", "int", "end", ")", "{", "if", "(", "(", "begin", "+", "n", ")", "!=", "end", ")", "return", "MISMATCH", ";", "else", "return", "n", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\".{\"", "+", "n", "+", "\"}\"", ";", "}", "}", ";", "}" ]
Returns a {@link Pattern} object that matches if the input has exactly {@code n} characters left. Match length is {@code n} if succeed.
[ "Returns", "a", "{" ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/pattern/Patterns.java#L146-L157
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/las/utils/LasUtils.java
LasUtils.dumpLasFolderOverview
public static void dumpLasFolderOverview( String folder, CoordinateReferenceSystem crs ) throws Exception { """ Dump an overview shapefile for a las folder. @param folder the folder. @param crs the crs to use. @throws Exception """ SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("overview"); b.setCRS(crs); b.add("the_geom", Polygon.class); b.add("name", String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); DefaultFeatureCollection newCollection = new DefaultFeatureCollection(); OmsFileIterator iter = new OmsFileIterator(); iter.inFolder = folder; iter.fileFilter = new FileFilter(){ public boolean accept( File pathname ) { return pathname.getName().endsWith(".las"); } }; iter.process(); List<File> filesList = iter.filesList; for( File file : filesList ) { try (ALasReader r = new LasReaderBuffered(file, crs)) { r.open(); ReferencedEnvelope3D envelope = r.getHeader().getDataEnvelope(); Polygon polygon = GeometryUtilities.createPolygonFromEnvelope(envelope); Object[] objs = new Object[]{polygon, r.getLasFile().getName()}; builder.addAll(objs); SimpleFeature feature = builder.buildFeature(null); newCollection.add(feature); } } File folderFile = new File(folder); File outFile = new File(folder, "overview_" + folderFile.getName() + ".shp"); OmsVectorWriter.writeVector(outFile.getAbsolutePath(), newCollection); }
java
public static void dumpLasFolderOverview( String folder, CoordinateReferenceSystem crs ) throws Exception { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("overview"); b.setCRS(crs); b.add("the_geom", Polygon.class); b.add("name", String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); DefaultFeatureCollection newCollection = new DefaultFeatureCollection(); OmsFileIterator iter = new OmsFileIterator(); iter.inFolder = folder; iter.fileFilter = new FileFilter(){ public boolean accept( File pathname ) { return pathname.getName().endsWith(".las"); } }; iter.process(); List<File> filesList = iter.filesList; for( File file : filesList ) { try (ALasReader r = new LasReaderBuffered(file, crs)) { r.open(); ReferencedEnvelope3D envelope = r.getHeader().getDataEnvelope(); Polygon polygon = GeometryUtilities.createPolygonFromEnvelope(envelope); Object[] objs = new Object[]{polygon, r.getLasFile().getName()}; builder.addAll(objs); SimpleFeature feature = builder.buildFeature(null); newCollection.add(feature); } } File folderFile = new File(folder); File outFile = new File(folder, "overview_" + folderFile.getName() + ".shp"); OmsVectorWriter.writeVector(outFile.getAbsolutePath(), newCollection); }
[ "public", "static", "void", "dumpLasFolderOverview", "(", "String", "folder", ",", "CoordinateReferenceSystem", "crs", ")", "throws", "Exception", "{", "SimpleFeatureTypeBuilder", "b", "=", "new", "SimpleFeatureTypeBuilder", "(", ")", ";", "b", ".", "setName", "(", "\"overview\"", ")", ";", "b", ".", "setCRS", "(", "crs", ")", ";", "b", ".", "add", "(", "\"the_geom\"", ",", "Polygon", ".", "class", ")", ";", "b", ".", "add", "(", "\"name\"", ",", "String", ".", "class", ")", ";", "SimpleFeatureType", "type", "=", "b", ".", "buildFeatureType", "(", ")", ";", "SimpleFeatureBuilder", "builder", "=", "new", "SimpleFeatureBuilder", "(", "type", ")", ";", "DefaultFeatureCollection", "newCollection", "=", "new", "DefaultFeatureCollection", "(", ")", ";", "OmsFileIterator", "iter", "=", "new", "OmsFileIterator", "(", ")", ";", "iter", ".", "inFolder", "=", "folder", ";", "iter", ".", "fileFilter", "=", "new", "FileFilter", "(", ")", "{", "public", "boolean", "accept", "(", "File", "pathname", ")", "{", "return", "pathname", ".", "getName", "(", ")", ".", "endsWith", "(", "\".las\"", ")", ";", "}", "}", ";", "iter", ".", "process", "(", ")", ";", "List", "<", "File", ">", "filesList", "=", "iter", ".", "filesList", ";", "for", "(", "File", "file", ":", "filesList", ")", "{", "try", "(", "ALasReader", "r", "=", "new", "LasReaderBuffered", "(", "file", ",", "crs", ")", ")", "{", "r", ".", "open", "(", ")", ";", "ReferencedEnvelope3D", "envelope", "=", "r", ".", "getHeader", "(", ")", ".", "getDataEnvelope", "(", ")", ";", "Polygon", "polygon", "=", "GeometryUtilities", ".", "createPolygonFromEnvelope", "(", "envelope", ")", ";", "Object", "[", "]", "objs", "=", "new", "Object", "[", "]", "{", "polygon", ",", "r", ".", "getLasFile", "(", ")", ".", "getName", "(", ")", "}", ";", "builder", ".", "addAll", "(", "objs", ")", ";", "SimpleFeature", "feature", "=", "builder", ".", "buildFeature", "(", "null", ")", ";", "newCollection", ".", "add", "(", "feature", ")", ";", "}", "}", "File", "folderFile", "=", "new", "File", "(", "folder", ")", ";", "File", "outFile", "=", "new", "File", "(", "folder", ",", "\"overview_\"", "+", "folderFile", ".", "getName", "(", ")", "+", "\".shp\"", ")", ";", "OmsVectorWriter", ".", "writeVector", "(", "outFile", ".", "getAbsolutePath", "(", ")", ",", "newCollection", ")", ";", "}" ]
Dump an overview shapefile for a las folder. @param folder the folder. @param crs the crs to use. @throws Exception
[ "Dump", "an", "overview", "shapefile", "for", "a", "las", "folder", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/las/utils/LasUtils.java#L251-L288
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.processCustomValueLists
private void processCustomValueLists() throws IOException { """ This method extracts and collates the value list information for custom column value lists. @throws IOException """ DirectoryEntry taskDir = (DirectoryEntry) m_projectDir.getEntry("TBkndTask"); if (taskDir.hasEntry("Props")) { Props taskProps = new Props14(m_inputStreamFactory.getInstance(taskDir, "Props")); CustomFieldValueReader14 reader = new CustomFieldValueReader14(m_file.getProjectProperties(), m_file.getCustomFields(), m_outlineCodeVarMeta, m_outlineCodeVarData, m_outlineCodeFixedData, m_outlineCodeFixedData2, taskProps); reader.process(); } }
java
private void processCustomValueLists() throws IOException { DirectoryEntry taskDir = (DirectoryEntry) m_projectDir.getEntry("TBkndTask"); if (taskDir.hasEntry("Props")) { Props taskProps = new Props14(m_inputStreamFactory.getInstance(taskDir, "Props")); CustomFieldValueReader14 reader = new CustomFieldValueReader14(m_file.getProjectProperties(), m_file.getCustomFields(), m_outlineCodeVarMeta, m_outlineCodeVarData, m_outlineCodeFixedData, m_outlineCodeFixedData2, taskProps); reader.process(); } }
[ "private", "void", "processCustomValueLists", "(", ")", "throws", "IOException", "{", "DirectoryEntry", "taskDir", "=", "(", "DirectoryEntry", ")", "m_projectDir", ".", "getEntry", "(", "\"TBkndTask\"", ")", ";", "if", "(", "taskDir", ".", "hasEntry", "(", "\"Props\"", ")", ")", "{", "Props", "taskProps", "=", "new", "Props14", "(", "m_inputStreamFactory", ".", "getInstance", "(", "taskDir", ",", "\"Props\"", ")", ")", ";", "CustomFieldValueReader14", "reader", "=", "new", "CustomFieldValueReader14", "(", "m_file", ".", "getProjectProperties", "(", ")", ",", "m_file", ".", "getCustomFields", "(", ")", ",", "m_outlineCodeVarMeta", ",", "m_outlineCodeVarData", ",", "m_outlineCodeFixedData", ",", "m_outlineCodeFixedData2", ",", "taskProps", ")", ";", "reader", ".", "process", "(", ")", ";", "}", "}" ]
This method extracts and collates the value list information for custom column value lists. @throws IOException
[ "This", "method", "extracts", "and", "collates", "the", "value", "list", "information", "for", "custom", "column", "value", "lists", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L206-L216
crawljax/crawljax
core/src/main/java/com/crawljax/util/UrlUtils.java
UrlUtils.isSameDomain
public static boolean isSameDomain(String currentUrl, URI url) { """ Checks if the given URL is part of the domain, or a sub-domain of the given {@link java.net.URI}. @param currentUrl The url you want to check. @param url The URL acting as the base. @return If the URL is part of the domain. """ String current = URI.create(getBaseUrl(currentUrl)).getHost() .toLowerCase(); String original = url.getHost().toLowerCase(); return current.endsWith(original); }
java
public static boolean isSameDomain(String currentUrl, URI url) { String current = URI.create(getBaseUrl(currentUrl)).getHost() .toLowerCase(); String original = url.getHost().toLowerCase(); return current.endsWith(original); }
[ "public", "static", "boolean", "isSameDomain", "(", "String", "currentUrl", ",", "URI", "url", ")", "{", "String", "current", "=", "URI", ".", "create", "(", "getBaseUrl", "(", "currentUrl", ")", ")", ".", "getHost", "(", ")", ".", "toLowerCase", "(", ")", ";", "String", "original", "=", "url", ".", "getHost", "(", ")", ".", "toLowerCase", "(", ")", ";", "return", "current", ".", "endsWith", "(", "original", ")", ";", "}" ]
Checks if the given URL is part of the domain, or a sub-domain of the given {@link java.net.URI}. @param currentUrl The url you want to check. @param url The URL acting as the base. @return If the URL is part of the domain.
[ "Checks", "if", "the", "given", "URL", "is", "part", "of", "the", "domain", "or", "a", "sub", "-", "domain", "of", "the", "given", "{", "@link", "java", ".", "net", ".", "URI", "}", "." ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/util/UrlUtils.java#L87-L93
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java
DTMDocumentImpl.getExpandedTypeID
public int getExpandedTypeID(String namespace, String localName, int type) { """ Given an expanded name, return an ID. If the expanded-name does not exist in the internal tables, the entry will be created, and the ID will be returned. Any additional nodes that are created that have this expanded name will use this ID. @return the expanded-name id of the node. """ // Create expanded name // %TBD% jjk Expanded name is bitfield-encoded as // typeID[6]nsuriID[10]localID[16]. Switch to that form, and to // accessing the ns/local via their tables rather than confusing // nsnames and expandednames. String expandedName = namespace + ":" + localName; int expandedNameID = m_nsNames.stringToIndex(expandedName); return expandedNameID; }
java
public int getExpandedTypeID(String namespace, String localName, int type) { // Create expanded name // %TBD% jjk Expanded name is bitfield-encoded as // typeID[6]nsuriID[10]localID[16]. Switch to that form, and to // accessing the ns/local via their tables rather than confusing // nsnames and expandednames. String expandedName = namespace + ":" + localName; int expandedNameID = m_nsNames.stringToIndex(expandedName); return expandedNameID; }
[ "public", "int", "getExpandedTypeID", "(", "String", "namespace", ",", "String", "localName", ",", "int", "type", ")", "{", "// Create expanded name", "// %TBD% jjk Expanded name is bitfield-encoded as", "// typeID[6]nsuriID[10]localID[16]. Switch to that form, and to", "// accessing the ns/local via their tables rather than confusing", "// nsnames and expandednames.", "String", "expandedName", "=", "namespace", "+", "\":\"", "+", "localName", ";", "int", "expandedNameID", "=", "m_nsNames", ".", "stringToIndex", "(", "expandedName", ")", ";", "return", "expandedNameID", ";", "}" ]
Given an expanded name, return an ID. If the expanded-name does not exist in the internal tables, the entry will be created, and the ID will be returned. Any additional nodes that are created that have this expanded name will use this ID. @return the expanded-name id of the node.
[ "Given", "an", "expanded", "name", "return", "an", "ID", ".", "If", "the", "expanded", "-", "name", "does", "not", "exist", "in", "the", "internal", "tables", "the", "entry", "will", "be", "created", "and", "the", "ID", "will", "be", "returned", ".", "Any", "additional", "nodes", "that", "are", "created", "that", "have", "this", "expanded", "name", "will", "use", "this", "ID", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L1535-L1545
alkacon/opencms-core
src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleExecutor.java
CmsSqlConsoleExecutor.executeUpdate
private int executeUpdate(String sentence, String poolName) throws SQLException { """ Executes a single sql sentence.<p> For <code>SELECT</code> sentences use <code>{@link #executeQuery(String, String)}</code>.<p> @param sentence the sentence to execute @param poolName the name of the pool to use @return the number of affected rows @throws SQLException if there is an error """ Connection conn = null; PreparedStatement stmt = null; int ret = 0; CmsSqlManager sqlManager = m_sqlManager; try { conn = sqlManager.getConnection(poolName); stmt = sqlManager.getPreparedStatementForSql(conn, sentence); ret = stmt.executeUpdate(); } finally { sqlManager.closeAll(null, conn, stmt, null); } return ret; }
java
private int executeUpdate(String sentence, String poolName) throws SQLException { Connection conn = null; PreparedStatement stmt = null; int ret = 0; CmsSqlManager sqlManager = m_sqlManager; try { conn = sqlManager.getConnection(poolName); stmt = sqlManager.getPreparedStatementForSql(conn, sentence); ret = stmt.executeUpdate(); } finally { sqlManager.closeAll(null, conn, stmt, null); } return ret; }
[ "private", "int", "executeUpdate", "(", "String", "sentence", ",", "String", "poolName", ")", "throws", "SQLException", "{", "Connection", "conn", "=", "null", ";", "PreparedStatement", "stmt", "=", "null", ";", "int", "ret", "=", "0", ";", "CmsSqlManager", "sqlManager", "=", "m_sqlManager", ";", "try", "{", "conn", "=", "sqlManager", ".", "getConnection", "(", "poolName", ")", ";", "stmt", "=", "sqlManager", ".", "getPreparedStatementForSql", "(", "conn", ",", "sentence", ")", ";", "ret", "=", "stmt", ".", "executeUpdate", "(", ")", ";", "}", "finally", "{", "sqlManager", ".", "closeAll", "(", "null", ",", "conn", ",", "stmt", ",", "null", ")", ";", "}", "return", "ret", ";", "}" ]
Executes a single sql sentence.<p> For <code>SELECT</code> sentences use <code>{@link #executeQuery(String, String)}</code>.<p> @param sentence the sentence to execute @param poolName the name of the pool to use @return the number of affected rows @throws SQLException if there is an error
[ "Executes", "a", "single", "sql", "sentence", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleExecutor.java#L238-L253
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/blockdata/BlockDataHandler.java
BlockDataHandler.removeData
public static <T> void removeData(String identifier, IBlockAccess world, BlockPos pos, boolean sendToClients) { """ Removes the custom data stored at the {@link BlockPos} for the specified identifier and eventually sends it to clients watching the chunk. @param <T> the generic type @param identifier the identifier @param world the world @param pos the pos @param sendToClients the send to clients """ setData(identifier, world, pos, null, sendToClients); }
java
public static <T> void removeData(String identifier, IBlockAccess world, BlockPos pos, boolean sendToClients) { setData(identifier, world, pos, null, sendToClients); }
[ "public", "static", "<", "T", ">", "void", "removeData", "(", "String", "identifier", ",", "IBlockAccess", "world", ",", "BlockPos", "pos", ",", "boolean", "sendToClients", ")", "{", "setData", "(", "identifier", ",", "world", ",", "pos", ",", "null", ",", "sendToClients", ")", ";", "}" ]
Removes the custom data stored at the {@link BlockPos} for the specified identifier and eventually sends it to clients watching the chunk. @param <T> the generic type @param identifier the identifier @param world the world @param pos the pos @param sendToClients the send to clients
[ "Removes", "the", "custom", "data", "stored", "at", "the", "{", "@link", "BlockPos", "}", "for", "the", "specified", "identifier", "and", "eventually", "sends", "it", "to", "clients", "watching", "the", "chunk", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/blockdata/BlockDataHandler.java#L361-L364
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_vxml_serviceName_settings_PUT
public void billingAccount_vxml_serviceName_settings_PUT(String billingAccount, String serviceName, OvhVxmlProperties body) throws IOException { """ Alter this object properties REST: PUT /telephony/{billingAccount}/vxml/{serviceName}/settings @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required] """ String qPath = "/telephony/{billingAccount}/vxml/{serviceName}/settings"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_vxml_serviceName_settings_PUT(String billingAccount, String serviceName, OvhVxmlProperties body) throws IOException { String qPath = "/telephony/{billingAccount}/vxml/{serviceName}/settings"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_vxml_serviceName_settings_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhVxmlProperties", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/vxml/{serviceName}/settings\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /telephony/{billingAccount}/vxml/{serviceName}/settings @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5105-L5109
johnkil/Android-AppMsg
library/src/com/devspark/appmsg/AppMsg.java
AppMsg.makeText
public static AppMsg makeText(Activity context, CharSequence text, Style style, float textSize) { """ @author mengguoqiang Make a {@link AppMsg} that just contains a text view. @param context The context to use. Usually your {@link android.app.Activity} object. @param text The text to show. Can be formatted text. @param style The style with a background and a duration. """ return makeText(context, text, style, R.layout.app_msg, textSize); }
java
public static AppMsg makeText(Activity context, CharSequence text, Style style, float textSize) { return makeText(context, text, style, R.layout.app_msg, textSize); }
[ "public", "static", "AppMsg", "makeText", "(", "Activity", "context", ",", "CharSequence", "text", ",", "Style", "style", ",", "float", "textSize", ")", "{", "return", "makeText", "(", "context", ",", "text", ",", "style", ",", "R", ".", "layout", ".", "app_msg", ",", "textSize", ")", ";", "}" ]
@author mengguoqiang Make a {@link AppMsg} that just contains a text view. @param context The context to use. Usually your {@link android.app.Activity} object. @param text The text to show. Can be formatted text. @param style The style with a background and a duration.
[ "@author", "mengguoqiang", "Make", "a", "{", "@link", "AppMsg", "}", "that", "just", "contains", "a", "text", "view", "." ]
train
https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/library/src/com/devspark/appmsg/AppMsg.java#L158-L160
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.deleteImageTagsAsync
public Observable<Void> deleteImageTagsAsync(UUID projectId, List<String> imageIds, List<String> tagIds) { """ Remove a set of tags from a set of images. @param projectId The project id @param imageIds Image ids. Limited to 64 images @param tagIds Tags to be deleted from the specified images. Limted to 20 tags @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return deleteImageTagsWithServiceResponseAsync(projectId, imageIds, tagIds).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> deleteImageTagsAsync(UUID projectId, List<String> imageIds, List<String> tagIds) { return deleteImageTagsWithServiceResponseAsync(projectId, imageIds, tagIds).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "deleteImageTagsAsync", "(", "UUID", "projectId", ",", "List", "<", "String", ">", "imageIds", ",", "List", "<", "String", ">", "tagIds", ")", "{", "return", "deleteImageTagsWithServiceResponseAsync", "(", "projectId", ",", "imageIds", ",", "tagIds", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Remove a set of tags from a set of images. @param projectId The project id @param imageIds Image ids. Limited to 64 images @param tagIds Tags to be deleted from the specified images. Limted to 20 tags @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Remove", "a", "set", "of", "tags", "from", "a", "set", "of", "images", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3532-L3539
k3po/k3po
control/src/main/java/org/kaazing/k3po/control/internal/Control.java
Control.readEvent
public CommandEvent readEvent(int timeout, TimeUnit unit) throws Exception { """ Reads a command event from the wire. @param timeout is the time to read from the connection. @param unit of time for the timeout. @return the CommandEvent read from the wire. @throws Exception if no event is read before the timeout. """ checkConnected(); connection.setReadTimeout((int) unit.toMillis(timeout)); CommandEvent event = null; String eventType = textIn.readLine(); if (Thread.interrupted()) { throw new InterruptedException("thread interrupted during blocking read"); } if (eventType != null) { switch (eventType) { case PREPARED_EVENT: event = readPreparedEvent(); break; case STARTED_EVENT: event = readStartedEvent(); break; case ERROR_EVENT: event = readErrorEvent(); break; case FINISHED_EVENT: event = readFinishedEvent(); break; case NOTIFIED_EVENT: event = readNotifiedEvent(); break; default: throw new IllegalStateException("Invalid protocol frame: " + eventType); } } return event; }
java
public CommandEvent readEvent(int timeout, TimeUnit unit) throws Exception { checkConnected(); connection.setReadTimeout((int) unit.toMillis(timeout)); CommandEvent event = null; String eventType = textIn.readLine(); if (Thread.interrupted()) { throw new InterruptedException("thread interrupted during blocking read"); } if (eventType != null) { switch (eventType) { case PREPARED_EVENT: event = readPreparedEvent(); break; case STARTED_EVENT: event = readStartedEvent(); break; case ERROR_EVENT: event = readErrorEvent(); break; case FINISHED_EVENT: event = readFinishedEvent(); break; case NOTIFIED_EVENT: event = readNotifiedEvent(); break; default: throw new IllegalStateException("Invalid protocol frame: " + eventType); } } return event; }
[ "public", "CommandEvent", "readEvent", "(", "int", "timeout", ",", "TimeUnit", "unit", ")", "throws", "Exception", "{", "checkConnected", "(", ")", ";", "connection", ".", "setReadTimeout", "(", "(", "int", ")", "unit", ".", "toMillis", "(", "timeout", ")", ")", ";", "CommandEvent", "event", "=", "null", ";", "String", "eventType", "=", "textIn", ".", "readLine", "(", ")", ";", "if", "(", "Thread", ".", "interrupted", "(", ")", ")", "{", "throw", "new", "InterruptedException", "(", "\"thread interrupted during blocking read\"", ")", ";", "}", "if", "(", "eventType", "!=", "null", ")", "{", "switch", "(", "eventType", ")", "{", "case", "PREPARED_EVENT", ":", "event", "=", "readPreparedEvent", "(", ")", ";", "break", ";", "case", "STARTED_EVENT", ":", "event", "=", "readStartedEvent", "(", ")", ";", "break", ";", "case", "ERROR_EVENT", ":", "event", "=", "readErrorEvent", "(", ")", ";", "break", ";", "case", "FINISHED_EVENT", ":", "event", "=", "readFinishedEvent", "(", ")", ";", "break", ";", "case", "NOTIFIED_EVENT", ":", "event", "=", "readNotifiedEvent", "(", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalStateException", "(", "\"Invalid protocol frame: \"", "+", "eventType", ")", ";", "}", "}", "return", "event", ";", "}" ]
Reads a command event from the wire. @param timeout is the time to read from the connection. @param unit of time for the timeout. @return the CommandEvent read from the wire. @throws Exception if no event is read before the timeout.
[ "Reads", "a", "command", "event", "from", "the", "wire", "." ]
train
https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/control/src/main/java/org/kaazing/k3po/control/internal/Control.java#L176-L213
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/Transformation2D.java
Transformation2D.flipX
public void flipX(double x0, double x1) { """ Flips the transformation around the X axis. @param x0 The X coordinate to flip. @param x1 The X coordinate to flip to. """ xx = -xx; xy = -xy; xd = x0 + x1 - xd; }
java
public void flipX(double x0, double x1) { xx = -xx; xy = -xy; xd = x0 + x1 - xd; }
[ "public", "void", "flipX", "(", "double", "x0", ",", "double", "x1", ")", "{", "xx", "=", "-", "xx", ";", "xy", "=", "-", "xy", ";", "xd", "=", "x0", "+", "x1", "-", "xd", ";", "}" ]
Flips the transformation around the X axis. @param x0 The X coordinate to flip. @param x1 The X coordinate to flip to.
[ "Flips", "the", "transformation", "around", "the", "X", "axis", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Transformation2D.java#L798-L802
operasoftware/operaprestodriver
src/com/opera/core/systems/scope/stp/services/ScopeExec.java
ScopeExec.executeScreenWatcher
private ScreenWatcherResult executeScreenWatcher(ScreenWatcher.Builder builder, long timeout) { """ Executes a screenwatcher with the given timeout and returns the result. """ if (timeout <= 0) { timeout = 1; } // TODO(andreastt): Unsafe long to int cast builder.setTimeOut((int) timeout); builder.setWindowID(services.getWindowManager().getActiveWindowId()); Response response = executeMessage(ExecMessage.SETUP_SCREEN_WATCHER, builder, OperaIntervals.RESPONSE_TIMEOUT.getMs() + timeout); ScreenWatcherResult.Builder watcherBuilder = ScreenWatcherResult.newBuilder(); buildPayload(response, watcherBuilder); return watcherBuilder.build(); }
java
private ScreenWatcherResult executeScreenWatcher(ScreenWatcher.Builder builder, long timeout) { if (timeout <= 0) { timeout = 1; } // TODO(andreastt): Unsafe long to int cast builder.setTimeOut((int) timeout); builder.setWindowID(services.getWindowManager().getActiveWindowId()); Response response = executeMessage(ExecMessage.SETUP_SCREEN_WATCHER, builder, OperaIntervals.RESPONSE_TIMEOUT.getMs() + timeout); ScreenWatcherResult.Builder watcherBuilder = ScreenWatcherResult.newBuilder(); buildPayload(response, watcherBuilder); return watcherBuilder.build(); }
[ "private", "ScreenWatcherResult", "executeScreenWatcher", "(", "ScreenWatcher", ".", "Builder", "builder", ",", "long", "timeout", ")", "{", "if", "(", "timeout", "<=", "0", ")", "{", "timeout", "=", "1", ";", "}", "// TODO(andreastt): Unsafe long to int cast", "builder", ".", "setTimeOut", "(", "(", "int", ")", "timeout", ")", ";", "builder", ".", "setWindowID", "(", "services", ".", "getWindowManager", "(", ")", ".", "getActiveWindowId", "(", ")", ")", ";", "Response", "response", "=", "executeMessage", "(", "ExecMessage", ".", "SETUP_SCREEN_WATCHER", ",", "builder", ",", "OperaIntervals", ".", "RESPONSE_TIMEOUT", ".", "getMs", "(", ")", "+", "timeout", ")", ";", "ScreenWatcherResult", ".", "Builder", "watcherBuilder", "=", "ScreenWatcherResult", ".", "newBuilder", "(", ")", ";", "buildPayload", "(", "response", ",", "watcherBuilder", ")", ";", "return", "watcherBuilder", ".", "build", "(", ")", ";", "}" ]
Executes a screenwatcher with the given timeout and returns the result.
[ "Executes", "a", "screenwatcher", "with", "the", "given", "timeout", "and", "returns", "the", "result", "." ]
train
https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/scope/stp/services/ScopeExec.java#L242-L260
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.writeUtf8
public static int writeUtf8(ByteBuf buf, CharSequence seq) { """ Encode a {@link CharSequence} in <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> and write it to a {@link ByteBuf}. <p> It behaves like {@link #reserveAndWriteUtf8(ByteBuf, CharSequence, int)} with {@code reserveBytes} computed by {@link #utf8MaxBytes(CharSequence)}.<br> This method returns the actual number of bytes written. """ return reserveAndWriteUtf8(buf, seq, utf8MaxBytes(seq)); }
java
public static int writeUtf8(ByteBuf buf, CharSequence seq) { return reserveAndWriteUtf8(buf, seq, utf8MaxBytes(seq)); }
[ "public", "static", "int", "writeUtf8", "(", "ByteBuf", "buf", ",", "CharSequence", "seq", ")", "{", "return", "reserveAndWriteUtf8", "(", "buf", ",", "seq", ",", "utf8MaxBytes", "(", "seq", ")", ")", ";", "}" ]
Encode a {@link CharSequence} in <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> and write it to a {@link ByteBuf}. <p> It behaves like {@link #reserveAndWriteUtf8(ByteBuf, CharSequence, int)} with {@code reserveBytes} computed by {@link #utf8MaxBytes(CharSequence)}.<br> This method returns the actual number of bytes written.
[ "Encode", "a", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L498-L500
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.readExcel2Objects
public <T> List<T> readExcel2Objects(String excelPath, Class<T> clazz, int offsetLine, int limitLine, int sheetIndex) throws Excel4JException, IOException, InvalidFormatException { """ 读取Excel操作基于注解映射成绑定的java对象 @param excelPath 待导出Excel的路径 @param clazz 待绑定的类(绑定属性注解{@link com.github.crab2died.annotation.ExcelField}) @param offsetLine Excel表头行(默认是0) @param limitLine 最大读取行数(默认表尾) @param sheetIndex Sheet索引(默认0) @param <T> 绑定的数据类 @return 返回转换为设置绑定的java对象集合 @throws Excel4JException 异常 @throws IOException 异常 @throws InvalidFormatException 异常 @author Crab2Died """ try (Workbook workbook = WorkbookFactory.create(new FileInputStream(new File(excelPath)))) { return readExcel2ObjectsHandler(workbook, clazz, offsetLine, limitLine, sheetIndex); } }
java
public <T> List<T> readExcel2Objects(String excelPath, Class<T> clazz, int offsetLine, int limitLine, int sheetIndex) throws Excel4JException, IOException, InvalidFormatException { try (Workbook workbook = WorkbookFactory.create(new FileInputStream(new File(excelPath)))) { return readExcel2ObjectsHandler(workbook, clazz, offsetLine, limitLine, sheetIndex); } }
[ "public", "<", "T", ">", "List", "<", "T", ">", "readExcel2Objects", "(", "String", "excelPath", ",", "Class", "<", "T", ">", "clazz", ",", "int", "offsetLine", ",", "int", "limitLine", ",", "int", "sheetIndex", ")", "throws", "Excel4JException", ",", "IOException", ",", "InvalidFormatException", "{", "try", "(", "Workbook", "workbook", "=", "WorkbookFactory", ".", "create", "(", "new", "FileInputStream", "(", "new", "File", "(", "excelPath", ")", ")", ")", ")", "{", "return", "readExcel2ObjectsHandler", "(", "workbook", ",", "clazz", ",", "offsetLine", ",", "limitLine", ",", "sheetIndex", ")", ";", "}", "}" ]
读取Excel操作基于注解映射成绑定的java对象 @param excelPath 待导出Excel的路径 @param clazz 待绑定的类(绑定属性注解{@link com.github.crab2died.annotation.ExcelField}) @param offsetLine Excel表头行(默认是0) @param limitLine 最大读取行数(默认表尾) @param sheetIndex Sheet索引(默认0) @param <T> 绑定的数据类 @return 返回转换为设置绑定的java对象集合 @throws Excel4JException 异常 @throws IOException 异常 @throws InvalidFormatException 异常 @author Crab2Died
[ "读取Excel操作基于注解映射成绑定的java对象" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L126-L133
qspin/qtaste
kernel/src/main/java/com/qspin/qtaste/util/Strings.java
Strings.fromNullTerminatedByteArray
public static String fromNullTerminatedByteArray(byte[] array) { """ Converts a null-terminated byte array into a string. @param array byte array containing a null-terminated string @return string from array """ int stringSize = array.length; for (int i = 0; i < array.length; i++) { if (array[i] == 0) { stringSize = i; break; } } return new String(array, 0, stringSize); }
java
public static String fromNullTerminatedByteArray(byte[] array) { int stringSize = array.length; for (int i = 0; i < array.length; i++) { if (array[i] == 0) { stringSize = i; break; } } return new String(array, 0, stringSize); }
[ "public", "static", "String", "fromNullTerminatedByteArray", "(", "byte", "[", "]", "array", ")", "{", "int", "stringSize", "=", "array", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "if", "(", "array", "[", "i", "]", "==", "0", ")", "{", "stringSize", "=", "i", ";", "break", ";", "}", "}", "return", "new", "String", "(", "array", ",", "0", ",", "stringSize", ")", ";", "}" ]
Converts a null-terminated byte array into a string. @param array byte array containing a null-terminated string @return string from array
[ "Converts", "a", "null", "-", "terminated", "byte", "array", "into", "a", "string", "." ]
train
https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/util/Strings.java#L101-L111
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java
DateFormat.setBooleanAttribute
public DateFormat setBooleanAttribute(BooleanAttribute key, boolean value) { """ Sets a boolean attribute for this instance. Aspects of DateFormat leniency are controlled by boolean attributes. @see BooleanAttribute """ if(key.equals(DateFormat.BooleanAttribute.PARSE_PARTIAL_MATCH)) { key = DateFormat.BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH; } if(value) { booleanAttributes.add(key); } else { booleanAttributes.remove(key); } return this; }
java
public DateFormat setBooleanAttribute(BooleanAttribute key, boolean value) { if(key.equals(DateFormat.BooleanAttribute.PARSE_PARTIAL_MATCH)) { key = DateFormat.BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH; } if(value) { booleanAttributes.add(key); } else { booleanAttributes.remove(key); } return this; }
[ "public", "DateFormat", "setBooleanAttribute", "(", "BooleanAttribute", "key", ",", "boolean", "value", ")", "{", "if", "(", "key", ".", "equals", "(", "DateFormat", ".", "BooleanAttribute", ".", "PARSE_PARTIAL_MATCH", ")", ")", "{", "key", "=", "DateFormat", ".", "BooleanAttribute", ".", "PARSE_PARTIAL_LITERAL_MATCH", ";", "}", "if", "(", "value", ")", "{", "booleanAttributes", ".", "add", "(", "key", ")", ";", "}", "else", "{", "booleanAttributes", ".", "remove", "(", "key", ")", ";", "}", "return", "this", ";", "}" ]
Sets a boolean attribute for this instance. Aspects of DateFormat leniency are controlled by boolean attributes. @see BooleanAttribute
[ "Sets", "a", "boolean", "attribute", "for", "this", "instance", ".", "Aspects", "of", "DateFormat", "leniency", "are", "controlled", "by", "boolean", "attributes", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1564-L1579
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_attachedDomain_domain_PUT
public void serviceName_attachedDomain_domain_PUT(String serviceName, String domain, OvhAttachedDomain body) throws IOException { """ Alter this object properties REST: PUT /hosting/web/{serviceName}/attachedDomain/{domain} @param body [required] New object properties @param serviceName [required] The internal name of your hosting @param domain [required] Domain linked (fqdn) """ String qPath = "/hosting/web/{serviceName}/attachedDomain/{domain}"; StringBuilder sb = path(qPath, serviceName, domain); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_attachedDomain_domain_PUT(String serviceName, String domain, OvhAttachedDomain body) throws IOException { String qPath = "/hosting/web/{serviceName}/attachedDomain/{domain}"; StringBuilder sb = path(qPath, serviceName, domain); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_attachedDomain_domain_PUT", "(", "String", "serviceName", ",", "String", "domain", ",", "OvhAttachedDomain", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/attachedDomain/{domain}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "domain", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /hosting/web/{serviceName}/attachedDomain/{domain} @param body [required] New object properties @param serviceName [required] The internal name of your hosting @param domain [required] Domain linked (fqdn)
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1963-L1967
Bernardo-MG/maven-site-fixer
src/main/java/com/bernardomg/velocity/tool/HtmlTool.java
HtmlTool.swapTagWithParent
public final void swapTagWithParent(final Element root, final String selector) { """ Finds a set of elements through a CSS selector and swaps its tag with that from its parent. @param root body element with source divisions to upgrade @param selector CSS selector for the elements to swap with its parent """ final Iterable<Element> elements; // Selected elements Element parent; // Parent element String text; // Preserved text checkNotNull(root, "Received a null pointer as root element"); checkNotNull(selector, "Received a null pointer as selector"); // Selects and iterates over the elements elements = root.select(selector); for (final Element element : elements) { parent = element.parent(); // Takes the text out of the element text = element.text(); element.text(""); // Swaps elements parent.replaceWith(element); element.appendChild(parent); // Sets the text into what was the parent element parent.text(text); } }
java
public final void swapTagWithParent(final Element root, final String selector) { final Iterable<Element> elements; // Selected elements Element parent; // Parent element String text; // Preserved text checkNotNull(root, "Received a null pointer as root element"); checkNotNull(selector, "Received a null pointer as selector"); // Selects and iterates over the elements elements = root.select(selector); for (final Element element : elements) { parent = element.parent(); // Takes the text out of the element text = element.text(); element.text(""); // Swaps elements parent.replaceWith(element); element.appendChild(parent); // Sets the text into what was the parent element parent.text(text); } }
[ "public", "final", "void", "swapTagWithParent", "(", "final", "Element", "root", ",", "final", "String", "selector", ")", "{", "final", "Iterable", "<", "Element", ">", "elements", ";", "// Selected elements", "Element", "parent", ";", "// Parent element", "String", "text", ";", "// Preserved text", "checkNotNull", "(", "root", ",", "\"Received a null pointer as root element\"", ")", ";", "checkNotNull", "(", "selector", ",", "\"Received a null pointer as selector\"", ")", ";", "// Selects and iterates over the elements", "elements", "=", "root", ".", "select", "(", "selector", ")", ";", "for", "(", "final", "Element", "element", ":", "elements", ")", "{", "parent", "=", "element", ".", "parent", "(", ")", ";", "// Takes the text out of the element", "text", "=", "element", ".", "text", "(", ")", ";", "element", ".", "text", "(", "\"\"", ")", ";", "// Swaps elements", "parent", ".", "replaceWith", "(", "element", ")", ";", "element", ".", "appendChild", "(", "parent", ")", ";", "// Sets the text into what was the parent element", "parent", ".", "text", "(", "text", ")", ";", "}", "}" ]
Finds a set of elements through a CSS selector and swaps its tag with that from its parent. @param root body element with source divisions to upgrade @param selector CSS selector for the elements to swap with its parent
[ "Finds", "a", "set", "of", "elements", "through", "a", "CSS", "selector", "and", "swaps", "its", "tag", "with", "that", "from", "its", "parent", "." ]
train
https://github.com/Bernardo-MG/maven-site-fixer/blob/e064472faa7edb0fca11647a22d90ad72089baa3/src/main/java/com/bernardomg/velocity/tool/HtmlTool.java#L166-L191
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyDecoder.java
KeyDecoder.decodeCharacterObjDesc
public static Character decodeCharacterObjDesc(byte[] src, int srcOffset) throws CorruptEncodingException { """ Decodes a Character object from exactly 1 or 3 bytes, as encoded for descending order. If null is returned, then 1 byte was read. @param src source of encoded bytes @param srcOffset offset into source array @return Character object or null """ try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeCharDesc(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static Character decodeCharacterObjDesc(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeCharDesc(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "Character", "decodeCharacterObjDesc", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "int", "b", "=", "src", "[", "srcOffset", "]", ";", "if", "(", "b", "==", "NULL_BYTE_HIGH", "||", "b", "==", "NULL_BYTE_LOW", ")", "{", "return", "null", ";", "}", "return", "decodeCharDesc", "(", "src", ",", "srcOffset", "+", "1", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a Character object from exactly 1 or 3 bytes, as encoded for descending order. If null is returned, then 1 byte was read. @param src source of encoded bytes @param srcOffset offset into source array @return Character object or null
[ "Decodes", "a", "Character", "object", "from", "exactly", "1", "or", "3", "bytes", "as", "encoded", "for", "descending", "order", ".", "If", "null", "is", "returned", "then", "1", "byte", "was", "read", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L213-L225
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfAction.java
PdfAction.javaScript
public static PdfAction javaScript(String code, PdfWriter writer, boolean unicode) { """ Creates a JavaScript action. If the JavaScript is smaller than 50 characters it will be placed as a string, otherwise it will be placed as a compressed stream. @param code the JavaScript code @param writer the writer for this action @param unicode select JavaScript unicode. Note that the internal Acrobat JavaScript engine does not support unicode, so this may or may not work for you @return the JavaScript action """ PdfAction js = new PdfAction(); js.put(PdfName.S, PdfName.JAVASCRIPT); if (unicode && code.length() < 50) { js.put(PdfName.JS, new PdfString(code, PdfObject.TEXT_UNICODE)); } else if (!unicode && code.length() < 100) { js.put(PdfName.JS, new PdfString(code)); } else { try { byte b[] = PdfEncodings.convertToBytes(code, unicode ? PdfObject.TEXT_UNICODE : PdfObject.TEXT_PDFDOCENCODING); PdfStream stream = new PdfStream(b); stream.flateCompress(writer.getCompressionLevel()); js.put(PdfName.JS, writer.addToBody(stream).getIndirectReference()); } catch (Exception e) { js.put(PdfName.JS, new PdfString(code)); } } return js; }
java
public static PdfAction javaScript(String code, PdfWriter writer, boolean unicode) { PdfAction js = new PdfAction(); js.put(PdfName.S, PdfName.JAVASCRIPT); if (unicode && code.length() < 50) { js.put(PdfName.JS, new PdfString(code, PdfObject.TEXT_UNICODE)); } else if (!unicode && code.length() < 100) { js.put(PdfName.JS, new PdfString(code)); } else { try { byte b[] = PdfEncodings.convertToBytes(code, unicode ? PdfObject.TEXT_UNICODE : PdfObject.TEXT_PDFDOCENCODING); PdfStream stream = new PdfStream(b); stream.flateCompress(writer.getCompressionLevel()); js.put(PdfName.JS, writer.addToBody(stream).getIndirectReference()); } catch (Exception e) { js.put(PdfName.JS, new PdfString(code)); } } return js; }
[ "public", "static", "PdfAction", "javaScript", "(", "String", "code", ",", "PdfWriter", "writer", ",", "boolean", "unicode", ")", "{", "PdfAction", "js", "=", "new", "PdfAction", "(", ")", ";", "js", ".", "put", "(", "PdfName", ".", "S", ",", "PdfName", ".", "JAVASCRIPT", ")", ";", "if", "(", "unicode", "&&", "code", ".", "length", "(", ")", "<", "50", ")", "{", "js", ".", "put", "(", "PdfName", ".", "JS", ",", "new", "PdfString", "(", "code", ",", "PdfObject", ".", "TEXT_UNICODE", ")", ")", ";", "}", "else", "if", "(", "!", "unicode", "&&", "code", ".", "length", "(", ")", "<", "100", ")", "{", "js", ".", "put", "(", "PdfName", ".", "JS", ",", "new", "PdfString", "(", "code", ")", ")", ";", "}", "else", "{", "try", "{", "byte", "b", "[", "]", "=", "PdfEncodings", ".", "convertToBytes", "(", "code", ",", "unicode", "?", "PdfObject", ".", "TEXT_UNICODE", ":", "PdfObject", ".", "TEXT_PDFDOCENCODING", ")", ";", "PdfStream", "stream", "=", "new", "PdfStream", "(", "b", ")", ";", "stream", ".", "flateCompress", "(", "writer", ".", "getCompressionLevel", "(", ")", ")", ";", "js", ".", "put", "(", "PdfName", ".", "JS", ",", "writer", ".", "addToBody", "(", "stream", ")", ".", "getIndirectReference", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "js", ".", "put", "(", "PdfName", ".", "JS", ",", "new", "PdfString", "(", "code", ")", ")", ";", "}", "}", "return", "js", ";", "}" ]
Creates a JavaScript action. If the JavaScript is smaller than 50 characters it will be placed as a string, otherwise it will be placed as a compressed stream. @param code the JavaScript code @param writer the writer for this action @param unicode select JavaScript unicode. Note that the internal Acrobat JavaScript engine does not support unicode, so this may or may not work for you @return the JavaScript action
[ "Creates", "a", "JavaScript", "action", ".", "If", "the", "JavaScript", "is", "smaller", "than", "50", "characters", "it", "will", "be", "placed", "as", "a", "string", "otherwise", "it", "will", "be", "placed", "as", "a", "compressed", "stream", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfAction.java#L292-L313
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.getGroupTemplate
public LdapGroup getGroupTemplate(String cn) { """ Returns a basic LDAP-Group-Template for a new LDAP-Group. The Group contains always the LDAP-Principal User (for Reading). @param cn of the new LDAP-Group. @return the (pre-filled) Group-Template. """ LdapGroup group = new LdapGroup(cn, this); group.set("dn", getDNForNode(group)); for (String oc : groupObjectClasses) { group.addObjectClass(oc.trim()); } group = (LdapGroup) updateObjectClasses(group); // TODO this needs to be cleaner :-/. // for inetOrgPerson if (group.getObjectClasses().contains("shadowAccount")) { group.set("uid", cn); } // for groupOfNames // First User is always the Principal group.addUser((LdapUser) getPrincipal()); return group; }
java
public LdapGroup getGroupTemplate(String cn) { LdapGroup group = new LdapGroup(cn, this); group.set("dn", getDNForNode(group)); for (String oc : groupObjectClasses) { group.addObjectClass(oc.trim()); } group = (LdapGroup) updateObjectClasses(group); // TODO this needs to be cleaner :-/. // for inetOrgPerson if (group.getObjectClasses().contains("shadowAccount")) { group.set("uid", cn); } // for groupOfNames // First User is always the Principal group.addUser((LdapUser) getPrincipal()); return group; }
[ "public", "LdapGroup", "getGroupTemplate", "(", "String", "cn", ")", "{", "LdapGroup", "group", "=", "new", "LdapGroup", "(", "cn", ",", "this", ")", ";", "group", ".", "set", "(", "\"dn\"", ",", "getDNForNode", "(", "group", ")", ")", ";", "for", "(", "String", "oc", ":", "groupObjectClasses", ")", "{", "group", ".", "addObjectClass", "(", "oc", ".", "trim", "(", ")", ")", ";", "}", "group", "=", "(", "LdapGroup", ")", "updateObjectClasses", "(", "group", ")", ";", "// TODO this needs to be cleaner :-/.", "// for inetOrgPerson", "if", "(", "group", ".", "getObjectClasses", "(", ")", ".", "contains", "(", "\"shadowAccount\"", ")", ")", "{", "group", ".", "set", "(", "\"uid\"", ",", "cn", ")", ";", "}", "// for groupOfNames", "// First User is always the Principal", "group", ".", "addUser", "(", "(", "LdapUser", ")", "getPrincipal", "(", ")", ")", ";", "return", "group", ";", "}" ]
Returns a basic LDAP-Group-Template for a new LDAP-Group. The Group contains always the LDAP-Principal User (for Reading). @param cn of the new LDAP-Group. @return the (pre-filled) Group-Template.
[ "Returns", "a", "basic", "LDAP", "-", "Group", "-", "Template", "for", "a", "new", "LDAP", "-", "Group", ".", "The", "Group", "contains", "always", "the", "LDAP", "-", "Principal", "User", "(", "for", "Reading", ")", "." ]
train
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L664-L682
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/actions/SaveXmlAction.java
SaveXmlAction.work
private void work(final IProject project, final String fileName) { """ Save the XML result of a FindBugs analysis on the given project, displaying a progress monitor. @param project The selected project. @param fileName The file name to store the XML to. """ FindBugsJob runFindBugs = new FindBugsJob("Saving SpotBugs XML data to " + fileName + "...", project) { @Override protected void runWithProgress(IProgressMonitor monitor) throws CoreException { BugCollection bugCollection = FindbugsPlugin.getBugCollection(project, monitor); try { bugCollection.writeXML(fileName); } catch (IOException e) { CoreException ex = new CoreException(FindbugsPlugin.createErrorStatus( "Can't write SpotBugs bug collection from project " + project + " to file " + fileName, e)); throw ex; } } }; runFindBugs.setRule(project); runFindBugs.scheduleInteractive(); }
java
private void work(final IProject project, final String fileName) { FindBugsJob runFindBugs = new FindBugsJob("Saving SpotBugs XML data to " + fileName + "...", project) { @Override protected void runWithProgress(IProgressMonitor monitor) throws CoreException { BugCollection bugCollection = FindbugsPlugin.getBugCollection(project, monitor); try { bugCollection.writeXML(fileName); } catch (IOException e) { CoreException ex = new CoreException(FindbugsPlugin.createErrorStatus( "Can't write SpotBugs bug collection from project " + project + " to file " + fileName, e)); throw ex; } } }; runFindBugs.setRule(project); runFindBugs.scheduleInteractive(); }
[ "private", "void", "work", "(", "final", "IProject", "project", ",", "final", "String", "fileName", ")", "{", "FindBugsJob", "runFindBugs", "=", "new", "FindBugsJob", "(", "\"Saving SpotBugs XML data to \"", "+", "fileName", "+", "\"...\"", ",", "project", ")", "{", "@", "Override", "protected", "void", "runWithProgress", "(", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "BugCollection", "bugCollection", "=", "FindbugsPlugin", ".", "getBugCollection", "(", "project", ",", "monitor", ")", ";", "try", "{", "bugCollection", ".", "writeXML", "(", "fileName", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "CoreException", "ex", "=", "new", "CoreException", "(", "FindbugsPlugin", ".", "createErrorStatus", "(", "\"Can't write SpotBugs bug collection from project \"", "+", "project", "+", "\" to file \"", "+", "fileName", ",", "e", ")", ")", ";", "throw", "ex", ";", "}", "}", "}", ";", "runFindBugs", ".", "setRule", "(", "project", ")", ";", "runFindBugs", ".", "scheduleInteractive", "(", ")", ";", "}" ]
Save the XML result of a FindBugs analysis on the given project, displaying a progress monitor. @param project The selected project. @param fileName The file name to store the XML to.
[ "Save", "the", "XML", "result", "of", "a", "FindBugs", "analysis", "on", "the", "given", "project", "displaying", "a", "progress", "monitor", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/actions/SaveXmlAction.java#L126-L142
jayantk/jklol
src/com/jayantkrish/jklol/cfg/CfgParseChart.java
CfgParseChart.updateOutsideEntry
public void updateOutsideEntry(int spanStart, int spanEnd, double[] values, Factor factor, VariableNumMap var) { """ Update an entry of the outside chart with a new production. Depending on the type of the chart, this performs either a sum or max over productions of the same type in the same entry. """ if (sumProduct) { updateEntrySumProduct(outsideChart[spanStart][spanEnd], values, factor.coerceToDiscrete().getWeights(), var.getOnlyVariableNum()); } else { updateEntryMaxProduct(outsideChart[spanStart][spanEnd], values, factor.coerceToDiscrete().getWeights(), var.getOnlyVariableNum()); } }
java
public void updateOutsideEntry(int spanStart, int spanEnd, double[] values, Factor factor, VariableNumMap var) { if (sumProduct) { updateEntrySumProduct(outsideChart[spanStart][spanEnd], values, factor.coerceToDiscrete().getWeights(), var.getOnlyVariableNum()); } else { updateEntryMaxProduct(outsideChart[spanStart][spanEnd], values, factor.coerceToDiscrete().getWeights(), var.getOnlyVariableNum()); } }
[ "public", "void", "updateOutsideEntry", "(", "int", "spanStart", ",", "int", "spanEnd", ",", "double", "[", "]", "values", ",", "Factor", "factor", ",", "VariableNumMap", "var", ")", "{", "if", "(", "sumProduct", ")", "{", "updateEntrySumProduct", "(", "outsideChart", "[", "spanStart", "]", "[", "spanEnd", "]", ",", "values", ",", "factor", ".", "coerceToDiscrete", "(", ")", ".", "getWeights", "(", ")", ",", "var", ".", "getOnlyVariableNum", "(", ")", ")", ";", "}", "else", "{", "updateEntryMaxProduct", "(", "outsideChart", "[", "spanStart", "]", "[", "spanEnd", "]", ",", "values", ",", "factor", ".", "coerceToDiscrete", "(", ")", ".", "getWeights", "(", ")", ",", "var", ".", "getOnlyVariableNum", "(", ")", ")", ";", "}", "}" ]
Update an entry of the outside chart with a new production. Depending on the type of the chart, this performs either a sum or max over productions of the same type in the same entry.
[ "Update", "an", "entry", "of", "the", "outside", "chart", "with", "a", "new", "production", ".", "Depending", "on", "the", "type", "of", "the", "chart", "this", "performs", "either", "a", "sum", "or", "max", "over", "productions", "of", "the", "same", "type", "in", "the", "same", "entry", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/cfg/CfgParseChart.java#L185-L193
otto-de/edison-microservice
edison-core/src/main/java/de/otto/edison/authentication/Credentials.java
Credentials.readFrom
public static Optional<Credentials> readFrom(HttpServletRequest request) { """ Read username and password from the request's {@code Authorization} header and create a {@code Credentials} object. Requires authorization header to be base64 encoded. @param request incoming http request @return {@code Optional} with parsed {@code Credentials} if {@code Authorization} header and credentials are present, {@code Optional.empty} otherwise. """ String authorizationHeader = request.getHeader("Authorization"); if (!StringUtils.isEmpty(authorizationHeader)) { String credentials = authorizationHeader.substring(6, authorizationHeader.length()); String[] decodedCredentialParts = new String(Base64Utils.decode(credentials.getBytes())).split(":", 2); if (!decodedCredentialParts[0].isEmpty() && !decodedCredentialParts[1].isEmpty()) { return Optional.of(new Credentials(decodedCredentialParts[0], decodedCredentialParts[1])); } } return Optional.empty(); }
java
public static Optional<Credentials> readFrom(HttpServletRequest request) { String authorizationHeader = request.getHeader("Authorization"); if (!StringUtils.isEmpty(authorizationHeader)) { String credentials = authorizationHeader.substring(6, authorizationHeader.length()); String[] decodedCredentialParts = new String(Base64Utils.decode(credentials.getBytes())).split(":", 2); if (!decodedCredentialParts[0].isEmpty() && !decodedCredentialParts[1].isEmpty()) { return Optional.of(new Credentials(decodedCredentialParts[0], decodedCredentialParts[1])); } } return Optional.empty(); }
[ "public", "static", "Optional", "<", "Credentials", ">", "readFrom", "(", "HttpServletRequest", "request", ")", "{", "String", "authorizationHeader", "=", "request", ".", "getHeader", "(", "\"Authorization\"", ")", ";", "if", "(", "!", "StringUtils", ".", "isEmpty", "(", "authorizationHeader", ")", ")", "{", "String", "credentials", "=", "authorizationHeader", ".", "substring", "(", "6", ",", "authorizationHeader", ".", "length", "(", ")", ")", ";", "String", "[", "]", "decodedCredentialParts", "=", "new", "String", "(", "Base64Utils", ".", "decode", "(", "credentials", ".", "getBytes", "(", ")", ")", ")", ".", "split", "(", "\":\"", ",", "2", ")", ";", "if", "(", "!", "decodedCredentialParts", "[", "0", "]", ".", "isEmpty", "(", ")", "&&", "!", "decodedCredentialParts", "[", "1", "]", ".", "isEmpty", "(", ")", ")", "{", "return", "Optional", ".", "of", "(", "new", "Credentials", "(", "decodedCredentialParts", "[", "0", "]", ",", "decodedCredentialParts", "[", "1", "]", ")", ")", ";", "}", "}", "return", "Optional", ".", "empty", "(", ")", ";", "}" ]
Read username and password from the request's {@code Authorization} header and create a {@code Credentials} object. Requires authorization header to be base64 encoded. @param request incoming http request @return {@code Optional} with parsed {@code Credentials} if {@code Authorization} header and credentials are present, {@code Optional.empty} otherwise.
[ "Read", "username", "and", "password", "from", "the", "request", "s", "{", "@code", "Authorization", "}", "header", "and", "create", "a", "{", "@code", "Credentials", "}", "object", ".", "Requires", "authorization", "header", "to", "be", "base64", "encoded", "." ]
train
https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-core/src/main/java/de/otto/edison/authentication/Credentials.java#L38-L48
OpenBEL/openbel-framework
org.openbel.framework.api/src/main/java/org/openbel/framework/api/Equivalencer.java
Equivalencer.getUUID
public SkinnyUUID getUUID(Namespace namespace, String value) throws EquivalencerException { """ Obtain the equivalence UUID for the given {@link Namespace namespace} and value. @param namespace {@link Namespace namespace}, must not be null @param value {@link String value}, must not be null @return {@link SkinnyUUID UUID} representing the value or <code>null</code> if the namespace/value combination has no equivalents. null is also returned if the namespace has no equivalences defined. @throws EquivalencerException Thrown if an exception occurs finding all equivalences """ loadEquivalencingEngine(); final Parameter p = new Parameter(namespace, value); try { return paramEquivalencer.getUUID(p); } catch (InvalidArgument e) { //TODO change when paramEquivalencer exception is changed return null; } catch (Exception e) { final String fmt = "Unable to find UUID for '%s'"; final String msg = format(fmt, p.toBELShortForm()); throw new EquivalencerException(msg, e); } }
java
public SkinnyUUID getUUID(Namespace namespace, String value) throws EquivalencerException { loadEquivalencingEngine(); final Parameter p = new Parameter(namespace, value); try { return paramEquivalencer.getUUID(p); } catch (InvalidArgument e) { //TODO change when paramEquivalencer exception is changed return null; } catch (Exception e) { final String fmt = "Unable to find UUID for '%s'"; final String msg = format(fmt, p.toBELShortForm()); throw new EquivalencerException(msg, e); } }
[ "public", "SkinnyUUID", "getUUID", "(", "Namespace", "namespace", ",", "String", "value", ")", "throws", "EquivalencerException", "{", "loadEquivalencingEngine", "(", ")", ";", "final", "Parameter", "p", "=", "new", "Parameter", "(", "namespace", ",", "value", ")", ";", "try", "{", "return", "paramEquivalencer", ".", "getUUID", "(", "p", ")", ";", "}", "catch", "(", "InvalidArgument", "e", ")", "{", "//TODO change when paramEquivalencer exception is changed", "return", "null", ";", "}", "catch", "(", "Exception", "e", ")", "{", "final", "String", "fmt", "=", "\"Unable to find UUID for '%s'\"", ";", "final", "String", "msg", "=", "format", "(", "fmt", ",", "p", ".", "toBELShortForm", "(", ")", ")", ";", "throw", "new", "EquivalencerException", "(", "msg", ",", "e", ")", ";", "}", "}" ]
Obtain the equivalence UUID for the given {@link Namespace namespace} and value. @param namespace {@link Namespace namespace}, must not be null @param value {@link String value}, must not be null @return {@link SkinnyUUID UUID} representing the value or <code>null</code> if the namespace/value combination has no equivalents. null is also returned if the namespace has no equivalences defined. @throws EquivalencerException Thrown if an exception occurs finding all equivalences
[ "Obtain", "the", "equivalence", "UUID", "for", "the", "given", "{" ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.api/src/main/java/org/openbel/framework/api/Equivalencer.java#L268-L283
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java
Configuration.finishOptionSettings0
private void finishOptionSettings0() throws DocletException { """ /* when this is called all the option have been set, this method, initializes certain components before anything else is started. """ initDestDirectory(); if (urlForLink != null && pkglistUrlForLink != null) extern.link(urlForLink, pkglistUrlForLink, reporter, false); if (urlForLinkOffline != null && pkglistUrlForLinkOffline != null) extern.link(urlForLinkOffline, pkglistUrlForLinkOffline, reporter, true); if (docencoding == null) { docencoding = encoding; } typeElementCatalog = new TypeElementCatalog(includedTypeElements, this); initTagletManager(customTagStrs); groups.stream().forEach((grp) -> { if (showModules) { group.checkModuleGroups(grp.value1, grp.value2); }
java
private void finishOptionSettings0() throws DocletException { initDestDirectory(); if (urlForLink != null && pkglistUrlForLink != null) extern.link(urlForLink, pkglistUrlForLink, reporter, false); if (urlForLinkOffline != null && pkglistUrlForLinkOffline != null) extern.link(urlForLinkOffline, pkglistUrlForLinkOffline, reporter, true); if (docencoding == null) { docencoding = encoding; } typeElementCatalog = new TypeElementCatalog(includedTypeElements, this); initTagletManager(customTagStrs); groups.stream().forEach((grp) -> { if (showModules) { group.checkModuleGroups(grp.value1, grp.value2); }
[ "private", "void", "finishOptionSettings0", "(", ")", "throws", "DocletException", "{", "initDestDirectory", "(", ")", ";", "if", "(", "urlForLink", "!=", "null", "&&", "pkglistUrlForLink", "!=", "null", ")", "extern", ".", "link", "(", "urlForLink", ",", "pkglistUrlForLink", ",", "reporter", ",", "false", ")", ";", "if", "(", "urlForLinkOffline", "!=", "null", "&&", "pkglistUrlForLinkOffline", "!=", "null", ")", "extern", ".", "link", "(", "urlForLinkOffline", ",", "pkglistUrlForLinkOffline", ",", "reporter", ",", "true", ")", ";", "if", "(", "docencoding", "==", "null", ")", "{", "docencoding", "=", "encoding", ";", "}", "typeElementCatalog", "=", "new", "TypeElementCatalog", "(", "includedTypeElements", ",", "this", ")", ";", "initTagletManager", "(", "customTagStrs", ")", ";", "groups", ".", "stream", "(", ")", ".", "forEach", "(", "(", "grp", ")", "-", ">", "{", "if", "(", "showModules", ")", "{", "group", ".", "checkModuleGroups", "(", "grp", ".", "value1", ",", "grp", ".", "value2", ")", "", ";", "}" ]
/* when this is called all the option have been set, this method, initializes certain components before anything else is started.
[ "/", "*", "when", "this", "is", "called", "all", "the", "option", "have", "been", "set", "this", "method", "initializes", "certain", "components", "before", "anything", "else", "is", "started", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java#L690-L704