repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
eurekaclinical/javautil
src/main/java/org/arp/javautil/io/IOUtil.java
IOUtil.getResourceAsStream
public static InputStream getResourceAsStream(String name, Class<?> cls) throws IOException { """ Finds a resource with a given name using the class loader of the specified class. Functions identically to {@link Class#getResourceAsStream(java.lang.String)}, except it throws an {@link IllegalArgumentException} if the specified resource name is <code>null</code>, and it throws an {@link IOException} if no resource with the specified name is found. @param name name {@link String} of the desired resource. Cannot be <code>null</code>. @param cls the {@link Class} whose loader to use. @return an {@link InputStream}. @throws IOException if no resource with this name is found. """ if (cls == null) { cls = IOUtil.class; } if (name == null) { throw new IllegalArgumentException("resource cannot be null"); } InputStream result = cls.getResourceAsStream(name); if (result == null) { throw new IOException("Could not open resource " + name + " using " + cls.getName() + "'s class loader"); } return result; }
java
public static InputStream getResourceAsStream(String name, Class<?> cls) throws IOException { if (cls == null) { cls = IOUtil.class; } if (name == null) { throw new IllegalArgumentException("resource cannot be null"); } InputStream result = cls.getResourceAsStream(name); if (result == null) { throw new IOException("Could not open resource " + name + " using " + cls.getName() + "'s class loader"); } return result; }
[ "public", "static", "InputStream", "getResourceAsStream", "(", "String", "name", ",", "Class", "<", "?", ">", "cls", ")", "throws", "IOException", "{", "if", "(", "cls", "==", "null", ")", "{", "cls", "=", "IOUtil", ".", "class", ";", "}", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"resource cannot be null\"", ")", ";", "}", "InputStream", "result", "=", "cls", ".", "getResourceAsStream", "(", "name", ")", ";", "if", "(", "result", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Could not open resource \"", "+", "name", "+", "\" using \"", "+", "cls", ".", "getName", "(", ")", "+", "\"'s class loader\"", ")", ";", "}", "return", "result", ";", "}" ]
Finds a resource with a given name using the class loader of the specified class. Functions identically to {@link Class#getResourceAsStream(java.lang.String)}, except it throws an {@link IllegalArgumentException} if the specified resource name is <code>null</code>, and it throws an {@link IOException} if no resource with the specified name is found. @param name name {@link String} of the desired resource. Cannot be <code>null</code>. @param cls the {@link Class} whose loader to use. @return an {@link InputStream}. @throws IOException if no resource with this name is found.
[ "Finds", "a", "resource", "with", "a", "given", "name", "using", "the", "class", "loader", "of", "the", "specified", "class", ".", "Functions", "identically", "to", "{", "@link", "Class#getResourceAsStream", "(", "java", ".", "lang", ".", "String", ")", "}", "except", "it", "throws", "an", "{", "@link", "IllegalArgumentException", "}", "if", "the", "specified", "resource", "name", "is", "<code", ">", "null<", "/", "code", ">", "and", "it", "throws", "an", "{", "@link", "IOException", "}", "if", "no", "resource", "with", "the", "specified", "name", "is", "found", "." ]
train
https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/io/IOUtil.java#L223-L237
elibom/jogger
src/main/java/com/elibom/jogger/middleware/router/loader/AbstractFileRoutesLoader.java
AbstractFileRoutesLoader.getMethod
private Method getMethod(Object controller, String methodName) throws RoutesException { """ Helper method. Retrieves the method with the specified <code>methodName</code> and from the specified object. Notice that the method must received two parameters of types {@link Request} and {@link Response} respectively. @param controller the object from which we will retrieve the method. @param methodName the name of the method to be retrieved. @return a <code>java.lang.reflect.Method</code> object. @throws RoutesException if the method doesn't exists or there is a problem accessing the method. """ try { // try to retrieve the method and check if an exception is thrown return controller.getClass().getMethod(methodName, Request.class, Response.class); } catch (Exception e) { throw new RoutesException(e); } }
java
private Method getMethod(Object controller, String methodName) throws RoutesException { try { // try to retrieve the method and check if an exception is thrown return controller.getClass().getMethod(methodName, Request.class, Response.class); } catch (Exception e) { throw new RoutesException(e); } }
[ "private", "Method", "getMethod", "(", "Object", "controller", ",", "String", "methodName", ")", "throws", "RoutesException", "{", "try", "{", "// try to retrieve the method and check if an exception is thrown", "return", "controller", ".", "getClass", "(", ")", ".", "getMethod", "(", "methodName", ",", "Request", ".", "class", ",", "Response", ".", "class", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RoutesException", "(", "e", ")", ";", "}", "}" ]
Helper method. Retrieves the method with the specified <code>methodName</code> and from the specified object. Notice that the method must received two parameters of types {@link Request} and {@link Response} respectively. @param controller the object from which we will retrieve the method. @param methodName the name of the method to be retrieved. @return a <code>java.lang.reflect.Method</code> object. @throws RoutesException if the method doesn't exists or there is a problem accessing the method.
[ "Helper", "method", ".", "Retrieves", "the", "method", "with", "the", "specified", "<code", ">", "methodName<", "/", "code", ">", "and", "from", "the", "specified", "object", ".", "Notice", "that", "the", "method", "must", "received", "two", "parameters", "of", "types", "{", "@link", "Request", "}", "and", "{", "@link", "Response", "}", "respectively", "." ]
train
https://github.com/elibom/jogger/blob/d5892ff45e76328d444a68b5a38c26e7bdd0692b/src/main/java/com/elibom/jogger/middleware/router/loader/AbstractFileRoutesLoader.java#L267-L274
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Connection.java
JDBC4Connection.prepareStatement
@Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { """ Creates a PreparedStatement object that will generate ResultSet objects with the given type and concurrency. """ if ((resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE || resultSetType == ResultSet.TYPE_FORWARD_ONLY) && resultSetConcurrency == ResultSet.CONCUR_READ_ONLY) { return prepareStatement(sql); } checkClosed(); throw SQLError.noSupport(); }
java
@Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { if ((resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE || resultSetType == ResultSet.TYPE_FORWARD_ONLY) && resultSetConcurrency == ResultSet.CONCUR_READ_ONLY) { return prepareStatement(sql); } checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "PreparedStatement", "prepareStatement", "(", "String", "sql", ",", "int", "resultSetType", ",", "int", "resultSetConcurrency", ")", "throws", "SQLException", "{", "if", "(", "(", "resultSetType", "==", "ResultSet", ".", "TYPE_SCROLL_INSENSITIVE", "||", "resultSetType", "==", "ResultSet", ".", "TYPE_FORWARD_ONLY", ")", "&&", "resultSetConcurrency", "==", "ResultSet", ".", "CONCUR_READ_ONLY", ")", "{", "return", "prepareStatement", "(", "sql", ")", ";", "}", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Creates a PreparedStatement object that will generate ResultSet objects with the given type and concurrency.
[ "Creates", "a", "PreparedStatement", "object", "that", "will", "generate", "ResultSet", "objects", "with", "the", "given", "type", "and", "concurrency", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Connection.java#L386-L395
hawkular/hawkular-bus
hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java
MessageProcessor.setHeaders
protected void setHeaders(BasicMessage basicMessage, Map<String, String> headers, Message destination) throws JMSException { """ First sets the {@link MessageProcessor#HEADER_BASIC_MESSAGE_CLASS} string property of {@code destination} to {@code basicMessage.getClass().getName()}, then copies all headers from {@code basicMessage.getHeaders()} to {@code destination} using {@link Message#setStringProperty(String, String)} and then does the same thing with the supplied {@code headers}. @param basicMessage the {@link BasicMessage} to copy headers from @param headers the headers to copy to {@code destination} @param destination the {@link Message} to copy the headers to @throws JMSException """ log.infof("Setting [%s] = [%s] on a message of type [%s]", MessageProcessor.HEADER_BASIC_MESSAGE_CLASS, basicMessage.getClass().getName(), destination.getClass().getName()); destination.setStringProperty(MessageProcessor.HEADER_BASIC_MESSAGE_CLASS, basicMessage.getClass().getName()); // if the basicMessage has headers, use those first Map<String, String> basicMessageHeaders = basicMessage.getHeaders(); if (basicMessageHeaders != null) { for (Map.Entry<String, String> entry : basicMessageHeaders.entrySet()) { destination.setStringProperty(entry.getKey(), entry.getValue()); } } // If we were given headers separately, add those now. // Notice these will override same-named headers that were found in the basic message itself. if (headers != null) { for (Map.Entry<String, String> entry : headers.entrySet()) { destination.setStringProperty(entry.getKey(), entry.getValue()); } } }
java
protected void setHeaders(BasicMessage basicMessage, Map<String, String> headers, Message destination) throws JMSException { log.infof("Setting [%s] = [%s] on a message of type [%s]", MessageProcessor.HEADER_BASIC_MESSAGE_CLASS, basicMessage.getClass().getName(), destination.getClass().getName()); destination.setStringProperty(MessageProcessor.HEADER_BASIC_MESSAGE_CLASS, basicMessage.getClass().getName()); // if the basicMessage has headers, use those first Map<String, String> basicMessageHeaders = basicMessage.getHeaders(); if (basicMessageHeaders != null) { for (Map.Entry<String, String> entry : basicMessageHeaders.entrySet()) { destination.setStringProperty(entry.getKey(), entry.getValue()); } } // If we were given headers separately, add those now. // Notice these will override same-named headers that were found in the basic message itself. if (headers != null) { for (Map.Entry<String, String> entry : headers.entrySet()) { destination.setStringProperty(entry.getKey(), entry.getValue()); } } }
[ "protected", "void", "setHeaders", "(", "BasicMessage", "basicMessage", ",", "Map", "<", "String", ",", "String", ">", "headers", ",", "Message", "destination", ")", "throws", "JMSException", "{", "log", ".", "infof", "(", "\"Setting [%s] = [%s] on a message of type [%s]\"", ",", "MessageProcessor", ".", "HEADER_BASIC_MESSAGE_CLASS", ",", "basicMessage", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "destination", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "destination", ".", "setStringProperty", "(", "MessageProcessor", ".", "HEADER_BASIC_MESSAGE_CLASS", ",", "basicMessage", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "// if the basicMessage has headers, use those first", "Map", "<", "String", ",", "String", ">", "basicMessageHeaders", "=", "basicMessage", ".", "getHeaders", "(", ")", ";", "if", "(", "basicMessageHeaders", "!=", "null", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "basicMessageHeaders", ".", "entrySet", "(", ")", ")", "{", "destination", ".", "setStringProperty", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "// If we were given headers separately, add those now.", "// Notice these will override same-named headers that were found in the basic message itself.", "if", "(", "headers", "!=", "null", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "headers", ".", "entrySet", "(", ")", ")", "{", "destination", ".", "setStringProperty", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "}" ]
First sets the {@link MessageProcessor#HEADER_BASIC_MESSAGE_CLASS} string property of {@code destination} to {@code basicMessage.getClass().getName()}, then copies all headers from {@code basicMessage.getHeaders()} to {@code destination} using {@link Message#setStringProperty(String, String)} and then does the same thing with the supplied {@code headers}. @param basicMessage the {@link BasicMessage} to copy headers from @param headers the headers to copy to {@code destination} @param destination the {@link Message} to copy the headers to @throws JMSException
[ "First", "sets", "the", "{", "@link", "MessageProcessor#HEADER_BASIC_MESSAGE_CLASS", "}", "string", "property", "of", "{", "@code", "destination", "}", "to", "{", "@code", "basicMessage", ".", "getClass", "()", ".", "getName", "()", "}", "then", "copies", "all", "headers", "from", "{", "@code", "basicMessage", ".", "getHeaders", "()", "}", "to", "{", "@code", "destination", "}", "using", "{", "@link", "Message#setStringProperty", "(", "String", "String", ")", "}", "and", "then", "does", "the", "same", "thing", "with", "the", "supplied", "{", "@code", "headers", "}", "." ]
train
https://github.com/hawkular/hawkular-bus/blob/28d6b58bec81a50f8344d39f309b6971271ae627/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java#L392-L413
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java
HexUtil.toByteArray
public static byte[] toByteArray(CharSequence hexString) { """ Creates a byte array from a CharSequence (String, StringBuilder, etc.) containing only valid hexidecimal formatted characters. Each grouping of 2 characters represent a byte in "Big Endian" format. The hex CharSequence must be an even length of characters. For example, a String of "1234" would return the byte array { 0x12, 0x34 }. @param hexString The String, StringBuilder, etc. that contains the sequence of hexidecimal character values. @return A new byte array representing the sequence of bytes created from the sequence of hexidecimal characters. If the hexString is null, then this method will return null. """ if (hexString == null) { return null; } return toByteArray(hexString, 0, hexString.length()); }
java
public static byte[] toByteArray(CharSequence hexString) { if (hexString == null) { return null; } return toByteArray(hexString, 0, hexString.length()); }
[ "public", "static", "byte", "[", "]", "toByteArray", "(", "CharSequence", "hexString", ")", "{", "if", "(", "hexString", "==", "null", ")", "{", "return", "null", ";", "}", "return", "toByteArray", "(", "hexString", ",", "0", ",", "hexString", ".", "length", "(", ")", ")", ";", "}" ]
Creates a byte array from a CharSequence (String, StringBuilder, etc.) containing only valid hexidecimal formatted characters. Each grouping of 2 characters represent a byte in "Big Endian" format. The hex CharSequence must be an even length of characters. For example, a String of "1234" would return the byte array { 0x12, 0x34 }. @param hexString The String, StringBuilder, etc. that contains the sequence of hexidecimal character values. @return A new byte array representing the sequence of bytes created from the sequence of hexidecimal characters. If the hexString is null, then this method will return null.
[ "Creates", "a", "byte", "array", "from", "a", "CharSequence", "(", "String", "StringBuilder", "etc", ".", ")", "containing", "only", "valid", "hexidecimal", "formatted", "characters", ".", "Each", "grouping", "of", "2", "characters", "represent", "a", "byte", "in", "Big", "Endian", "format", ".", "The", "hex", "CharSequence", "must", "be", "an", "even", "length", "of", "characters", ".", "For", "example", "a", "String", "of", "1234", "would", "return", "the", "byte", "array", "{", "0x12", "0x34", "}", "." ]
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L328-L333
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java
FileSystemView.checkAccess
public void checkAccess(JimfsPath path) throws IOException { """ Checks access to the file at the given path for the given modes. Since access controls are not implemented for this file system, this just checks that the file exists. """ // just check that the file exists lookUpWithLock(path, Options.FOLLOW_LINKS).requireExists(path); }
java
public void checkAccess(JimfsPath path) throws IOException { // just check that the file exists lookUpWithLock(path, Options.FOLLOW_LINKS).requireExists(path); }
[ "public", "void", "checkAccess", "(", "JimfsPath", "path", ")", "throws", "IOException", "{", "// just check that the file exists", "lookUpWithLock", "(", "path", ",", "Options", ".", "FOLLOW_LINKS", ")", ".", "requireExists", "(", "path", ")", ";", "}" ]
Checks access to the file at the given path for the given modes. Since access controls are not implemented for this file system, this just checks that the file exists.
[ "Checks", "access", "to", "the", "file", "at", "the", "given", "path", "for", "the", "given", "modes", ".", "Since", "access", "controls", "are", "not", "implemented", "for", "this", "file", "system", "this", "just", "checks", "that", "the", "file", "exists", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java#L382-L385
stratosphere/stratosphere
stratosphere-clients/src/main/java/eu/stratosphere/client/CliFrontend.java
CliFrontend.buildProgram
protected PackagedProgram buildProgram(CommandLine line) { """ @param line @return Either a PackagedProgram (upon success), or null; """ String[] programArgs = line.hasOption(ARGS_OPTION.getOpt()) ? line.getOptionValues(ARGS_OPTION.getOpt()) : line.getArgs(); // take the jar file from the option, or as the first trailing parameter (if available) String jarFilePath = null; if (line.hasOption(JAR_OPTION.getOpt())) { jarFilePath = line.getOptionValue(JAR_OPTION.getOpt()); } else if (programArgs.length > 0) { jarFilePath = programArgs[0]; programArgs = Arrays.copyOfRange(programArgs, 1, programArgs.length); } else { System.out.println("Error: Jar file is not set."); return null; } File jarFile = new File(jarFilePath); // Check if JAR file exists if (!jarFile.exists()) { System.out.println("Error: Jar file does not exist."); return null; } else if (!jarFile.isFile()) { System.out.println("Error: Jar file is not a file."); return null; } // Get assembler class String entryPointClass = line.hasOption(CLASS_OPTION.getOpt()) ? line.getOptionValue(CLASS_OPTION.getOpt()) : null; try { return entryPointClass == null ? new PackagedProgram(jarFile, programArgs) : new PackagedProgram(jarFile, entryPointClass, programArgs); } catch (ProgramInvocationException e) { handleError(e); return null; } }
java
protected PackagedProgram buildProgram(CommandLine line) { String[] programArgs = line.hasOption(ARGS_OPTION.getOpt()) ? line.getOptionValues(ARGS_OPTION.getOpt()) : line.getArgs(); // take the jar file from the option, or as the first trailing parameter (if available) String jarFilePath = null; if (line.hasOption(JAR_OPTION.getOpt())) { jarFilePath = line.getOptionValue(JAR_OPTION.getOpt()); } else if (programArgs.length > 0) { jarFilePath = programArgs[0]; programArgs = Arrays.copyOfRange(programArgs, 1, programArgs.length); } else { System.out.println("Error: Jar file is not set."); return null; } File jarFile = new File(jarFilePath); // Check if JAR file exists if (!jarFile.exists()) { System.out.println("Error: Jar file does not exist."); return null; } else if (!jarFile.isFile()) { System.out.println("Error: Jar file is not a file."); return null; } // Get assembler class String entryPointClass = line.hasOption(CLASS_OPTION.getOpt()) ? line.getOptionValue(CLASS_OPTION.getOpt()) : null; try { return entryPointClass == null ? new PackagedProgram(jarFile, programArgs) : new PackagedProgram(jarFile, entryPointClass, programArgs); } catch (ProgramInvocationException e) { handleError(e); return null; } }
[ "protected", "PackagedProgram", "buildProgram", "(", "CommandLine", "line", ")", "{", "String", "[", "]", "programArgs", "=", "line", ".", "hasOption", "(", "ARGS_OPTION", ".", "getOpt", "(", ")", ")", "?", "line", ".", "getOptionValues", "(", "ARGS_OPTION", ".", "getOpt", "(", ")", ")", ":", "line", ".", "getArgs", "(", ")", ";", "// take the jar file from the option, or as the first trailing parameter (if available)", "String", "jarFilePath", "=", "null", ";", "if", "(", "line", ".", "hasOption", "(", "JAR_OPTION", ".", "getOpt", "(", ")", ")", ")", "{", "jarFilePath", "=", "line", ".", "getOptionValue", "(", "JAR_OPTION", ".", "getOpt", "(", ")", ")", ";", "}", "else", "if", "(", "programArgs", ".", "length", ">", "0", ")", "{", "jarFilePath", "=", "programArgs", "[", "0", "]", ";", "programArgs", "=", "Arrays", ".", "copyOfRange", "(", "programArgs", ",", "1", ",", "programArgs", ".", "length", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"Error: Jar file is not set.\"", ")", ";", "return", "null", ";", "}", "File", "jarFile", "=", "new", "File", "(", "jarFilePath", ")", ";", "// Check if JAR file exists", "if", "(", "!", "jarFile", ".", "exists", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Error: Jar file does not exist.\"", ")", ";", "return", "null", ";", "}", "else", "if", "(", "!", "jarFile", ".", "isFile", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Error: Jar file is not a file.\"", ")", ";", "return", "null", ";", "}", "// Get assembler class", "String", "entryPointClass", "=", "line", ".", "hasOption", "(", "CLASS_OPTION", ".", "getOpt", "(", ")", ")", "?", "line", ".", "getOptionValue", "(", "CLASS_OPTION", ".", "getOpt", "(", ")", ")", ":", "null", ";", "try", "{", "return", "entryPointClass", "==", "null", "?", "new", "PackagedProgram", "(", "jarFile", ",", "programArgs", ")", ":", "new", "PackagedProgram", "(", "jarFile", ",", "entryPointClass", ",", "programArgs", ")", ";", "}", "catch", "(", "ProgramInvocationException", "e", ")", "{", "handleError", "(", "e", ")", ";", "return", "null", ";", "}", "}" ]
@param line @return Either a PackagedProgram (upon success), or null;
[ "@param", "line" ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-clients/src/main/java/eu/stratosphere/client/CliFrontend.java#L660-L704
Ordinastie/MalisisCore
src/main/java/net/malisis/core/client/gui/text/GuiText.java
GuiText.buildLines
private void buildLines() { """ Splits the cache in multiple lines to fit in the {@link #wrapSize}. @param str the str """ wrapSize.update(); buildLines |= wrapSize.hasChanged(); if (!buildLines) return; lines.clear(); String str = cache.replace("\r?(?<=\n)", "\n"); StringBuilder line = new StringBuilder(); StringBuilder word = new StringBuilder(); //FontRenderOptions fro = new FontRenderOptions(); int wrapWidth = multiLine ? getWrapSize() : -1; float lineWidth = 0; float wordWidth = 0; float lineHeight = 0; StringWalker walker = new StringWalker(str, fontOptions); walker.skipChars(false); walker.applyStyles(true); while (walker.walk()) { char c = walker.getChar(); lineWidth += walker.width(); wordWidth += walker.width(); lineHeight = Math.max(lineHeight, walker.height()); word.append(c); //we just ended a new word, add it to the current line if (Character.isWhitespace(c) || c == '-' || c == '.') { line.append(word); word.setLength(0); wordWidth = 0; } if (isMultiLine() && ((wrapWidth > 0 && lineWidth >= wrapWidth) || c == '\n')) { //the first word on the line is too large, split anyway if (line.length() == 0) { line.append(word); word.setLength(0); wordWidth = 0; } //remove current word from last line lineWidth -= wordWidth; //add the new line lines.add(new LineInfo(line.toString(), MathHelper.ceil(lineWidth), MathHelper.ceil(lineHeight), 0)); line.setLength(0); lineWidth = wordWidth; } } line.append(word); lines.add(new LineInfo(line.toString(), MathHelper.ceil(lineWidth), MathHelper.ceil(lineHeight), 0)); buildLines = false; updateSize(); }
java
private void buildLines() { wrapSize.update(); buildLines |= wrapSize.hasChanged(); if (!buildLines) return; lines.clear(); String str = cache.replace("\r?(?<=\n)", "\n"); StringBuilder line = new StringBuilder(); StringBuilder word = new StringBuilder(); //FontRenderOptions fro = new FontRenderOptions(); int wrapWidth = multiLine ? getWrapSize() : -1; float lineWidth = 0; float wordWidth = 0; float lineHeight = 0; StringWalker walker = new StringWalker(str, fontOptions); walker.skipChars(false); walker.applyStyles(true); while (walker.walk()) { char c = walker.getChar(); lineWidth += walker.width(); wordWidth += walker.width(); lineHeight = Math.max(lineHeight, walker.height()); word.append(c); //we just ended a new word, add it to the current line if (Character.isWhitespace(c) || c == '-' || c == '.') { line.append(word); word.setLength(0); wordWidth = 0; } if (isMultiLine() && ((wrapWidth > 0 && lineWidth >= wrapWidth) || c == '\n')) { //the first word on the line is too large, split anyway if (line.length() == 0) { line.append(word); word.setLength(0); wordWidth = 0; } //remove current word from last line lineWidth -= wordWidth; //add the new line lines.add(new LineInfo(line.toString(), MathHelper.ceil(lineWidth), MathHelper.ceil(lineHeight), 0)); line.setLength(0); lineWidth = wordWidth; } } line.append(word); lines.add(new LineInfo(line.toString(), MathHelper.ceil(lineWidth), MathHelper.ceil(lineHeight), 0)); buildLines = false; updateSize(); }
[ "private", "void", "buildLines", "(", ")", "{", "wrapSize", ".", "update", "(", ")", ";", "buildLines", "|=", "wrapSize", ".", "hasChanged", "(", ")", ";", "if", "(", "!", "buildLines", ")", "return", ";", "lines", ".", "clear", "(", ")", ";", "String", "str", "=", "cache", ".", "replace", "(", "\"\\r?(?<=\\n)\"", ",", "\"\\n\"", ")", ";", "StringBuilder", "line", "=", "new", "StringBuilder", "(", ")", ";", "StringBuilder", "word", "=", "new", "StringBuilder", "(", ")", ";", "//FontRenderOptions fro = new FontRenderOptions();", "int", "wrapWidth", "=", "multiLine", "?", "getWrapSize", "(", ")", ":", "-", "1", ";", "float", "lineWidth", "=", "0", ";", "float", "wordWidth", "=", "0", ";", "float", "lineHeight", "=", "0", ";", "StringWalker", "walker", "=", "new", "StringWalker", "(", "str", ",", "fontOptions", ")", ";", "walker", ".", "skipChars", "(", "false", ")", ";", "walker", ".", "applyStyles", "(", "true", ")", ";", "while", "(", "walker", ".", "walk", "(", ")", ")", "{", "char", "c", "=", "walker", ".", "getChar", "(", ")", ";", "lineWidth", "+=", "walker", ".", "width", "(", ")", ";", "wordWidth", "+=", "walker", ".", "width", "(", ")", ";", "lineHeight", "=", "Math", ".", "max", "(", "lineHeight", ",", "walker", ".", "height", "(", ")", ")", ";", "word", ".", "append", "(", "c", ")", ";", "//we just ended a new word, add it to the current line", "if", "(", "Character", ".", "isWhitespace", "(", "c", ")", "||", "c", "==", "'", "'", "||", "c", "==", "'", "'", ")", "{", "line", ".", "append", "(", "word", ")", ";", "word", ".", "setLength", "(", "0", ")", ";", "wordWidth", "=", "0", ";", "}", "if", "(", "isMultiLine", "(", ")", "&&", "(", "(", "wrapWidth", ">", "0", "&&", "lineWidth", ">=", "wrapWidth", ")", "||", "c", "==", "'", "'", ")", ")", "{", "//the first word on the line is too large, split anyway", "if", "(", "line", ".", "length", "(", ")", "==", "0", ")", "{", "line", ".", "append", "(", "word", ")", ";", "word", ".", "setLength", "(", "0", ")", ";", "wordWidth", "=", "0", ";", "}", "//remove current word from last line", "lineWidth", "-=", "wordWidth", ";", "//add the new line", "lines", ".", "add", "(", "new", "LineInfo", "(", "line", ".", "toString", "(", ")", ",", "MathHelper", ".", "ceil", "(", "lineWidth", ")", ",", "MathHelper", ".", "ceil", "(", "lineHeight", ")", ",", "0", ")", ")", ";", "line", ".", "setLength", "(", "0", ")", ";", "lineWidth", "=", "wordWidth", ";", "}", "}", "line", ".", "append", "(", "word", ")", ";", "lines", ".", "add", "(", "new", "LineInfo", "(", "line", ".", "toString", "(", ")", ",", "MathHelper", ".", "ceil", "(", "lineWidth", ")", ",", "MathHelper", ".", "ceil", "(", "lineHeight", ")", ",", "0", ")", ")", ";", "buildLines", "=", "false", ";", "updateSize", "(", ")", ";", "}" ]
Splits the cache in multiple lines to fit in the {@link #wrapSize}. @param str the str
[ "Splits", "the", "cache", "in", "multiple", "lines", "to", "fit", "in", "the", "{", "@link", "#wrapSize", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/text/GuiText.java#L412-L477
haraldk/TwelveMonkeys
common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java
StringUtil.ensureExcludesAt
static String ensureExcludesAt(String pSource, String pSubstring, int pPosition) { """ Ensures that a string does not include a given substring at a given position. <p/> Removes a given substring from a string if it is there. E.g an URL "http://www.vg.no", to "www.vg.no". @param pSource The source string. @param pSubstring The substring to check and possibly remove. @param pPosition The location of possible substring removal, the index starts with 0. @return the string, without the substring at the given location. """ StringBuilder newString = new StringBuilder(pSource); try { String existingString = pSource.substring(pPosition + 1, pPosition + pSubstring.length() + 1); if (!existingString.equalsIgnoreCase(pSubstring)) { newString.delete(pPosition, pPosition + pSubstring.length()); } } catch (Exception e) { // Do something!? } return newString.toString(); }
java
static String ensureExcludesAt(String pSource, String pSubstring, int pPosition) { StringBuilder newString = new StringBuilder(pSource); try { String existingString = pSource.substring(pPosition + 1, pPosition + pSubstring.length() + 1); if (!existingString.equalsIgnoreCase(pSubstring)) { newString.delete(pPosition, pPosition + pSubstring.length()); } } catch (Exception e) { // Do something!? } return newString.toString(); }
[ "static", "String", "ensureExcludesAt", "(", "String", "pSource", ",", "String", "pSubstring", ",", "int", "pPosition", ")", "{", "StringBuilder", "newString", "=", "new", "StringBuilder", "(", "pSource", ")", ";", "try", "{", "String", "existingString", "=", "pSource", ".", "substring", "(", "pPosition", "+", "1", ",", "pPosition", "+", "pSubstring", ".", "length", "(", ")", "+", "1", ")", ";", "if", "(", "!", "existingString", ".", "equalsIgnoreCase", "(", "pSubstring", ")", ")", "{", "newString", ".", "delete", "(", "pPosition", ",", "pPosition", "+", "pSubstring", ".", "length", "(", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "// Do something!?\r", "}", "return", "newString", ".", "toString", "(", ")", ";", "}" ]
Ensures that a string does not include a given substring at a given position. <p/> Removes a given substring from a string if it is there. E.g an URL "http://www.vg.no", to "www.vg.no". @param pSource The source string. @param pSubstring The substring to check and possibly remove. @param pPosition The location of possible substring removal, the index starts with 0. @return the string, without the substring at the given location.
[ "Ensures", "that", "a", "string", "does", "not", "include", "a", "given", "substring", "at", "a", "given", "position", ".", "<p", "/", ">", "Removes", "a", "given", "substring", "from", "a", "string", "if", "it", "is", "there", ".", "E", ".", "g", "an", "URL", "http", ":", "//", "www", ".", "vg", ".", "no", "to", "www", ".", "vg", ".", "no", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java#L1396-L1410
mikepenz/FastAdapter
library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java
FastAdapterDialog.withNegativeButton
public FastAdapterDialog<Item> withNegativeButton(@StringRes int textRes, OnClickListener listener) { """ Set a listener to be invoked when the negative button of the dialog is pressed. @param textRes The resource id of the text to display in the negative button @param listener The {@link DialogInterface.OnClickListener} to use. @return This Builder object to allow for chaining of calls to set methods """ return withButton(BUTTON_NEGATIVE, textRes, listener); }
java
public FastAdapterDialog<Item> withNegativeButton(@StringRes int textRes, OnClickListener listener) { return withButton(BUTTON_NEGATIVE, textRes, listener); }
[ "public", "FastAdapterDialog", "<", "Item", ">", "withNegativeButton", "(", "@", "StringRes", "int", "textRes", ",", "OnClickListener", "listener", ")", "{", "return", "withButton", "(", "BUTTON_NEGATIVE", ",", "textRes", ",", "listener", ")", ";", "}" ]
Set a listener to be invoked when the negative button of the dialog is pressed. @param textRes The resource id of the text to display in the negative button @param listener The {@link DialogInterface.OnClickListener} to use. @return This Builder object to allow for chaining of calls to set methods
[ "Set", "a", "listener", "to", "be", "invoked", "when", "the", "negative", "button", "of", "the", "dialog", "is", "pressed", "." ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java#L164-L166
samskivert/samskivert
src/main/java/com/samskivert/servlet/MessageManager.java
MessageManager.getMessage
public String getMessage (HttpServletRequest req, String path) { """ Looks up the message with the specified path in the resource bundle most appropriate for the locales described as preferred by the request. Always reports missing paths. """ return getMessage(req, path, true); }
java
public String getMessage (HttpServletRequest req, String path) { return getMessage(req, path, true); }
[ "public", "String", "getMessage", "(", "HttpServletRequest", "req", ",", "String", "path", ")", "{", "return", "getMessage", "(", "req", ",", "path", ",", "true", ")", ";", "}" ]
Looks up the message with the specified path in the resource bundle most appropriate for the locales described as preferred by the request. Always reports missing paths.
[ "Looks", "up", "the", "message", "with", "the", "specified", "path", "in", "the", "resource", "bundle", "most", "appropriate", "for", "the", "locales", "described", "as", "preferred", "by", "the", "request", ".", "Always", "reports", "missing", "paths", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/MessageManager.java#L72-L75
jingwei/krati
krati-main/src/main/java/krati/core/array/basic/ArrayFile.java
ArrayFile.setWaterMarks
public void setWaterMarks(long lwmScn, long hwmScn) throws IOException { """ Sets the water marks of this ArrayFile. @param lwmScn - the low water mark @param hwmScn - the high water mark @throws IOException if the <code>lwmScn</code> is greater than the <code>hwmScn</code> or the changes to the underlying file cannot be flushed. """ if(lwmScn <= hwmScn) { writeHwmScn(hwmScn); _writer.flush(); writeLwmScn(lwmScn); _writer.flush(); } else { throw new IOException("Invalid water marks: lwmScn=" + lwmScn + " hwmScn=" + hwmScn); } }
java
public void setWaterMarks(long lwmScn, long hwmScn) throws IOException { if(lwmScn <= hwmScn) { writeHwmScn(hwmScn); _writer.flush(); writeLwmScn(lwmScn); _writer.flush(); } else { throw new IOException("Invalid water marks: lwmScn=" + lwmScn + " hwmScn=" + hwmScn); } }
[ "public", "void", "setWaterMarks", "(", "long", "lwmScn", ",", "long", "hwmScn", ")", "throws", "IOException", "{", "if", "(", "lwmScn", "<=", "hwmScn", ")", "{", "writeHwmScn", "(", "hwmScn", ")", ";", "_writer", ".", "flush", "(", ")", ";", "writeLwmScn", "(", "lwmScn", ")", ";", "_writer", ".", "flush", "(", ")", ";", "}", "else", "{", "throw", "new", "IOException", "(", "\"Invalid water marks: lwmScn=\"", "+", "lwmScn", "+", "\" hwmScn=\"", "+", "hwmScn", ")", ";", "}", "}" ]
Sets the water marks of this ArrayFile. @param lwmScn - the low water mark @param hwmScn - the high water mark @throws IOException if the <code>lwmScn</code> is greater than the <code>hwmScn</code> or the changes to the underlying file cannot be flushed.
[ "Sets", "the", "water", "marks", "of", "this", "ArrayFile", "." ]
train
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/ArrayFile.java#L617-L626
aspectran/aspectran
core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java
BasicResponseAdapter.addHeader
@Override public void addHeader(String name, String value) { """ Add the given single header value to the current list of values for the given header. @param name the header name @param value the header value to be added """ touchHeaders().add(name, value); }
java
@Override public void addHeader(String name, String value) { touchHeaders().add(name, value); }
[ "@", "Override", "public", "void", "addHeader", "(", "String", "name", ",", "String", "value", ")", "{", "touchHeaders", "(", ")", ".", "add", "(", "name", ",", "value", ")", ";", "}" ]
Add the given single header value to the current list of values for the given header. @param name the header name @param value the header value to be added
[ "Add", "the", "given", "single", "header", "value", "to", "the", "current", "list", "of", "values", "for", "the", "given", "header", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java#L136-L139
JodaOrg/joda-money
src/main/java/org/joda/money/Money.java
Money.convertedTo
public Money convertedTo(CurrencyUnit currency, BigDecimal conversionMultipler, RoundingMode roundingMode) { """ Returns a copy of this monetary value converted into another currency using the specified conversion rate, with a rounding mode used to adjust the decimal places in the result. <p> This instance is immutable and unaffected by this method. @param currency the new currency, not null @param conversionMultipler the conversion factor between the currencies, not null @param roundingMode the rounding mode to use to bring the decimal places back in line, not null @return the new multiplied instance, never null @throws IllegalArgumentException if the currency is the same as this currency @throws IllegalArgumentException if the conversion multiplier is negative @throws ArithmeticException if the rounding fails """ return with(money.convertedTo(currency, conversionMultipler).withCurrencyScale(roundingMode)); }
java
public Money convertedTo(CurrencyUnit currency, BigDecimal conversionMultipler, RoundingMode roundingMode) { return with(money.convertedTo(currency, conversionMultipler).withCurrencyScale(roundingMode)); }
[ "public", "Money", "convertedTo", "(", "CurrencyUnit", "currency", ",", "BigDecimal", "conversionMultipler", ",", "RoundingMode", "roundingMode", ")", "{", "return", "with", "(", "money", ".", "convertedTo", "(", "currency", ",", "conversionMultipler", ")", ".", "withCurrencyScale", "(", "roundingMode", ")", ")", ";", "}" ]
Returns a copy of this monetary value converted into another currency using the specified conversion rate, with a rounding mode used to adjust the decimal places in the result. <p> This instance is immutable and unaffected by this method. @param currency the new currency, not null @param conversionMultipler the conversion factor between the currencies, not null @param roundingMode the rounding mode to use to bring the decimal places back in line, not null @return the new multiplied instance, never null @throws IllegalArgumentException if the currency is the same as this currency @throws IllegalArgumentException if the conversion multiplier is negative @throws ArithmeticException if the rounding fails
[ "Returns", "a", "copy", "of", "this", "monetary", "value", "converted", "into", "another", "currency", "using", "the", "specified", "conversion", "rate", "with", "a", "rounding", "mode", "used", "to", "adjust", "the", "decimal", "places", "in", "the", "result", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "." ]
train
https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/Money.java#L1185-L1187
jayantk/jklol
src/com/jayantkrish/jklol/preprocessing/FeatureStandardizer.java
FeatureStandardizer.getMeans
public static DiscreteFactor getMeans(DiscreteFactor featureFactor, int featureVariableNum) { """ Gets the mean value of each assignment to {@code featureVariableNum} in {@code featureFactor}. @param featureFactor @param featureVariableNum @return """ return getMeans(Arrays.asList(featureFactor), featureVariableNum); }
java
public static DiscreteFactor getMeans(DiscreteFactor featureFactor, int featureVariableNum) { return getMeans(Arrays.asList(featureFactor), featureVariableNum); }
[ "public", "static", "DiscreteFactor", "getMeans", "(", "DiscreteFactor", "featureFactor", ",", "int", "featureVariableNum", ")", "{", "return", "getMeans", "(", "Arrays", ".", "asList", "(", "featureFactor", ")", ",", "featureVariableNum", ")", ";", "}" ]
Gets the mean value of each assignment to {@code featureVariableNum} in {@code featureFactor}. @param featureFactor @param featureVariableNum @return
[ "Gets", "the", "mean", "value", "of", "each", "assignment", "to", "{", "@code", "featureVariableNum", "}", "in", "{", "@code", "featureFactor", "}", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/preprocessing/FeatureStandardizer.java#L129-L131
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/utils/PathUtils.java
PathUtils.toPathOperationsList
public static List<PathOperation> toPathOperationsList(String path, Path pathModel) { """ Converts a Swagger path into a PathOperation. @param path the path @param pathModel the Swagger Path model @return the path operations """ List<PathOperation> pathOperations = new ArrayList<>(); getOperationMap(pathModel).forEach((httpMethod, operation) -> pathOperations.add(new PathOperation(httpMethod, path, operation))); return pathOperations; }
java
public static List<PathOperation> toPathOperationsList(String path, Path pathModel) { List<PathOperation> pathOperations = new ArrayList<>(); getOperationMap(pathModel).forEach((httpMethod, operation) -> pathOperations.add(new PathOperation(httpMethod, path, operation))); return pathOperations; }
[ "public", "static", "List", "<", "PathOperation", ">", "toPathOperationsList", "(", "String", "path", ",", "Path", "pathModel", ")", "{", "List", "<", "PathOperation", ">", "pathOperations", "=", "new", "ArrayList", "<>", "(", ")", ";", "getOperationMap", "(", "pathModel", ")", ".", "forEach", "(", "(", "httpMethod", ",", "operation", ")", "->", "pathOperations", ".", "add", "(", "new", "PathOperation", "(", "httpMethod", ",", "path", ",", "operation", ")", ")", ")", ";", "return", "pathOperations", ";", "}" ]
Converts a Swagger path into a PathOperation. @param path the path @param pathModel the Swagger Path model @return the path operations
[ "Converts", "a", "Swagger", "path", "into", "a", "PathOperation", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/utils/PathUtils.java#L91-L96
r0adkll/PostOffice
library/src/main/java/com/r0adkll/postoffice/styles/EditTextStyle.java
EditTextStyle.onButtonClicked
@Override public void onButtonClicked(int which, DialogInterface dialogInterface) { """ Called when one of the three available buttons are clicked so that this style can perform a special action such as calling a content delivery callback. @param which which button was pressed @param dialogInterface """ switch (which){ case Dialog.BUTTON_POSITIVE: if(mListener != null) mListener.onAccepted(getText()); break; case Dialog.BUTTON_NEGATIVE: // Do nothing for the negative click break; } }
java
@Override public void onButtonClicked(int which, DialogInterface dialogInterface) { switch (which){ case Dialog.BUTTON_POSITIVE: if(mListener != null) mListener.onAccepted(getText()); break; case Dialog.BUTTON_NEGATIVE: // Do nothing for the negative click break; } }
[ "@", "Override", "public", "void", "onButtonClicked", "(", "int", "which", ",", "DialogInterface", "dialogInterface", ")", "{", "switch", "(", "which", ")", "{", "case", "Dialog", ".", "BUTTON_POSITIVE", ":", "if", "(", "mListener", "!=", "null", ")", "mListener", ".", "onAccepted", "(", "getText", "(", ")", ")", ";", "break", ";", "case", "Dialog", ".", "BUTTON_NEGATIVE", ":", "// Do nothing for the negative click", "break", ";", "}", "}" ]
Called when one of the three available buttons are clicked so that this style can perform a special action such as calling a content delivery callback. @param which which button was pressed @param dialogInterface
[ "Called", "when", "one", "of", "the", "three", "available", "buttons", "are", "clicked", "so", "that", "this", "style", "can", "perform", "a", "special", "action", "such", "as", "calling", "a", "content", "delivery", "callback", "." ]
train
https://github.com/r0adkll/PostOffice/blob/f98e365fd66c004ccce64ee87d9f471b97e4e3c2/library/src/main/java/com/r0adkll/postoffice/styles/EditTextStyle.java#L92-L102
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java
TypeUtils.hasProperty
public static boolean hasProperty(TypeDef typeDef, String property) { """ Checks if property exists on the specified type. @param typeDef The type. @param property The property name. @return True if method is found, false otherwise. """ return unrollHierarchy(typeDef) .stream() .flatMap(h -> h.getProperties().stream()) .filter(p -> property.equals(p.getName())) .findAny() .isPresent(); }
java
public static boolean hasProperty(TypeDef typeDef, String property) { return unrollHierarchy(typeDef) .stream() .flatMap(h -> h.getProperties().stream()) .filter(p -> property.equals(p.getName())) .findAny() .isPresent(); }
[ "public", "static", "boolean", "hasProperty", "(", "TypeDef", "typeDef", ",", "String", "property", ")", "{", "return", "unrollHierarchy", "(", "typeDef", ")", ".", "stream", "(", ")", ".", "flatMap", "(", "h", "->", "h", ".", "getProperties", "(", ")", ".", "stream", "(", ")", ")", ".", "filter", "(", "p", "->", "property", ".", "equals", "(", "p", ".", "getName", "(", ")", ")", ")", ".", "findAny", "(", ")", ".", "isPresent", "(", ")", ";", "}" ]
Checks if property exists on the specified type. @param typeDef The type. @param property The property name. @return True if method is found, false otherwise.
[ "Checks", "if", "property", "exists", "on", "the", "specified", "type", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java#L413-L420
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/logging/LoggingFactory.java
LoggingFactory.createLogger
public static Logger createLogger(final LoggerType type, final String consumerName) throws LoggingException { """ Creates a new Logger. @param consumerName Consumer Name @return The referenced Logger @throws LoggingException """ Logger log = new Logger(type, consumerName); if (consumerLoggingIndex.put(consumerName, log) != null) { throw ErrorFactory .createLoggingException(ErrorKeys.LOGGING_LOGGINGFACTORY_LOGGER_ALREADY_EXIST); } return log; }
java
public static Logger createLogger(final LoggerType type, final String consumerName) throws LoggingException { Logger log = new Logger(type, consumerName); if (consumerLoggingIndex.put(consumerName, log) != null) { throw ErrorFactory .createLoggingException(ErrorKeys.LOGGING_LOGGINGFACTORY_LOGGER_ALREADY_EXIST); } return log; }
[ "public", "static", "Logger", "createLogger", "(", "final", "LoggerType", "type", ",", "final", "String", "consumerName", ")", "throws", "LoggingException", "{", "Logger", "log", "=", "new", "Logger", "(", "type", ",", "consumerName", ")", ";", "if", "(", "consumerLoggingIndex", ".", "put", "(", "consumerName", ",", "log", ")", "!=", "null", ")", "{", "throw", "ErrorFactory", ".", "createLoggingException", "(", "ErrorKeys", ".", "LOGGING_LOGGINGFACTORY_LOGGER_ALREADY_EXIST", ")", ";", "}", "return", "log", ";", "}" ]
Creates a new Logger. @param consumerName Consumer Name @return The referenced Logger @throws LoggingException
[ "Creates", "a", "new", "Logger", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/logging/LoggingFactory.java#L70-L82
diffplug/durian
src/com/diffplug/common/base/TreeComparison.java
TreeComparison.createComparisonFailure
private AssertionError createComparisonFailure(String className, String expected, String actual) throws Exception { """ Attempts to create an instance of junit's ComparisonFailure exception using reflection. """ Class<?> clazz = Class.forName(className); Constructor<?> constructor = clazz.getConstructor(String.class, String.class, String.class); return (AssertionError) constructor.newInstance("", expected, actual); }
java
private AssertionError createComparisonFailure(String className, String expected, String actual) throws Exception { Class<?> clazz = Class.forName(className); Constructor<?> constructor = clazz.getConstructor(String.class, String.class, String.class); return (AssertionError) constructor.newInstance("", expected, actual); }
[ "private", "AssertionError", "createComparisonFailure", "(", "String", "className", ",", "String", "expected", ",", "String", "actual", ")", "throws", "Exception", "{", "Class", "<", "?", ">", "clazz", "=", "Class", ".", "forName", "(", "className", ")", ";", "Constructor", "<", "?", ">", "constructor", "=", "clazz", ".", "getConstructor", "(", "String", ".", "class", ",", "String", ".", "class", ",", "String", ".", "class", ")", ";", "return", "(", "AssertionError", ")", "constructor", ".", "newInstance", "(", "\"\"", ",", "expected", ",", "actual", ")", ";", "}" ]
Attempts to create an instance of junit's ComparisonFailure exception using reflection.
[ "Attempts", "to", "create", "an", "instance", "of", "junit", "s", "ComparisonFailure", "exception", "using", "reflection", "." ]
train
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeComparison.java#L136-L140
Comcast/jrugged
jrugged-spring/src/main/java/org/fishwife/jrugged/spring/AnnotatedMethodScanner.java
AnnotatedMethodScanner.findAnnotatedMethods
public Set<Method> findAnnotatedMethods(String scanBase, Class<? extends Annotation> annotationClass) { """ Find all methods on classes under scanBase that are annotated with annotationClass. @param scanBase Package to scan recursively, in dot notation (ie: org.jrugged...) @param annotationClass Class of the annotation to search for @return Set&lt;Method&gt; The set of all @{java.lang.reflect.Method}s having the annotation """ Set<BeanDefinition> filteredComponents = findCandidateBeans(scanBase, annotationClass); return extractAnnotatedMethods(filteredComponents, annotationClass); }
java
public Set<Method> findAnnotatedMethods(String scanBase, Class<? extends Annotation> annotationClass) { Set<BeanDefinition> filteredComponents = findCandidateBeans(scanBase, annotationClass); return extractAnnotatedMethods(filteredComponents, annotationClass); }
[ "public", "Set", "<", "Method", ">", "findAnnotatedMethods", "(", "String", "scanBase", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ")", "{", "Set", "<", "BeanDefinition", ">", "filteredComponents", "=", "findCandidateBeans", "(", "scanBase", ",", "annotationClass", ")", ";", "return", "extractAnnotatedMethods", "(", "filteredComponents", ",", "annotationClass", ")", ";", "}" ]
Find all methods on classes under scanBase that are annotated with annotationClass. @param scanBase Package to scan recursively, in dot notation (ie: org.jrugged...) @param annotationClass Class of the annotation to search for @return Set&lt;Method&gt; The set of all @{java.lang.reflect.Method}s having the annotation
[ "Find", "all", "methods", "on", "classes", "under", "scanBase", "that", "are", "annotated", "with", "annotationClass", "." ]
train
https://github.com/Comcast/jrugged/blob/b6a5147c68ee733faf5616d49800abcbba67afe9/jrugged-spring/src/main/java/org/fishwife/jrugged/spring/AnnotatedMethodScanner.java#L48-L51
augustd/burp-suite-utils
src/main/java/com/monikamorrow/burp/ToolsScopeComponent.java
ToolsScopeComponent.setEnabledToolConfig
public void setEnabledToolConfig(int tool, boolean enabled) { """ Allows the enabling/disabling of UI tool selection elements, not every tool makes sense for every extension @param tool The tool code, as defined in IBurpExtenderCallbacks @param enabled True if the checkbox should be enabled. """ switch (tool) { case IBurpExtenderCallbacks.TOOL_PROXY: jCheckBoxProxy.setEnabled(enabled); break; case IBurpExtenderCallbacks.TOOL_REPEATER: jCheckBoxRepeater.setEnabled(enabled); break; case IBurpExtenderCallbacks.TOOL_SCANNER: jCheckBoxScanner.setEnabled(enabled); break; case IBurpExtenderCallbacks.TOOL_INTRUDER: jCheckBoxIntruder.setEnabled(enabled); break; case IBurpExtenderCallbacks.TOOL_SEQUENCER: jCheckBoxSequencer.setEnabled(enabled); break; case IBurpExtenderCallbacks.TOOL_SPIDER: jCheckBoxSpider.setEnabled(enabled); break; case IBurpExtenderCallbacks.TOOL_EXTENDER: jCheckBoxExtender.setEnabled(enabled); break; default: break; } }
java
public void setEnabledToolConfig(int tool, boolean enabled) { switch (tool) { case IBurpExtenderCallbacks.TOOL_PROXY: jCheckBoxProxy.setEnabled(enabled); break; case IBurpExtenderCallbacks.TOOL_REPEATER: jCheckBoxRepeater.setEnabled(enabled); break; case IBurpExtenderCallbacks.TOOL_SCANNER: jCheckBoxScanner.setEnabled(enabled); break; case IBurpExtenderCallbacks.TOOL_INTRUDER: jCheckBoxIntruder.setEnabled(enabled); break; case IBurpExtenderCallbacks.TOOL_SEQUENCER: jCheckBoxSequencer.setEnabled(enabled); break; case IBurpExtenderCallbacks.TOOL_SPIDER: jCheckBoxSpider.setEnabled(enabled); break; case IBurpExtenderCallbacks.TOOL_EXTENDER: jCheckBoxExtender.setEnabled(enabled); break; default: break; } }
[ "public", "void", "setEnabledToolConfig", "(", "int", "tool", ",", "boolean", "enabled", ")", "{", "switch", "(", "tool", ")", "{", "case", "IBurpExtenderCallbacks", ".", "TOOL_PROXY", ":", "jCheckBoxProxy", ".", "setEnabled", "(", "enabled", ")", ";", "break", ";", "case", "IBurpExtenderCallbacks", ".", "TOOL_REPEATER", ":", "jCheckBoxRepeater", ".", "setEnabled", "(", "enabled", ")", ";", "break", ";", "case", "IBurpExtenderCallbacks", ".", "TOOL_SCANNER", ":", "jCheckBoxScanner", ".", "setEnabled", "(", "enabled", ")", ";", "break", ";", "case", "IBurpExtenderCallbacks", ".", "TOOL_INTRUDER", ":", "jCheckBoxIntruder", ".", "setEnabled", "(", "enabled", ")", ";", "break", ";", "case", "IBurpExtenderCallbacks", ".", "TOOL_SEQUENCER", ":", "jCheckBoxSequencer", ".", "setEnabled", "(", "enabled", ")", ";", "break", ";", "case", "IBurpExtenderCallbacks", ".", "TOOL_SPIDER", ":", "jCheckBoxSpider", ".", "setEnabled", "(", "enabled", ")", ";", "break", ";", "case", "IBurpExtenderCallbacks", ".", "TOOL_EXTENDER", ":", "jCheckBoxExtender", ".", "setEnabled", "(", "enabled", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}" ]
Allows the enabling/disabling of UI tool selection elements, not every tool makes sense for every extension @param tool The tool code, as defined in IBurpExtenderCallbacks @param enabled True if the checkbox should be enabled.
[ "Allows", "the", "enabling", "/", "disabling", "of", "UI", "tool", "selection", "elements", "not", "every", "tool", "makes", "sense", "for", "every", "extension" ]
train
https://github.com/augustd/burp-suite-utils/blob/5e34a6b9147f5705382f98049dd9e4f387b78629/src/main/java/com/monikamorrow/burp/ToolsScopeComponent.java#L49-L75
VoltDB/voltdb
src/frontend/org/voltdb/exportclient/ExportRow.java
ExportRow.decodeRow
public static ExportRow decodeRow(ExportRow previous, int partition, long startTS, ByteBuffer bb) throws IOException { """ Decode a byte array of row data into ExportRow @param previous previous row for schema purposes. @param partition partition of this data @param startTS start time for this export data source @param rowData row data to decode. @return ExportRow row data with metadata @throws IOException """ final int partitionColIndex = bb.getInt(); final int columnCount = bb.getInt(); assert(columnCount <= DDLCompiler.MAX_COLUMNS); boolean[] is_null = extractNullFlags(bb, columnCount); assert(previous != null); if (previous == null) { throw new IOException("Export block with no schema found without prior block with schema."); } final long generation = previous.generation; final String tableName = previous.tableName; final List<String> colNames = previous.names; final List<VoltType> colTypes = previous.types; final List<Integer> colLengths = previous.lengths; Object[] retval = new Object[colNames.size()]; Object pval = null; for (int i = 0; i < colNames.size(); ++i) { if (is_null[i]) { retval[i] = null; } else { retval[i] = decodeNextColumn(bb, colTypes.get(i)); } if (i == partitionColIndex) { pval = retval[i]; } } return new ExportRow(tableName, colNames, colTypes, colLengths, retval, (pval == null ? partition : pval), partitionColIndex, partition, generation); }
java
public static ExportRow decodeRow(ExportRow previous, int partition, long startTS, ByteBuffer bb) throws IOException { final int partitionColIndex = bb.getInt(); final int columnCount = bb.getInt(); assert(columnCount <= DDLCompiler.MAX_COLUMNS); boolean[] is_null = extractNullFlags(bb, columnCount); assert(previous != null); if (previous == null) { throw new IOException("Export block with no schema found without prior block with schema."); } final long generation = previous.generation; final String tableName = previous.tableName; final List<String> colNames = previous.names; final List<VoltType> colTypes = previous.types; final List<Integer> colLengths = previous.lengths; Object[] retval = new Object[colNames.size()]; Object pval = null; for (int i = 0; i < colNames.size(); ++i) { if (is_null[i]) { retval[i] = null; } else { retval[i] = decodeNextColumn(bb, colTypes.get(i)); } if (i == partitionColIndex) { pval = retval[i]; } } return new ExportRow(tableName, colNames, colTypes, colLengths, retval, (pval == null ? partition : pval), partitionColIndex, partition, generation); }
[ "public", "static", "ExportRow", "decodeRow", "(", "ExportRow", "previous", ",", "int", "partition", ",", "long", "startTS", ",", "ByteBuffer", "bb", ")", "throws", "IOException", "{", "final", "int", "partitionColIndex", "=", "bb", ".", "getInt", "(", ")", ";", "final", "int", "columnCount", "=", "bb", ".", "getInt", "(", ")", ";", "assert", "(", "columnCount", "<=", "DDLCompiler", ".", "MAX_COLUMNS", ")", ";", "boolean", "[", "]", "is_null", "=", "extractNullFlags", "(", "bb", ",", "columnCount", ")", ";", "assert", "(", "previous", "!=", "null", ")", ";", "if", "(", "previous", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Export block with no schema found without prior block with schema.\"", ")", ";", "}", "final", "long", "generation", "=", "previous", ".", "generation", ";", "final", "String", "tableName", "=", "previous", ".", "tableName", ";", "final", "List", "<", "String", ">", "colNames", "=", "previous", ".", "names", ";", "final", "List", "<", "VoltType", ">", "colTypes", "=", "previous", ".", "types", ";", "final", "List", "<", "Integer", ">", "colLengths", "=", "previous", ".", "lengths", ";", "Object", "[", "]", "retval", "=", "new", "Object", "[", "colNames", ".", "size", "(", ")", "]", ";", "Object", "pval", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "colNames", ".", "size", "(", ")", ";", "++", "i", ")", "{", "if", "(", "is_null", "[", "i", "]", ")", "{", "retval", "[", "i", "]", "=", "null", ";", "}", "else", "{", "retval", "[", "i", "]", "=", "decodeNextColumn", "(", "bb", ",", "colTypes", ".", "get", "(", "i", ")", ")", ";", "}", "if", "(", "i", "==", "partitionColIndex", ")", "{", "pval", "=", "retval", "[", "i", "]", ";", "}", "}", "return", "new", "ExportRow", "(", "tableName", ",", "colNames", ",", "colTypes", ",", "colLengths", ",", "retval", ",", "(", "pval", "==", "null", "?", "partition", ":", "pval", ")", ",", "partitionColIndex", ",", "partition", ",", "generation", ")", ";", "}" ]
Decode a byte array of row data into ExportRow @param previous previous row for schema purposes. @param partition partition of this data @param startTS start time for this export data source @param rowData row data to decode. @return ExportRow row data with metadata @throws IOException
[ "Decode", "a", "byte", "array", "of", "row", "data", "into", "ExportRow" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/exportclient/ExportRow.java#L106-L136
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
AbstractIndexWriter.addDescription
protected void addDescription(ModuleElement mdle, Content dlTree, SearchIndexItem si) { """ Add one line summary comment for the module. @param mdle the module to be documented @param dlTree the content tree to which the description will be added """ String moduleName = utils.getFullyQualifiedName(mdle); Content link = getModuleLink(mdle, new StringContent(moduleName)); si.setLabel(moduleName); si.setCategory(resources.getText("doclet.Modules")); Content dt = HtmlTree.DT(link); dt.addContent(" - "); dt.addContent(contents.module_); dt.addContent(" " + moduleName); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addSummaryComment(mdle, dd); dlTree.addContent(dd); }
java
protected void addDescription(ModuleElement mdle, Content dlTree, SearchIndexItem si) { String moduleName = utils.getFullyQualifiedName(mdle); Content link = getModuleLink(mdle, new StringContent(moduleName)); si.setLabel(moduleName); si.setCategory(resources.getText("doclet.Modules")); Content dt = HtmlTree.DT(link); dt.addContent(" - "); dt.addContent(contents.module_); dt.addContent(" " + moduleName); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addSummaryComment(mdle, dd); dlTree.addContent(dd); }
[ "protected", "void", "addDescription", "(", "ModuleElement", "mdle", ",", "Content", "dlTree", ",", "SearchIndexItem", "si", ")", "{", "String", "moduleName", "=", "utils", ".", "getFullyQualifiedName", "(", "mdle", ")", ";", "Content", "link", "=", "getModuleLink", "(", "mdle", ",", "new", "StringContent", "(", "moduleName", ")", ")", ";", "si", ".", "setLabel", "(", "moduleName", ")", ";", "si", ".", "setCategory", "(", "resources", ".", "getText", "(", "\"doclet.Modules\"", ")", ")", ";", "Content", "dt", "=", "HtmlTree", ".", "DT", "(", "link", ")", ";", "dt", ".", "addContent", "(", "\" - \"", ")", ";", "dt", ".", "addContent", "(", "contents", ".", "module_", ")", ";", "dt", ".", "addContent", "(", "\" \"", "+", "moduleName", ")", ";", "dlTree", ".", "addContent", "(", "dt", ")", ";", "Content", "dd", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "DD", ")", ";", "addSummaryComment", "(", "mdle", ",", "dd", ")", ";", "dlTree", ".", "addContent", "(", "dd", ")", ";", "}" ]
Add one line summary comment for the module. @param mdle the module to be documented @param dlTree the content tree to which the description will be added
[ "Add", "one", "line", "summary", "comment", "for", "the", "module", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java#L226-L239
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicyClient.java
SslPolicyClient.insertSslPolicy
@BetaApi public final Operation insertSslPolicy(String project, SslPolicy sslPolicyResource) { """ Returns the specified SSL policy resource. Gets a list of available SSL policies by making a list() request. <p>Sample code: <pre><code> try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) { ProjectName project = ProjectName.of("[PROJECT]"); SslPolicy sslPolicyResource = SslPolicy.newBuilder().build(); Operation response = sslPolicyClient.insertSslPolicy(project.toString(), sslPolicyResource); } </code></pre> @param project Project ID for this request. @param sslPolicyResource A SSL policy specifies the server-side support for SSL features. This can be attached to a TargetHttpsProxy or a TargetSslProxy. This affects connections between clients and the HTTPS or SSL proxy load balancer. They do not affect the connection between the load balancers and the backends. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ InsertSslPolicyHttpRequest request = InsertSslPolicyHttpRequest.newBuilder() .setProject(project) .setSslPolicyResource(sslPolicyResource) .build(); return insertSslPolicy(request); }
java
@BetaApi public final Operation insertSslPolicy(String project, SslPolicy sslPolicyResource) { InsertSslPolicyHttpRequest request = InsertSslPolicyHttpRequest.newBuilder() .setProject(project) .setSslPolicyResource(sslPolicyResource) .build(); return insertSslPolicy(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertSslPolicy", "(", "String", "project", ",", "SslPolicy", "sslPolicyResource", ")", "{", "InsertSslPolicyHttpRequest", "request", "=", "InsertSslPolicyHttpRequest", ".", "newBuilder", "(", ")", ".", "setProject", "(", "project", ")", ".", "setSslPolicyResource", "(", "sslPolicyResource", ")", ".", "build", "(", ")", ";", "return", "insertSslPolicy", "(", "request", ")", ";", "}" ]
Returns the specified SSL policy resource. Gets a list of available SSL policies by making a list() request. <p>Sample code: <pre><code> try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) { ProjectName project = ProjectName.of("[PROJECT]"); SslPolicy sslPolicyResource = SslPolicy.newBuilder().build(); Operation response = sslPolicyClient.insertSslPolicy(project.toString(), sslPolicyResource); } </code></pre> @param project Project ID for this request. @param sslPolicyResource A SSL policy specifies the server-side support for SSL features. This can be attached to a TargetHttpsProxy or a TargetSslProxy. This affects connections between clients and the HTTPS or SSL proxy load balancer. They do not affect the connection between the load balancers and the backends. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Returns", "the", "specified", "SSL", "policy", "resource", ".", "Gets", "a", "list", "of", "available", "SSL", "policies", "by", "making", "a", "list", "()", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicyClient.java#L411-L420
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/query/QueryUtil.java
QueryUtil.packageResult
public static <T> IQueryResult<T> packageResult(List<T> results, CompletionStatus status) { """ Convenience method for packaging query results. @param <T> Class of query result. @param results Results to package. @param status The completion status. @return Packaged results. """ return packageResult(results, status, null); }
java
public static <T> IQueryResult<T> packageResult(List<T> results, CompletionStatus status) { return packageResult(results, status, null); }
[ "public", "static", "<", "T", ">", "IQueryResult", "<", "T", ">", "packageResult", "(", "List", "<", "T", ">", "results", ",", "CompletionStatus", "status", ")", "{", "return", "packageResult", "(", "results", ",", "status", ",", "null", ")", ";", "}" ]
Convenience method for packaging query results. @param <T> Class of query result. @param results Results to package. @param status The completion status. @return Packaged results.
[ "Convenience", "method", "for", "packaging", "query", "results", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/query/QueryUtil.java#L115-L117
reactor/reactor-netty
src/main/java/reactor/netty/udp/UdpServer.java
UdpServer.doOnUnbound
public final UdpServer doOnUnbound(Consumer<? super Connection> doOnUnbound) { """ Setup a callback called when {@link io.netty.channel.Channel} is unbound. @param doOnUnbound a consumer observing server stop event @return a new {@link UdpServer} """ Objects.requireNonNull(doOnUnbound, "doOnUnbound"); return new UdpServerDoOn(this, null, null, doOnUnbound); }
java
public final UdpServer doOnUnbound(Consumer<? super Connection> doOnUnbound) { Objects.requireNonNull(doOnUnbound, "doOnUnbound"); return new UdpServerDoOn(this, null, null, doOnUnbound); }
[ "public", "final", "UdpServer", "doOnUnbound", "(", "Consumer", "<", "?", "super", "Connection", ">", "doOnUnbound", ")", "{", "Objects", ".", "requireNonNull", "(", "doOnUnbound", ",", "\"doOnUnbound\"", ")", ";", "return", "new", "UdpServerDoOn", "(", "this", ",", "null", ",", "null", ",", "doOnUnbound", ")", ";", "}" ]
Setup a callback called when {@link io.netty.channel.Channel} is unbound. @param doOnUnbound a consumer observing server stop event @return a new {@link UdpServer}
[ "Setup", "a", "callback", "called", "when", "{", "@link", "io", ".", "netty", ".", "channel", ".", "Channel", "}", "is", "unbound", "." ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/udp/UdpServer.java#L207-L210
threerings/nenya
core/src/main/java/com/threerings/media/util/MathUtil.java
MathUtil.ellipseCircum
public static double ellipseCircum (double a, double b) { """ Returns the approximate circumference of the ellipse defined by the specified minor and major axes. The formula used (due to Ramanujan, via a paper of his entitled "Modular Equations and Approximations to Pi"), is <code>Pi(3a + 3b - sqrt[(a+3b)(b+3a)])</code>. """ return Math.PI * (3*a + 3*b - Math.sqrt((a + 3*b) * (b + 3*a))); }
java
public static double ellipseCircum (double a, double b) { return Math.PI * (3*a + 3*b - Math.sqrt((a + 3*b) * (b + 3*a))); }
[ "public", "static", "double", "ellipseCircum", "(", "double", "a", ",", "double", "b", ")", "{", "return", "Math", ".", "PI", "*", "(", "3", "*", "a", "+", "3", "*", "b", "-", "Math", ".", "sqrt", "(", "(", "a", "+", "3", "*", "b", ")", "*", "(", "b", "+", "3", "*", "a", ")", ")", ")", ";", "}" ]
Returns the approximate circumference of the ellipse defined by the specified minor and major axes. The formula used (due to Ramanujan, via a paper of his entitled "Modular Equations and Approximations to Pi"), is <code>Pi(3a + 3b - sqrt[(a+3b)(b+3a)])</code>.
[ "Returns", "the", "approximate", "circumference", "of", "the", "ellipse", "defined", "by", "the", "specified", "minor", "and", "major", "axes", ".", "The", "formula", "used", "(", "due", "to", "Ramanujan", "via", "a", "paper", "of", "his", "entitled", "Modular", "Equations", "and", "Approximations", "to", "Pi", ")", "is", "<code", ">", "Pi", "(", "3a", "+", "3b", "-", "sqrt", "[", "(", "a", "+", "3b", ")", "(", "b", "+", "3a", ")", "]", ")", "<", "/", "code", ">", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/MathUtil.java#L85-L88
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getAchievementCategoryInfo
public void getAchievementCategoryInfo(int[] ids, Callback<List<AchievementCategory>> callback) throws GuildWars2Exception, NullPointerException { """ For more info on achievements categories API go <a href="https://wiki.guildwars2.com/wiki/API:2/achievements/categories">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of achievement category id(s) @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception invalid API key @throws NullPointerException if given {@link Callback} is empty @see AchievementCategory achievement category info """ isParamValid(new ParamChecker(ids)); gw2API.getAchievementCategoryInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getAchievementCategoryInfo(int[] ids, Callback<List<AchievementCategory>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getAchievementCategoryInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getAchievementCategoryInfo", "(", "int", "[", "]", "ids", ",", "Callback", "<", "List", "<", "AchievementCategory", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ids", ")", ")", ";", "gw2API", ".", "getAchievementCategoryInfo", "(", "processIds", "(", "ids", ")", ",", "GuildWars2", ".", "lang", ".", "getValue", "(", ")", ")", ".", "enqueue", "(", "callback", ")", ";", "}" ]
For more info on achievements categories API go <a href="https://wiki.guildwars2.com/wiki/API:2/achievements/categories">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of achievement category id(s) @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception invalid API key @throws NullPointerException if given {@link Callback} is empty @see AchievementCategory achievement category info
[ "For", "more", "info", "on", "achievements", "categories", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "achievements", "/", "categories", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "user", "the", "access", "to", "{", "@link", "Callback#onResponse", "(", "Call", "Response", ")", "}", "and", "{", "@link", "Callback#onFailure", "(", "Call", "Throwable", ")", "}", "methods", "for", "custom", "interactions" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L511-L514
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bos/BosClient.java
BosClient.getObject
public ObjectMetadata getObject(GetObjectRequest request, File destinationFile) { """ Gets the object metadata for the object stored in Bos under the specified bucket and key, and saves the object contents to the specified file. Returns <code>null</code> if the specified constraints weren't met. @param request The request object containing all the options on how to download the Bos object content. @param destinationFile Indicates the file (which might already exist) where to save the object content being downloading from Bos. @return All Bos object metadata for the specified object. Returns <code>null</code> if constraints were specified but not met. """ checkNotNull(request, "request should not be null."); checkNotNull(destinationFile, "destinationFile should not be null."); BosObject bosObject = this.getObject(request); this.downloadObjectToFile(bosObject, destinationFile, request.getRange() == null); return bosObject.getObjectMetadata(); }
java
public ObjectMetadata getObject(GetObjectRequest request, File destinationFile) { checkNotNull(request, "request should not be null."); checkNotNull(destinationFile, "destinationFile should not be null."); BosObject bosObject = this.getObject(request); this.downloadObjectToFile(bosObject, destinationFile, request.getRange() == null); return bosObject.getObjectMetadata(); }
[ "public", "ObjectMetadata", "getObject", "(", "GetObjectRequest", "request", ",", "File", "destinationFile", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "checkNotNull", "(", "destinationFile", ",", "\"destinationFile should not be null.\"", ")", ";", "BosObject", "bosObject", "=", "this", ".", "getObject", "(", "request", ")", ";", "this", ".", "downloadObjectToFile", "(", "bosObject", ",", "destinationFile", ",", "request", ".", "getRange", "(", ")", "==", "null", ")", ";", "return", "bosObject", ".", "getObjectMetadata", "(", ")", ";", "}" ]
Gets the object metadata for the object stored in Bos under the specified bucket and key, and saves the object contents to the specified file. Returns <code>null</code> if the specified constraints weren't met. @param request The request object containing all the options on how to download the Bos object content. @param destinationFile Indicates the file (which might already exist) where to save the object content being downloading from Bos. @return All Bos object metadata for the specified object. Returns <code>null</code> if constraints were specified but not met.
[ "Gets", "the", "object", "metadata", "for", "the", "object", "stored", "in", "Bos", "under", "the", "specified", "bucket", "and", "key", "and", "saves", "the", "object", "contents", "to", "the", "specified", "file", ".", "Returns", "<code", ">", "null<", "/", "code", ">", "if", "the", "specified", "constraints", "weren", "t", "met", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L698-L705
hawkular/hawkular-commons
hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/AbstractGatewayWebSocket.java
AbstractGatewayWebSocket.onBinaryMessage
@OnMessage public void onBinaryMessage(InputStream binaryDataStream, Session session) { """ When a binary message is received from a WebSocket client, this method will lookup the {@link WsCommand} for the given request class and execute it. @param binaryDataStream contains the JSON request and additional binary data @param session the client session making the request """ String requestClassName = "?"; try { // parse the JSON and get its message POJO, including any additional binary data being streamed BasicMessageWithExtraData<BasicMessage> reqWithData = new ApiDeserializer().deserialize(binaryDataStream); BasicMessage request = reqWithData.getBasicMessage(); requestClassName = request.getClass().getName(); log.infoReceivedBinaryData(requestClassName, session.getId(), endpoint); handleRequest(session, reqWithData); } catch (Throwable t) { log.errorWsCommandExecutionFailure(requestClassName, session.getId(), endpoint, t); String errorMessage = "BusCommand failed [" + requestClassName + "]"; sendErrorResponse(session, errorMessage, t); } }
java
@OnMessage public void onBinaryMessage(InputStream binaryDataStream, Session session) { String requestClassName = "?"; try { // parse the JSON and get its message POJO, including any additional binary data being streamed BasicMessageWithExtraData<BasicMessage> reqWithData = new ApiDeserializer().deserialize(binaryDataStream); BasicMessage request = reqWithData.getBasicMessage(); requestClassName = request.getClass().getName(); log.infoReceivedBinaryData(requestClassName, session.getId(), endpoint); handleRequest(session, reqWithData); } catch (Throwable t) { log.errorWsCommandExecutionFailure(requestClassName, session.getId(), endpoint, t); String errorMessage = "BusCommand failed [" + requestClassName + "]"; sendErrorResponse(session, errorMessage, t); } }
[ "@", "OnMessage", "public", "void", "onBinaryMessage", "(", "InputStream", "binaryDataStream", ",", "Session", "session", ")", "{", "String", "requestClassName", "=", "\"?\"", ";", "try", "{", "// parse the JSON and get its message POJO, including any additional binary data being streamed", "BasicMessageWithExtraData", "<", "BasicMessage", ">", "reqWithData", "=", "new", "ApiDeserializer", "(", ")", ".", "deserialize", "(", "binaryDataStream", ")", ";", "BasicMessage", "request", "=", "reqWithData", ".", "getBasicMessage", "(", ")", ";", "requestClassName", "=", "request", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "log", ".", "infoReceivedBinaryData", "(", "requestClassName", ",", "session", ".", "getId", "(", ")", ",", "endpoint", ")", ";", "handleRequest", "(", "session", ",", "reqWithData", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "log", ".", "errorWsCommandExecutionFailure", "(", "requestClassName", ",", "session", ".", "getId", "(", ")", ",", "endpoint", ",", "t", ")", ";", "String", "errorMessage", "=", "\"BusCommand failed [\"", "+", "requestClassName", "+", "\"]\"", ";", "sendErrorResponse", "(", "session", ",", "errorMessage", ",", "t", ")", ";", "}", "}" ]
When a binary message is received from a WebSocket client, this method will lookup the {@link WsCommand} for the given request class and execute it. @param binaryDataStream contains the JSON request and additional binary data @param session the client session making the request
[ "When", "a", "binary", "message", "is", "received", "from", "a", "WebSocket", "client", "this", "method", "will", "lookup", "the", "{", "@link", "WsCommand", "}", "for", "the", "given", "request", "class", "and", "execute", "it", "." ]
train
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/AbstractGatewayWebSocket.java#L114-L131
ops4j/org.ops4j.pax.exam2
containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/DependenciesDeployer.java
DependenciesDeployer.getDependenciesFeature
public KarafFeaturesOption getDependenciesFeature() { """ Create a feature for the test dependencies specified as ProvisionOption in the system @return feature option for dependencies """ if (subsystem == null) { return null; } try { File featuresXmlFile = new File(karafBase, "test-dependencies.xml"); Writer wr = new OutputStreamWriter(new FileOutputStream(featuresXmlFile), "UTF-8"); writeDependenciesFeature(wr, subsystem.getOptions(ProvisionOption.class)); wr.close(); String repoUrl = "file:" + featuresXmlFile.toString().replaceAll("\\\\", "/").replaceAll(" ", "%20"); return new KarafFeaturesOption(repoUrl, "test-dependencies"); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
java
public KarafFeaturesOption getDependenciesFeature() { if (subsystem == null) { return null; } try { File featuresXmlFile = new File(karafBase, "test-dependencies.xml"); Writer wr = new OutputStreamWriter(new FileOutputStream(featuresXmlFile), "UTF-8"); writeDependenciesFeature(wr, subsystem.getOptions(ProvisionOption.class)); wr.close(); String repoUrl = "file:" + featuresXmlFile.toString().replaceAll("\\\\", "/").replaceAll(" ", "%20"); return new KarafFeaturesOption(repoUrl, "test-dependencies"); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
[ "public", "KarafFeaturesOption", "getDependenciesFeature", "(", ")", "{", "if", "(", "subsystem", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "File", "featuresXmlFile", "=", "new", "File", "(", "karafBase", ",", "\"test-dependencies.xml\"", ")", ";", "Writer", "wr", "=", "new", "OutputStreamWriter", "(", "new", "FileOutputStream", "(", "featuresXmlFile", ")", ",", "\"UTF-8\"", ")", ";", "writeDependenciesFeature", "(", "wr", ",", "subsystem", ".", "getOptions", "(", "ProvisionOption", ".", "class", ")", ")", ";", "wr", ".", "close", "(", ")", ";", "String", "repoUrl", "=", "\"file:\"", "+", "featuresXmlFile", ".", "toString", "(", ")", ".", "replaceAll", "(", "\"\\\\\\\\\"", ",", "\"/\"", ")", ".", "replaceAll", "(", "\" \"", ",", "\"%20\"", ")", ";", "return", "new", "KarafFeaturesOption", "(", "repoUrl", ",", "\"test-dependencies\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}" ]
Create a feature for the test dependencies specified as ProvisionOption in the system @return feature option for dependencies
[ "Create", "a", "feature", "for", "the", "test", "dependencies", "specified", "as", "ProvisionOption", "in", "the", "system" ]
train
https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/DependenciesDeployer.java#L116-L133
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLInverseFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.java
OWLInverseFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLInverseFunctionalObjectPropertyAxiomImpl instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLInverseFunctionalObjectPropertyAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLInverseFunctionalObjectPropertyAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLInverseFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.java#L74-L77
jenkinsci/jenkins
core/src/main/java/hudson/model/Descriptor.java
Descriptor.findByClassName
private static @CheckForNull <T extends Descriptor> T findByClassName(Collection<? extends T> list, String className) { """ Finds a descriptor from a collection by the class name of the {@link Descriptor}. This is useless as of the introduction of {@link #getId} and so only very old compatibility code needs it. """ for (T d : list) { if(d.getClass().getName().equals(className)) return d; } return null; }
java
private static @CheckForNull <T extends Descriptor> T findByClassName(Collection<? extends T> list, String className) { for (T d : list) { if(d.getClass().getName().equals(className)) return d; } return null; }
[ "private", "static", "@", "CheckForNull", "<", "T", "extends", "Descriptor", ">", "T", "findByClassName", "(", "Collection", "<", "?", "extends", "T", ">", "list", ",", "String", "className", ")", "{", "for", "(", "T", "d", ":", "list", ")", "{", "if", "(", "d", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "equals", "(", "className", ")", ")", "return", "d", ";", "}", "return", "null", ";", "}" ]
Finds a descriptor from a collection by the class name of the {@link Descriptor}. This is useless as of the introduction of {@link #getId} and so only very old compatibility code needs it.
[ "Finds", "a", "descriptor", "from", "a", "collection", "by", "the", "class", "name", "of", "the", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Descriptor.java#L1086-L1092
google/closure-compiler
src/com/google/javascript/jscomp/NodeUtil.java
NodeUtil.markNewScopesChanged
static void markNewScopesChanged(Node node, AbstractCompiler compiler) { """ Recurses through a tree, marking all function nodes as changed. """ if (node.isFunction()) { compiler.reportChangeToChangeScope(node); } for (Node child = node.getFirstChild(); child != null; child = child.getNext()) { markNewScopesChanged(child, compiler); } }
java
static void markNewScopesChanged(Node node, AbstractCompiler compiler) { if (node.isFunction()) { compiler.reportChangeToChangeScope(node); } for (Node child = node.getFirstChild(); child != null; child = child.getNext()) { markNewScopesChanged(child, compiler); } }
[ "static", "void", "markNewScopesChanged", "(", "Node", "node", ",", "AbstractCompiler", "compiler", ")", "{", "if", "(", "node", ".", "isFunction", "(", ")", ")", "{", "compiler", ".", "reportChangeToChangeScope", "(", "node", ")", ";", "}", "for", "(", "Node", "child", "=", "node", ".", "getFirstChild", "(", ")", ";", "child", "!=", "null", ";", "child", "=", "child", ".", "getNext", "(", ")", ")", "{", "markNewScopesChanged", "(", "child", ",", "compiler", ")", ";", "}", "}" ]
Recurses through a tree, marking all function nodes as changed.
[ "Recurses", "through", "a", "tree", "marking", "all", "function", "nodes", "as", "changed", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L5822-L5829
kite-sdk/kite
kite-morphlines/kite-morphlines-core/src/main/java/org/kitesdk/morphline/shaded/org/apache/commons/codec/binary/binary/Base64.java
Base64.encodeBase64
public static byte[] encodeBase64(final byte[] binaryData, final boolean isChunked, final boolean urlSafe) { """ Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks. @param binaryData Array containing binary data to encode. @param isChunked if {@code true} this encoder will chunk the base64 output into 76 character blocks @param urlSafe if {@code true} this encoder will emit - and _ instead of the usual + and / characters. <b>Note: no padding is added when encoding using the URL-safe alphabet.</b> @return Base64-encoded data. @throws IllegalArgumentException Thrown when the input array needs an output array bigger than {@link Integer#MAX_VALUE} @since 1.4 """ return encodeBase64(binaryData, isChunked, urlSafe, Integer.MAX_VALUE); }
java
public static byte[] encodeBase64(final byte[] binaryData, final boolean isChunked, final boolean urlSafe) { return encodeBase64(binaryData, isChunked, urlSafe, Integer.MAX_VALUE); }
[ "public", "static", "byte", "[", "]", "encodeBase64", "(", "final", "byte", "[", "]", "binaryData", ",", "final", "boolean", "isChunked", ",", "final", "boolean", "urlSafe", ")", "{", "return", "encodeBase64", "(", "binaryData", ",", "isChunked", ",", "urlSafe", ",", "Integer", ".", "MAX_VALUE", ")", ";", "}" ]
Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks. @param binaryData Array containing binary data to encode. @param isChunked if {@code true} this encoder will chunk the base64 output into 76 character blocks @param urlSafe if {@code true} this encoder will emit - and _ instead of the usual + and / characters. <b>Note: no padding is added when encoding using the URL-safe alphabet.</b> @return Base64-encoded data. @throws IllegalArgumentException Thrown when the input array needs an output array bigger than {@link Integer#MAX_VALUE} @since 1.4
[ "Encodes", "binary", "data", "using", "the", "base64", "algorithm", "optionally", "chunking", "the", "output", "into", "76", "character", "blocks", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-morphlines/kite-morphlines-core/src/main/java/org/kitesdk/morphline/shaded/org/apache/commons/codec/binary/binary/Base64.java#L638-L640
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/categories/image.java
image.getBitmapByImageURL
public static void getBitmapByImageURL(String imageURL, final OnEventListener callback) { """ Get a bitmap by a given URL @param imageURL given URL @param callback callback """ new DownloadImageTask<Bitmap>(imageURL, new OnEventListener<Bitmap>() { @Override public void onSuccess(Bitmap bitmap) { callback.onSuccess(bitmap); } @Override public void onFailure(Exception e) { callback.onFailure(e); } }).execute(); }
java
public static void getBitmapByImageURL(String imageURL, final OnEventListener callback) { new DownloadImageTask<Bitmap>(imageURL, new OnEventListener<Bitmap>() { @Override public void onSuccess(Bitmap bitmap) { callback.onSuccess(bitmap); } @Override public void onFailure(Exception e) { callback.onFailure(e); } }).execute(); }
[ "public", "static", "void", "getBitmapByImageURL", "(", "String", "imageURL", ",", "final", "OnEventListener", "callback", ")", "{", "new", "DownloadImageTask", "<", "Bitmap", ">", "(", "imageURL", ",", "new", "OnEventListener", "<", "Bitmap", ">", "(", ")", "{", "@", "Override", "public", "void", "onSuccess", "(", "Bitmap", "bitmap", ")", "{", "callback", ".", "onSuccess", "(", "bitmap", ")", ";", "}", "@", "Override", "public", "void", "onFailure", "(", "Exception", "e", ")", "{", "callback", ".", "onFailure", "(", "e", ")", ";", "}", "}", ")", ".", "execute", "(", ")", ";", "}" ]
Get a bitmap by a given URL @param imageURL given URL @param callback callback
[ "Get", "a", "bitmap", "by", "a", "given", "URL" ]
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/image.java#L77-L92
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/DocumentLine.java
DocumentLine.setEndings
public void setEndings(int i, float v) { """ indexed setter for endings - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array """ if (DocumentLine_Type.featOkTst && ((DocumentLine_Type)jcasType).casFeat_endings == null) jcasType.jcas.throwFeatMissing("endings", "ch.epfl.bbp.uima.types.DocumentLine"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((DocumentLine_Type)jcasType).casFeatCode_endings), i); jcasType.ll_cas.ll_setFloatArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((DocumentLine_Type)jcasType).casFeatCode_endings), i, v);}
java
public void setEndings(int i, float v) { if (DocumentLine_Type.featOkTst && ((DocumentLine_Type)jcasType).casFeat_endings == null) jcasType.jcas.throwFeatMissing("endings", "ch.epfl.bbp.uima.types.DocumentLine"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((DocumentLine_Type)jcasType).casFeatCode_endings), i); jcasType.ll_cas.ll_setFloatArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((DocumentLine_Type)jcasType).casFeatCode_endings), i, v);}
[ "public", "void", "setEndings", "(", "int", "i", ",", "float", "v", ")", "{", "if", "(", "DocumentLine_Type", ".", "featOkTst", "&&", "(", "(", "DocumentLine_Type", ")", "jcasType", ")", ".", "casFeat_endings", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"endings\"", ",", "\"ch.epfl.bbp.uima.types.DocumentLine\"", ")", ";", "jcasType", ".", "jcas", ".", "checkArrayBounds", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "DocumentLine_Type", ")", "jcasType", ")", ".", "casFeatCode_endings", ")", ",", "i", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setFloatArrayValue", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "DocumentLine_Type", ")", "jcasType", ")", ".", "casFeatCode_endings", ")", ",", "i", ",", "v", ")", ";", "}" ]
indexed setter for endings - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "endings", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/DocumentLine.java#L204-L208
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java
ClustersInner.beginUpdateAsync
public Observable<ClusterInner> beginUpdateAsync(String resourceGroupName, String clusterName, ClusterUpdate parameters) { """ Update a Kusto cluster. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param parameters The Kusto cluster parameters supplied to the Update operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ClusterInner object """ return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<ClusterInner>, ClusterInner>() { @Override public ClusterInner call(ServiceResponse<ClusterInner> response) { return response.body(); } }); }
java
public Observable<ClusterInner> beginUpdateAsync(String resourceGroupName, String clusterName, ClusterUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<ClusterInner>, ClusterInner>() { @Override public ClusterInner call(ServiceResponse<ClusterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ClusterInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "ClusterUpdate", "parameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ClusterInner", ">", ",", "ClusterInner", ">", "(", ")", "{", "@", "Override", "public", "ClusterInner", "call", "(", "ServiceResponse", "<", "ClusterInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Update a Kusto cluster. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param parameters The Kusto cluster parameters supplied to the Update operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ClusterInner object
[ "Update", "a", "Kusto", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java#L507-L514
Axway/Grapes
server/src/main/java/org/axway/grapes/server/core/LicenseHandler.java
LicenseHandler.approveLicense
public void approveLicense(final String name, final Boolean approved) { """ Approve or reject a license @param name String @param approved Boolean """ final DbLicense license = getLicense(name); repoHandler.approveLicense(license, approved); }
java
public void approveLicense(final String name, final Boolean approved) { final DbLicense license = getLicense(name); repoHandler.approveLicense(license, approved); }
[ "public", "void", "approveLicense", "(", "final", "String", "name", ",", "final", "Boolean", "approved", ")", "{", "final", "DbLicense", "license", "=", "getLicense", "(", "name", ")", ";", "repoHandler", ".", "approveLicense", "(", "license", ",", "approved", ")", ";", "}" ]
Approve or reject a license @param name String @param approved Boolean
[ "Approve", "or", "reject", "a", "license" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/LicenseHandler.java#L130-L133
openbase/jul
visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGIcon.java
SVGIcon.setForegroundIconColor
public void setForegroundIconColor(final Color color, final Color outline, final double width) { """ Method sets the icon color and a stroke with a given color and width. @param color color for the foreground icon to be set @param outline color for the stroke @param width width of the stroke """ setForegroundIconColor(color); foregroundIcon.setStroke(outline); foregroundIcon.setStrokeWidth(width); }
java
public void setForegroundIconColor(final Color color, final Color outline, final double width) { setForegroundIconColor(color); foregroundIcon.setStroke(outline); foregroundIcon.setStrokeWidth(width); }
[ "public", "void", "setForegroundIconColor", "(", "final", "Color", "color", ",", "final", "Color", "outline", ",", "final", "double", "width", ")", "{", "setForegroundIconColor", "(", "color", ")", ";", "foregroundIcon", ".", "setStroke", "(", "outline", ")", ";", "foregroundIcon", ".", "setStrokeWidth", "(", "width", ")", ";", "}" ]
Method sets the icon color and a stroke with a given color and width. @param color color for the foreground icon to be set @param outline color for the stroke @param width width of the stroke
[ "Method", "sets", "the", "icon", "color", "and", "a", "stroke", "with", "a", "given", "color", "and", "width", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGIcon.java#L466-L470
actframework/actframework
src/main/java/act/internal/util/AppDescriptor.java
AppDescriptor.of
public static AppDescriptor of(String appName, String packageName, Version appVersion) { """ Create an `AppDescriptor` with appName, package name and app version. If `appName` is `null` or blank, it will try the following approach to get app name: 1. check the {@link Version#getArtifactId() artifact id} and use it unless 2. if artifact id is null or empty, then infer app name using {@link AppNameInferer} @param appName the app name, optional @param packageName the package name @param appVersion the app version @return an `AppDescriptor` """ String[] packages = packageName.split(S.COMMON_SEP); String effectPackageName = packageName; if (packages.length > 0) { effectPackageName = packages[0]; } E.illegalArgumentIf(!JavaNames.isPackageOrClassName(effectPackageName), "valid package name expected. found: " + effectPackageName); return new AppDescriptor(ensureAppName(appName, effectPackageName, $.requireNotNull(appVersion)), packageName, appVersion); }
java
public static AppDescriptor of(String appName, String packageName, Version appVersion) { String[] packages = packageName.split(S.COMMON_SEP); String effectPackageName = packageName; if (packages.length > 0) { effectPackageName = packages[0]; } E.illegalArgumentIf(!JavaNames.isPackageOrClassName(effectPackageName), "valid package name expected. found: " + effectPackageName); return new AppDescriptor(ensureAppName(appName, effectPackageName, $.requireNotNull(appVersion)), packageName, appVersion); }
[ "public", "static", "AppDescriptor", "of", "(", "String", "appName", ",", "String", "packageName", ",", "Version", "appVersion", ")", "{", "String", "[", "]", "packages", "=", "packageName", ".", "split", "(", "S", ".", "COMMON_SEP", ")", ";", "String", "effectPackageName", "=", "packageName", ";", "if", "(", "packages", ".", "length", ">", "0", ")", "{", "effectPackageName", "=", "packages", "[", "0", "]", ";", "}", "E", ".", "illegalArgumentIf", "(", "!", "JavaNames", ".", "isPackageOrClassName", "(", "effectPackageName", ")", ",", "\"valid package name expected. found: \"", "+", "effectPackageName", ")", ";", "return", "new", "AppDescriptor", "(", "ensureAppName", "(", "appName", ",", "effectPackageName", ",", "$", ".", "requireNotNull", "(", "appVersion", ")", ")", ",", "packageName", ",", "appVersion", ")", ";", "}" ]
Create an `AppDescriptor` with appName, package name and app version. If `appName` is `null` or blank, it will try the following approach to get app name: 1. check the {@link Version#getArtifactId() artifact id} and use it unless 2. if artifact id is null or empty, then infer app name using {@link AppNameInferer} @param appName the app name, optional @param packageName the package name @param appVersion the app version @return an `AppDescriptor`
[ "Create", "an", "AppDescriptor", "with", "appName", "package", "name", "and", "app", "version", "." ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/internal/util/AppDescriptor.java#L143-L154
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java
MultiUserChatLightManager.unblockRoom
public void unblockRoom(DomainBareJid mucLightService, Jid roomJid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { """ Unblock a room. @param mucLightService @param roomJid @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException """ HashMap<Jid, Boolean> rooms = new HashMap<>(); rooms.put(roomJid, true); sendUnblockRooms(mucLightService, rooms); }
java
public void unblockRoom(DomainBareJid mucLightService, Jid roomJid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { HashMap<Jid, Boolean> rooms = new HashMap<>(); rooms.put(roomJid, true); sendUnblockRooms(mucLightService, rooms); }
[ "public", "void", "unblockRoom", "(", "DomainBareJid", "mucLightService", ",", "Jid", "roomJid", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "HashMap", "<", "Jid", ",", "Boolean", ">", "rooms", "=", "new", "HashMap", "<>", "(", ")", ";", "rooms", ".", "put", "(", "roomJid", ",", "true", ")", ";", "sendUnblockRooms", "(", "mucLightService", ",", "rooms", ")", ";", "}" ]
Unblock a room. @param mucLightService @param roomJid @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException
[ "Unblock", "a", "room", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java#L340-L345
lviggiano/owner
owner-creator-maven-plugin/src/main/java/org/aeonbits/owner/creator/PropertiesFileCreator.java
PropertiesFileCreator.parseMethods
private Group[] parseMethods(Class clazz) { """ Method to get group array with subgroups and properties. @param clazz class to parse @return array of groups """ List<Group> groups = new ArrayList(); Group unknownGroup = new Group(); groups.add(unknownGroup); String[] groupsOrder = new String[0]; for (Method method : clazz.getMethods()) { Property prop = new Property(); prop.deprecated = method.isAnnotationPresent(Deprecated.class); if (method.isAnnotationPresent(Key.class)) { Key val = method.getAnnotation(Key.class); prop.name = val.value(); } else { prop.name = method.getName(); } if (method.isAnnotationPresent(DefaultValue.class)) { DefaultValue val = method.getAnnotation(DefaultValue.class); prop.defaultValue = val.value(); } unknownGroup.properties.add(prop); } return orderGroup(groups, groupsOrder); }
java
private Group[] parseMethods(Class clazz) { List<Group> groups = new ArrayList(); Group unknownGroup = new Group(); groups.add(unknownGroup); String[] groupsOrder = new String[0]; for (Method method : clazz.getMethods()) { Property prop = new Property(); prop.deprecated = method.isAnnotationPresent(Deprecated.class); if (method.isAnnotationPresent(Key.class)) { Key val = method.getAnnotation(Key.class); prop.name = val.value(); } else { prop.name = method.getName(); } if (method.isAnnotationPresent(DefaultValue.class)) { DefaultValue val = method.getAnnotation(DefaultValue.class); prop.defaultValue = val.value(); } unknownGroup.properties.add(prop); } return orderGroup(groups, groupsOrder); }
[ "private", "Group", "[", "]", "parseMethods", "(", "Class", "clazz", ")", "{", "List", "<", "Group", ">", "groups", "=", "new", "ArrayList", "(", ")", ";", "Group", "unknownGroup", "=", "new", "Group", "(", ")", ";", "groups", ".", "add", "(", "unknownGroup", ")", ";", "String", "[", "]", "groupsOrder", "=", "new", "String", "[", "0", "]", ";", "for", "(", "Method", "method", ":", "clazz", ".", "getMethods", "(", ")", ")", "{", "Property", "prop", "=", "new", "Property", "(", ")", ";", "prop", ".", "deprecated", "=", "method", ".", "isAnnotationPresent", "(", "Deprecated", ".", "class", ")", ";", "if", "(", "method", ".", "isAnnotationPresent", "(", "Key", ".", "class", ")", ")", "{", "Key", "val", "=", "method", ".", "getAnnotation", "(", "Key", ".", "class", ")", ";", "prop", ".", "name", "=", "val", ".", "value", "(", ")", ";", "}", "else", "{", "prop", ".", "name", "=", "method", ".", "getName", "(", ")", ";", "}", "if", "(", "method", ".", "isAnnotationPresent", "(", "DefaultValue", ".", "class", ")", ")", "{", "DefaultValue", "val", "=", "method", ".", "getAnnotation", "(", "DefaultValue", ".", "class", ")", ";", "prop", ".", "defaultValue", "=", "val", ".", "value", "(", ")", ";", "}", "unknownGroup", ".", "properties", ".", "add", "(", "prop", ")", ";", "}", "return", "orderGroup", "(", "groups", ",", "groupsOrder", ")", ";", "}" ]
Method to get group array with subgroups and properties. @param clazz class to parse @return array of groups
[ "Method", "to", "get", "group", "array", "with", "subgroups", "and", "properties", "." ]
train
https://github.com/lviggiano/owner/blob/1223ecfbe3c275b3b7c5ec13e9238c9bb888754f/owner-creator-maven-plugin/src/main/java/org/aeonbits/owner/creator/PropertiesFileCreator.java#L65-L92
indeedeng/util
util-core/src/main/java/com/indeed/util/core/TreeTimer.java
TreeTimer.leftpad
@Nonnull private static String leftpad(@Nonnull String s, int n) { """ Left-pads a String with spaces so it is length <code>n</code>. If the String is already at least length n, no padding is done. """ return leftpad(s, n, ' '); }
java
@Nonnull private static String leftpad(@Nonnull String s, int n) { return leftpad(s, n, ' '); }
[ "@", "Nonnull", "private", "static", "String", "leftpad", "(", "@", "Nonnull", "String", "s", ",", "int", "n", ")", "{", "return", "leftpad", "(", "s", ",", "n", ",", "'", "'", ")", ";", "}" ]
Left-pads a String with spaces so it is length <code>n</code>. If the String is already at least length n, no padding is done.
[ "Left", "-", "pads", "a", "String", "with", "spaces", "so", "it", "is", "length", "<code", ">", "n<", "/", "code", ">", ".", "If", "the", "String", "is", "already", "at", "least", "length", "n", "no", "padding", "is", "done", "." ]
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/TreeTimer.java#L81-L84
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/safari/SafariOptions.java
SafariOptions.fromCapabilities
public static SafariOptions fromCapabilities(Capabilities capabilities) throws WebDriverException { """ Construct a {@link SafariOptions} instance from given capabilities. When the {@link #CAPABILITY} capability is set, all other capabilities will be ignored! @param capabilities Desired capabilities from which the options are derived. @return SafariOptions @throws WebDriverException If an error occurred during the reconstruction of the options """ if (capabilities instanceof SafariOptions) { return (SafariOptions) capabilities; } Object cap = capabilities.getCapability(SafariOptions.CAPABILITY); if (cap instanceof SafariOptions) { return (SafariOptions) cap; } else if (cap instanceof Map) { return new SafariOptions(new MutableCapabilities(((Map<String, ?>) cap))); } else { return new SafariOptions(); } }
java
public static SafariOptions fromCapabilities(Capabilities capabilities) throws WebDriverException { if (capabilities instanceof SafariOptions) { return (SafariOptions) capabilities; } Object cap = capabilities.getCapability(SafariOptions.CAPABILITY); if (cap instanceof SafariOptions) { return (SafariOptions) cap; } else if (cap instanceof Map) { return new SafariOptions(new MutableCapabilities(((Map<String, ?>) cap))); } else { return new SafariOptions(); } }
[ "public", "static", "SafariOptions", "fromCapabilities", "(", "Capabilities", "capabilities", ")", "throws", "WebDriverException", "{", "if", "(", "capabilities", "instanceof", "SafariOptions", ")", "{", "return", "(", "SafariOptions", ")", "capabilities", ";", "}", "Object", "cap", "=", "capabilities", ".", "getCapability", "(", "SafariOptions", ".", "CAPABILITY", ")", ";", "if", "(", "cap", "instanceof", "SafariOptions", ")", "{", "return", "(", "SafariOptions", ")", "cap", ";", "}", "else", "if", "(", "cap", "instanceof", "Map", ")", "{", "return", "new", "SafariOptions", "(", "new", "MutableCapabilities", "(", "(", "(", "Map", "<", "String", ",", "?", ">", ")", "cap", ")", ")", ")", ";", "}", "else", "{", "return", "new", "SafariOptions", "(", ")", ";", "}", "}" ]
Construct a {@link SafariOptions} instance from given capabilities. When the {@link #CAPABILITY} capability is set, all other capabilities will be ignored! @param capabilities Desired capabilities from which the options are derived. @return SafariOptions @throws WebDriverException If an error occurred during the reconstruction of the options
[ "Construct", "a", "{", "@link", "SafariOptions", "}", "instance", "from", "given", "capabilities", ".", "When", "the", "{", "@link", "#CAPABILITY", "}", "capability", "is", "set", "all", "other", "capabilities", "will", "be", "ignored!" ]
train
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/safari/SafariOptions.java#L102-L115
bmwcarit/joynr
java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java
LongPollingMessagingDelegate.createChannel
public String createChannel(String ccid, String atmosphereTrackingId) { """ Creates a long polling channel. @param ccid the identifier of the channel @param atmosphereTrackingId the tracking ID of the channel @return the path segment for the channel. The path, appended to the base URI of the channel service, can be used to post messages to the channel. """ throwExceptionIfTrackingIdnotSet(atmosphereTrackingId); log.info("CREATE channel for cluster controller: {} trackingId: {} ", ccid, atmosphereTrackingId); Broadcaster broadcaster = null; // look for an existing broadcaster BroadcasterFactory defaultBroadcasterFactory = BroadcasterFactory.getDefault(); if (defaultBroadcasterFactory == null) { throw new JoynrHttpException(500, 10009, "broadcaster was null"); } broadcaster = defaultBroadcasterFactory.lookup(Broadcaster.class, ccid, false); // create a new one if none already exists if (broadcaster == null) { broadcaster = defaultBroadcasterFactory.get(BounceProxyBroadcaster.class, ccid); } // avoids error where previous long poll from browser got message // destined for new long poll // especially as seen in js, where every second refresh caused a fail for (AtmosphereResource resource : broadcaster.getAtmosphereResources()) { if (resource.uuid() != null && resource.uuid().equals(atmosphereTrackingId)) { resource.resume(); } } UUIDBroadcasterCache broadcasterCache = (UUIDBroadcasterCache) broadcaster.getBroadcasterConfig() .getBroadcasterCache(); broadcasterCache.activeClients().put(atmosphereTrackingId, System.currentTimeMillis()); // BroadcasterCacheInspector is not implemented corrected in Atmosphere // 1.1.0RC4 // broadcasterCache.inspector(new MessageExpirationInspector()); return "/channels/" + ccid + "/"; }
java
public String createChannel(String ccid, String atmosphereTrackingId) { throwExceptionIfTrackingIdnotSet(atmosphereTrackingId); log.info("CREATE channel for cluster controller: {} trackingId: {} ", ccid, atmosphereTrackingId); Broadcaster broadcaster = null; // look for an existing broadcaster BroadcasterFactory defaultBroadcasterFactory = BroadcasterFactory.getDefault(); if (defaultBroadcasterFactory == null) { throw new JoynrHttpException(500, 10009, "broadcaster was null"); } broadcaster = defaultBroadcasterFactory.lookup(Broadcaster.class, ccid, false); // create a new one if none already exists if (broadcaster == null) { broadcaster = defaultBroadcasterFactory.get(BounceProxyBroadcaster.class, ccid); } // avoids error where previous long poll from browser got message // destined for new long poll // especially as seen in js, where every second refresh caused a fail for (AtmosphereResource resource : broadcaster.getAtmosphereResources()) { if (resource.uuid() != null && resource.uuid().equals(atmosphereTrackingId)) { resource.resume(); } } UUIDBroadcasterCache broadcasterCache = (UUIDBroadcasterCache) broadcaster.getBroadcasterConfig() .getBroadcasterCache(); broadcasterCache.activeClients().put(atmosphereTrackingId, System.currentTimeMillis()); // BroadcasterCacheInspector is not implemented corrected in Atmosphere // 1.1.0RC4 // broadcasterCache.inspector(new MessageExpirationInspector()); return "/channels/" + ccid + "/"; }
[ "public", "String", "createChannel", "(", "String", "ccid", ",", "String", "atmosphereTrackingId", ")", "{", "throwExceptionIfTrackingIdnotSet", "(", "atmosphereTrackingId", ")", ";", "log", ".", "info", "(", "\"CREATE channel for cluster controller: {} trackingId: {} \"", ",", "ccid", ",", "atmosphereTrackingId", ")", ";", "Broadcaster", "broadcaster", "=", "null", ";", "// look for an existing broadcaster", "BroadcasterFactory", "defaultBroadcasterFactory", "=", "BroadcasterFactory", ".", "getDefault", "(", ")", ";", "if", "(", "defaultBroadcasterFactory", "==", "null", ")", "{", "throw", "new", "JoynrHttpException", "(", "500", ",", "10009", ",", "\"broadcaster was null\"", ")", ";", "}", "broadcaster", "=", "defaultBroadcasterFactory", ".", "lookup", "(", "Broadcaster", ".", "class", ",", "ccid", ",", "false", ")", ";", "// create a new one if none already exists", "if", "(", "broadcaster", "==", "null", ")", "{", "broadcaster", "=", "defaultBroadcasterFactory", ".", "get", "(", "BounceProxyBroadcaster", ".", "class", ",", "ccid", ")", ";", "}", "// avoids error where previous long poll from browser got message", "// destined for new long poll", "// especially as seen in js, where every second refresh caused a fail", "for", "(", "AtmosphereResource", "resource", ":", "broadcaster", ".", "getAtmosphereResources", "(", ")", ")", "{", "if", "(", "resource", ".", "uuid", "(", ")", "!=", "null", "&&", "resource", ".", "uuid", "(", ")", ".", "equals", "(", "atmosphereTrackingId", ")", ")", "{", "resource", ".", "resume", "(", ")", ";", "}", "}", "UUIDBroadcasterCache", "broadcasterCache", "=", "(", "UUIDBroadcasterCache", ")", "broadcaster", ".", "getBroadcasterConfig", "(", ")", ".", "getBroadcasterCache", "(", ")", ";", "broadcasterCache", ".", "activeClients", "(", ")", ".", "put", "(", "atmosphereTrackingId", ",", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "// BroadcasterCacheInspector is not implemented corrected in Atmosphere", "// 1.1.0RC4", "// broadcasterCache.inspector(new MessageExpirationInspector());", "return", "\"/channels/\"", "+", "ccid", "+", "\"/\"", ";", "}" ]
Creates a long polling channel. @param ccid the identifier of the channel @param atmosphereTrackingId the tracking ID of the channel @return the path segment for the channel. The path, appended to the base URI of the channel service, can be used to post messages to the channel.
[ "Creates", "a", "long", "polling", "channel", "." ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java#L95-L133
mcxiaoke/Android-Next
core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java
IOUtils.readFully
public static void readFully(InputStream input, byte[] buffer) throws IOException { """ Read the requested number of bytes or fail if there are not enough left. <p/> This allows for the possibility that {@link InputStream#read(byte[], int, int)} may not read as many bytes as requested (most likely because of reaching EOF). @param input where to read input from @param buffer destination @throws IOException if there is a problem reading the file @throws IllegalArgumentException if length is negative @throws EOFException if the number of bytes read was incorrect @since 2.2 """ readFully(input, buffer, 0, buffer.length); }
java
public static void readFully(InputStream input, byte[] buffer) throws IOException { readFully(input, buffer, 0, buffer.length); }
[ "public", "static", "void", "readFully", "(", "InputStream", "input", ",", "byte", "[", "]", "buffer", ")", "throws", "IOException", "{", "readFully", "(", "input", ",", "buffer", ",", "0", ",", "buffer", ".", "length", ")", ";", "}" ]
Read the requested number of bytes or fail if there are not enough left. <p/> This allows for the possibility that {@link InputStream#read(byte[], int, int)} may not read as many bytes as requested (most likely because of reaching EOF). @param input where to read input from @param buffer destination @throws IOException if there is a problem reading the file @throws IllegalArgumentException if length is negative @throws EOFException if the number of bytes read was incorrect @since 2.2
[ "Read", "the", "requested", "number", "of", "bytes", "or", "fail", "if", "there", "are", "not", "enough", "left", ".", "<p", "/", ">", "This", "allows", "for", "the", "possibility", "that", "{", "@link", "InputStream#read", "(", "byte", "[]", "int", "int", ")", "}", "may", "not", "read", "as", "many", "bytes", "as", "requested", "(", "most", "likely", "because", "of", "reaching", "EOF", ")", "." ]
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java#L1050-L1052
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.toUnique
public static <T> List<T> toUnique(List<T> self) { """ Returns a List containing the items from the List but with duplicates removed using the natural ordering of the items to determine uniqueness. <p> <pre class="groovyTestCase"> def letters = ['c', 'a', 't', 's', 'a', 't', 'h', 'a', 't'] def expected = ['c', 'a', 't', 's', 'h'] assert letters.toUnique() == expected </pre> @param self a List @return the List of non-duplicate items @since 2.4.0 """ return toUnique(self, (Comparator<T>) null); }
java
public static <T> List<T> toUnique(List<T> self) { return toUnique(self, (Comparator<T>) null); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "toUnique", "(", "List", "<", "T", ">", "self", ")", "{", "return", "toUnique", "(", "self", ",", "(", "Comparator", "<", "T", ">", ")", "null", ")", ";", "}" ]
Returns a List containing the items from the List but with duplicates removed using the natural ordering of the items to determine uniqueness. <p> <pre class="groovyTestCase"> def letters = ['c', 'a', 't', 's', 'a', 't', 'h', 'a', 't'] def expected = ['c', 'a', 't', 's', 'h'] assert letters.toUnique() == expected </pre> @param self a List @return the List of non-duplicate items @since 2.4.0
[ "Returns", "a", "List", "containing", "the", "items", "from", "the", "List", "but", "with", "duplicates", "removed", "using", "the", "natural", "ordering", "of", "the", "items", "to", "determine", "uniqueness", ".", "<p", ">", "<pre", "class", "=", "groovyTestCase", ">", "def", "letters", "=", "[", "c", "a", "t", "s", "a", "t", "h", "a", "t", "]", "def", "expected", "=", "[", "c", "a", "t", "s", "h", "]", "assert", "letters", ".", "toUnique", "()", "==", "expected", "<", "/", "pre", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L1942-L1944
buschmais/jqa-maven-plugin
src/main/java/com/buschmais/jqassistant/scm/maven/AbstractMojo.java
AbstractMojo.addRuleFiles
private void addRuleFiles(List<RuleSource> sources, File directory) throws MojoExecutionException { """ Add rules from the given directory to the list of sources. @param sources The sources. @param directory The directory. @throws MojoExecutionException On error. """ List<RuleSource> ruleSources = readRulesDirectory(directory); for (RuleSource ruleSource : ruleSources) { getLog().debug("Adding rules from file " + ruleSource); sources.add(ruleSource); } }
java
private void addRuleFiles(List<RuleSource> sources, File directory) throws MojoExecutionException { List<RuleSource> ruleSources = readRulesDirectory(directory); for (RuleSource ruleSource : ruleSources) { getLog().debug("Adding rules from file " + ruleSource); sources.add(ruleSource); } }
[ "private", "void", "addRuleFiles", "(", "List", "<", "RuleSource", ">", "sources", ",", "File", "directory", ")", "throws", "MojoExecutionException", "{", "List", "<", "RuleSource", ">", "ruleSources", "=", "readRulesDirectory", "(", "directory", ")", ";", "for", "(", "RuleSource", "ruleSource", ":", "ruleSources", ")", "{", "getLog", "(", ")", ".", "debug", "(", "\"Adding rules from file \"", "+", "ruleSource", ")", ";", "sources", ".", "add", "(", "ruleSource", ")", ";", "}", "}" ]
Add rules from the given directory to the list of sources. @param sources The sources. @param directory The directory. @throws MojoExecutionException On error.
[ "Add", "rules", "from", "the", "given", "directory", "to", "the", "list", "of", "sources", "." ]
train
https://github.com/buschmais/jqa-maven-plugin/blob/5c21a8058fc1b013333081907fbf00d3525e11c3/src/main/java/com/buschmais/jqassistant/scm/maven/AbstractMojo.java#L327-L333
ops4j/org.ops4j.pax.exam2
containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/options/KarafDistributionOption.java
KarafDistributionOption.karafDistributionConfiguration
public static KarafDistributionBaseConfigurationOption karafDistributionConfiguration( String frameworkURL, String name, String karafVersion) { """ Configures which distribution options to use. Relevant are the frameworkURL, the frameworkName and the Karaf version since all of those params are relevant to decide which wrapper configurations to use. @param frameworkURL frameworkURL @param name framework name @param karafVersion Karaf version @return option """ return new KarafDistributionConfigurationOption(frameworkURL, name, karafVersion); }
java
public static KarafDistributionBaseConfigurationOption karafDistributionConfiguration( String frameworkURL, String name, String karafVersion) { return new KarafDistributionConfigurationOption(frameworkURL, name, karafVersion); }
[ "public", "static", "KarafDistributionBaseConfigurationOption", "karafDistributionConfiguration", "(", "String", "frameworkURL", ",", "String", "name", ",", "String", "karafVersion", ")", "{", "return", "new", "KarafDistributionConfigurationOption", "(", "frameworkURL", ",", "name", ",", "karafVersion", ")", ";", "}" ]
Configures which distribution options to use. Relevant are the frameworkURL, the frameworkName and the Karaf version since all of those params are relevant to decide which wrapper configurations to use. @param frameworkURL frameworkURL @param name framework name @param karafVersion Karaf version @return option
[ "Configures", "which", "distribution", "options", "to", "use", ".", "Relevant", "are", "the", "frameworkURL", "the", "frameworkName", "and", "the", "Karaf", "version", "since", "all", "of", "those", "params", "are", "relevant", "to", "decide", "which", "wrapper", "configurations", "to", "use", "." ]
train
https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/options/KarafDistributionOption.java#L126-L129
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaGraphicsGLRegisterBuffer
public static int cudaGraphicsGLRegisterBuffer(cudaGraphicsResource resource, int buffer, int Flags) { """ Registers an OpenGL buffer object. <pre> cudaError_t cudaGraphicsGLRegisterBuffer ( cudaGraphicsResource** resource, GLuint buffer, unsigned int flags ) </pre> <div> <p>Registers an OpenGL buffer object. Registers the buffer object specified by <tt>buffer</tt> for access by CUDA. A handle to the registered object is returned as <tt>resource</tt>. The register flags <tt>flags</tt> specify the intended usage, as follows: </p> <ul> <li> <p>cudaGraphicsRegisterFlagsNone: Specifies no hints about how this resource will be used. It is therefore assumed that this resource will be read from and written to by CUDA. This is the default value. </p> </li> <li> <p>cudaGraphicsRegisterFlagsReadOnly: Specifies that CUDA will not write to this resource. </p> </li> <li> <p>cudaGraphicsRegisterFlagsWriteDiscard: Specifies that CUDA will not read from this resource and will write over the entire contents of the resource, so none of the data previously stored in the resource will be preserved. </p> </li> </ul> </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param resource Pointer to the returned object handle @param buffer name of buffer object to be registered @param flags Register flags @return cudaSuccess, cudaErrorInvalidDevice, cudaErrorInvalidValue, cudaErrorInvalidResourceHandle, cudaErrorUnknown @see JCuda#cudaGraphicsUnregisterResource @see JCuda#cudaGraphicsMapResources @see JCuda#cudaGraphicsResourceGetMappedPointer """ return checkResult(cudaGraphicsGLRegisterBufferNative(resource, buffer, Flags)); }
java
public static int cudaGraphicsGLRegisterBuffer(cudaGraphicsResource resource, int buffer, int Flags) { return checkResult(cudaGraphicsGLRegisterBufferNative(resource, buffer, Flags)); }
[ "public", "static", "int", "cudaGraphicsGLRegisterBuffer", "(", "cudaGraphicsResource", "resource", ",", "int", "buffer", ",", "int", "Flags", ")", "{", "return", "checkResult", "(", "cudaGraphicsGLRegisterBufferNative", "(", "resource", ",", "buffer", ",", "Flags", ")", ")", ";", "}" ]
Registers an OpenGL buffer object. <pre> cudaError_t cudaGraphicsGLRegisterBuffer ( cudaGraphicsResource** resource, GLuint buffer, unsigned int flags ) </pre> <div> <p>Registers an OpenGL buffer object. Registers the buffer object specified by <tt>buffer</tt> for access by CUDA. A handle to the registered object is returned as <tt>resource</tt>. The register flags <tt>flags</tt> specify the intended usage, as follows: </p> <ul> <li> <p>cudaGraphicsRegisterFlagsNone: Specifies no hints about how this resource will be used. It is therefore assumed that this resource will be read from and written to by CUDA. This is the default value. </p> </li> <li> <p>cudaGraphicsRegisterFlagsReadOnly: Specifies that CUDA will not write to this resource. </p> </li> <li> <p>cudaGraphicsRegisterFlagsWriteDiscard: Specifies that CUDA will not read from this resource and will write over the entire contents of the resource, so none of the data previously stored in the resource will be preserved. </p> </li> </ul> </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param resource Pointer to the returned object handle @param buffer name of buffer object to be registered @param flags Register flags @return cudaSuccess, cudaErrorInvalidDevice, cudaErrorInvalidValue, cudaErrorInvalidResourceHandle, cudaErrorUnknown @see JCuda#cudaGraphicsUnregisterResource @see JCuda#cudaGraphicsMapResources @see JCuda#cudaGraphicsResourceGetMappedPointer
[ "Registers", "an", "OpenGL", "buffer", "object", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L10668-L10671
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.drawImage
public void drawImage (final PDImageXObject image, final float x, final float y, final float width, final float height) throws IOException { """ Draw an image at the x,y coordinates, with the given size. @param image The image to draw. @param x The x-coordinate to draw the image. @param y The y-coordinate to draw the image. @param width The width to draw the image. @param height The height to draw the image. @throws IOException If there is an error writing to the stream. @throws IllegalStateException If the method was called within a text block. """ if (inTextMode) { throw new IllegalStateException ("Error: drawImage is not allowed within a text block."); } saveGraphicsState (); final AffineTransform transform = new AffineTransform (width, 0, 0, height, x, y); transform (new Matrix (transform)); writeOperand (resources.add (image)); writeOperator ((byte) 'D', (byte) 'o'); restoreGraphicsState (); }
java
public void drawImage (final PDImageXObject image, final float x, final float y, final float width, final float height) throws IOException { if (inTextMode) { throw new IllegalStateException ("Error: drawImage is not allowed within a text block."); } saveGraphicsState (); final AffineTransform transform = new AffineTransform (width, 0, 0, height, x, y); transform (new Matrix (transform)); writeOperand (resources.add (image)); writeOperator ((byte) 'D', (byte) 'o'); restoreGraphicsState (); }
[ "public", "void", "drawImage", "(", "final", "PDImageXObject", "image", ",", "final", "float", "x", ",", "final", "float", "y", ",", "final", "float", "width", ",", "final", "float", "height", ")", "throws", "IOException", "{", "if", "(", "inTextMode", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Error: drawImage is not allowed within a text block.\"", ")", ";", "}", "saveGraphicsState", "(", ")", ";", "final", "AffineTransform", "transform", "=", "new", "AffineTransform", "(", "width", ",", "0", ",", "0", ",", "height", ",", "x", ",", "y", ")", ";", "transform", "(", "new", "Matrix", "(", "transform", ")", ")", ";", "writeOperand", "(", "resources", ".", "add", "(", "image", ")", ")", ";", "writeOperator", "(", "(", "byte", ")", "'", "'", ",", "(", "byte", ")", "'", "'", ")", ";", "restoreGraphicsState", "(", ")", ";", "}" ]
Draw an image at the x,y coordinates, with the given size. @param image The image to draw. @param x The x-coordinate to draw the image. @param y The y-coordinate to draw the image. @param width The width to draw the image. @param height The height to draw the image. @throws IOException If there is an error writing to the stream. @throws IllegalStateException If the method was called within a text block.
[ "Draw", "an", "image", "at", "the", "x", "y", "coordinates", "with", "the", "given", "size", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L510-L530
lets-blade/blade
src/main/java/com/blade/kit/DateKit.java
DateKit.toUnix
public static int toUnix(String time, String pattern) { """ format string time to unix time @param time string date @param pattern date format pattern @return return unix time """ LocalDateTime formatted = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern)); return (int) formatted.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond(); }
java
public static int toUnix(String time, String pattern) { LocalDateTime formatted = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern)); return (int) formatted.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond(); }
[ "public", "static", "int", "toUnix", "(", "String", "time", ",", "String", "pattern", ")", "{", "LocalDateTime", "formatted", "=", "LocalDateTime", ".", "parse", "(", "time", ",", "DateTimeFormatter", ".", "ofPattern", "(", "pattern", ")", ")", ";", "return", "(", "int", ")", "formatted", ".", "atZone", "(", "ZoneId", ".", "systemDefault", "(", ")", ")", ".", "toInstant", "(", ")", ".", "getEpochSecond", "(", ")", ";", "}" ]
format string time to unix time @param time string date @param pattern date format pattern @return return unix time
[ "format", "string", "time", "to", "unix", "time" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/DateKit.java#L98-L101
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java
P2sVpnServerConfigurationsInner.getAsync
public Observable<P2SVpnServerConfigurationInner> getAsync(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName) { """ Retrieves the details of a P2SVpnServerConfiguration. @param resourceGroupName The resource group name of the P2SVpnServerConfiguration. @param virtualWanName The name of the VirtualWan. @param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the P2SVpnServerConfigurationInner object """ return getWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName).map(new Func1<ServiceResponse<P2SVpnServerConfigurationInner>, P2SVpnServerConfigurationInner>() { @Override public P2SVpnServerConfigurationInner call(ServiceResponse<P2SVpnServerConfigurationInner> response) { return response.body(); } }); }
java
public Observable<P2SVpnServerConfigurationInner> getAsync(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName) { return getWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName).map(new Func1<ServiceResponse<P2SVpnServerConfigurationInner>, P2SVpnServerConfigurationInner>() { @Override public P2SVpnServerConfigurationInner call(ServiceResponse<P2SVpnServerConfigurationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "P2SVpnServerConfigurationInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "virtualWanName", ",", "String", "p2SVpnServerConfigurationName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualWanName", ",", "p2SVpnServerConfigurationName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "P2SVpnServerConfigurationInner", ">", ",", "P2SVpnServerConfigurationInner", ">", "(", ")", "{", "@", "Override", "public", "P2SVpnServerConfigurationInner", "call", "(", "ServiceResponse", "<", "P2SVpnServerConfigurationInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieves the details of a P2SVpnServerConfiguration. @param resourceGroupName The resource group name of the P2SVpnServerConfiguration. @param virtualWanName The name of the VirtualWan. @param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the P2SVpnServerConfigurationInner object
[ "Retrieves", "the", "details", "of", "a", "P2SVpnServerConfiguration", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java#L132-L139
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/ProjectableSQLQuery.java
ProjectableSQLQuery.addFlag
@Override public Q addFlag(Position position, String prefix, Expression<?> expr) { """ Add the given prefix and expression as a general query flag @param position position of the flag @param prefix prefix for the flag @param expr expression of the flag @return the current object """ Expression<?> flag = Expressions.template(expr.getType(), prefix + "{0}", expr); return queryMixin.addFlag(new QueryFlag(position, flag)); }
java
@Override public Q addFlag(Position position, String prefix, Expression<?> expr) { Expression<?> flag = Expressions.template(expr.getType(), prefix + "{0}", expr); return queryMixin.addFlag(new QueryFlag(position, flag)); }
[ "@", "Override", "public", "Q", "addFlag", "(", "Position", "position", ",", "String", "prefix", ",", "Expression", "<", "?", ">", "expr", ")", "{", "Expression", "<", "?", ">", "flag", "=", "Expressions", ".", "template", "(", "expr", ".", "getType", "(", ")", ",", "prefix", "+", "\"{0}\"", ",", "expr", ")", ";", "return", "queryMixin", ".", "addFlag", "(", "new", "QueryFlag", "(", "position", ",", "flag", ")", ")", ";", "}" ]
Add the given prefix and expression as a general query flag @param position position of the flag @param prefix prefix for the flag @param expr expression of the flag @return the current object
[ "Add", "the", "given", "prefix", "and", "expression", "as", "a", "general", "query", "flag" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/ProjectableSQLQuery.java#L110-L114
Devskiller/jfairy
src/main/java/com/devskiller/jfairy/Bootstrap.java
Bootstrap.getFairyModuleForLocale
private static FairyModule getFairyModuleForLocale(DataMaster dataMaster, Locale locale, RandomGenerator randomGenerator) { """ Support customized language config @param dataMaster master of the config @param locale The Locale to set. @param randomGenerator specific random generator @return FariyModule instance in accordance with locale """ LanguageCode code; try { code = LanguageCode.valueOf(locale.getLanguage().toUpperCase()); } catch (IllegalArgumentException e) { LOG.warn("Uknown locale " + locale); code = LanguageCode.EN; } switch (code) { case PL: return new PlFairyModule(dataMaster, randomGenerator); case EN: return new EnFairyModule(dataMaster, randomGenerator); case ES: return new EsFairyModule(dataMaster, randomGenerator); case FR: return new EsFairyModule(dataMaster, randomGenerator); case SV: return new SvFairyModule(dataMaster, randomGenerator); case ZH: return new ZhFairyModule(dataMaster, randomGenerator); case DE: return new DeFairyModule(dataMaster, randomGenerator); case KA: return new KaFairyModule(dataMaster, randomGenerator); default: LOG.info("No data for your language - using EN"); return new EnFairyModule(dataMaster, randomGenerator); } }
java
private static FairyModule getFairyModuleForLocale(DataMaster dataMaster, Locale locale, RandomGenerator randomGenerator) { LanguageCode code; try { code = LanguageCode.valueOf(locale.getLanguage().toUpperCase()); } catch (IllegalArgumentException e) { LOG.warn("Uknown locale " + locale); code = LanguageCode.EN; } switch (code) { case PL: return new PlFairyModule(dataMaster, randomGenerator); case EN: return new EnFairyModule(dataMaster, randomGenerator); case ES: return new EsFairyModule(dataMaster, randomGenerator); case FR: return new EsFairyModule(dataMaster, randomGenerator); case SV: return new SvFairyModule(dataMaster, randomGenerator); case ZH: return new ZhFairyModule(dataMaster, randomGenerator); case DE: return new DeFairyModule(dataMaster, randomGenerator); case KA: return new KaFairyModule(dataMaster, randomGenerator); default: LOG.info("No data for your language - using EN"); return new EnFairyModule(dataMaster, randomGenerator); } }
[ "private", "static", "FairyModule", "getFairyModuleForLocale", "(", "DataMaster", "dataMaster", ",", "Locale", "locale", ",", "RandomGenerator", "randomGenerator", ")", "{", "LanguageCode", "code", ";", "try", "{", "code", "=", "LanguageCode", ".", "valueOf", "(", "locale", ".", "getLanguage", "(", ")", ".", "toUpperCase", "(", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "LOG", ".", "warn", "(", "\"Uknown locale \"", "+", "locale", ")", ";", "code", "=", "LanguageCode", ".", "EN", ";", "}", "switch", "(", "code", ")", "{", "case", "PL", ":", "return", "new", "PlFairyModule", "(", "dataMaster", ",", "randomGenerator", ")", ";", "case", "EN", ":", "return", "new", "EnFairyModule", "(", "dataMaster", ",", "randomGenerator", ")", ";", "case", "ES", ":", "return", "new", "EsFairyModule", "(", "dataMaster", ",", "randomGenerator", ")", ";", "case", "FR", ":", "return", "new", "EsFairyModule", "(", "dataMaster", ",", "randomGenerator", ")", ";", "case", "SV", ":", "return", "new", "SvFairyModule", "(", "dataMaster", ",", "randomGenerator", ")", ";", "case", "ZH", ":", "return", "new", "ZhFairyModule", "(", "dataMaster", ",", "randomGenerator", ")", ";", "case", "DE", ":", "return", "new", "DeFairyModule", "(", "dataMaster", ",", "randomGenerator", ")", ";", "case", "KA", ":", "return", "new", "KaFairyModule", "(", "dataMaster", ",", "randomGenerator", ")", ";", "default", ":", "LOG", ".", "info", "(", "\"No data for your language - using EN\"", ")", ";", "return", "new", "EnFairyModule", "(", "dataMaster", ",", "randomGenerator", ")", ";", "}", "}" ]
Support customized language config @param dataMaster master of the config @param locale The Locale to set. @param randomGenerator specific random generator @return FariyModule instance in accordance with locale
[ "Support", "customized", "language", "config" ]
train
https://github.com/Devskiller/jfairy/blob/126d1c8b1545f725afd10f969b9d27005ac520b7/src/main/java/com/devskiller/jfairy/Bootstrap.java#L121-L152
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java
MongoDBClient.getGFSDBFiles
private List<GridFSDBFile> getGFSDBFiles(BasicDBObject mongoQuery, BasicDBObject sort, String collectionName, int maxResult, int firstResult) { """ Gets the GFSDB files. @param mongoQuery the mongo query @param sort the sort @param collectionName the collection name @param maxResult the max result @param firstResult the first result @return the GFSDB files """ KunderaGridFS gfs = new KunderaGridFS(mongoDb, collectionName); return gfs.find(mongoQuery, sort, firstResult, maxResult); }
java
private List<GridFSDBFile> getGFSDBFiles(BasicDBObject mongoQuery, BasicDBObject sort, String collectionName, int maxResult, int firstResult) { KunderaGridFS gfs = new KunderaGridFS(mongoDb, collectionName); return gfs.find(mongoQuery, sort, firstResult, maxResult); }
[ "private", "List", "<", "GridFSDBFile", ">", "getGFSDBFiles", "(", "BasicDBObject", "mongoQuery", ",", "BasicDBObject", "sort", ",", "String", "collectionName", ",", "int", "maxResult", ",", "int", "firstResult", ")", "{", "KunderaGridFS", "gfs", "=", "new", "KunderaGridFS", "(", "mongoDb", ",", "collectionName", ")", ";", "return", "gfs", ".", "find", "(", "mongoQuery", ",", "sort", ",", "firstResult", ",", "maxResult", ")", ";", "}" ]
Gets the GFSDB files. @param mongoQuery the mongo query @param sort the sort @param collectionName the collection name @param maxResult the max result @param firstResult the first result @return the GFSDB files
[ "Gets", "the", "GFSDB", "files", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java#L893-L898
Impetus/Kundera
src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/utils/HBaseUtils.java
HBaseUtils.fromBytes
public static Object fromBytes(EntityMetadata m, MetamodelImpl metaModel, byte[] b) { """ From bytes. @param m the m @param metaModel the meta model @param b the b @return the object """ Class idFieldClass = m.getIdAttribute().getJavaType(); if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType())) { return fromBytes(b, String.class); } return fromBytes(b, idFieldClass); }
java
public static Object fromBytes(EntityMetadata m, MetamodelImpl metaModel, byte[] b) { Class idFieldClass = m.getIdAttribute().getJavaType(); if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType())) { return fromBytes(b, String.class); } return fromBytes(b, idFieldClass); }
[ "public", "static", "Object", "fromBytes", "(", "EntityMetadata", "m", ",", "MetamodelImpl", "metaModel", ",", "byte", "[", "]", "b", ")", "{", "Class", "idFieldClass", "=", "m", ".", "getIdAttribute", "(", ")", ".", "getJavaType", "(", ")", ";", "if", "(", "metaModel", ".", "isEmbeddable", "(", "m", ".", "getIdAttribute", "(", ")", ".", "getBindableJavaType", "(", ")", ")", ")", "{", "return", "fromBytes", "(", "b", ",", "String", ".", "class", ")", ";", "}", "return", "fromBytes", "(", "b", ",", "idFieldClass", ")", ";", "}" ]
From bytes. @param m the m @param metaModel the meta model @param b the b @return the object
[ "From", "bytes", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/utils/HBaseUtils.java#L146-L154
nextreports/nextreports-engine
src/ro/nextreports/engine/util/DateUtil.java
DateUtil.addMonths
public static Date addMonths(Date d, int months) { """ Add months to a date @param d date @param months months @return new date """ Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.add(Calendar.MONTH, months); return cal.getTime(); }
java
public static Date addMonths(Date d, int months) { Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.add(Calendar.MONTH, months); return cal.getTime(); }
[ "public", "static", "Date", "addMonths", "(", "Date", "d", ",", "int", "months", ")", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "d", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "MONTH", ",", "months", ")", ";", "return", "cal", ".", "getTime", "(", ")", ";", "}" ]
Add months to a date @param d date @param months months @return new date
[ "Add", "months", "to", "a", "date" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L509-L514
super-csv/super-csv
super-csv/src/main/java/org/supercsv/cellprocessor/ParseBool.java
ParseBool.checkPreconditions
private static void checkPreconditions(final String[] trueValues, final String[] falseValues) { """ Checks the preconditions for constructing a new ParseBool processor. @param trueValues the array of Strings which represent true @param falseValues the array of Strings which represent false @throws IllegalArgumentException if trueValues or falseValues is empty @throws NullPointerException if trueValues or falseValues is null """ if( trueValues == null ) { throw new NullPointerException("trueValues should not be null"); } else if( trueValues.length == 0 ) { throw new IllegalArgumentException("trueValues should not be empty"); } if( falseValues == null ) { throw new NullPointerException("falseValues should not be null"); } else if( falseValues.length == 0 ) { throw new IllegalArgumentException("falseValues should not be empty"); } }
java
private static void checkPreconditions(final String[] trueValues, final String[] falseValues) { if( trueValues == null ) { throw new NullPointerException("trueValues should not be null"); } else if( trueValues.length == 0 ) { throw new IllegalArgumentException("trueValues should not be empty"); } if( falseValues == null ) { throw new NullPointerException("falseValues should not be null"); } else if( falseValues.length == 0 ) { throw new IllegalArgumentException("falseValues should not be empty"); } }
[ "private", "static", "void", "checkPreconditions", "(", "final", "String", "[", "]", "trueValues", ",", "final", "String", "[", "]", "falseValues", ")", "{", "if", "(", "trueValues", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"trueValues should not be null\"", ")", ";", "}", "else", "if", "(", "trueValues", ".", "length", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"trueValues should not be empty\"", ")", ";", "}", "if", "(", "falseValues", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"falseValues should not be null\"", ")", ";", "}", "else", "if", "(", "falseValues", ".", "length", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"falseValues should not be empty\"", ")", ";", "}", "}" ]
Checks the preconditions for constructing a new ParseBool processor. @param trueValues the array of Strings which represent true @param falseValues the array of Strings which represent false @throws IllegalArgumentException if trueValues or falseValues is empty @throws NullPointerException if trueValues or falseValues is null
[ "Checks", "the", "preconditions", "for", "constructing", "a", "new", "ParseBool", "processor", "." ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/ParseBool.java#L304-L318
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/data/model/ModelUtil.java
ModelUtil.getPrototype
public static NumberVector getPrototype(Model model, Relation<? extends NumberVector> relation) { """ Get the representative vector for a cluster model. <b>Only representative-based models are supported!</b> {@code null} is returned when the model is not supported! @param model Model @param relation Data relation (for representatives specified per DBID) @return Some {@link NumberVector}, {@code null} if not supported. """ // Mean model contains a numeric Vector if(model instanceof MeanModel) { return DoubleVector.wrap(((MeanModel) model).getMean()); } // Handle medoid models if(model instanceof MedoidModel) { return relation.get(((MedoidModel) model).getMedoid()); } if(model instanceof PrototypeModel) { Object p = ((PrototypeModel<?>) model).getPrototype(); if(p instanceof NumberVector) { return (NumberVector) p; } return null; // Inconvertible } return null; }
java
public static NumberVector getPrototype(Model model, Relation<? extends NumberVector> relation) { // Mean model contains a numeric Vector if(model instanceof MeanModel) { return DoubleVector.wrap(((MeanModel) model).getMean()); } // Handle medoid models if(model instanceof MedoidModel) { return relation.get(((MedoidModel) model).getMedoid()); } if(model instanceof PrototypeModel) { Object p = ((PrototypeModel<?>) model).getPrototype(); if(p instanceof NumberVector) { return (NumberVector) p; } return null; // Inconvertible } return null; }
[ "public", "static", "NumberVector", "getPrototype", "(", "Model", "model", ",", "Relation", "<", "?", "extends", "NumberVector", ">", "relation", ")", "{", "// Mean model contains a numeric Vector", "if", "(", "model", "instanceof", "MeanModel", ")", "{", "return", "DoubleVector", ".", "wrap", "(", "(", "(", "MeanModel", ")", "model", ")", ".", "getMean", "(", ")", ")", ";", "}", "// Handle medoid models", "if", "(", "model", "instanceof", "MedoidModel", ")", "{", "return", "relation", ".", "get", "(", "(", "(", "MedoidModel", ")", "model", ")", ".", "getMedoid", "(", ")", ")", ";", "}", "if", "(", "model", "instanceof", "PrototypeModel", ")", "{", "Object", "p", "=", "(", "(", "PrototypeModel", "<", "?", ">", ")", "model", ")", ".", "getPrototype", "(", ")", ";", "if", "(", "p", "instanceof", "NumberVector", ")", "{", "return", "(", "NumberVector", ")", "p", ";", "}", "return", "null", ";", "// Inconvertible", "}", "return", "null", ";", "}" ]
Get the representative vector for a cluster model. <b>Only representative-based models are supported!</b> {@code null} is returned when the model is not supported! @param model Model @param relation Data relation (for representatives specified per DBID) @return Some {@link NumberVector}, {@code null} if not supported.
[ "Get", "the", "representative", "vector", "for", "a", "cluster", "model", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/data/model/ModelUtil.java#L99-L116
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java
CommonOps_ZDRM.multTransA
public static void multTransA(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { """ <p>Performs the following operation:<br> <br> c = a<sup>H</sup> * b <br> <br> c<sub>ij</sub> = &sum;<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>kj</sub>} </p> @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified. """ if( a.numCols >= EjmlParameters.CMULT_COLUMN_SWITCH || b.numCols >= EjmlParameters.CMULT_COLUMN_SWITCH ) { MatrixMatrixMult_ZDRM.multTransA_reorder(a, b, c); } else { MatrixMatrixMult_ZDRM.multTransA_small(a, b, c); } }
java
public static void multTransA(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { if( a.numCols >= EjmlParameters.CMULT_COLUMN_SWITCH || b.numCols >= EjmlParameters.CMULT_COLUMN_SWITCH ) { MatrixMatrixMult_ZDRM.multTransA_reorder(a, b, c); } else { MatrixMatrixMult_ZDRM.multTransA_small(a, b, c); } }
[ "public", "static", "void", "multTransA", "(", "ZMatrixRMaj", "a", ",", "ZMatrixRMaj", "b", ",", "ZMatrixRMaj", "c", ")", "{", "if", "(", "a", ".", "numCols", ">=", "EjmlParameters", ".", "CMULT_COLUMN_SWITCH", "||", "b", ".", "numCols", ">=", "EjmlParameters", ".", "CMULT_COLUMN_SWITCH", ")", "{", "MatrixMatrixMult_ZDRM", ".", "multTransA_reorder", "(", "a", ",", "b", ",", "c", ")", ";", "}", "else", "{", "MatrixMatrixMult_ZDRM", ".", "multTransA_small", "(", "a", ",", "b", ",", "c", ")", ";", "}", "}" ]
<p>Performs the following operation:<br> <br> c = a<sup>H</sup> * b <br> <br> c<sub>ij</sub> = &sum;<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>kj</sub>} </p> @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "a<sup", ">", "H<", "/", "sup", ">", "*", "b", "<br", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "&sum", ";", "<sub", ">", "k", "=", "1", ":", "n<", "/", "sub", ">", "{", "a<sub", ">", "ki<", "/", "sub", ">", "*", "b<sub", ">", "kj<", "/", "sub", ">", "}", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L454-L462
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java
AbstractCreator.methodCallParametersCode
private CodeBlock methodCallParametersCode( CodeBlock.Builder builder, List<CodeBlock> parameters ) { """ Build the code for the parameters of a method call. @param builder the code builder @param parameters the parameters @return the code """ if ( parameters.isEmpty() ) { return builder.add( "()" ).build(); } builder.add( "(" ); Iterator<CodeBlock> iterator = parameters.iterator(); builder.add( iterator.next() ); while ( iterator.hasNext() ) { builder.add( ", " ); builder.add( iterator.next() ); } builder.add( ")" ); return builder.build(); }
java
private CodeBlock methodCallParametersCode( CodeBlock.Builder builder, List<CodeBlock> parameters ) { if ( parameters.isEmpty() ) { return builder.add( "()" ).build(); } builder.add( "(" ); Iterator<CodeBlock> iterator = parameters.iterator(); builder.add( iterator.next() ); while ( iterator.hasNext() ) { builder.add( ", " ); builder.add( iterator.next() ); } builder.add( ")" ); return builder.build(); }
[ "private", "CodeBlock", "methodCallParametersCode", "(", "CodeBlock", ".", "Builder", "builder", ",", "List", "<", "CodeBlock", ">", "parameters", ")", "{", "if", "(", "parameters", ".", "isEmpty", "(", ")", ")", "{", "return", "builder", ".", "add", "(", "\"()\"", ")", ".", "build", "(", ")", ";", "}", "builder", ".", "add", "(", "\"(\"", ")", ";", "Iterator", "<", "CodeBlock", ">", "iterator", "=", "parameters", ".", "iterator", "(", ")", ";", "builder", ".", "add", "(", "iterator", ".", "next", "(", ")", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "builder", ".", "add", "(", "\", \"", ")", ";", "builder", ".", "add", "(", "iterator", ".", "next", "(", ")", ")", ";", "}", "builder", ".", "add", "(", "\")\"", ")", ";", "return", "builder", ".", "build", "(", ")", ";", "}" ]
Build the code for the parameters of a method call. @param builder the code builder @param parameters the parameters @return the code
[ "Build", "the", "code", "for", "the", "parameters", "of", "a", "method", "call", "." ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java#L969-L986
jfrog/artifactory-client-java
httpClient/src/main/java/org/jfrog/artifactory/client/httpClient/http/HttpBuilderBase.java
HttpBuilderBase.createConnectionMgr
private PoolingHttpClientConnectionManager createConnectionMgr() { """ Creates custom Http Client connection pool to be used by Http Client @return {@link PoolingHttpClientConnectionManager} """ PoolingHttpClientConnectionManager connectionMgr; // prepare SSLContext SSLContext sslContext = buildSslContext(); ConnectionSocketFactory plainsf = PlainConnectionSocketFactory.getSocketFactory(); // we allow to disable host name verification against CA certificate, // notice: in general this is insecure and should be avoided in production, // (this type of configuration is useful for development purposes) boolean noHostVerification = false; LayeredConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( sslContext, noHostVerification ? NoopHostnameVerifier.INSTANCE : new DefaultHostnameVerifier() ); Registry<ConnectionSocketFactory> r = RegistryBuilder.<ConnectionSocketFactory>create() .register("http", plainsf) .register("https", sslsf) .build(); connectionMgr = new PoolingHttpClientConnectionManager(r, null, null, null, connectionPoolTimeToLive, TimeUnit.SECONDS); connectionMgr.setMaxTotal(maxConnectionsTotal); connectionMgr.setDefaultMaxPerRoute(maxConnectionsPerRoute); HttpHost localhost = new HttpHost("localhost", 80); connectionMgr.setMaxPerRoute(new HttpRoute(localhost), maxConnectionsPerRoute); return connectionMgr; }
java
private PoolingHttpClientConnectionManager createConnectionMgr() { PoolingHttpClientConnectionManager connectionMgr; // prepare SSLContext SSLContext sslContext = buildSslContext(); ConnectionSocketFactory plainsf = PlainConnectionSocketFactory.getSocketFactory(); // we allow to disable host name verification against CA certificate, // notice: in general this is insecure and should be avoided in production, // (this type of configuration is useful for development purposes) boolean noHostVerification = false; LayeredConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( sslContext, noHostVerification ? NoopHostnameVerifier.INSTANCE : new DefaultHostnameVerifier() ); Registry<ConnectionSocketFactory> r = RegistryBuilder.<ConnectionSocketFactory>create() .register("http", plainsf) .register("https", sslsf) .build(); connectionMgr = new PoolingHttpClientConnectionManager(r, null, null, null, connectionPoolTimeToLive, TimeUnit.SECONDS); connectionMgr.setMaxTotal(maxConnectionsTotal); connectionMgr.setDefaultMaxPerRoute(maxConnectionsPerRoute); HttpHost localhost = new HttpHost("localhost", 80); connectionMgr.setMaxPerRoute(new HttpRoute(localhost), maxConnectionsPerRoute); return connectionMgr; }
[ "private", "PoolingHttpClientConnectionManager", "createConnectionMgr", "(", ")", "{", "PoolingHttpClientConnectionManager", "connectionMgr", ";", "// prepare SSLContext", "SSLContext", "sslContext", "=", "buildSslContext", "(", ")", ";", "ConnectionSocketFactory", "plainsf", "=", "PlainConnectionSocketFactory", ".", "getSocketFactory", "(", ")", ";", "// we allow to disable host name verification against CA certificate,", "// notice: in general this is insecure and should be avoided in production,", "// (this type of configuration is useful for development purposes)", "boolean", "noHostVerification", "=", "false", ";", "LayeredConnectionSocketFactory", "sslsf", "=", "new", "SSLConnectionSocketFactory", "(", "sslContext", ",", "noHostVerification", "?", "NoopHostnameVerifier", ".", "INSTANCE", ":", "new", "DefaultHostnameVerifier", "(", ")", ")", ";", "Registry", "<", "ConnectionSocketFactory", ">", "r", "=", "RegistryBuilder", ".", "<", "ConnectionSocketFactory", ">", "create", "(", ")", ".", "register", "(", "\"http\"", ",", "plainsf", ")", ".", "register", "(", "\"https\"", ",", "sslsf", ")", ".", "build", "(", ")", ";", "connectionMgr", "=", "new", "PoolingHttpClientConnectionManager", "(", "r", ",", "null", ",", "null", ",", "null", ",", "connectionPoolTimeToLive", ",", "TimeUnit", ".", "SECONDS", ")", ";", "connectionMgr", ".", "setMaxTotal", "(", "maxConnectionsTotal", ")", ";", "connectionMgr", ".", "setDefaultMaxPerRoute", "(", "maxConnectionsPerRoute", ")", ";", "HttpHost", "localhost", "=", "new", "HttpHost", "(", "\"localhost\"", ",", "80", ")", ";", "connectionMgr", ".", "setMaxPerRoute", "(", "new", "HttpRoute", "(", "localhost", ")", ",", "maxConnectionsPerRoute", ")", ";", "return", "connectionMgr", ";", "}" ]
Creates custom Http Client connection pool to be used by Http Client @return {@link PoolingHttpClientConnectionManager}
[ "Creates", "custom", "Http", "Client", "connection", "pool", "to", "be", "used", "by", "Http", "Client" ]
train
https://github.com/jfrog/artifactory-client-java/blob/e7443f4ffa8bf7d3b161f9cdc59bfc3036e9b46e/httpClient/src/main/java/org/jfrog/artifactory/client/httpClient/http/HttpBuilderBase.java#L269-L295
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/backpressure/StackTraceSampleCoordinator.java
StackTraceSampleCoordinator.cancelStackTraceSample
public void cancelStackTraceSample(int sampleId, Throwable cause) { """ Cancels a pending sample. @param sampleId ID of the sample to cancel. @param cause Cause of the cancelling (can be <code>null</code>). """ synchronized (lock) { if (isShutDown) { return; } PendingStackTraceSample sample = pendingSamples.remove(sampleId); if (sample != null) { if (cause != null) { LOG.info("Cancelling sample " + sampleId, cause); } else { LOG.info("Cancelling sample {}", sampleId); } sample.discard(cause); rememberRecentSampleId(sampleId); } } }
java
public void cancelStackTraceSample(int sampleId, Throwable cause) { synchronized (lock) { if (isShutDown) { return; } PendingStackTraceSample sample = pendingSamples.remove(sampleId); if (sample != null) { if (cause != null) { LOG.info("Cancelling sample " + sampleId, cause); } else { LOG.info("Cancelling sample {}", sampleId); } sample.discard(cause); rememberRecentSampleId(sampleId); } } }
[ "public", "void", "cancelStackTraceSample", "(", "int", "sampleId", ",", "Throwable", "cause", ")", "{", "synchronized", "(", "lock", ")", "{", "if", "(", "isShutDown", ")", "{", "return", ";", "}", "PendingStackTraceSample", "sample", "=", "pendingSamples", ".", "remove", "(", "sampleId", ")", ";", "if", "(", "sample", "!=", "null", ")", "{", "if", "(", "cause", "!=", "null", ")", "{", "LOG", ".", "info", "(", "\"Cancelling sample \"", "+", "sampleId", ",", "cause", ")", ";", "}", "else", "{", "LOG", ".", "info", "(", "\"Cancelling sample {}\"", ",", "sampleId", ")", ";", "}", "sample", ".", "discard", "(", "cause", ")", ";", "rememberRecentSampleId", "(", "sampleId", ")", ";", "}", "}", "}" ]
Cancels a pending sample. @param sampleId ID of the sample to cancel. @param cause Cause of the cancelling (can be <code>null</code>).
[ "Cancels", "a", "pending", "sample", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/backpressure/StackTraceSampleCoordinator.java#L192-L210
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java
PersistenceController.updateStoreWithNewMessage
public Observable<Boolean> updateStoreWithNewMessage(final ChatMessage message, final ChatController.NoConversationListener noConversationListener) { """ Deletes temporary message and inserts provided one. If no associated conversation exists will trigger GET from server. @param message Message to save. @param noConversationListener Listener for the chat controller to get conversation if no local copy is present. @return Observable emitting result. """ return asObservable(new Executor<Boolean>() { @Override protected void execute(ChatStore store, Emitter<Boolean> emitter) { boolean isSuccessful = true; store.beginTransaction(); ChatConversationBase conversation = store.getConversation(message.getConversationId()); String tempId = (String) (message.getMetadata() != null ? message.getMetadata().get(MESSAGE_METADATA_TEMP_ID) : null); if (!TextUtils.isEmpty(tempId)) { store.deleteMessage(message.getConversationId(), tempId); } if (message.getSentEventId() == null) { message.setSentEventId(-1L); } if (message.getSentEventId() == -1L) { if (conversation != null && conversation.getLastLocalEventId() != -1L) { message.setSentEventId(conversation.getLastLocalEventId() + 1); } message.addStatusUpdate(ChatMessageStatus.builder().populate(message.getConversationId(), message.getMessageId(), message.getFromWhom().getId(), LocalMessageStatus.sent, System.currentTimeMillis(), null).build()); isSuccessful = store.upsert(message); } else { isSuccessful = store.upsert(message); } if (!doUpdateConversationFromEvent(store, message.getConversationId(), message.getSentEventId(), message.getSentOn()) && noConversationListener != null) { noConversationListener.getConversation(message.getConversationId()); } store.endTransaction(); emitter.onNext(isSuccessful); emitter.onCompleted(); } }); }
java
public Observable<Boolean> updateStoreWithNewMessage(final ChatMessage message, final ChatController.NoConversationListener noConversationListener) { return asObservable(new Executor<Boolean>() { @Override protected void execute(ChatStore store, Emitter<Boolean> emitter) { boolean isSuccessful = true; store.beginTransaction(); ChatConversationBase conversation = store.getConversation(message.getConversationId()); String tempId = (String) (message.getMetadata() != null ? message.getMetadata().get(MESSAGE_METADATA_TEMP_ID) : null); if (!TextUtils.isEmpty(tempId)) { store.deleteMessage(message.getConversationId(), tempId); } if (message.getSentEventId() == null) { message.setSentEventId(-1L); } if (message.getSentEventId() == -1L) { if (conversation != null && conversation.getLastLocalEventId() != -1L) { message.setSentEventId(conversation.getLastLocalEventId() + 1); } message.addStatusUpdate(ChatMessageStatus.builder().populate(message.getConversationId(), message.getMessageId(), message.getFromWhom().getId(), LocalMessageStatus.sent, System.currentTimeMillis(), null).build()); isSuccessful = store.upsert(message); } else { isSuccessful = store.upsert(message); } if (!doUpdateConversationFromEvent(store, message.getConversationId(), message.getSentEventId(), message.getSentOn()) && noConversationListener != null) { noConversationListener.getConversation(message.getConversationId()); } store.endTransaction(); emitter.onNext(isSuccessful); emitter.onCompleted(); } }); }
[ "public", "Observable", "<", "Boolean", ">", "updateStoreWithNewMessage", "(", "final", "ChatMessage", "message", ",", "final", "ChatController", ".", "NoConversationListener", "noConversationListener", ")", "{", "return", "asObservable", "(", "new", "Executor", "<", "Boolean", ">", "(", ")", "{", "@", "Override", "protected", "void", "execute", "(", "ChatStore", "store", ",", "Emitter", "<", "Boolean", ">", "emitter", ")", "{", "boolean", "isSuccessful", "=", "true", ";", "store", ".", "beginTransaction", "(", ")", ";", "ChatConversationBase", "conversation", "=", "store", ".", "getConversation", "(", "message", ".", "getConversationId", "(", ")", ")", ";", "String", "tempId", "=", "(", "String", ")", "(", "message", ".", "getMetadata", "(", ")", "!=", "null", "?", "message", ".", "getMetadata", "(", ")", ".", "get", "(", "MESSAGE_METADATA_TEMP_ID", ")", ":", "null", ")", ";", "if", "(", "!", "TextUtils", ".", "isEmpty", "(", "tempId", ")", ")", "{", "store", ".", "deleteMessage", "(", "message", ".", "getConversationId", "(", ")", ",", "tempId", ")", ";", "}", "if", "(", "message", ".", "getSentEventId", "(", ")", "==", "null", ")", "{", "message", ".", "setSentEventId", "(", "-", "1L", ")", ";", "}", "if", "(", "message", ".", "getSentEventId", "(", ")", "==", "-", "1L", ")", "{", "if", "(", "conversation", "!=", "null", "&&", "conversation", ".", "getLastLocalEventId", "(", ")", "!=", "-", "1L", ")", "{", "message", ".", "setSentEventId", "(", "conversation", ".", "getLastLocalEventId", "(", ")", "+", "1", ")", ";", "}", "message", ".", "addStatusUpdate", "(", "ChatMessageStatus", ".", "builder", "(", ")", ".", "populate", "(", "message", ".", "getConversationId", "(", ")", ",", "message", ".", "getMessageId", "(", ")", ",", "message", ".", "getFromWhom", "(", ")", ".", "getId", "(", ")", ",", "LocalMessageStatus", ".", "sent", ",", "System", ".", "currentTimeMillis", "(", ")", ",", "null", ")", ".", "build", "(", ")", ")", ";", "isSuccessful", "=", "store", ".", "upsert", "(", "message", ")", ";", "}", "else", "{", "isSuccessful", "=", "store", ".", "upsert", "(", "message", ")", ";", "}", "if", "(", "!", "doUpdateConversationFromEvent", "(", "store", ",", "message", ".", "getConversationId", "(", ")", ",", "message", ".", "getSentEventId", "(", ")", ",", "message", ".", "getSentOn", "(", ")", ")", "&&", "noConversationListener", "!=", "null", ")", "{", "noConversationListener", ".", "getConversation", "(", "message", ".", "getConversationId", "(", ")", ")", ";", "}", "store", ".", "endTransaction", "(", ")", ";", "emitter", ".", "onNext", "(", "isSuccessful", ")", ";", "emitter", ".", "onCompleted", "(", ")", ";", "}", "}", ")", ";", "}" ]
Deletes temporary message and inserts provided one. If no associated conversation exists will trigger GET from server. @param message Message to save. @param noConversationListener Listener for the chat controller to get conversation if no local copy is present. @return Observable emitting result.
[ "Deletes", "temporary", "message", "and", "inserts", "provided", "one", ".", "If", "no", "associated", "conversation", "exists", "will", "trigger", "GET", "from", "server", "." ]
train
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java#L254-L295
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/sort/linearlogarithmic/Quicksort.java
Quicksort.partition
private static <E extends Comparable<E>> int partition(List<E> list, int start, int end) { """ Routine that arranges the elements in ascending order around a pivot. This routine runs in O(n) time. @param <E> the type of elements in this list. @param list array that we want to sort @param start index of the starting point to sort @param end index of the end point to sort @return an integer that represent the index of the pivot """ E pivot = list.get(end); int index = start - 1; for(int j = start; j < end; j++) { if(list.get(j).compareTo(pivot) <= 0) { index++; TrivialSwap.swap(list, index, j); } } TrivialSwap.swap(list, index + 1, end); return index + 1; }
java
private static <E extends Comparable<E>> int partition(List<E> list, int start, int end) { E pivot = list.get(end); int index = start - 1; for(int j = start; j < end; j++) { if(list.get(j).compareTo(pivot) <= 0) { index++; TrivialSwap.swap(list, index, j); } } TrivialSwap.swap(list, index + 1, end); return index + 1; }
[ "private", "static", "<", "E", "extends", "Comparable", "<", "E", ">", ">", "int", "partition", "(", "List", "<", "E", ">", "list", ",", "int", "start", ",", "int", "end", ")", "{", "E", "pivot", "=", "list", ".", "get", "(", "end", ")", ";", "int", "index", "=", "start", "-", "1", ";", "for", "(", "int", "j", "=", "start", ";", "j", "<", "end", ";", "j", "++", ")", "{", "if", "(", "list", ".", "get", "(", "j", ")", ".", "compareTo", "(", "pivot", ")", "<=", "0", ")", "{", "index", "++", ";", "TrivialSwap", ".", "swap", "(", "list", ",", "index", ",", "j", ")", ";", "}", "}", "TrivialSwap", ".", "swap", "(", "list", ",", "index", "+", "1", ",", "end", ")", ";", "return", "index", "+", "1", ";", "}" ]
Routine that arranges the elements in ascending order around a pivot. This routine runs in O(n) time. @param <E> the type of elements in this list. @param list array that we want to sort @param start index of the starting point to sort @param end index of the end point to sort @return an integer that represent the index of the pivot
[ "Routine", "that", "arranges", "the", "elements", "in", "ascending", "order", "around", "a", "pivot", ".", "This", "routine", "runs", "in", "O", "(", "n", ")", "time", "." ]
train
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/linearlogarithmic/Quicksort.java#L898-L912
wildfly/wildfly-core
jmx/src/main/java/org/jboss/as/jmx/model/ObjectNameAddressUtil.java
ObjectNameAddressUtil.resolvePathAddress
static PathAddress resolvePathAddress(final String domain, final Resource rootResource, final ObjectName name) { """ Converts the ObjectName to a PathAddress. @param domain the name of the caller's JMX domain @param rootResource the root resource for the management model @param name the ObjectName @return the PathAddress if it exists in the model, {@code null} otherwise """ return resolvePathAddress(ModelControllerMBeanHelper.createRootObjectName(domain), rootResource, name); }
java
static PathAddress resolvePathAddress(final String domain, final Resource rootResource, final ObjectName name) { return resolvePathAddress(ModelControllerMBeanHelper.createRootObjectName(domain), rootResource, name); }
[ "static", "PathAddress", "resolvePathAddress", "(", "final", "String", "domain", ",", "final", "Resource", "rootResource", ",", "final", "ObjectName", "name", ")", "{", "return", "resolvePathAddress", "(", "ModelControllerMBeanHelper", ".", "createRootObjectName", "(", "domain", ")", ",", "rootResource", ",", "name", ")", ";", "}" ]
Converts the ObjectName to a PathAddress. @param domain the name of the caller's JMX domain @param rootResource the root resource for the management model @param name the ObjectName @return the PathAddress if it exists in the model, {@code null} otherwise
[ "Converts", "the", "ObjectName", "to", "a", "PathAddress", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/jmx/src/main/java/org/jboss/as/jmx/model/ObjectNameAddressUtil.java#L180-L182
craterdog/java-security-framework
java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java
CertificateManager.createPkcs12KeyStore
public final KeyStore createPkcs12KeyStore(String keyName, char[] password, PrivateKey privateKey, List<X509Certificate> certificates) { """ This method creates a new PKCS12 format key store containing a named private key and public certificate chain. @param keyName The name of the private key and public certificate. @param password The password used to encrypt the private key. @param privateKey The private key. @param certificates The chain of X509 format public certificates. @return The new PKCS12 format key store. """ try { logger.entry(); X509Certificate[] chain = new X509Certificate[certificates.size()]; chain = certificates.toArray(chain); KeyStore keyStore = KeyStore.getInstance(KEY_STORE_FORMAT); keyStore.load(null, null); keyStore.setKeyEntry(keyName, privateKey, password, chain); logger.exit(); return keyStore; } catch (IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to create a new keystore.", e); logger.error(exception.toString()); throw exception; } }
java
public final KeyStore createPkcs12KeyStore(String keyName, char[] password, PrivateKey privateKey, List<X509Certificate> certificates) { try { logger.entry(); X509Certificate[] chain = new X509Certificate[certificates.size()]; chain = certificates.toArray(chain); KeyStore keyStore = KeyStore.getInstance(KEY_STORE_FORMAT); keyStore.load(null, null); keyStore.setKeyEntry(keyName, privateKey, password, chain); logger.exit(); return keyStore; } catch (IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to create a new keystore.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "final", "KeyStore", "createPkcs12KeyStore", "(", "String", "keyName", ",", "char", "[", "]", "password", ",", "PrivateKey", "privateKey", ",", "List", "<", "X509Certificate", ">", "certificates", ")", "{", "try", "{", "logger", ".", "entry", "(", ")", ";", "X509Certificate", "[", "]", "chain", "=", "new", "X509Certificate", "[", "certificates", ".", "size", "(", ")", "]", ";", "chain", "=", "certificates", ".", "toArray", "(", "chain", ")", ";", "KeyStore", "keyStore", "=", "KeyStore", ".", "getInstance", "(", "KEY_STORE_FORMAT", ")", ";", "keyStore", ".", "load", "(", "null", ",", "null", ")", ";", "keyStore", ".", "setKeyEntry", "(", "keyName", ",", "privateKey", ",", "password", ",", "chain", ")", ";", "logger", ".", "exit", "(", ")", ";", "return", "keyStore", ";", "}", "catch", "(", "IOException", "|", "KeyStoreException", "|", "NoSuchAlgorithmException", "|", "CertificateException", "e", ")", "{", "RuntimeException", "exception", "=", "new", "RuntimeException", "(", "\"An unexpected exception occurred while attempting to create a new keystore.\"", ",", "e", ")", ";", "logger", ".", "error", "(", "exception", ".", "toString", "(", ")", ")", ";", "throw", "exception", ";", "}", "}" ]
This method creates a new PKCS12 format key store containing a named private key and public certificate chain. @param keyName The name of the private key and public certificate. @param password The password used to encrypt the private key. @param privateKey The private key. @param certificates The chain of X509 format public certificates. @return The new PKCS12 format key store.
[ "This", "method", "creates", "a", "new", "PKCS12", "format", "key", "store", "containing", "a", "named", "private", "key", "and", "public", "certificate", "chain", "." ]
train
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java#L180-L195
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.getPermissions
public CmsPermissionSetCustom getPermissions(CmsRequestContext context, CmsResource resource, CmsUser user) throws CmsException { """ Returns the set of permissions of the current user for a given resource.<p> @param context the current request context @param resource the resource @param user the user @return bit set with allowed permissions @throws CmsException if something goes wrong """ CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsPermissionSetCustom result = null; try { result = m_driverManager.getPermissions(dbc, resource, user); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_GET_PERMISSIONS_2, user.getName(), context.getSitePath(resource)), e); } finally { dbc.clear(); } return result; }
java
public CmsPermissionSetCustom getPermissions(CmsRequestContext context, CmsResource resource, CmsUser user) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsPermissionSetCustom result = null; try { result = m_driverManager.getPermissions(dbc, resource, user); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_GET_PERMISSIONS_2, user.getName(), context.getSitePath(resource)), e); } finally { dbc.clear(); } return result; }
[ "public", "CmsPermissionSetCustom", "getPermissions", "(", "CmsRequestContext", "context", ",", "CmsResource", "resource", ",", "CmsUser", "user", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "CmsPermissionSetCustom", "result", "=", "null", ";", "try", "{", "result", "=", "m_driverManager", ".", "getPermissions", "(", "dbc", ",", "resource", ",", "user", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "dbc", ".", "report", "(", "null", ",", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_GET_PERMISSIONS_2", ",", "user", ".", "getName", "(", ")", ",", "context", ".", "getSitePath", "(", "resource", ")", ")", ",", "e", ")", ";", "}", "finally", "{", "dbc", ".", "clear", "(", ")", ";", "}", "return", "result", ";", "}" ]
Returns the set of permissions of the current user for a given resource.<p> @param context the current request context @param resource the resource @param user the user @return bit set with allowed permissions @throws CmsException if something goes wrong
[ "Returns", "the", "set", "of", "permissions", "of", "the", "current", "user", "for", "a", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L2519-L2535
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableIOSupport.java
CASableIOSupport.getFile
public File getFile(String hash) { """ Construct file name of given hash. @param hash String - digester hash """ // work with digest return new File(channel.rootDir, channel.makeFilePath(hash, 0)); }
java
public File getFile(String hash) { // work with digest return new File(channel.rootDir, channel.makeFilePath(hash, 0)); }
[ "public", "File", "getFile", "(", "String", "hash", ")", "{", "// work with digest\r", "return", "new", "File", "(", "channel", ".", "rootDir", ",", "channel", ".", "makeFilePath", "(", "hash", ",", "0", ")", ")", ";", "}" ]
Construct file name of given hash. @param hash String - digester hash
[ "Construct", "file", "name", "of", "given", "hash", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableIOSupport.java#L88-L92
strator-dev/greenpepper-open
extensions-external/fit/src/main/java/com/greenpepper/extensions/fit/Fit.java
Fit.isATimedActionFitInterpreter
public static boolean isATimedActionFitInterpreter(SystemUnderDevelopment sud, String name) { """ <p>isATimedActionFitInterpreter.</p> @param sud a {@link com.greenpepper.systemunderdevelopment.SystemUnderDevelopment} object. @param name a {@link java.lang.String} object. @return a boolean. """ try { Object target = sud.getFixture(name).getTarget(); if (target instanceof TimedActionFixture) return true; } catch (Throwable t) { } return false; }
java
public static boolean isATimedActionFitInterpreter(SystemUnderDevelopment sud, String name) { try { Object target = sud.getFixture(name).getTarget(); if (target instanceof TimedActionFixture) return true; } catch (Throwable t) { } return false; }
[ "public", "static", "boolean", "isATimedActionFitInterpreter", "(", "SystemUnderDevelopment", "sud", ",", "String", "name", ")", "{", "try", "{", "Object", "target", "=", "sud", ".", "getFixture", "(", "name", ")", ".", "getTarget", "(", ")", ";", "if", "(", "target", "instanceof", "TimedActionFixture", ")", "return", "true", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "}", "return", "false", ";", "}" ]
<p>isATimedActionFitInterpreter.</p> @param sud a {@link com.greenpepper.systemunderdevelopment.SystemUnderDevelopment} object. @param name a {@link java.lang.String} object. @return a boolean.
[ "<p", ">", "isATimedActionFitInterpreter", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper-open/blob/71fd244b4989e9cd2d07ae62dd954a1f2a269a92/extensions-external/fit/src/main/java/com/greenpepper/extensions/fit/Fit.java#L29-L42
restfb/restfb
src/main/java/com/restfb/util/ReflectionUtils.java
ReflectionUtils.findMethodsWithAnnotation
public static <T extends Annotation> List<Method> findMethodsWithAnnotation(Class<?> type, Class<T> annotationType) { """ Finds methods on the given {@code type} and all of its superclasses annotated with annotations of type {@code annotationType}. <p> These results are cached to mitigate performance overhead. @param <T> The annotation type. @param type The target type token. @param annotationType The annotation type token. @return A list of methods with the given annotation. @since 1.6.11 """ ClassAnnotationCacheKey cacheKey = new ClassAnnotationCacheKey(type, annotationType); List<Method> cachedResults = METHODS_WITH_ANNOTATION_CACHE.get(cacheKey); if (cachedResults != null) { return cachedResults; } List<Method> methodsWithAnnotation = new ArrayList<>(); // Walk all superclasses looking for annotated methods until we hit Object while (!Object.class.equals(type)) { for (Method method : type.getDeclaredMethods()) { T annotation = method.getAnnotation(annotationType); if (annotation != null) { methodsWithAnnotation.add(method); } } type = type.getSuperclass(); } methodsWithAnnotation = unmodifiableList(methodsWithAnnotation); METHODS_WITH_ANNOTATION_CACHE.put(cacheKey, methodsWithAnnotation); return methodsWithAnnotation; }
java
public static <T extends Annotation> List<Method> findMethodsWithAnnotation(Class<?> type, Class<T> annotationType) { ClassAnnotationCacheKey cacheKey = new ClassAnnotationCacheKey(type, annotationType); List<Method> cachedResults = METHODS_WITH_ANNOTATION_CACHE.get(cacheKey); if (cachedResults != null) { return cachedResults; } List<Method> methodsWithAnnotation = new ArrayList<>(); // Walk all superclasses looking for annotated methods until we hit Object while (!Object.class.equals(type)) { for (Method method : type.getDeclaredMethods()) { T annotation = method.getAnnotation(annotationType); if (annotation != null) { methodsWithAnnotation.add(method); } } type = type.getSuperclass(); } methodsWithAnnotation = unmodifiableList(methodsWithAnnotation); METHODS_WITH_ANNOTATION_CACHE.put(cacheKey, methodsWithAnnotation); return methodsWithAnnotation; }
[ "public", "static", "<", "T", "extends", "Annotation", ">", "List", "<", "Method", ">", "findMethodsWithAnnotation", "(", "Class", "<", "?", ">", "type", ",", "Class", "<", "T", ">", "annotationType", ")", "{", "ClassAnnotationCacheKey", "cacheKey", "=", "new", "ClassAnnotationCacheKey", "(", "type", ",", "annotationType", ")", ";", "List", "<", "Method", ">", "cachedResults", "=", "METHODS_WITH_ANNOTATION_CACHE", ".", "get", "(", "cacheKey", ")", ";", "if", "(", "cachedResults", "!=", "null", ")", "{", "return", "cachedResults", ";", "}", "List", "<", "Method", ">", "methodsWithAnnotation", "=", "new", "ArrayList", "<>", "(", ")", ";", "// Walk all superclasses looking for annotated methods until we hit Object", "while", "(", "!", "Object", ".", "class", ".", "equals", "(", "type", ")", ")", "{", "for", "(", "Method", "method", ":", "type", ".", "getDeclaredMethods", "(", ")", ")", "{", "T", "annotation", "=", "method", ".", "getAnnotation", "(", "annotationType", ")", ";", "if", "(", "annotation", "!=", "null", ")", "{", "methodsWithAnnotation", ".", "add", "(", "method", ")", ";", "}", "}", "type", "=", "type", ".", "getSuperclass", "(", ")", ";", "}", "methodsWithAnnotation", "=", "unmodifiableList", "(", "methodsWithAnnotation", ")", ";", "METHODS_WITH_ANNOTATION_CACHE", ".", "put", "(", "cacheKey", ",", "methodsWithAnnotation", ")", ";", "return", "methodsWithAnnotation", ";", "}" ]
Finds methods on the given {@code type} and all of its superclasses annotated with annotations of type {@code annotationType}. <p> These results are cached to mitigate performance overhead. @param <T> The annotation type. @param type The target type token. @param annotationType The annotation type token. @return A list of methods with the given annotation. @since 1.6.11
[ "Finds", "methods", "on", "the", "given", "{", "@code", "type", "}", "and", "all", "of", "its", "superclasses", "annotated", "with", "annotations", "of", "type", "{", "@code", "annotationType", "}", ".", "<p", ">", "These", "results", "are", "cached", "to", "mitigate", "performance", "overhead", "." ]
train
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/ReflectionUtils.java#L143-L169
vlingo/vlingo-actors
src/main/java/io/vlingo/actors/World.java
World.start
public static World start(final String name) { """ Answers a new {@code World} with the given {@code name} and that is configured with the contents of the {@code vlingo-actors.properties} file. @param name the {@code String} name to assign to the new {@code World} instance @return {@code World} """ return start(name, io.vlingo.actors.Properties.properties); }
java
public static World start(final String name) { return start(name, io.vlingo.actors.Properties.properties); }
[ "public", "static", "World", "start", "(", "final", "String", "name", ")", "{", "return", "start", "(", "name", ",", "io", ".", "vlingo", ".", "actors", ".", "Properties", ".", "properties", ")", ";", "}" ]
Answers a new {@code World} with the given {@code name} and that is configured with the contents of the {@code vlingo-actors.properties} file. @param name the {@code String} name to assign to the new {@code World} instance @return {@code World}
[ "Answers", "a", "new", "{" ]
train
https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/World.java#L56-L58
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/config/ProjectFilterSettings.java
ProjectFilterSettings.hiddenFromEncodedString
public static void hiddenFromEncodedString(ProjectFilterSettings result, String s) { """ set the hidden bug categories on the specifed ProjectFilterSettings from an encoded string @param result the ProjectFilterSettings from which to remove bug categories @param s the encoded string @see ProjectFilterSettings#hiddenFromEncodedString(ProjectFilterSettings, String) """ if (s.length() > 0) { int bar = s.indexOf(FIELD_DELIMITER); String categories; if (bar >= 0) { categories = s.substring(0, bar); } else { categories = s; } StringTokenizer t = new StringTokenizer(categories, LISTITEM_DELIMITER); while (t.hasMoreTokens()) { String category = t.nextToken(); result.removeCategory(category); } } }
java
public static void hiddenFromEncodedString(ProjectFilterSettings result, String s) { if (s.length() > 0) { int bar = s.indexOf(FIELD_DELIMITER); String categories; if (bar >= 0) { categories = s.substring(0, bar); } else { categories = s; } StringTokenizer t = new StringTokenizer(categories, LISTITEM_DELIMITER); while (t.hasMoreTokens()) { String category = t.nextToken(); result.removeCategory(category); } } }
[ "public", "static", "void", "hiddenFromEncodedString", "(", "ProjectFilterSettings", "result", ",", "String", "s", ")", "{", "if", "(", "s", ".", "length", "(", ")", ">", "0", ")", "{", "int", "bar", "=", "s", ".", "indexOf", "(", "FIELD_DELIMITER", ")", ";", "String", "categories", ";", "if", "(", "bar", ">=", "0", ")", "{", "categories", "=", "s", ".", "substring", "(", "0", ",", "bar", ")", ";", "}", "else", "{", "categories", "=", "s", ";", "}", "StringTokenizer", "t", "=", "new", "StringTokenizer", "(", "categories", ",", "LISTITEM_DELIMITER", ")", ";", "while", "(", "t", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "category", "=", "t", ".", "nextToken", "(", ")", ";", "result", ".", "removeCategory", "(", "category", ")", ";", "}", "}", "}" ]
set the hidden bug categories on the specifed ProjectFilterSettings from an encoded string @param result the ProjectFilterSettings from which to remove bug categories @param s the encoded string @see ProjectFilterSettings#hiddenFromEncodedString(ProjectFilterSettings, String)
[ "set", "the", "hidden", "bug", "categories", "on", "the", "specifed", "ProjectFilterSettings", "from", "an", "encoded", "string" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/config/ProjectFilterSettings.java#L236-L253
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/SqlExecutor.java
SqlExecutor.getSingleResult
public <T> T getSingleResult(Class<T> clazz, String sql, Object[] params) { """ Returns a single entity from the first row of an SQL. @param <T> the entity type @param clazz the class of the entity @param sql the SQL to execute @param params the parameters to execute the SQL @return the entity from the result set. @throws SQLRuntimeException if a database access error occurs """ PreparedStatement stmt = null; ResultSet rs = null; try { stmt = connectionProvider.getConnection().prepareStatement(sql); setParameters(stmt, params); if (logger.isDebugEnabled()) { printSql(sql); printParameters(params); } rs = stmt.executeQuery(); ResultSetMetaData meta = rs.getMetaData(); int columnCount = meta.getColumnCount(); BeanDesc beanDesc = beanDescFactory.getBeanDesc(clazz); if(rs.next()){ T entity = entityOperator.createEntity(clazz, rs, meta, columnCount, beanDesc, dialect, valueTypes, nameConverter); return entity; } return null; } catch (SQLException ex) { throw new SQLRuntimeException(ex); } finally { JdbcUtil.close(rs); JdbcUtil.close(stmt); } }
java
public <T> T getSingleResult(Class<T> clazz, String sql, Object[] params) { PreparedStatement stmt = null; ResultSet rs = null; try { stmt = connectionProvider.getConnection().prepareStatement(sql); setParameters(stmt, params); if (logger.isDebugEnabled()) { printSql(sql); printParameters(params); } rs = stmt.executeQuery(); ResultSetMetaData meta = rs.getMetaData(); int columnCount = meta.getColumnCount(); BeanDesc beanDesc = beanDescFactory.getBeanDesc(clazz); if(rs.next()){ T entity = entityOperator.createEntity(clazz, rs, meta, columnCount, beanDesc, dialect, valueTypes, nameConverter); return entity; } return null; } catch (SQLException ex) { throw new SQLRuntimeException(ex); } finally { JdbcUtil.close(rs); JdbcUtil.close(stmt); } }
[ "public", "<", "T", ">", "T", "getSingleResult", "(", "Class", "<", "T", ">", "clazz", ",", "String", "sql", ",", "Object", "[", "]", "params", ")", "{", "PreparedStatement", "stmt", "=", "null", ";", "ResultSet", "rs", "=", "null", ";", "try", "{", "stmt", "=", "connectionProvider", ".", "getConnection", "(", ")", ".", "prepareStatement", "(", "sql", ")", ";", "setParameters", "(", "stmt", ",", "params", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "printSql", "(", "sql", ")", ";", "printParameters", "(", "params", ")", ";", "}", "rs", "=", "stmt", ".", "executeQuery", "(", ")", ";", "ResultSetMetaData", "meta", "=", "rs", ".", "getMetaData", "(", ")", ";", "int", "columnCount", "=", "meta", ".", "getColumnCount", "(", ")", ";", "BeanDesc", "beanDesc", "=", "beanDescFactory", ".", "getBeanDesc", "(", "clazz", ")", ";", "if", "(", "rs", ".", "next", "(", ")", ")", "{", "T", "entity", "=", "entityOperator", ".", "createEntity", "(", "clazz", ",", "rs", ",", "meta", ",", "columnCount", ",", "beanDesc", ",", "dialect", ",", "valueTypes", ",", "nameConverter", ")", ";", "return", "entity", ";", "}", "return", "null", ";", "}", "catch", "(", "SQLException", "ex", ")", "{", "throw", "new", "SQLRuntimeException", "(", "ex", ")", ";", "}", "finally", "{", "JdbcUtil", ".", "close", "(", "rs", ")", ";", "JdbcUtil", ".", "close", "(", "stmt", ")", ";", "}", "}" ]
Returns a single entity from the first row of an SQL. @param <T> the entity type @param clazz the class of the entity @param sql the SQL to execute @param params the parameters to execute the SQL @return the entity from the result set. @throws SQLRuntimeException if a database access error occurs
[ "Returns", "a", "single", "entity", "from", "the", "first", "row", "of", "an", "SQL", "." ]
train
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/SqlExecutor.java#L228-L261
mozilla/rhino
src/org/mozilla/javascript/Context.java
Context.decompileFunctionBody
public final String decompileFunctionBody(Function fun, int indent) { """ Decompile the body of a JavaScript Function. <p> Decompiles the body a previously compiled JavaScript Function object to canonical source, omitting the function header and trailing brace. Returns '[native code]' if no decompilation information is available. @param fun the JavaScript function to decompile @param indent the number of spaces to indent the result @return a string representing the function body source. """ if (fun instanceof BaseFunction) { BaseFunction bf = (BaseFunction)fun; return bf.decompile(indent, Decompiler.ONLY_BODY_FLAG); } // ALERT: not sure what the right response here is. return "[native code]\n"; }
java
public final String decompileFunctionBody(Function fun, int indent) { if (fun instanceof BaseFunction) { BaseFunction bf = (BaseFunction)fun; return bf.decompile(indent, Decompiler.ONLY_BODY_FLAG); } // ALERT: not sure what the right response here is. return "[native code]\n"; }
[ "public", "final", "String", "decompileFunctionBody", "(", "Function", "fun", ",", "int", "indent", ")", "{", "if", "(", "fun", "instanceof", "BaseFunction", ")", "{", "BaseFunction", "bf", "=", "(", "BaseFunction", ")", "fun", ";", "return", "bf", ".", "decompile", "(", "indent", ",", "Decompiler", ".", "ONLY_BODY_FLAG", ")", ";", "}", "// ALERT: not sure what the right response here is.", "return", "\"[native code]\\n\"", ";", "}" ]
Decompile the body of a JavaScript Function. <p> Decompiles the body a previously compiled JavaScript Function object to canonical source, omitting the function header and trailing brace. Returns '[native code]' if no decompilation information is available. @param fun the JavaScript function to decompile @param indent the number of spaces to indent the result @return a string representing the function body source.
[ "Decompile", "the", "body", "of", "a", "JavaScript", "Function", ".", "<p", ">", "Decompiles", "the", "body", "a", "previously", "compiled", "JavaScript", "Function", "object", "to", "canonical", "source", "omitting", "the", "function", "header", "and", "trailing", "brace", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Context.java#L1620-L1628
haraldk/TwelveMonkeys
sandbox/sandbox-servlet/src/main/java/com/twelvemonkeys/servlet/jsp/droplet/Droplet.java
Droplet.serviceParameter
public void serviceParameter(String pParameter, PageContext pPageContext) throws ServletException, IOException { """ Services a parameter. Programatically equivalent to the <d:valueof param="pParameter"/> JSP tag. """ Object param = pPageContext.getRequest().getAttribute(pParameter); if (param != null) { if (param instanceof Param) { ((Param) param).service(pPageContext); } else { pPageContext.getOut().print(param); } } else { // Try to get value from parameters Object obj = pPageContext.getRequest().getParameter(pParameter); // Print parameter or default value pPageContext.getOut().print((obj != null) ? obj : ""); } }
java
public void serviceParameter(String pParameter, PageContext pPageContext) throws ServletException, IOException { Object param = pPageContext.getRequest().getAttribute(pParameter); if (param != null) { if (param instanceof Param) { ((Param) param).service(pPageContext); } else { pPageContext.getOut().print(param); } } else { // Try to get value from parameters Object obj = pPageContext.getRequest().getParameter(pParameter); // Print parameter or default value pPageContext.getOut().print((obj != null) ? obj : ""); } }
[ "public", "void", "serviceParameter", "(", "String", "pParameter", ",", "PageContext", "pPageContext", ")", "throws", "ServletException", ",", "IOException", "{", "Object", "param", "=", "pPageContext", ".", "getRequest", "(", ")", ".", "getAttribute", "(", "pParameter", ")", ";", "if", "(", "param", "!=", "null", ")", "{", "if", "(", "param", "instanceof", "Param", ")", "{", "(", "(", "Param", ")", "param", ")", ".", "service", "(", "pPageContext", ")", ";", "}", "else", "{", "pPageContext", ".", "getOut", "(", ")", ".", "print", "(", "param", ")", ";", "}", "}", "else", "{", "// Try to get value from parameters\r", "Object", "obj", "=", "pPageContext", ".", "getRequest", "(", ")", ".", "getParameter", "(", "pParameter", ")", ";", "// Print parameter or default value\r", "pPageContext", ".", "getOut", "(", ")", ".", "print", "(", "(", "obj", "!=", "null", ")", "?", "obj", ":", "\"\"", ")", ";", "}", "}" ]
Services a parameter. Programatically equivalent to the <d:valueof param="pParameter"/> JSP tag.
[ "Services", "a", "parameter", ".", "Programatically", "equivalent", "to", "the", "<d", ":", "valueof", "param", "=", "pParameter", "/", ">", "JSP", "tag", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-servlet/src/main/java/com/twelvemonkeys/servlet/jsp/droplet/Droplet.java#L47-L65
exKAZUu/GameAIArena
src/main/java/net/exkazuu/gameaiarena/api/Point2.java
Point2.parse
public static Point2 parse(String str) { """ 文字列表現から{@link Point2}インスタンスへ変換します。 @param str {@link Point2}インスタンスへ変換する文字列 @return 変換した{@link Point2}インスタンス """ String[] numbers = str.split(","); if (numbers.length != 2) { throw new IllegalArgumentException("'str' has an invalid format."); } int[] vs = new int[2]; for (int i = 0; i < numbers.length; i++) { String number = numbers[i]; int left = StringUtils.indexOfAny(number, new char[] {'+', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}); int right = StringUtils.lastIndexOfAny(numbers[i], new char[] {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}); if (!(0 <= left && left <= right)) { throw new IllegalArgumentException("'str' has an invalid format."); } vs[i] = Integer.parseInt(numbers[i].substring(left, right + 1)); } return new Point2(vs[0], vs[1]); }
java
public static Point2 parse(String str) { String[] numbers = str.split(","); if (numbers.length != 2) { throw new IllegalArgumentException("'str' has an invalid format."); } int[] vs = new int[2]; for (int i = 0; i < numbers.length; i++) { String number = numbers[i]; int left = StringUtils.indexOfAny(number, new char[] {'+', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}); int right = StringUtils.lastIndexOfAny(numbers[i], new char[] {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}); if (!(0 <= left && left <= right)) { throw new IllegalArgumentException("'str' has an invalid format."); } vs[i] = Integer.parseInt(numbers[i].substring(left, right + 1)); } return new Point2(vs[0], vs[1]); }
[ "public", "static", "Point2", "parse", "(", "String", "str", ")", "{", "String", "[", "]", "numbers", "=", "str", ".", "split", "(", "\",\"", ")", ";", "if", "(", "numbers", ".", "length", "!=", "2", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"'str' has an invalid format.\"", ")", ";", "}", "int", "[", "]", "vs", "=", "new", "int", "[", "2", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numbers", ".", "length", ";", "i", "++", ")", "{", "String", "number", "=", "numbers", "[", "i", "]", ";", "int", "left", "=", "StringUtils", ".", "indexOfAny", "(", "number", ",", "new", "char", "[", "]", "{", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", "}", ")", ";", "int", "right", "=", "StringUtils", ".", "lastIndexOfAny", "(", "numbers", "[", "i", "]", ",", "new", "char", "[", "]", "{", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", "}", ")", ";", "if", "(", "!", "(", "0", "<=", "left", "&&", "left", "<=", "right", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"'str' has an invalid format.\"", ")", ";", "}", "vs", "[", "i", "]", "=", "Integer", ".", "parseInt", "(", "numbers", "[", "i", "]", ".", "substring", "(", "left", ",", "right", "+", "1", ")", ")", ";", "}", "return", "new", "Point2", "(", "vs", "[", "0", "]", ",", "vs", "[", "1", "]", ")", ";", "}" ]
文字列表現から{@link Point2}インスタンスへ変換します。 @param str {@link Point2}インスタンスへ変換する文字列 @return 変換した{@link Point2}インスタンス
[ "文字列表現から", "{", "@link", "Point2", "}", "インスタンスへ変換します。" ]
train
https://github.com/exKAZUu/GameAIArena/blob/66894c251569fb763174654d6c262c5176dfcf48/src/main/java/net/exkazuu/gameaiarena/api/Point2.java#L189-L209
google/auto
value/src/main/java/com/google/auto/value/processor/BuilderMethodClassifier.java
BuilderMethodClassifier.checkSetterParameter
private boolean checkSetterParameter(ExecutableElement valueGetter, ExecutableElement setter) { """ Checks that the given setter method has a parameter type that is compatible with the return type of the given getter. Compatible means either that it is the same, or that it is a type that can be copied using a method like {@code ImmutableList.copyOf} or {@code Optional.of}. @return true if the types correspond, false if an error has been reported. """ TypeMirror targetType = getterToPropertyType.get(valueGetter); ExecutableType finalSetter = MoreTypes.asExecutable( typeUtils.asMemberOf(MoreTypes.asDeclared(builderType.asType()), setter)); TypeMirror parameterType = finalSetter.getParameterTypes().get(0); if (typeUtils.isSameType(parameterType, targetType)) { return true; } // Parameter type is not equal to property type, but might be convertible with copyOf. ImmutableList<ExecutableElement> copyOfMethods = copyOfMethods(targetType); if (!copyOfMethods.isEmpty()) { return canMakeCopyUsing(copyOfMethods, valueGetter, setter); } String error = String.format( "Parameter type %s of setter method should be %s to match getter %s.%s", parameterType, targetType, autoValueClass, valueGetter.getSimpleName()); errorReporter.reportError(error, setter); return false; }
java
private boolean checkSetterParameter(ExecutableElement valueGetter, ExecutableElement setter) { TypeMirror targetType = getterToPropertyType.get(valueGetter); ExecutableType finalSetter = MoreTypes.asExecutable( typeUtils.asMemberOf(MoreTypes.asDeclared(builderType.asType()), setter)); TypeMirror parameterType = finalSetter.getParameterTypes().get(0); if (typeUtils.isSameType(parameterType, targetType)) { return true; } // Parameter type is not equal to property type, but might be convertible with copyOf. ImmutableList<ExecutableElement> copyOfMethods = copyOfMethods(targetType); if (!copyOfMethods.isEmpty()) { return canMakeCopyUsing(copyOfMethods, valueGetter, setter); } String error = String.format( "Parameter type %s of setter method should be %s to match getter %s.%s", parameterType, targetType, autoValueClass, valueGetter.getSimpleName()); errorReporter.reportError(error, setter); return false; }
[ "private", "boolean", "checkSetterParameter", "(", "ExecutableElement", "valueGetter", ",", "ExecutableElement", "setter", ")", "{", "TypeMirror", "targetType", "=", "getterToPropertyType", ".", "get", "(", "valueGetter", ")", ";", "ExecutableType", "finalSetter", "=", "MoreTypes", ".", "asExecutable", "(", "typeUtils", ".", "asMemberOf", "(", "MoreTypes", ".", "asDeclared", "(", "builderType", ".", "asType", "(", ")", ")", ",", "setter", ")", ")", ";", "TypeMirror", "parameterType", "=", "finalSetter", ".", "getParameterTypes", "(", ")", ".", "get", "(", "0", ")", ";", "if", "(", "typeUtils", ".", "isSameType", "(", "parameterType", ",", "targetType", ")", ")", "{", "return", "true", ";", "}", "// Parameter type is not equal to property type, but might be convertible with copyOf.", "ImmutableList", "<", "ExecutableElement", ">", "copyOfMethods", "=", "copyOfMethods", "(", "targetType", ")", ";", "if", "(", "!", "copyOfMethods", ".", "isEmpty", "(", ")", ")", "{", "return", "canMakeCopyUsing", "(", "copyOfMethods", ",", "valueGetter", ",", "setter", ")", ";", "}", "String", "error", "=", "String", ".", "format", "(", "\"Parameter type %s of setter method should be %s to match getter %s.%s\"", ",", "parameterType", ",", "targetType", ",", "autoValueClass", ",", "valueGetter", ".", "getSimpleName", "(", ")", ")", ";", "errorReporter", ".", "reportError", "(", "error", ",", "setter", ")", ";", "return", "false", ";", "}" ]
Checks that the given setter method has a parameter type that is compatible with the return type of the given getter. Compatible means either that it is the same, or that it is a type that can be copied using a method like {@code ImmutableList.copyOf} or {@code Optional.of}. @return true if the types correspond, false if an error has been reported.
[ "Checks", "that", "the", "given", "setter", "method", "has", "a", "parameter", "type", "that", "is", "compatible", "with", "the", "return", "type", "of", "the", "given", "getter", ".", "Compatible", "means", "either", "that", "it", "is", "the", "same", "or", "that", "it", "is", "a", "type", "that", "can", "be", "copied", "using", "a", "method", "like", "{", "@code", "ImmutableList", ".", "copyOf", "}", "or", "{", "@code", "Optional", ".", "of", "}", "." ]
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/value/src/main/java/com/google/auto/value/processor/BuilderMethodClassifier.java#L417-L438
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/rasterlite/Rasterlite2Coverage.java
Rasterlite2Coverage.getRL2Image
public byte[] getRL2Image( Geometry geom, String geomEpsg, int width, int height ) throws Exception { """ Extract an image from the database. @param geom the image bounding box geometry. @param width the pixel width of the expected image. @param height the pixel height of the expected image. @return the image bytes. @throws Exception """ String sql; String rasterName = getName(); if (geomEpsg != null) { sql = "select GetMapImageFromRaster('" + rasterName + "', ST_Transform(ST_GeomFromText('" + geom.toText() + "', " + geomEpsg + "), " + srid + ") , " + width + " , " + height + ", 'default', 'image/png', '#ffffff', 0, 80, 1 )"; } else { sql = "select GetMapImageFromRaster('" + rasterName + "', ST_GeomFromText('" + geom.toText() + "') , " + width + " , " + height + ", 'default', 'image/png', '#ffffff', 0, 80, 1 )"; } return database.execOnConnection(mConn -> { try (IHMStatement stmt = mConn.createStatement()) { IHMResultSet resultSet = stmt.executeQuery(sql); if (resultSet.next()) { byte[] bytes = resultSet.getBytes(1); return bytes; } } return null; }); }
java
public byte[] getRL2Image( Geometry geom, String geomEpsg, int width, int height ) throws Exception { String sql; String rasterName = getName(); if (geomEpsg != null) { sql = "select GetMapImageFromRaster('" + rasterName + "', ST_Transform(ST_GeomFromText('" + geom.toText() + "', " + geomEpsg + "), " + srid + ") , " + width + " , " + height + ", 'default', 'image/png', '#ffffff', 0, 80, 1 )"; } else { sql = "select GetMapImageFromRaster('" + rasterName + "', ST_GeomFromText('" + geom.toText() + "') , " + width + " , " + height + ", 'default', 'image/png', '#ffffff', 0, 80, 1 )"; } return database.execOnConnection(mConn -> { try (IHMStatement stmt = mConn.createStatement()) { IHMResultSet resultSet = stmt.executeQuery(sql); if (resultSet.next()) { byte[] bytes = resultSet.getBytes(1); return bytes; } } return null; }); }
[ "public", "byte", "[", "]", "getRL2Image", "(", "Geometry", "geom", ",", "String", "geomEpsg", ",", "int", "width", ",", "int", "height", ")", "throws", "Exception", "{", "String", "sql", ";", "String", "rasterName", "=", "getName", "(", ")", ";", "if", "(", "geomEpsg", "!=", "null", ")", "{", "sql", "=", "\"select GetMapImageFromRaster('\"", "+", "rasterName", "+", "\"', ST_Transform(ST_GeomFromText('\"", "+", "geom", ".", "toText", "(", ")", "+", "\"', \"", "+", "geomEpsg", "+", "\"), \"", "+", "srid", "+", "\") , \"", "+", "width", "+", "\" , \"", "+", "height", "+", "\", 'default', 'image/png', '#ffffff', 0, 80, 1 )\"", ";", "}", "else", "{", "sql", "=", "\"select GetMapImageFromRaster('\"", "+", "rasterName", "+", "\"', ST_GeomFromText('\"", "+", "geom", ".", "toText", "(", ")", "+", "\"') , \"", "+", "width", "+", "\" , \"", "+", "height", "+", "\", 'default', 'image/png', '#ffffff', 0, 80, 1 )\"", ";", "}", "return", "database", ".", "execOnConnection", "(", "mConn", "->", "{", "try", "(", "IHMStatement", "stmt", "=", "mConn", ".", "createStatement", "(", ")", ")", "{", "IHMResultSet", "resultSet", "=", "stmt", ".", "executeQuery", "(", "sql", ")", ";", "if", "(", "resultSet", ".", "next", "(", ")", ")", "{", "byte", "[", "]", "bytes", "=", "resultSet", ".", "getBytes", "(", "1", ")", ";", "return", "bytes", ";", "}", "}", "return", "null", ";", "}", ")", ";", "}" ]
Extract an image from the database. @param geom the image bounding box geometry. @param width the pixel width of the expected image. @param height the pixel height of the expected image. @return the image bytes. @throws Exception
[ "Extract", "an", "image", "from", "the", "database", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/rasterlite/Rasterlite2Coverage.java#L108-L130
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java
DynamicReportBuilder.setColspan
public DynamicReportBuilder setColspan(int colNumber, int colQuantity, String colspanTitle) { """ Set a colspan in a group of columns. First add the cols to the report @param colNumber the index of the col @param colQuantity the number of cols how i will take @param colspanTitle colspan title @return a Dynamic Report Builder @throws ColumnBuilderException When the index of the cols is out of bounds. """ this.setColspan(colNumber, colQuantity, colspanTitle, null); return this; }
java
public DynamicReportBuilder setColspan(int colNumber, int colQuantity, String colspanTitle) { this.setColspan(colNumber, colQuantity, colspanTitle, null); return this; }
[ "public", "DynamicReportBuilder", "setColspan", "(", "int", "colNumber", ",", "int", "colQuantity", ",", "String", "colspanTitle", ")", "{", "this", ".", "setColspan", "(", "colNumber", ",", "colQuantity", ",", "colspanTitle", ",", "null", ")", ";", "return", "this", ";", "}" ]
Set a colspan in a group of columns. First add the cols to the report @param colNumber the index of the col @param colQuantity the number of cols how i will take @param colspanTitle colspan title @return a Dynamic Report Builder @throws ColumnBuilderException When the index of the cols is out of bounds.
[ "Set", "a", "colspan", "in", "a", "group", "of", "columns", ".", "First", "add", "the", "cols", "to", "the", "report" ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L1645-L1650
languagetool-org/languagetool
languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java
Tools.openDirectoryDialog
static File openDirectoryDialog(Frame frame, File initialDir) { """ Show a directory chooser dialog, starting with a specified directory @param frame Owner frame @param initialDir The initial directory @return the selected file @since 3.0 """ return openFileDialog(frame, null, initialDir, JFileChooser.DIRECTORIES_ONLY); }
java
static File openDirectoryDialog(Frame frame, File initialDir) { return openFileDialog(frame, null, initialDir, JFileChooser.DIRECTORIES_ONLY); }
[ "static", "File", "openDirectoryDialog", "(", "Frame", "frame", ",", "File", "initialDir", ")", "{", "return", "openFileDialog", "(", "frame", ",", "null", ",", "initialDir", ",", "JFileChooser", ".", "DIRECTORIES_ONLY", ")", ";", "}" ]
Show a directory chooser dialog, starting with a specified directory @param frame Owner frame @param initialDir The initial directory @return the selected file @since 3.0
[ "Show", "a", "directory", "chooser", "dialog", "starting", "with", "a", "specified", "directory" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java#L80-L82
abel533/Mapper
core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java
SqlHelper.getBindValue
public static String getBindValue(EntityColumn column, String value) { """ <bind name="pattern" value="'%' + _parameter.getTitle() + '%'" /> @param column @return """ StringBuilder sql = new StringBuilder(); sql.append("<bind name=\""); sql.append(column.getProperty()).append("_bind\" "); sql.append("value='").append(value).append("'/>"); return sql.toString(); }
java
public static String getBindValue(EntityColumn column, String value) { StringBuilder sql = new StringBuilder(); sql.append("<bind name=\""); sql.append(column.getProperty()).append("_bind\" "); sql.append("value='").append(value).append("'/>"); return sql.toString(); }
[ "public", "static", "String", "getBindValue", "(", "EntityColumn", "column", ",", "String", "value", ")", "{", "StringBuilder", "sql", "=", "new", "StringBuilder", "(", ")", ";", "sql", ".", "append", "(", "\"<bind name=\\\"\"", ")", ";", "sql", ".", "append", "(", "column", ".", "getProperty", "(", ")", ")", ".", "append", "(", "\"_bind\\\" \"", ")", ";", "sql", ".", "append", "(", "\"value='\"", ")", ".", "append", "(", "value", ")", ".", "append", "(", "\"'/>\"", ")", ";", "return", "sql", ".", "toString", "(", ")", ";", "}" ]
<bind name="pattern" value="'%' + _parameter.getTitle() + '%'" /> @param column @return
[ "<bind", "name", "=", "pattern", "value", "=", "%", "+", "_parameter", ".", "getTitle", "()", "+", "%", "/", ">" ]
train
https://github.com/abel533/Mapper/blob/45c3d716583cba3680e03f1f6790fab5e1f4f668/core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java#L121-L127
pac4j/pac4j
pac4j-oauth/src/main/java/org/pac4j/oauth/profile/generic/GenericOAuth20ProfileDefinition.java
GenericOAuth20ProfileDefinition.profileAttribute
public void profileAttribute(final String name, final AttributeConverter<? extends Object> converter) { """ Add an attribute as a primary one and its converter. @param name name of the attribute @param converter converter """ profileAttribute(name, name, converter); }
java
public void profileAttribute(final String name, final AttributeConverter<? extends Object> converter) { profileAttribute(name, name, converter); }
[ "public", "void", "profileAttribute", "(", "final", "String", "name", ",", "final", "AttributeConverter", "<", "?", "extends", "Object", ">", "converter", ")", "{", "profileAttribute", "(", "name", ",", "name", ",", "converter", ")", ";", "}" ]
Add an attribute as a primary one and its converter. @param name name of the attribute @param converter converter
[ "Add", "an", "attribute", "as", "a", "primary", "one", "and", "its", "converter", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-oauth/src/main/java/org/pac4j/oauth/profile/generic/GenericOAuth20ProfileDefinition.java#L94-L96
apache/incubator-atlas
common/src/main/java/org/apache/atlas/utils/ParamChecker.java
ParamChecker.notEmptyIfNotNull
public static String notEmptyIfNotNull(String value, String name, String info) { """ Check that a string is not empty if its not null. @param value value. @param name parameter name for the exception message. @return the given value. """ if (value == null) { return value; } if (value.trim().length() == 0) { throw new IllegalArgumentException(name + " cannot be empty" + (info == null ? "" : ", " + info)); } return value.trim(); }
java
public static String notEmptyIfNotNull(String value, String name, String info) { if (value == null) { return value; } if (value.trim().length() == 0) { throw new IllegalArgumentException(name + " cannot be empty" + (info == null ? "" : ", " + info)); } return value.trim(); }
[ "public", "static", "String", "notEmptyIfNotNull", "(", "String", "value", ",", "String", "name", ",", "String", "info", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "value", ";", "}", "if", "(", "value", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "name", "+", "\" cannot be empty\"", "+", "(", "info", "==", "null", "?", "\"\"", ":", "\", \"", "+", "info", ")", ")", ";", "}", "return", "value", ".", "trim", "(", ")", ";", "}" ]
Check that a string is not empty if its not null. @param value value. @param name parameter name for the exception message. @return the given value.
[ "Check", "that", "a", "string", "is", "not", "empty", "if", "its", "not", "null", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/common/src/main/java/org/apache/atlas/utils/ParamChecker.java#L115-L124
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java
SynchronousRequest.getAllMapNames
public List<SimpleName> getAllMapNames() throws GuildWars2Exception { """ For more info on map name API go <a href="https://wiki.guildwars2.com/wiki/API:1/map_names">here</a><br/> @return list of names @throws GuildWars2Exception see {@link ErrorCode} for detail @see SimpleName map name """ try { Response<List<SimpleName>> response = gw2API.getAllMapNames(GuildWars2.lang.getValue()).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
java
public List<SimpleName> getAllMapNames() throws GuildWars2Exception { try { Response<List<SimpleName>> response = gw2API.getAllMapNames(GuildWars2.lang.getValue()).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
[ "public", "List", "<", "SimpleName", ">", "getAllMapNames", "(", ")", "throws", "GuildWars2Exception", "{", "try", "{", "Response", "<", "List", "<", "SimpleName", ">>", "response", "=", "gw2API", ".", "getAllMapNames", "(", "GuildWars2", ".", "lang", ".", "getValue", "(", ")", ")", ".", "execute", "(", ")", ";", "if", "(", "!", "response", ".", "isSuccessful", "(", ")", ")", "throwError", "(", "response", ".", "code", "(", ")", ",", "response", ".", "errorBody", "(", ")", ")", ";", "return", "response", ".", "body", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "GuildWars2Exception", "(", "ErrorCode", ".", "Network", ",", "\"Network Error: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
For more info on map name API go <a href="https://wiki.guildwars2.com/wiki/API:1/map_names">here</a><br/> @return list of names @throws GuildWars2Exception see {@link ErrorCode} for detail @see SimpleName map name
[ "For", "more", "info", "on", "map", "name", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "1", "/", "map_names", ">", "here<", "/", "a", ">", "<br", "/", ">" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L99-L107
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java
HadoopUtils.deletePathByRegex
public static void deletePathByRegex(FileSystem fs, final Path path, final String regex) throws IOException { """ Delete files according to the regular expression provided @param fs Filesystem object @param path base path @param regex regular expression to select files to delete @throws IOException """ FileStatus[] statusList = fs.listStatus(path, path1 -> path1.getName().matches(regex)); for (final FileStatus oldJobFile : statusList) { HadoopUtils.deletePath(fs, oldJobFile.getPath(), true); } }
java
public static void deletePathByRegex(FileSystem fs, final Path path, final String regex) throws IOException { FileStatus[] statusList = fs.listStatus(path, path1 -> path1.getName().matches(regex)); for (final FileStatus oldJobFile : statusList) { HadoopUtils.deletePath(fs, oldJobFile.getPath(), true); } }
[ "public", "static", "void", "deletePathByRegex", "(", "FileSystem", "fs", ",", "final", "Path", "path", ",", "final", "String", "regex", ")", "throws", "IOException", "{", "FileStatus", "[", "]", "statusList", "=", "fs", ".", "listStatus", "(", "path", ",", "path1", "->", "path1", ".", "getName", "(", ")", ".", "matches", "(", "regex", ")", ")", ";", "for", "(", "final", "FileStatus", "oldJobFile", ":", "statusList", ")", "{", "HadoopUtils", ".", "deletePath", "(", "fs", ",", "oldJobFile", ".", "getPath", "(", ")", ",", "true", ")", ";", "}", "}" ]
Delete files according to the regular expression provided @param fs Filesystem object @param path base path @param regex regular expression to select files to delete @throws IOException
[ "Delete", "files", "according", "to", "the", "regular", "expression", "provided" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L197-L203
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/CrsUtilities.java
CrsUtilities.getCrsFromEpsg
public static CoordinateReferenceSystem getCrsFromEpsg( String epsgPlusCode, Boolean doLatitudeFirst ) { """ Get the {@link CoordinateReferenceSystem} from an epsg definition. @param epsgPlusCode the code as EPSG:4326 @param doLatitudeFirst see {@link CRS#decode(String, boolean)} @return the crs. """ String sridString = epsgPlusCode.replaceFirst("EPSG:", "").replaceFirst("epsg:", ""); int srid = Integer.parseInt(sridString); return getCrsFromSrid(srid, doLatitudeFirst); }
java
public static CoordinateReferenceSystem getCrsFromEpsg( String epsgPlusCode, Boolean doLatitudeFirst ) { String sridString = epsgPlusCode.replaceFirst("EPSG:", "").replaceFirst("epsg:", ""); int srid = Integer.parseInt(sridString); return getCrsFromSrid(srid, doLatitudeFirst); }
[ "public", "static", "CoordinateReferenceSystem", "getCrsFromEpsg", "(", "String", "epsgPlusCode", ",", "Boolean", "doLatitudeFirst", ")", "{", "String", "sridString", "=", "epsgPlusCode", ".", "replaceFirst", "(", "\"EPSG:\"", ",", "\"\"", ")", ".", "replaceFirst", "(", "\"epsg:\"", ",", "\"\"", ")", ";", "int", "srid", "=", "Integer", ".", "parseInt", "(", "sridString", ")", ";", "return", "getCrsFromSrid", "(", "srid", ",", "doLatitudeFirst", ")", ";", "}" ]
Get the {@link CoordinateReferenceSystem} from an epsg definition. @param epsgPlusCode the code as EPSG:4326 @param doLatitudeFirst see {@link CRS#decode(String, boolean)} @return the crs.
[ "Get", "the", "{", "@link", "CoordinateReferenceSystem", "}", "from", "an", "epsg", "definition", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/CrsUtilities.java#L232-L236
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java
VarOptItemsSketch.updateHeavyGeneral
private void updateHeavyGeneral(final T item, final double weight, final boolean mark) { """ /* In the "heavy" case the new item has weight > old_tau, so would appear to the left of items in R in a hypothetical reverse-sorted list and might or might not be light enough be part of this round's downsampling. [After first splitting off the R=1 case] we greatly simplify the code by putting the new item into the H heap whether it needs to be there or not. In other words, it might go into the heap and then come right back out, but that should be okay because pseudo_heavy items cannot predominate in long streams unless (max wt) / (min wt) > o(exp(N)) """ assert m_ == 0; assert r_ >= 2; assert (r_ + h_) == k_; // put into H, although may come back out momentarily push(item, weight, mark); growCandidateSet(totalWtR_, r_); }
java
private void updateHeavyGeneral(final T item, final double weight, final boolean mark) { assert m_ == 0; assert r_ >= 2; assert (r_ + h_) == k_; // put into H, although may come back out momentarily push(item, weight, mark); growCandidateSet(totalWtR_, r_); }
[ "private", "void", "updateHeavyGeneral", "(", "final", "T", "item", ",", "final", "double", "weight", ",", "final", "boolean", "mark", ")", "{", "assert", "m_", "==", "0", ";", "assert", "r_", ">=", "2", ";", "assert", "(", "r_", "+", "h_", ")", "==", "k_", ";", "// put into H, although may come back out momentarily", "push", "(", "item", ",", "weight", ",", "mark", ")", ";", "growCandidateSet", "(", "totalWtR_", ",", "r_", ")", ";", "}" ]
/* In the "heavy" case the new item has weight > old_tau, so would appear to the left of items in R in a hypothetical reverse-sorted list and might or might not be light enough be part of this round's downsampling. [After first splitting off the R=1 case] we greatly simplify the code by putting the new item into the H heap whether it needs to be there or not. In other words, it might go into the heap and then come right back out, but that should be okay because pseudo_heavy items cannot predominate in long streams unless (max wt) / (min wt) > o(exp(N))
[ "/", "*", "In", "the", "heavy", "case", "the", "new", "item", "has", "weight", ">", "old_tau", "so", "would", "appear", "to", "the", "left", "of", "items", "in", "R", "in", "a", "hypothetical", "reverse", "-", "sorted", "list", "and", "might", "or", "might", "not", "be", "light", "enough", "be", "part", "of", "this", "round", "s", "downsampling", ".", "[", "After", "first", "splitting", "off", "the", "R", "=", "1", "case", "]", "we", "greatly", "simplify", "the", "code", "by", "putting", "the", "new", "item", "into", "the", "H", "heap", "whether", "it", "needs", "to", "be", "there", "or", "not", ".", "In", "other", "words", "it", "might", "go", "into", "the", "heap", "and", "then", "come", "right", "back", "out", "but", "that", "should", "be", "okay", "because", "pseudo_heavy", "items", "cannot", "predominate", "in", "long", "streams", "unless", "(", "max", "wt", ")", "/", "(", "min", "wt", ")", ">", "o", "(", "exp", "(", "N", "))" ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java#L923-L932
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java
AmqpChannel.qosBasic
public AmqpChannel qosBasic(int prefetchSize, int prefetchCount, boolean global) { """ This method requests a specific quality of service. The QoS can be specified for the current channel or for all channels on the connection. The particular properties and semantics of a qos method always depend on the content class semantics. Though the qos method could in principle apply to both peers, it is currently meaningful only for the server. @param prefetchSize @param prefetchCount @param global """ Object[] args = {prefetchSize, prefetchCount, global}; WrappedByteBuffer bodyArg = null; HashMap<String, Object> headersArg = null; String methodName = "qosBasic"; String methodId = "60" + "10"; AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId); Object[] arguments = {this, amqpMethod, this.id, args, bodyArg, headersArg}; asyncClient.enqueueAction(methodName, "channelWrite", arguments, null, null); return this; }
java
public AmqpChannel qosBasic(int prefetchSize, int prefetchCount, boolean global) { Object[] args = {prefetchSize, prefetchCount, global}; WrappedByteBuffer bodyArg = null; HashMap<String, Object> headersArg = null; String methodName = "qosBasic"; String methodId = "60" + "10"; AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId); Object[] arguments = {this, amqpMethod, this.id, args, bodyArg, headersArg}; asyncClient.enqueueAction(methodName, "channelWrite", arguments, null, null); return this; }
[ "public", "AmqpChannel", "qosBasic", "(", "int", "prefetchSize", ",", "int", "prefetchCount", ",", "boolean", "global", ")", "{", "Object", "[", "]", "args", "=", "{", "prefetchSize", ",", "prefetchCount", ",", "global", "}", ";", "WrappedByteBuffer", "bodyArg", "=", "null", ";", "HashMap", "<", "String", ",", "Object", ">", "headersArg", "=", "null", ";", "String", "methodName", "=", "\"qosBasic\"", ";", "String", "methodId", "=", "\"60\"", "+", "\"10\"", ";", "AmqpMethod", "amqpMethod", "=", "MethodLookup", ".", "LookupMethod", "(", "methodId", ")", ";", "Object", "[", "]", "arguments", "=", "{", "this", ",", "amqpMethod", ",", "this", ".", "id", ",", "args", ",", "bodyArg", ",", "headersArg", "}", ";", "asyncClient", ".", "enqueueAction", "(", "methodName", ",", "\"channelWrite\"", ",", "arguments", ",", "null", ",", "null", ")", ";", "return", "this", ";", "}" ]
This method requests a specific quality of service. The QoS can be specified for the current channel or for all channels on the connection. The particular properties and semantics of a qos method always depend on the content class semantics. Though the qos method could in principle apply to both peers, it is currently meaningful only for the server. @param prefetchSize @param prefetchCount @param global
[ "This", "method", "requests", "a", "specific", "quality", "of", "service", ".", "The", "QoS", "can", "be", "specified", "for", "the", "current", "channel", "or", "for", "all", "channels", "on", "the", "connection", ".", "The", "particular", "properties", "and", "semantics", "of", "a", "qos", "method", "always", "depend", "on", "the", "content", "class", "semantics", ".", "Though", "the", "qos", "method", "could", "in", "principle", "apply", "to", "both", "peers", "it", "is", "currently", "meaningful", "only", "for", "the", "server", "." ]
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L699-L710
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/JsonUtils.java
JsonUtils.renderException
private static void renderException(final Map model, final HttpServletResponse response) { """ Render exceptions. Sets the response status accordingly to note bad requests. @param model the model @param response the response """ response.setStatus(HttpServletResponse.SC_BAD_REQUEST); model.put("status", HttpServletResponse.SC_BAD_REQUEST); render(model, response); }
java
private static void renderException(final Map model, final HttpServletResponse response) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); model.put("status", HttpServletResponse.SC_BAD_REQUEST); render(model, response); }
[ "private", "static", "void", "renderException", "(", "final", "Map", "model", ",", "final", "HttpServletResponse", "response", ")", "{", "response", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_BAD_REQUEST", ")", ";", "model", ".", "put", "(", "\"status\"", ",", "HttpServletResponse", ".", "SC_BAD_REQUEST", ")", ";", "render", "(", "model", ",", "response", ")", ";", "}" ]
Render exceptions. Sets the response status accordingly to note bad requests. @param model the model @param response the response
[ "Render", "exceptions", ".", "Sets", "the", "response", "status", "accordingly", "to", "note", "bad", "requests", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/JsonUtils.java#L67-L71
graknlabs/grakn
server/src/server/exception/TransactionException.java
TransactionException.immutableProperty
public static TransactionException immutableProperty(Object oldValue, Object newValue, Enum vertexProperty) { """ Thrown when attempting to mutate a property which is immutable """ return create(ErrorMessage.IMMUTABLE_VALUE.getMessage(oldValue, newValue, vertexProperty.name())); }
java
public static TransactionException immutableProperty(Object oldValue, Object newValue, Enum vertexProperty) { return create(ErrorMessage.IMMUTABLE_VALUE.getMessage(oldValue, newValue, vertexProperty.name())); }
[ "public", "static", "TransactionException", "immutableProperty", "(", "Object", "oldValue", ",", "Object", "newValue", ",", "Enum", "vertexProperty", ")", "{", "return", "create", "(", "ErrorMessage", ".", "IMMUTABLE_VALUE", ".", "getMessage", "(", "oldValue", ",", "newValue", ",", "vertexProperty", ".", "name", "(", ")", ")", ")", ";", "}" ]
Thrown when attempting to mutate a property which is immutable
[ "Thrown", "when", "attempting", "to", "mutate", "a", "property", "which", "is", "immutable" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L173-L175
DV8FromTheWorld/JDA
src/main/java/com/iwebpp/crypto/TweetNaclFast.java
Signature.detached_verify
public boolean detached_verify(byte [] message, byte [] signature) { """ /* @description Verifies the signature for the message and returns true if verification succeeded or false if it failed. """ if (signature.length != signatureLength) return false; if (theirPublicKey.length != publicKeyLength) return false; byte [] sm = new byte[signatureLength + message.length]; byte [] m = new byte[signatureLength + message.length]; for (int i = 0; i < signatureLength; i++) sm[i] = signature[i]; for (int i = 0; i < message.length; i++) sm[i + signatureLength] = message[i]; return (crypto_sign_open(m, -1, sm, 0, sm.length, theirPublicKey) >= 0); }
java
public boolean detached_verify(byte [] message, byte [] signature) { if (signature.length != signatureLength) return false; if (theirPublicKey.length != publicKeyLength) return false; byte [] sm = new byte[signatureLength + message.length]; byte [] m = new byte[signatureLength + message.length]; for (int i = 0; i < signatureLength; i++) sm[i] = signature[i]; for (int i = 0; i < message.length; i++) sm[i + signatureLength] = message[i]; return (crypto_sign_open(m, -1, sm, 0, sm.length, theirPublicKey) >= 0); }
[ "public", "boolean", "detached_verify", "(", "byte", "[", "]", "message", ",", "byte", "[", "]", "signature", ")", "{", "if", "(", "signature", ".", "length", "!=", "signatureLength", ")", "return", "false", ";", "if", "(", "theirPublicKey", ".", "length", "!=", "publicKeyLength", ")", "return", "false", ";", "byte", "[", "]", "sm", "=", "new", "byte", "[", "signatureLength", "+", "message", ".", "length", "]", ";", "byte", "[", "]", "m", "=", "new", "byte", "[", "signatureLength", "+", "message", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "signatureLength", ";", "i", "++", ")", "sm", "[", "i", "]", "=", "signature", "[", "i", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "message", ".", "length", ";", "i", "++", ")", "sm", "[", "i", "+", "signatureLength", "]", "=", "message", "[", "i", "]", ";", "return", "(", "crypto_sign_open", "(", "m", ",", "-", "1", ",", "sm", ",", "0", ",", "sm", ".", "length", ",", "theirPublicKey", ")", ">=", "0", ")", ";", "}" ]
/* @description Verifies the signature for the message and returns true if verification succeeded or false if it failed.
[ "/", "*" ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/com/iwebpp/crypto/TweetNaclFast.java#L779-L791
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java
ProfileWriterImpl.addPackageDeprecationInfo
public void addPackageDeprecationInfo(Content li, PackageDoc pkg) { """ Add the profile package deprecation information to the documentation tree. @param li the content tree to which the deprecation information will be added @param pkg the PackageDoc that is added """ Tag[] deprs; if (Util.isDeprecated(pkg)) { deprs = pkg.tags("deprecated"); HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); deprDiv.addStyle(HtmlStyle.deprecatedContent); Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); deprDiv.addContent(deprPhrase); if (deprs.length > 0) { Tag[] commentTags = deprs[0].inlineTags(); if (commentTags.length > 0) { addInlineDeprecatedComment(pkg, deprs[0], deprDiv); } } li.addContent(deprDiv); } }
java
public void addPackageDeprecationInfo(Content li, PackageDoc pkg) { Tag[] deprs; if (Util.isDeprecated(pkg)) { deprs = pkg.tags("deprecated"); HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); deprDiv.addStyle(HtmlStyle.deprecatedContent); Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); deprDiv.addContent(deprPhrase); if (deprs.length > 0) { Tag[] commentTags = deprs[0].inlineTags(); if (commentTags.length > 0) { addInlineDeprecatedComment(pkg, deprs[0], deprDiv); } } li.addContent(deprDiv); } }
[ "public", "void", "addPackageDeprecationInfo", "(", "Content", "li", ",", "PackageDoc", "pkg", ")", "{", "Tag", "[", "]", "deprs", ";", "if", "(", "Util", ".", "isDeprecated", "(", "pkg", ")", ")", "{", "deprs", "=", "pkg", ".", "tags", "(", "\"deprecated\"", ")", ";", "HtmlTree", "deprDiv", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "DIV", ")", ";", "deprDiv", ".", "addStyle", "(", "HtmlStyle", ".", "deprecatedContent", ")", ";", "Content", "deprPhrase", "=", "HtmlTree", ".", "SPAN", "(", "HtmlStyle", ".", "deprecatedLabel", ",", "deprecatedPhrase", ")", ";", "deprDiv", ".", "addContent", "(", "deprPhrase", ")", ";", "if", "(", "deprs", ".", "length", ">", "0", ")", "{", "Tag", "[", "]", "commentTags", "=", "deprs", "[", "0", "]", ".", "inlineTags", "(", ")", ";", "if", "(", "commentTags", ".", "length", ">", "0", ")", "{", "addInlineDeprecatedComment", "(", "pkg", ",", "deprs", "[", "0", "]", ",", "deprDiv", ")", ";", "}", "}", "li", ".", "addContent", "(", "deprDiv", ")", ";", "}", "}" ]
Add the profile package deprecation information to the documentation tree. @param li the content tree to which the deprecation information will be added @param pkg the PackageDoc that is added
[ "Add", "the", "profile", "package", "deprecation", "information", "to", "the", "documentation", "tree", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java#L184-L200
real-logic/agrona
agrona/src/main/java/org/agrona/IoUtil.java
IoUtil.mapExistingFile
public static MappedByteBuffer mapExistingFile( final File location, final String descriptionLabel, final long offset, final long length) { """ Check that file exists, open file, and return MappedByteBuffer for only region specified as {@link java.nio.channels.FileChannel.MapMode#READ_WRITE}. <p> The file itself will be closed, but the mapping will persist. @param location of the file to map @param descriptionLabel to be associated for an exceptions @param offset offset to start mapping at @param length length to map region @return {@link java.nio.MappedByteBuffer} for the file """ return mapExistingFile(location, READ_WRITE, descriptionLabel, offset, length); }
java
public static MappedByteBuffer mapExistingFile( final File location, final String descriptionLabel, final long offset, final long length) { return mapExistingFile(location, READ_WRITE, descriptionLabel, offset, length); }
[ "public", "static", "MappedByteBuffer", "mapExistingFile", "(", "final", "File", "location", ",", "final", "String", "descriptionLabel", ",", "final", "long", "offset", ",", "final", "long", "length", ")", "{", "return", "mapExistingFile", "(", "location", ",", "READ_WRITE", ",", "descriptionLabel", ",", "offset", ",", "length", ")", ";", "}" ]
Check that file exists, open file, and return MappedByteBuffer for only region specified as {@link java.nio.channels.FileChannel.MapMode#READ_WRITE}. <p> The file itself will be closed, but the mapping will persist. @param location of the file to map @param descriptionLabel to be associated for an exceptions @param offset offset to start mapping at @param length length to map region @return {@link java.nio.MappedByteBuffer} for the file
[ "Check", "that", "file", "exists", "open", "file", "and", "return", "MappedByteBuffer", "for", "only", "region", "specified", "as", "{", "@link", "java", ".", "nio", ".", "channels", ".", "FileChannel", ".", "MapMode#READ_WRITE", "}", ".", "<p", ">", "The", "file", "itself", "will", "be", "closed", "but", "the", "mapping", "will", "persist", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/IoUtil.java#L297-L301
apiman/apiman
manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/OrganizationResourceImpl.java
OrganizationResourceImpl.createPlanVersionInternal
protected PlanVersionBean createPlanVersionInternal(NewPlanVersionBean bean, PlanBean plan) throws StorageException { """ Creates a plan version. @param bean @param plan @throws StorageException """ if (!BeanUtils.isValidVersion(bean.getVersion())) { throw new StorageException("Invalid/illegal plan version: " + bean.getVersion()); //$NON-NLS-1$ } PlanVersionBean newVersion = new PlanVersionBean(); newVersion.setCreatedBy(securityContext.getCurrentUser()); newVersion.setCreatedOn(new Date()); newVersion.setModifiedBy(securityContext.getCurrentUser()); newVersion.setModifiedOn(new Date()); newVersion.setStatus(PlanStatus.Created); newVersion.setPlan(plan); newVersion.setVersion(bean.getVersion()); storage.createPlanVersion(newVersion); storage.createAuditEntry(AuditUtils.planVersionCreated(newVersion, securityContext)); return newVersion; }
java
protected PlanVersionBean createPlanVersionInternal(NewPlanVersionBean bean, PlanBean plan) throws StorageException { if (!BeanUtils.isValidVersion(bean.getVersion())) { throw new StorageException("Invalid/illegal plan version: " + bean.getVersion()); //$NON-NLS-1$ } PlanVersionBean newVersion = new PlanVersionBean(); newVersion.setCreatedBy(securityContext.getCurrentUser()); newVersion.setCreatedOn(new Date()); newVersion.setModifiedBy(securityContext.getCurrentUser()); newVersion.setModifiedOn(new Date()); newVersion.setStatus(PlanStatus.Created); newVersion.setPlan(plan); newVersion.setVersion(bean.getVersion()); storage.createPlanVersion(newVersion); storage.createAuditEntry(AuditUtils.planVersionCreated(newVersion, securityContext)); return newVersion; }
[ "protected", "PlanVersionBean", "createPlanVersionInternal", "(", "NewPlanVersionBean", "bean", ",", "PlanBean", "plan", ")", "throws", "StorageException", "{", "if", "(", "!", "BeanUtils", ".", "isValidVersion", "(", "bean", ".", "getVersion", "(", ")", ")", ")", "{", "throw", "new", "StorageException", "(", "\"Invalid/illegal plan version: \"", "+", "bean", ".", "getVersion", "(", ")", ")", ";", "//$NON-NLS-1$", "}", "PlanVersionBean", "newVersion", "=", "new", "PlanVersionBean", "(", ")", ";", "newVersion", ".", "setCreatedBy", "(", "securityContext", ".", "getCurrentUser", "(", ")", ")", ";", "newVersion", ".", "setCreatedOn", "(", "new", "Date", "(", ")", ")", ";", "newVersion", ".", "setModifiedBy", "(", "securityContext", ".", "getCurrentUser", "(", ")", ")", ";", "newVersion", ".", "setModifiedOn", "(", "new", "Date", "(", ")", ")", ";", "newVersion", ".", "setStatus", "(", "PlanStatus", ".", "Created", ")", ";", "newVersion", ".", "setPlan", "(", "plan", ")", ";", "newVersion", ".", "setVersion", "(", "bean", ".", "getVersion", "(", ")", ")", ";", "storage", ".", "createPlanVersion", "(", "newVersion", ")", ";", "storage", ".", "createAuditEntry", "(", "AuditUtils", ".", "planVersionCreated", "(", "newVersion", ",", "securityContext", ")", ")", ";", "return", "newVersion", ";", "}" ]
Creates a plan version. @param bean @param plan @throws StorageException
[ "Creates", "a", "plan", "version", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/OrganizationResourceImpl.java#L2892-L2909
h2oai/h2o-3
h2o-core/src/main/java/water/util/VecUtils.java
VecUtils.numericToStringVec
public static Vec numericToStringVec(Vec src) { """ Create a new {@link Vec} of string values from a numeric {@link Vec}. Currently only uses a default pretty printer. Would be better if it accepted a format string PUBDEV-2211 @param src a numeric {@link Vec} @return a string {@link Vec} """ if (src.isCategorical() || src.isUUID()) throw new H2OIllegalValueException("Cannot convert a non-numeric column" + " using numericToStringVec() ",src); Vec res = new MRTask() { @Override public void map(Chunk chk, NewChunk newChk) { if (chk instanceof C0DChunk) { // all NAs for (int i=0; i < chk._len; i++) newChk.addNA(); } else { for (int i=0; i < chk._len; i++) { if (!chk.isNA(i)) newChk.addStr(PrettyPrint.number(chk, chk.atd(i), 4)); else newChk.addNA(); } } } }.doAll(Vec.T_STR, src).outputFrame().anyVec(); assert res != null; return res; }
java
public static Vec numericToStringVec(Vec src) { if (src.isCategorical() || src.isUUID()) throw new H2OIllegalValueException("Cannot convert a non-numeric column" + " using numericToStringVec() ",src); Vec res = new MRTask() { @Override public void map(Chunk chk, NewChunk newChk) { if (chk instanceof C0DChunk) { // all NAs for (int i=0; i < chk._len; i++) newChk.addNA(); } else { for (int i=0; i < chk._len; i++) { if (!chk.isNA(i)) newChk.addStr(PrettyPrint.number(chk, chk.atd(i), 4)); else newChk.addNA(); } } } }.doAll(Vec.T_STR, src).outputFrame().anyVec(); assert res != null; return res; }
[ "public", "static", "Vec", "numericToStringVec", "(", "Vec", "src", ")", "{", "if", "(", "src", ".", "isCategorical", "(", ")", "||", "src", ".", "isUUID", "(", ")", ")", "throw", "new", "H2OIllegalValueException", "(", "\"Cannot convert a non-numeric column\"", "+", "\" using numericToStringVec() \"", ",", "src", ")", ";", "Vec", "res", "=", "new", "MRTask", "(", ")", "{", "@", "Override", "public", "void", "map", "(", "Chunk", "chk", ",", "NewChunk", "newChk", ")", "{", "if", "(", "chk", "instanceof", "C0DChunk", ")", "{", "// all NAs", "for", "(", "int", "i", "=", "0", ";", "i", "<", "chk", ".", "_len", ";", "i", "++", ")", "newChk", ".", "addNA", "(", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "chk", ".", "_len", ";", "i", "++", ")", "{", "if", "(", "!", "chk", ".", "isNA", "(", "i", ")", ")", "newChk", ".", "addStr", "(", "PrettyPrint", ".", "number", "(", "chk", ",", "chk", ".", "atd", "(", "i", ")", ",", "4", ")", ")", ";", "else", "newChk", ".", "addNA", "(", ")", ";", "}", "}", "}", "}", ".", "doAll", "(", "Vec", ".", "T_STR", ",", "src", ")", ".", "outputFrame", "(", ")", ".", "anyVec", "(", ")", ";", "assert", "res", "!=", "null", ";", "return", "res", ";", "}" ]
Create a new {@link Vec} of string values from a numeric {@link Vec}. Currently only uses a default pretty printer. Would be better if it accepted a format string PUBDEV-2211 @param src a numeric {@link Vec} @return a string {@link Vec}
[ "Create", "a", "new", "{", "@link", "Vec", "}", "of", "string", "values", "from", "a", "numeric", "{", "@link", "Vec", "}", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/VecUtils.java#L335-L357
sahan/IckleBot
icklebot/src/main/java/com/lonepulse/icklebot/fragment/InjectionFragment.java
InjectionFragment.onViewCreated
@Override public void onViewCreated(View view, Bundle savedInstanceState) { """ <p>Performs <b>dependency injection</b> by invoking {@link InjectionUtils#inject()}.</p> """ super.onViewCreated(view, savedInstanceState); InjectionUtils.inject(INJECTOR_CONFIGURATION); }
java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); InjectionUtils.inject(INJECTOR_CONFIGURATION); }
[ "@", "Override", "public", "void", "onViewCreated", "(", "View", "view", ",", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onViewCreated", "(", "view", ",", "savedInstanceState", ")", ";", "InjectionUtils", ".", "inject", "(", "INJECTOR_CONFIGURATION", ")", ";", "}" ]
<p>Performs <b>dependency injection</b> by invoking {@link InjectionUtils#inject()}.</p>
[ "<p", ">", "Performs", "<b", ">", "dependency", "injection<", "/", "b", ">", "by", "invoking", "{" ]
train
https://github.com/sahan/IckleBot/blob/a19003ceb3ad7c7ee508dc23a8cb31b5676aa499/icklebot/src/main/java/com/lonepulse/icklebot/fragment/InjectionFragment.java#L64-L69