repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
att/AAF
authz/authz-cass/src/main/java/com/att/dao/aaf/cached/CachedUserRoleDAO.java
CachedUserRoleDAO.readByUser
public Result<List<Data>> readByUser(AuthzTrans trans, final String user) { DAOGetter getter = new DAOGetter(trans,dao()) { public Result<List<Data>> call() { // If the call is for THIS user, and it exists, get from TRANS, add to TRANS if not. if(user!=null && user.equals(trans.user())) { Result<List<Data>> transLD = trans.get(transURSlot,null); if(transLD==null ) { transLD = dao.readByUser(trans, user); } return transLD; } else { return dao.readByUser(trans, user); } } }; Result<List<Data>> lurd = get(trans, user, getter); if(lurd.isOK() && lurd.isEmpty()) { return Result.err(Status.ERR_UserRoleNotFound,"UserRole not found for [%s]",user); } return lurd; }
java
public Result<List<Data>> readByUser(AuthzTrans trans, final String user) { DAOGetter getter = new DAOGetter(trans,dao()) { public Result<List<Data>> call() { // If the call is for THIS user, and it exists, get from TRANS, add to TRANS if not. if(user!=null && user.equals(trans.user())) { Result<List<Data>> transLD = trans.get(transURSlot,null); if(transLD==null ) { transLD = dao.readByUser(trans, user); } return transLD; } else { return dao.readByUser(trans, user); } } }; Result<List<Data>> lurd = get(trans, user, getter); if(lurd.isOK() && lurd.isEmpty()) { return Result.err(Status.ERR_UserRoleNotFound,"UserRole not found for [%s]",user); } return lurd; }
[ "public", "Result", "<", "List", "<", "Data", ">", ">", "readByUser", "(", "AuthzTrans", "trans", ",", "final", "String", "user", ")", "{", "DAOGetter", "getter", "=", "new", "DAOGetter", "(", "trans", ",", "dao", "(", ")", ")", "{", "public", "Result"...
Special Case. User Roles by User are very likely to be called many times in a Transaction, to validate "May User do..." Pull result, and make accessible by the Trans, which is always keyed by User. @param trans @param user @return
[ "Special", "Case", ".", "User", "Roles", "by", "User", "are", "very", "likely", "to", "be", "called", "many", "times", "in", "a", "Transaction", "to", "validate", "May", "User", "do", "...", "Pull", "result", "and", "make", "accessible", "by", "the", "Tr...
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/cached/CachedUserRoleDAO.java#L34-L54
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java
EntityCapsManager.verifyDiscoverInfoVersion
public static boolean verifyDiscoverInfoVersion(String ver, String hash, DiscoverInfo info) { // step 3.3 check for duplicate identities if (info.containsDuplicateIdentities()) return false; // step 3.4 check for duplicate features if (info.containsDuplicateFeatures()) return false; // step 3.5 check for well-formed packet extensions if (verifyPacketExtensions(info)) return false; String calculatedVer = generateVerificationString(info, hash).version; if (!ver.equals(calculatedVer)) return false; return true; }
java
public static boolean verifyDiscoverInfoVersion(String ver, String hash, DiscoverInfo info) { // step 3.3 check for duplicate identities if (info.containsDuplicateIdentities()) return false; // step 3.4 check for duplicate features if (info.containsDuplicateFeatures()) return false; // step 3.5 check for well-formed packet extensions if (verifyPacketExtensions(info)) return false; String calculatedVer = generateVerificationString(info, hash).version; if (!ver.equals(calculatedVer)) return false; return true; }
[ "public", "static", "boolean", "verifyDiscoverInfoVersion", "(", "String", "ver", ",", "String", "hash", ",", "DiscoverInfo", "info", ")", "{", "// step 3.3 check for duplicate identities", "if", "(", "info", ".", "containsDuplicateIdentities", "(", ")", ")", "return"...
Verify DiscoverInfo and Caps Node as defined in XEP-0115 5.4 Processing Method. @see <a href="http://xmpp.org/extensions/xep-0115.html#ver-proc">XEP-0115 5.4 Processing Method</a> @param ver @param hash @param info @return true if it's valid and should be cache, false if not
[ "Verify", "DiscoverInfo", "and", "Caps", "Node", "as", "defined", "in", "XEP", "-", "0115", "5", ".", "4", "Processing", "Method", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java#L584-L603
jmeetsma/Iglu-Http
src/main/java/org/ijsberg/iglu/util/http/ServletSupport.java
ServletSupport.writeClassPathResource
public static void writeClassPathResource(HttpServletResponse response, String path, String contentType) throws IOException { if (path.startsWith("/")) { path = path.substring(1); } // System.out.println(new LogEntry("trying to retrieve " + path + " from classloader"); InputStream input = ServletSupport.class.getClassLoader().getResourceAsStream(path); if (input != null) { response.setContentType(contentType); OutputStream out = response.getOutputStream(); int available = input.available(); while (available > 0) { byte[] buf = new byte[available]; input.read(buf); out.write(buf); available = input.available(); } } else { System.out.println(new LogEntry("resource " + path + " not found")); } }
java
public static void writeClassPathResource(HttpServletResponse response, String path, String contentType) throws IOException { if (path.startsWith("/")) { path = path.substring(1); } // System.out.println(new LogEntry("trying to retrieve " + path + " from classloader"); InputStream input = ServletSupport.class.getClassLoader().getResourceAsStream(path); if (input != null) { response.setContentType(contentType); OutputStream out = response.getOutputStream(); int available = input.available(); while (available > 0) { byte[] buf = new byte[available]; input.read(buf); out.write(buf); available = input.available(); } } else { System.out.println(new LogEntry("resource " + path + " not found")); } }
[ "public", "static", "void", "writeClassPathResource", "(", "HttpServletResponse", "response", ",", "String", "path", ",", "String", "contentType", ")", "throws", "IOException", "{", "if", "(", "path", ".", "startsWith", "(", "\"/\"", ")", ")", "{", "path", "="...
Obtains binary resource from classpath and writes it to http response. @param response @param path file name of the resource to write to http servlet response @param contentType
[ "Obtains", "binary", "resource", "from", "classpath", "and", "writes", "it", "to", "http", "response", "." ]
train
https://github.com/jmeetsma/Iglu-Http/blob/5b5ed3b417285dc79b7aa013bf2340bb5ba1ffbe/src/main/java/org/ijsberg/iglu/util/http/ServletSupport.java#L656-L682
Jasig/uPortal
uPortal-url/src/main/java/org/apereo/portal/url/UrlStringBuilder.java
UrlStringBuilder.addParameters
public UrlStringBuilder addParameters(String namespace, Map<String, List<String>> parameters) { for (final String name : parameters.keySet()) { Validate.notNull(name, "parameter map cannot contain any null keys"); } for (final Map.Entry<String, List<String>> newParamEntry : parameters.entrySet()) { final String name = newParamEntry.getKey(); final List<String> values = this.copy(newParamEntry.getValue()); this.parameters.put(namespace + name, values); } return this; }
java
public UrlStringBuilder addParameters(String namespace, Map<String, List<String>> parameters) { for (final String name : parameters.keySet()) { Validate.notNull(name, "parameter map cannot contain any null keys"); } for (final Map.Entry<String, List<String>> newParamEntry : parameters.entrySet()) { final String name = newParamEntry.getKey(); final List<String> values = this.copy(newParamEntry.getValue()); this.parameters.put(namespace + name, values); } return this; }
[ "public", "UrlStringBuilder", "addParameters", "(", "String", "namespace", ",", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "parameters", ")", "{", "for", "(", "final", "String", "name", ":", "parameters", ".", "keySet", "(", ")", ")", "{...
Adds the contents of the specified Map as the parameters, the values of the Map are List<String> @param namespace String to prepend to each parameter name in the Map @param parameters Map of parameters to set @return this
[ "Adds", "the", "contents", "of", "the", "specified", "Map", "as", "the", "parameters", "the", "values", "of", "the", "Map", "are", "List<String", ">" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-url/src/main/java/org/apereo/portal/url/UrlStringBuilder.java#L202-L214
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java
DataFrameJoiner.leftOuter
public Table leftOuter(Table table2, String col2Name) { return leftOuter(table2, false, col2Name); }
java
public Table leftOuter(Table table2, String col2Name) { return leftOuter(table2, false, col2Name); }
[ "public", "Table", "leftOuter", "(", "Table", "table2", ",", "String", "col2Name", ")", "{", "return", "leftOuter", "(", "table2", ",", "false", ",", "col2Name", ")", ";", "}" ]
Joins the joiner to the table2, using the given column for the second table and returns the resulting table @param table2 The table to join with @param col2Name The column to join on. If col2Name refers to a double column, the join is performed after rounding to integers. @return The resulting table
[ "Joins", "the", "joiner", "to", "the", "table2", "using", "the", "given", "column", "for", "the", "second", "table", "and", "returns", "the", "resulting", "table" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java#L526-L528
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/Assert.java
Assert.isAssignableTo
public static void isAssignableTo(Class<?> from, Class<?> to, String message, Object... arguments) { isAssignableTo(from, to, new ClassCastException(format(message, arguments))); }
java
public static void isAssignableTo(Class<?> from, Class<?> to, String message, Object... arguments) { isAssignableTo(from, to, new ClassCastException(format(message, arguments))); }
[ "public", "static", "void", "isAssignableTo", "(", "Class", "<", "?", ">", "from", ",", "Class", "<", "?", ">", "to", ",", "String", "message", ",", "Object", "...", "arguments", ")", "{", "isAssignableTo", "(", "from", ",", "to", ",", "new", "ClassCas...
Asserts that the {@link Class 'from' class type} is assignable to the {@link Class 'to' class type}. The assertion holds if and only if the {@link Class 'from' class type} is the same as or a subclass of the {@link Class 'to' class type}. @param from {@link Class class type} being evaluated for assignment compatibility with the {@link Class 'to' class type}. @param to {@link Class class type} used to determine if the {@link Class 'from' class type} is assignment compatible. @param message {@link String} containing the message used in the {@link ClassCastException} thrown if the assertion fails. @param arguments array of {@link Object arguments} used as placeholder values when formatting the {@link String message}. @throws java.lang.ClassCastException if the {@link Class 'from' class type} is not assignment compatible with the {@link Class 'to' class type}. @see #isAssignableTo(Class, Class, RuntimeException) @see java.lang.Class#isAssignableFrom(Class)
[ "Asserts", "that", "the", "{", "@link", "Class", "from", "class", "type", "}", "is", "assignable", "to", "the", "{", "@link", "Class", "to", "class", "type", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L543-L545
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/PaxDate.java
PaxDate.ofYearDay
static PaxDate ofYearDay(int prolepticYear, int dayOfYear) { YEAR.checkValidValue(prolepticYear); PaxChronology.DAY_OF_YEAR_RANGE.checkValidValue(dayOfYear, DAY_OF_YEAR); boolean leap = PaxChronology.INSTANCE.isLeapYear(prolepticYear); if (dayOfYear > DAYS_IN_YEAR && !leap) { throw new DateTimeException("Invalid date 'DayOfYear " + dayOfYear + "' as '" + prolepticYear + "' is not a leap year"); } int month = ((dayOfYear - 1) / DAYS_IN_MONTH) + 1; // In leap years, the leap-month is shorter than the following month, so needs to be adjusted. if (leap && month == MONTHS_IN_YEAR && dayOfYear >= (DAYS_IN_YEAR + DAYS_IN_WEEK) - DAYS_IN_MONTH + 1) { month++; } // Subtract days-at-start-of-month from days in year int dayOfMonth = dayOfYear - (month - 1) * DAYS_IN_MONTH; // Adjust for shorter inserted leap-month. if (month == MONTHS_IN_YEAR + 1) { dayOfMonth += (DAYS_IN_MONTH - DAYS_IN_WEEK); } return of(prolepticYear, month, dayOfMonth); }
java
static PaxDate ofYearDay(int prolepticYear, int dayOfYear) { YEAR.checkValidValue(prolepticYear); PaxChronology.DAY_OF_YEAR_RANGE.checkValidValue(dayOfYear, DAY_OF_YEAR); boolean leap = PaxChronology.INSTANCE.isLeapYear(prolepticYear); if (dayOfYear > DAYS_IN_YEAR && !leap) { throw new DateTimeException("Invalid date 'DayOfYear " + dayOfYear + "' as '" + prolepticYear + "' is not a leap year"); } int month = ((dayOfYear - 1) / DAYS_IN_MONTH) + 1; // In leap years, the leap-month is shorter than the following month, so needs to be adjusted. if (leap && month == MONTHS_IN_YEAR && dayOfYear >= (DAYS_IN_YEAR + DAYS_IN_WEEK) - DAYS_IN_MONTH + 1) { month++; } // Subtract days-at-start-of-month from days in year int dayOfMonth = dayOfYear - (month - 1) * DAYS_IN_MONTH; // Adjust for shorter inserted leap-month. if (month == MONTHS_IN_YEAR + 1) { dayOfMonth += (DAYS_IN_MONTH - DAYS_IN_WEEK); } return of(prolepticYear, month, dayOfMonth); }
[ "static", "PaxDate", "ofYearDay", "(", "int", "prolepticYear", ",", "int", "dayOfYear", ")", "{", "YEAR", ".", "checkValidValue", "(", "prolepticYear", ")", ";", "PaxChronology", ".", "DAY_OF_YEAR_RANGE", ".", "checkValidValue", "(", "dayOfYear", ",", "DAY_OF_YEAR...
Obtains a {@code PaxDate} representing a date in the Pax calendar system from the proleptic-year and day-of-year fields. <p> This returns a {@code PaxDate} with the specified fields. The day must be valid for the year, otherwise an exception will be thrown. @param prolepticYear the Pax proleptic-year @param dayOfYear the Pax day-of-year, from 1 to 371 @return the date in Pax calendar system, not null @throws DateTimeException if the value of any field is out of range, or if the day-of-year is invalid for the year
[ "Obtains", "a", "{", "@code", "PaxDate", "}", "representing", "a", "date", "in", "the", "Pax", "calendar", "system", "from", "the", "proleptic", "-", "year", "and", "day", "-", "of", "-", "year", "fields", ".", "<p", ">", "This", "returns", "a", "{", ...
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/PaxDate.java#L248-L272
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/protocol/version07/Base64.java
Base64.encodeFromFile
public static String encodeFromFile(String filename) throws java.io.IOException { String encodedData = null; Base64.InputStream bis = null; try { // Set up some useful variables Path file = Paths.get(filename); byte[] buffer = new byte[Math.max((int) (Files.size(file) * 1.4 + 1), 40)]; // Need max() for math on small files // (v2.2.1); Need +1 for a few corner cases // (v2.3.5) int length = 0; int numBytes; // Open a stream bis = new Base64.InputStream(new java.io.BufferedInputStream(Files.newInputStream(file)), Base64.ENCODE); // Read until done while ((numBytes = bis.read(buffer, length, 4096)) >= 0) { length += numBytes; } // end while // Save in a variable to return encodedData = new String(buffer, 0, length, StandardCharsets.US_ASCII); } // end try catch (java.io.IOException e) { throw e; // Catch and release to execute finally{} } // end catch: java.io.IOException finally { try { bis.close(); } catch (Exception e) { } } // end finally return encodedData; }
java
public static String encodeFromFile(String filename) throws java.io.IOException { String encodedData = null; Base64.InputStream bis = null; try { // Set up some useful variables Path file = Paths.get(filename); byte[] buffer = new byte[Math.max((int) (Files.size(file) * 1.4 + 1), 40)]; // Need max() for math on small files // (v2.2.1); Need +1 for a few corner cases // (v2.3.5) int length = 0; int numBytes; // Open a stream bis = new Base64.InputStream(new java.io.BufferedInputStream(Files.newInputStream(file)), Base64.ENCODE); // Read until done while ((numBytes = bis.read(buffer, length, 4096)) >= 0) { length += numBytes; } // end while // Save in a variable to return encodedData = new String(buffer, 0, length, StandardCharsets.US_ASCII); } // end try catch (java.io.IOException e) { throw e; // Catch and release to execute finally{} } // end catch: java.io.IOException finally { try { bis.close(); } catch (Exception e) { } } // end finally return encodedData; }
[ "public", "static", "String", "encodeFromFile", "(", "String", "filename", ")", "throws", "java", ".", "io", ".", "IOException", "{", "String", "encodedData", "=", "null", ";", "Base64", ".", "InputStream", "bis", "=", "null", ";", "try", "{", "// Set up som...
Convenience method for reading a binary file and base64-encoding it. <p> As of v 2.3, if there is a error, the method will throw an java.io.IOException. <b>This is new to v2.3!</b> In earlier versions, it just returned false, but in retrospect that's a pretty poor way to handle it. </p> @param filename Filename for reading binary data @return base64-encoded string @throws java.io.IOException if there is an error @since 2.1
[ "Convenience", "method", "for", "reading", "a", "binary", "file", "and", "base64", "-", "encoding", "it", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/protocol/version07/Base64.java#L1411-L1447
kaazing/gateway
resource.address/tcp/src/main/java/org/kaazing/gateway/resource/address/tcp/TcpResourceAddressFactorySpi.java
TcpResourceAddressFactorySpi.throwPreferedIPv4StackIPv6AddressError
private void throwPreferedIPv4StackIPv6AddressError(String location, List<TcpResourceAddress> tcpAddresses) { try { InetAddress address = InetAddress.getByName(URIUtils.getHost(location)); boolean preferIPv4Stack = Boolean.parseBoolean(System.getProperty(JAVA_NET_PREFER_IPV4_STACK)); if (preferIPv4Stack && (address instanceof Inet6Address)) { throw new IllegalArgumentException(format(PREFER_IPV4_STACK_IPV6_ADDRESS_EXCEPTION_FORMATTER, location)); } } catch (UnknownHostException e) { // InetAddress.getByName(hostAddress) throws an exception (hostAddress may have an // unsupported format, e.g. network interface syntax) } }
java
private void throwPreferedIPv4StackIPv6AddressError(String location, List<TcpResourceAddress> tcpAddresses) { try { InetAddress address = InetAddress.getByName(URIUtils.getHost(location)); boolean preferIPv4Stack = Boolean.parseBoolean(System.getProperty(JAVA_NET_PREFER_IPV4_STACK)); if (preferIPv4Stack && (address instanceof Inet6Address)) { throw new IllegalArgumentException(format(PREFER_IPV4_STACK_IPV6_ADDRESS_EXCEPTION_FORMATTER, location)); } } catch (UnknownHostException e) { // InetAddress.getByName(hostAddress) throws an exception (hostAddress may have an // unsupported format, e.g. network interface syntax) } }
[ "private", "void", "throwPreferedIPv4StackIPv6AddressError", "(", "String", "location", ",", "List", "<", "TcpResourceAddress", ">", "tcpAddresses", ")", "{", "try", "{", "InetAddress", "address", "=", "InetAddress", ".", "getByName", "(", "URIUtils", ".", "getHost"...
Throw error on specific circumstances: - no addresses available for binding - when PreferedIPv4 flag is true and the host IP is IPV6 @param location @param tcpAddresses
[ "Throw", "error", "on", "specific", "circumstances", ":", "-", "no", "addresses", "available", "for", "binding", "-", "when", "PreferedIPv4", "flag", "is", "true", "and", "the", "host", "IP", "is", "IPV6" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/resource.address/tcp/src/main/java/org/kaazing/gateway/resource/address/tcp/TcpResourceAddressFactorySpi.java#L288-L299
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.acceptSessionFromConnectionStringBuilder
public static IMessageSession acceptSessionFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId) throws InterruptedException, ServiceBusException { return acceptSessionFromConnectionStringBuilder(amqpConnectionStringBuilder, sessionId, DEFAULTRECEIVEMODE); }
java
public static IMessageSession acceptSessionFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId) throws InterruptedException, ServiceBusException { return acceptSessionFromConnectionStringBuilder(amqpConnectionStringBuilder, sessionId, DEFAULTRECEIVEMODE); }
[ "public", "static", "IMessageSession", "acceptSessionFromConnectionStringBuilder", "(", "ConnectionStringBuilder", "amqpConnectionStringBuilder", ",", "String", "sessionId", ")", "throws", "InterruptedException", ",", "ServiceBusException", "{", "return", "acceptSessionFromConnecti...
Accept a {@link IMessageSession} in default {@link ReceiveMode#PEEKLOCK} mode from service bus connection string builder with specified session id. Session Id can be null, if null, service will return the first available session. @param amqpConnectionStringBuilder the connection string builder @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session @return {@link IMessageSession} instance @throws InterruptedException if the current thread was interrupted while waiting @throws ServiceBusException if the session cannot be accepted
[ "Accept", "a", "{", "@link", "IMessageSession", "}", "in", "default", "{", "@link", "ReceiveMode#PEEKLOCK", "}", "mode", "from", "service", "bus", "connection", "string", "builder", "with", "specified", "session", "id", ".", "Session", "Id", "can", "be", "null...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L512-L514
belaban/JGroups
src/org/jgroups/blocks/MessageDispatcher.java
MessageDispatcher.sendMessage
public <T> T sendMessage(Address dest, Buffer data, RequestOptions opts) throws Exception { if(dest == null) throw new IllegalArgumentException("message destination is null, cannot send message"); if(opts == null) { log.warn("request options were null, using default of sync"); opts=RequestOptions.SYNC(); } // invoke an async RPC directly and return null, without creating a UnicastRequest instance if(opts.mode() == ResponseMode.GET_NONE) { rpc_stats.add(RpcStats.Type.UNICAST, dest, false, 0); corr.sendUnicastRequest(dest, data, null, opts); return null; } // now it must be a sync RPC UnicastRequest<T> req=new UnicastRequest<>(corr, dest, opts); long start=!rpc_stats.extendedStats()? 0 : System.nanoTime(); try { return req.execute(data, true); } finally { long time=!rpc_stats.extendedStats()? 0 : System.nanoTime() - start; rpc_stats.add(RpcStats.Type.UNICAST, dest, true, time); } }
java
public <T> T sendMessage(Address dest, Buffer data, RequestOptions opts) throws Exception { if(dest == null) throw new IllegalArgumentException("message destination is null, cannot send message"); if(opts == null) { log.warn("request options were null, using default of sync"); opts=RequestOptions.SYNC(); } // invoke an async RPC directly and return null, without creating a UnicastRequest instance if(opts.mode() == ResponseMode.GET_NONE) { rpc_stats.add(RpcStats.Type.UNICAST, dest, false, 0); corr.sendUnicastRequest(dest, data, null, opts); return null; } // now it must be a sync RPC UnicastRequest<T> req=new UnicastRequest<>(corr, dest, opts); long start=!rpc_stats.extendedStats()? 0 : System.nanoTime(); try { return req.execute(data, true); } finally { long time=!rpc_stats.extendedStats()? 0 : System.nanoTime() - start; rpc_stats.add(RpcStats.Type.UNICAST, dest, true, time); } }
[ "public", "<", "T", ">", "T", "sendMessage", "(", "Address", "dest", ",", "Buffer", "data", ",", "RequestOptions", "opts", ")", "throws", "Exception", "{", "if", "(", "dest", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"message dest...
Sends a unicast message and - depending on the options - returns a result @param dest the target to which to send the unicast message. Must not be null. @param data the payload to send @param opts the options to be used @return T the result. Null if the call is asynchronous (non-blocking) or if the response is null @throws Exception If there was problem sending the request, processing it at the receiver, or processing it at the sender. @throws TimeoutException If the call didn't succeed within the timeout defined in options (if set)
[ "Sends", "a", "unicast", "message", "and", "-", "depending", "on", "the", "options", "-", "returns", "a", "result" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/MessageDispatcher.java#L358-L384
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/parser/lexparser/BaseLexicon.java
BaseLexicon.addTagging
protected void addTagging(boolean seen, IntTaggedWord itw, double count) { if (seen) { seenCounter.incrementCount(itw, count); if (itw.tag() == nullTag) { words.add(itw); } else if (itw.word() == nullWord) { tags.add(itw); } else { // rules.add(itw); } } else { uwModel.addTagging(seen, itw, count); // if (itw.tag() == nullTag) { // sigs.add(itw); // } } }
java
protected void addTagging(boolean seen, IntTaggedWord itw, double count) { if (seen) { seenCounter.incrementCount(itw, count); if (itw.tag() == nullTag) { words.add(itw); } else if (itw.word() == nullWord) { tags.add(itw); } else { // rules.add(itw); } } else { uwModel.addTagging(seen, itw, count); // if (itw.tag() == nullTag) { // sigs.add(itw); // } } }
[ "protected", "void", "addTagging", "(", "boolean", "seen", ",", "IntTaggedWord", "itw", ",", "double", "count", ")", "{", "if", "(", "seen", ")", "{", "seenCounter", ".", "incrementCount", "(", "itw", ",", "count", ")", ";", "if", "(", "itw", ".", "tag...
Adds the tagging with count to the data structures in this Lexicon.
[ "Adds", "the", "tagging", "with", "count", "to", "the", "data", "structures", "in", "this", "Lexicon", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/BaseLexicon.java#L437-L453
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/util/Memory.java
Memory.setBytes
public void setBytes(long memoryOffset, byte[] buffer, int bufferOffset, int count) { if (buffer == null) throw new NullPointerException(); else if (bufferOffset < 0 || count < 0 || bufferOffset + count > buffer.length) throw new IndexOutOfBoundsException(); else if (count == 0) return; long end = memoryOffset + count; checkBounds(memoryOffset, end); unsafe.copyMemory(buffer, BYTE_ARRAY_BASE_OFFSET + bufferOffset, null, peer + memoryOffset, count); }
java
public void setBytes(long memoryOffset, byte[] buffer, int bufferOffset, int count) { if (buffer == null) throw new NullPointerException(); else if (bufferOffset < 0 || count < 0 || bufferOffset + count > buffer.length) throw new IndexOutOfBoundsException(); else if (count == 0) return; long end = memoryOffset + count; checkBounds(memoryOffset, end); unsafe.copyMemory(buffer, BYTE_ARRAY_BASE_OFFSET + bufferOffset, null, peer + memoryOffset, count); }
[ "public", "void", "setBytes", "(", "long", "memoryOffset", ",", "byte", "[", "]", "buffer", ",", "int", "bufferOffset", ",", "int", "count", ")", "{", "if", "(", "buffer", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "else", ...
Transfers count bytes from buffer to Memory @param memoryOffset start offset in the memory @param buffer the data buffer @param bufferOffset start offset of the buffer @param count number of bytes to transfer
[ "Transfers", "count", "bytes", "from", "buffer", "to", "Memory" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/util/Memory.java#L224-L239
HadoopGenomics/Hadoop-BAM
src/main/java/org/seqdoop/hadoop_bam/util/MurmurHash3.java
MurmurHash3.murmurhash3
public static long murmurhash3(CharSequence chars, int seed) { final int len = chars.length(); final int nblocks = len / 8; long h1 = seed; long h2 = seed; final long c1 = 0x87c37b91114253d5L; final long c2 = 0x4cf5ad432745937fL; for (int i = 0; i < nblocks; ++i) { int i0 = (i*2 + 0) * 4; int i1 = (i*2 + 1) * 4; long k1 = (long)chars.charAt(i0) | (long)chars.charAt(i0+1) << 16 | (long)chars.charAt(i0+2) << 32 | (long)chars.charAt(i0+3) << 48; long k2 = (long)chars.charAt(i1) | (long)chars.charAt(i1+1) << 16 | (long)chars.charAt(i1+2) << 32 | (long)chars.charAt(i1+3) << 48; k1 *= c1; k1 = k1 << 31 | k1 >>> (64-31); k1 *= c2; h1 ^= k1; h1 = h1 << 27 | h1 >>> (64-27); h1 += h2; h1 = h1*5 + 0x52dce729; k2 *= c2; k2 = k2 << 33 | k2 >>> (64-33); k2 *= c1; h2 ^= k2; h2 = h2 << 31 | h1 >>> (64-31); h2 += h1; h2 = h2*5 + 0x38495ab5; } long k1 = 0; long k2 = 0; switch (len & 7) { case 7: k2 ^= (long)chars.charAt(6) << 32; case 6: k2 ^= (long)chars.charAt(5) << 16; case 5: k2 ^= (long)chars.charAt(4) << 0; k2 *= c2; k2 = k2 << 33 | k2 >>> (64-33); k2 *= c1; h2 ^= k2; case 4: k1 ^= (long)chars.charAt(3) << 48; case 3: k1 ^= (long)chars.charAt(2) << 32; case 2: k1 ^= (long)chars.charAt(1) << 16; case 1: k1 ^= (long)chars.charAt(0) << 0; k1 *= c1; k1 = k1 << 31 | k1 >>> (64-31); k1 *= c2; h1 ^= k1; case 0: break; } h1 ^= len; h2 ^= len; h1 += h2; h2 += h1; h1 = fmix(h1); h2 = fmix(h2); h1 += h2; // h2 += h1; return h1; }
java
public static long murmurhash3(CharSequence chars, int seed) { final int len = chars.length(); final int nblocks = len / 8; long h1 = seed; long h2 = seed; final long c1 = 0x87c37b91114253d5L; final long c2 = 0x4cf5ad432745937fL; for (int i = 0; i < nblocks; ++i) { int i0 = (i*2 + 0) * 4; int i1 = (i*2 + 1) * 4; long k1 = (long)chars.charAt(i0) | (long)chars.charAt(i0+1) << 16 | (long)chars.charAt(i0+2) << 32 | (long)chars.charAt(i0+3) << 48; long k2 = (long)chars.charAt(i1) | (long)chars.charAt(i1+1) << 16 | (long)chars.charAt(i1+2) << 32 | (long)chars.charAt(i1+3) << 48; k1 *= c1; k1 = k1 << 31 | k1 >>> (64-31); k1 *= c2; h1 ^= k1; h1 = h1 << 27 | h1 >>> (64-27); h1 += h2; h1 = h1*5 + 0x52dce729; k2 *= c2; k2 = k2 << 33 | k2 >>> (64-33); k2 *= c1; h2 ^= k2; h2 = h2 << 31 | h1 >>> (64-31); h2 += h1; h2 = h2*5 + 0x38495ab5; } long k1 = 0; long k2 = 0; switch (len & 7) { case 7: k2 ^= (long)chars.charAt(6) << 32; case 6: k2 ^= (long)chars.charAt(5) << 16; case 5: k2 ^= (long)chars.charAt(4) << 0; k2 *= c2; k2 = k2 << 33 | k2 >>> (64-33); k2 *= c1; h2 ^= k2; case 4: k1 ^= (long)chars.charAt(3) << 48; case 3: k1 ^= (long)chars.charAt(2) << 32; case 2: k1 ^= (long)chars.charAt(1) << 16; case 1: k1 ^= (long)chars.charAt(0) << 0; k1 *= c1; k1 = k1 << 31 | k1 >>> (64-31); k1 *= c2; h1 ^= k1; case 0: break; } h1 ^= len; h2 ^= len; h1 += h2; h2 += h1; h1 = fmix(h1); h2 = fmix(h2); h1 += h2; // h2 += h1; return h1; }
[ "public", "static", "long", "murmurhash3", "(", "CharSequence", "chars", ",", "int", "seed", ")", "{", "final", "int", "len", "=", "chars", ".", "length", "(", ")", ";", "final", "int", "nblocks", "=", "len", "/", "8", ";", "long", "h1", "=", "seed",...
This version hashes the characters directly. It is not equivalent to hashing chars.toString().getBytes(), as it hashes UTF-16 code units, but it is much faster.
[ "This", "version", "hashes", "the", "characters", "directly", ".", "It", "is", "not", "equivalent", "to", "hashing", "chars", ".", "toString", "()", ".", "getBytes", "()", "as", "it", "hashes", "UTF", "-", "16", "code", "units", "but", "it", "is", "much"...
train
https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/MurmurHash3.java#L108-L171
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteQueryBuilder.java
SQLiteQueryBuilder.appendColumns
public static void appendColumns(StringBuilder s, String[] columns) { int n = columns.length; for (int i = 0; i < n; i++) { String column = columns[i]; if (column != null) { if (i > 0) { s.append(", "); } s.append(column); } } s.append(' '); }
java
public static void appendColumns(StringBuilder s, String[] columns) { int n = columns.length; for (int i = 0; i < n; i++) { String column = columns[i]; if (column != null) { if (i > 0) { s.append(", "); } s.append(column); } } s.append(' '); }
[ "public", "static", "void", "appendColumns", "(", "StringBuilder", "s", ",", "String", "[", "]", "columns", ")", "{", "int", "n", "=", "columns", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", ...
Add the names that are non-null in columns to s, separating them with commas.
[ "Add", "the", "names", "that", "are", "non", "-", "null", "in", "columns", "to", "s", "separating", "them", "with", "commas", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteQueryBuilder.java#L249-L263
syphr42/prom
src/main/java/org/syphr/prom/PropertiesManagers.java
PropertiesManagers.newManager
public static <T extends Enum<T> & Defaultable> PropertiesManager<T> newManager(File file, Class<T> keyType, final Retriever... retrievers) { return newManager(file, keyType, createExecutor(), retrievers); }
java
public static <T extends Enum<T> & Defaultable> PropertiesManager<T> newManager(File file, Class<T> keyType, final Retriever... retrievers) { return newManager(file, keyType, createExecutor(), retrievers); }
[ "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", "&", "Defaultable", ">", "PropertiesManager", "<", "T", ">", "newManager", "(", "File", "file", ",", "Class", "<", "T", ">", "keyType", ",", "final", "Retriever", "...", "retrievers", ")", ...
Build a new manager for the given properties file. @param <T> the type of key used for the new manager @param file the file system location of the properties represented here @param keyType the enumeration of keys in the properties file @param retrievers a set of retrievers that will be used to resolve extra property references (i.e. if a nested value reference is found in a properties file and there is no property to match it, the given retrievers will be used) @return a new manager
[ "Build", "a", "new", "manager", "for", "the", "given", "properties", "file", "." ]
train
https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/PropertiesManagers.java#L229-L234
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java
AbstractCreator.getPrintWriter
protected final PrintWriter getPrintWriter( String packageName, String className ) { return context.tryCreate( logger, packageName, className ); }
java
protected final PrintWriter getPrintWriter( String packageName, String className ) { return context.tryCreate( logger, packageName, className ); }
[ "protected", "final", "PrintWriter", "getPrintWriter", "(", "String", "packageName", ",", "String", "className", ")", "{", "return", "context", ".", "tryCreate", "(", "logger", ",", "packageName", ",", "className", ")", ";", "}" ]
Creates the {@link PrintWriter} to write the class. @param packageName the package @param className the name of the class @return the {@link PrintWriter} or null if the class already exists.
[ "Creates", "the", "{", "@link", "PrintWriter", "}", "to", "write", "the", "class", "." ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java#L119-L121
code4everything/util
src/main/java/com/zhazhapan/util/DateUtils.java
DateUtils.addMinute
public static Date addMinute(String date, int amount) throws ParseException { return add(date, Calendar.MINUTE, amount); }
java
public static Date addMinute(String date, int amount) throws ParseException { return add(date, Calendar.MINUTE, amount); }
[ "public", "static", "Date", "addMinute", "(", "String", "date", ",", "int", "amount", ")", "throws", "ParseException", "{", "return", "add", "(", "date", ",", "Calendar", ".", "MINUTE", ",", "amount", ")", ";", "}" ]
添加分钟 @param date 日期 @param amount 数量 @return 添加后的日期 @throws ParseException 异常
[ "添加分钟" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/DateUtils.java#L369-L371
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getFilteredGuildLogInfo
public void getFilteredGuildLogInfo(String id, String api, int since, Callback<List<GuildLog>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.GUILD, id), new ParamChecker(ParamType.API, api)); gw2API.getFilteredGuildLogInfo(id, api, Integer.toString(since)).enqueue(callback); }
java
public void getFilteredGuildLogInfo(String id, String api, int since, Callback<List<GuildLog>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.GUILD, id), new ParamChecker(ParamType.API, api)); gw2API.getFilteredGuildLogInfo(id, api, Integer.toString(since)).enqueue(callback); }
[ "public", "void", "getFilteredGuildLogInfo", "(", "String", "id", ",", "String", "api", ",", "int", "since", ",", "Callback", "<", "List", "<", "GuildLog", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamVali...
For more info on guild log API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/:id/log">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions<br/> @param id guild id @param api Guild leader's Guild Wars 2 API key @param since log id used to filter log entries @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws NullPointerException if given {@link Callback} is empty @see GuildLog guild log info
[ "For", "more", "info", "on", "guild", "log", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "guild", "/", ":", "id", "/", "log", ">", "here<", "/", "a", ">", ...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1484-L1487
federkasten/appbundle-maven-plugin
src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java
CreateApplicationBundleMojo.copyAdditionalBundledClasspathResources
private List<String> copyAdditionalBundledClasspathResources(File javaDirectory, String targetDirectoryName, List<FileSet> additionalBundledClasspathResources) throws MojoExecutionException { // Create the destination directory File destinationDirectory = new File(javaDirectory, targetDirectoryName); destinationDirectory.mkdirs(); List<String> addedFilenames = this.copyResources(destinationDirectory, additionalBundledClasspathResources); return addPath(addedFilenames, targetDirectoryName); }
java
private List<String> copyAdditionalBundledClasspathResources(File javaDirectory, String targetDirectoryName, List<FileSet> additionalBundledClasspathResources) throws MojoExecutionException { // Create the destination directory File destinationDirectory = new File(javaDirectory, targetDirectoryName); destinationDirectory.mkdirs(); List<String> addedFilenames = this.copyResources(destinationDirectory, additionalBundledClasspathResources); return addPath(addedFilenames, targetDirectoryName); }
[ "private", "List", "<", "String", ">", "copyAdditionalBundledClasspathResources", "(", "File", "javaDirectory", ",", "String", "targetDirectoryName", ",", "List", "<", "FileSet", ">", "additionalBundledClasspathResources", ")", "throws", "MojoExecutionException", "{", "//...
Copy additional dependencies into the $JAVAROOT directory. @param javaDirectory @param targetDirectoryName The directory within $JAVAROOT that these resources will be copied to @param additionalBundledClasspathResources @return A list of file names added @throws MojoExecutionException
[ "Copy", "additional", "dependencies", "into", "the", "$JAVAROOT", "directory", "." ]
train
https://github.com/federkasten/appbundle-maven-plugin/blob/4cdaf7e0da95c83bc8a045ba40cb3eef45d25a5f/src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java#L559-L567
OpenLiberty/open-liberty
dev/com.ibm.ws.security.credentials.ssotoken/src/com/ibm/ws/security/credentials/ssotoken/internal/SSOTokenCredentialProvider.java
SSOTokenCredentialProvider.setSsoTokenCredential
private void setSsoTokenCredential(Subject subject, String principalAccessId) throws CredentialException { try { TokenManager tokenManager = tokenManagerRef.getService(); SingleSignonToken ssoToken = null; Set<Token> tokens = subject.getPrivateCredentials(Token.class); if (tokens.isEmpty() == false) { Token ssoLtpaToken = tokens.iterator().next(); subject.getPrivateCredentials().remove(ssoLtpaToken); ssoToken = tokenManager.createSSOToken(ssoLtpaToken); } else { Map<String, Object> tokenData = new HashMap<String, Object>(); tokenData.put("unique_id", principalAccessId); ssoToken = tokenManager.createSSOToken(tokenData); } subject.getPrivateCredentials().add(ssoToken); } catch (TokenCreationFailedException e) { throw new CredentialException(e.getLocalizedMessage()); } }
java
private void setSsoTokenCredential(Subject subject, String principalAccessId) throws CredentialException { try { TokenManager tokenManager = tokenManagerRef.getService(); SingleSignonToken ssoToken = null; Set<Token> tokens = subject.getPrivateCredentials(Token.class); if (tokens.isEmpty() == false) { Token ssoLtpaToken = tokens.iterator().next(); subject.getPrivateCredentials().remove(ssoLtpaToken); ssoToken = tokenManager.createSSOToken(ssoLtpaToken); } else { Map<String, Object> tokenData = new HashMap<String, Object>(); tokenData.put("unique_id", principalAccessId); ssoToken = tokenManager.createSSOToken(tokenData); } subject.getPrivateCredentials().add(ssoToken); } catch (TokenCreationFailedException e) { throw new CredentialException(e.getLocalizedMessage()); } }
[ "private", "void", "setSsoTokenCredential", "(", "Subject", "subject", ",", "String", "principalAccessId", ")", "throws", "CredentialException", "{", "try", "{", "TokenManager", "tokenManager", "=", "tokenManagerRef", ".", "getService", "(", ")", ";", "SingleSignonTok...
Create an SSO token for the specified accessId. @param subject @param principalAccessId @throws TokenCreationFailedException
[ "Create", "an", "SSO", "token", "for", "the", "specified", "accessId", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.credentials.ssotoken/src/com/ibm/ws/security/credentials/ssotoken/internal/SSOTokenCredentialProvider.java#L95-L115
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_role_roleId_GET
public OvhRole serviceName_role_roleId_GET(String serviceName, String roleId) throws IOException { String qPath = "/dbaas/logs/{serviceName}/role/{roleId}"; StringBuilder sb = path(qPath, serviceName, roleId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRole.class); }
java
public OvhRole serviceName_role_roleId_GET(String serviceName, String roleId) throws IOException { String qPath = "/dbaas/logs/{serviceName}/role/{roleId}"; StringBuilder sb = path(qPath, serviceName, roleId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRole.class); }
[ "public", "OvhRole", "serviceName_role_roleId_GET", "(", "String", "serviceName", ",", "String", "roleId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/{serviceName}/role/{roleId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ...
Returns details of specified role REST: GET /dbaas/logs/{serviceName}/role/{roleId} @param serviceName [required] Service name @param roleId [required] Role ID
[ "Returns", "details", "of", "specified", "role" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L733-L738
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyRangeAxiomImpl_CustomFieldSerializer.java
OWLObjectPropertyRangeAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectPropertyRangeAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectPropertyRangeAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLObjectPropertyRangeAxiomImpl", "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/OWLObjectPropertyRangeAxiomImpl_CustomFieldSerializer.java#L76-L79
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/Base58.java
Base58.encodeChecked
public static String encodeChecked(int version, byte[] payload) { if (version < 0 || version > 255) throw new IllegalArgumentException("Version not in range."); // A stringified buffer is: // 1 byte version + data bytes + 4 bytes check code (a truncated hash) byte[] addressBytes = new byte[1 + payload.length + 4]; addressBytes[0] = (byte) version; System.arraycopy(payload, 0, addressBytes, 1, payload.length); byte[] checksum = Sha256Hash.hashTwice(addressBytes, 0, payload.length + 1); System.arraycopy(checksum, 0, addressBytes, payload.length + 1, 4); return Base58.encode(addressBytes); }
java
public static String encodeChecked(int version, byte[] payload) { if (version < 0 || version > 255) throw new IllegalArgumentException("Version not in range."); // A stringified buffer is: // 1 byte version + data bytes + 4 bytes check code (a truncated hash) byte[] addressBytes = new byte[1 + payload.length + 4]; addressBytes[0] = (byte) version; System.arraycopy(payload, 0, addressBytes, 1, payload.length); byte[] checksum = Sha256Hash.hashTwice(addressBytes, 0, payload.length + 1); System.arraycopy(checksum, 0, addressBytes, payload.length + 1, 4); return Base58.encode(addressBytes); }
[ "public", "static", "String", "encodeChecked", "(", "int", "version", ",", "byte", "[", "]", "payload", ")", "{", "if", "(", "version", "<", "0", "||", "version", ">", "255", ")", "throw", "new", "IllegalArgumentException", "(", "\"Version not in range.\"", ...
Encodes the given version and bytes as a base58 string. A checksum is appended. @param version the version to encode @param payload the bytes to encode, e.g. pubkey hash @return the base58-encoded string
[ "Encodes", "the", "given", "version", "and", "bytes", "as", "a", "base58", "string", ".", "A", "checksum", "is", "appended", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Base58.java#L101-L113
Netflix/astyanax
astyanax-cql/src/main/java/com/netflix/astyanax/cql/reads/QueryGenCache.java
QueryGenCache.getBoundStatement
public BoundStatement getBoundStatement(Q query, boolean useCaching) { PreparedStatement pStatement = getPreparedStatement(query, useCaching); return bindValues(pStatement, query); }
java
public BoundStatement getBoundStatement(Q query, boolean useCaching) { PreparedStatement pStatement = getPreparedStatement(query, useCaching); return bindValues(pStatement, query); }
[ "public", "BoundStatement", "getBoundStatement", "(", "Q", "query", ",", "boolean", "useCaching", ")", "{", "PreparedStatement", "pStatement", "=", "getPreparedStatement", "(", "query", ",", "useCaching", ")", ";", "return", "bindValues", "(", "pStatement", ",", "...
Get the bound statement from the prepared statement @param query @param useCaching @return BoundStatement
[ "Get", "the", "bound", "statement", "from", "the", "prepared", "statement" ]
train
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cql/src/main/java/com/netflix/astyanax/cql/reads/QueryGenCache.java#L62-L66
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AbstractPreferenceFragment.java
AbstractPreferenceFragment.createRestoreDefaultsListener
private DialogInterface.OnClickListener createRestoreDefaultsListener() { return new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { restoreDefaults(); } }; }
java
private DialogInterface.OnClickListener createRestoreDefaultsListener() { return new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { restoreDefaults(); } }; }
[ "private", "DialogInterface", ".", "OnClickListener", "createRestoreDefaultsListener", "(", ")", "{", "return", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "final", "DialogInterface", "dialog", ...
Creates and returns a listener, which allows to restore the default values of the fragment's preferences. @return The listener, which has been created, as an instance of the type {@link DialogInterface.OnClickListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "restore", "the", "default", "values", "of", "the", "fragment", "s", "preferences", "." ]
train
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AbstractPreferenceFragment.java#L58-L67
VoltDB/voltdb
src/frontend/org/voltdb/utils/CatalogUtil.java
CatalogUtil.makeDeploymentHashForConfig
public static UUID makeDeploymentHashForConfig(byte[] deploymentBytes) { String normalized = new String(deploymentBytes, StandardCharsets.UTF_8); Matcher matcher = XML_COMMENT_RE.matcher(normalized); normalized = matcher.replaceAll(""); matcher = HOSTCOUNT_RE.matcher(normalized); normalized = matcher.replaceFirst("hostcount=\"0\""); return Digester.md5AsUUID(normalized); }
java
public static UUID makeDeploymentHashForConfig(byte[] deploymentBytes) { String normalized = new String(deploymentBytes, StandardCharsets.UTF_8); Matcher matcher = XML_COMMENT_RE.matcher(normalized); normalized = matcher.replaceAll(""); matcher = HOSTCOUNT_RE.matcher(normalized); normalized = matcher.replaceFirst("hostcount=\"0\""); return Digester.md5AsUUID(normalized); }
[ "public", "static", "UUID", "makeDeploymentHashForConfig", "(", "byte", "[", "]", "deploymentBytes", ")", "{", "String", "normalized", "=", "new", "String", "(", "deploymentBytes", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "Matcher", "matcher", "=", "XML_...
Computes a MD5 digest (128 bits -> 2 longs -> UUID which is comprised of two longs) of a deployment file stripped of all comments and its hostcount attribute set to 0. @param deploymentBytes @return MD5 digest for for configuration
[ "Computes", "a", "MD5", "digest", "(", "128", "bits", "-", ">", "2", "longs", "-", ">", "UUID", "which", "is", "comprised", "of", "two", "longs", ")", "of", "a", "deployment", "file", "stripped", "of", "all", "comments", "and", "its", "hostcount", "att...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/CatalogUtil.java#L1186-L1193
networknt/light-4j
dump/src/main/java/com/networknt/dump/RootDumper.java
RootDumper.dumpRequest
public void dumpRequest(Map<String, Object> result) { if(!dumpConfig.isRequestEnabled()) { return; } Map<String, Object> requestResult = new LinkedHashMap<>(); for(IRequestDumpable dumper: dumperFactory.createRequestDumpers(dumpConfig, exchange)) { if(dumper.isApplicableForRequest()){ dumper.dumpRequest(requestResult); } } result.put(DumpConstants.REQUEST, requestResult); }
java
public void dumpRequest(Map<String, Object> result) { if(!dumpConfig.isRequestEnabled()) { return; } Map<String, Object> requestResult = new LinkedHashMap<>(); for(IRequestDumpable dumper: dumperFactory.createRequestDumpers(dumpConfig, exchange)) { if(dumper.isApplicableForRequest()){ dumper.dumpRequest(requestResult); } } result.put(DumpConstants.REQUEST, requestResult); }
[ "public", "void", "dumpRequest", "(", "Map", "<", "String", ",", "Object", ">", "result", ")", "{", "if", "(", "!", "dumpConfig", ".", "isRequestEnabled", "(", ")", ")", "{", "return", ";", "}", "Map", "<", "String", ",", "Object", ">", "requestResult"...
create dumpers that can dump http request info, and put http request info into Map<String, Object> result @param result a Map<String, Object> to put http request info to
[ "create", "dumpers", "that", "can", "dump", "http", "request", "info", "and", "put", "http", "request", "info", "into", "Map<String", "Object", ">", "result" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/RootDumper.java#L43-L53
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java
DataFrameJoiner.rightOuter
public Table rightOuter(Table table2, boolean allowDuplicateColumnNames, String... col2Names) { Table leftOuter = table2.join(col2Names).leftOuter(table, allowDuplicateColumnNames, columnNames); // reverse the columns Table result = Table.create(leftOuter.name()); // loop on table that was originally first (left) and add the left-joined matching columns by name for (String name : table.columnNames()) { try { result.addColumns(leftOuter.column(name)); } catch (IllegalStateException e) { // Can ignore this exception as it is anticipated. // NOTE: DataFrameJoiner.rightOuter(): skipping left table's column,'" // +name+"', in favor of right table's matching column that was kept in join operation."); } } for (String name : table2.columnNames()) { if (!result.columnNames().stream().anyMatch(name::equalsIgnoreCase)) { result.addColumns(leftOuter.column(name)); } } return result; }
java
public Table rightOuter(Table table2, boolean allowDuplicateColumnNames, String... col2Names) { Table leftOuter = table2.join(col2Names).leftOuter(table, allowDuplicateColumnNames, columnNames); // reverse the columns Table result = Table.create(leftOuter.name()); // loop on table that was originally first (left) and add the left-joined matching columns by name for (String name : table.columnNames()) { try { result.addColumns(leftOuter.column(name)); } catch (IllegalStateException e) { // Can ignore this exception as it is anticipated. // NOTE: DataFrameJoiner.rightOuter(): skipping left table's column,'" // +name+"', in favor of right table's matching column that was kept in join operation."); } } for (String name : table2.columnNames()) { if (!result.columnNames().stream().anyMatch(name::equalsIgnoreCase)) { result.addColumns(leftOuter.column(name)); } } return result; }
[ "public", "Table", "rightOuter", "(", "Table", "table2", ",", "boolean", "allowDuplicateColumnNames", ",", "String", "...", "col2Names", ")", "{", "Table", "leftOuter", "=", "table2", ".", "join", "(", "col2Names", ")", ".", "leftOuter", "(", "table", ",", "...
Joins the joiner to the table2, using the given columns for the second table and returns the resulting table @param table2 The table to join with @param allowDuplicateColumnNames if {@code false} the join will fail if any columns other than the join column have the same name if {@code true} the join will succeed and duplicate columns are renamed @param col2Names The columns to join on. If a name refers to a double column, the join is performed after rounding to integers. @return The resulting table
[ "Joins", "the", "joiner", "to", "the", "table2", "using", "the", "given", "columns", "for", "the", "second", "table", "and", "returns", "the", "resulting", "table" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java#L605-L626
looly/hutool
hutool-json/src/main/java/cn/hutool/json/JSONUtil.java
JSONUtil.quote
public static Writer quote(String str, Writer writer) throws IOException { return quote(str, writer, true); }
java
public static Writer quote(String str, Writer writer) throws IOException { return quote(str, writer, true); }
[ "public", "static", "Writer", "quote", "(", "String", "str", ",", "Writer", "writer", ")", "throws", "IOException", "{", "return", "quote", "(", "str", ",", "writer", ",", "true", ")", ";", "}" ]
对所有双引号做转义处理(使用双反斜杠做转义)<br> 为了能在HTML中较好的显示,会将&lt;/转义为&lt;\/<br> JSON字符串中不能包含控制字符和未经转义的引号和反斜杠 @param str 字符串 @param writer Writer @return Writer @throws IOException IO异常
[ "对所有双引号做转义处理(使用双反斜杠做转义)<br", ">", "为了能在HTML中较好的显示,会将&lt", ";", "/", "转义为&lt", ";", "\\", "/", "<br", ">", "JSON字符串中不能包含控制字符和未经转义的引号和反斜杠" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L482-L484
tvesalainen/util
util/src/main/java/org/vesalainen/util/InterfaceTracer.java
InterfaceTracer.getTracer
public static <T> T getTracer(Class<T> intf, T ob, Appendable appendable) { return getTracer(intf, new InterfaceTracer(ob), ob, appendable); }
java
public static <T> T getTracer(Class<T> intf, T ob, Appendable appendable) { return getTracer(intf, new InterfaceTracer(ob), ob, appendable); }
[ "public", "static", "<", "T", ">", "T", "getTracer", "(", "Class", "<", "T", ">", "intf", ",", "T", "ob", ",", "Appendable", "appendable", ")", "{", "return", "getTracer", "(", "intf", ",", "new", "InterfaceTracer", "(", "ob", ")", ",", "ob", ",", ...
Creates a tracer for intf @param <T> @param intf Implemented interface @param ob Class instance for given interface or null @param appendable Output for trace @return
[ "Creates", "a", "tracer", "for", "intf" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/InterfaceTracer.java#L90-L93
JodaOrg/joda-time
src/main/java/org/joda/time/YearMonth.java
YearMonth.toInterval
public Interval toInterval(DateTimeZone zone) { zone = DateTimeUtils.getZone(zone); DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone); DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone); return new Interval(start, end); }
java
public Interval toInterval(DateTimeZone zone) { zone = DateTimeUtils.getZone(zone); DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone); DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone); return new Interval(start, end); }
[ "public", "Interval", "toInterval", "(", "DateTimeZone", "zone", ")", "{", "zone", "=", "DateTimeUtils", ".", "getZone", "(", "zone", ")", ";", "DateTime", "start", "=", "toLocalDate", "(", "1", ")", ".", "toDateTimeAtStartOfDay", "(", "zone", ")", ";", "D...
Converts this object to an Interval representing the whole month. <p> The interval will use the chronology of the year-month in the specified zone. <p> This instance is immutable and unaffected by this method call. @param zone the zone to get the Interval in, null means default @return an interval over the month, never null
[ "Converts", "this", "object", "to", "an", "Interval", "representing", "the", "whole", "month", ".", "<p", ">", "The", "interval", "will", "use", "the", "chronology", "of", "the", "year", "-", "month", "in", "the", "specified", "zone", ".", "<p", ">", "Th...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/YearMonth.java#L696-L701
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionsInner.java
ConnectionsInner.createOrUpdate
public ConnectionInner createOrUpdate(String resourceGroupName, String automationAccountName, String connectionName, ConnectionCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, connectionName, parameters).toBlocking().single().body(); }
java
public ConnectionInner createOrUpdate(String resourceGroupName, String automationAccountName, String connectionName, ConnectionCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, connectionName, parameters).toBlocking().single().body(); }
[ "public", "ConnectionInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "connectionName", ",", "ConnectionCreateOrUpdateParameters", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "("...
Create or update a connection. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param connectionName The parameters supplied to the create or update connection operation. @param parameters The parameters supplied to the create or update connection operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ConnectionInner object if successful.
[ "Create", "or", "update", "a", "connection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionsInner.java#L288-L290
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PositiveDepthConstraintCheck.java
PositiveDepthConstraintCheck.checkConstraint
public boolean checkConstraint( Point2D_F64 viewA , Point2D_F64 viewB , Se3_F64 fromAtoB ) { triangulate.triangulate(viewA,viewB,fromAtoB,P); if( P.z > 0 ) { SePointOps_F64.transform(fromAtoB,P,P); return P.z > 0; } return false; }
java
public boolean checkConstraint( Point2D_F64 viewA , Point2D_F64 viewB , Se3_F64 fromAtoB ) { triangulate.triangulate(viewA,viewB,fromAtoB,P); if( P.z > 0 ) { SePointOps_F64.transform(fromAtoB,P,P); return P.z > 0; } return false; }
[ "public", "boolean", "checkConstraint", "(", "Point2D_F64", "viewA", ",", "Point2D_F64", "viewB", ",", "Se3_F64", "fromAtoB", ")", "{", "triangulate", ".", "triangulate", "(", "viewA", ",", "viewB", ",", "fromAtoB", ",", "P", ")", ";", "if", "(", "P", ".",...
Checks to see if a single point meets the constraint. @param viewA View of the 3D point from the first camera. Calibrated coordinates. @param viewB View of the 3D point from the second camera. Calibrated coordinates. @param fromAtoB Transform from the B to A camera frame. @return If the triangulated point appears in front of both cameras.
[ "Checks", "to", "see", "if", "a", "single", "point", "meets", "the", "constraint", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PositiveDepthConstraintCheck.java#L67-L76
citrusframework/citrus
modules/citrus-rmi/src/main/java/com/consol/citrus/rmi/endpoint/RmiEndpointUtils.java
RmiEndpointUtils.getPort
public static Integer getPort(String resourcePath, RmiEndpointConfiguration endpointConfiguration) { if (resourcePath.contains(":")) { String portSpec = resourcePath.split(":")[1]; if (portSpec.contains("/")) { portSpec = portSpec.substring(0, portSpec.indexOf('/')); } return Integer.valueOf(portSpec); } return endpointConfiguration.getPort(); }
java
public static Integer getPort(String resourcePath, RmiEndpointConfiguration endpointConfiguration) { if (resourcePath.contains(":")) { String portSpec = resourcePath.split(":")[1]; if (portSpec.contains("/")) { portSpec = portSpec.substring(0, portSpec.indexOf('/')); } return Integer.valueOf(portSpec); } return endpointConfiguration.getPort(); }
[ "public", "static", "Integer", "getPort", "(", "String", "resourcePath", ",", "RmiEndpointConfiguration", "endpointConfiguration", ")", "{", "if", "(", "resourcePath", ".", "contains", "(", "\":\"", ")", ")", "{", "String", "portSpec", "=", "resourcePath", ".", ...
Extract port number from resource path. If not present use default port from endpoint configuration. @param resourcePath @param endpointConfiguration @return
[ "Extract", "port", "number", "from", "resource", "path", ".", "If", "not", "present", "use", "default", "port", "from", "endpoint", "configuration", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-rmi/src/main/java/com/consol/citrus/rmi/endpoint/RmiEndpointUtils.java#L51-L63
alkacon/opencms-core
src/org/opencms/lock/CmsLockManager.java
CmsLockManager.getSiblingsLock
private CmsLock getSiblingsLock(List<CmsResource> siblings, String resourcename) { for (int i = 0; i < siblings.size(); i++) { CmsResource sibling = siblings.get(i); CmsLock exclusiveLock = getDirectLock(sibling.getRootPath()); if (exclusiveLock != null) { // a sibling is already locked return internalSiblingLock(exclusiveLock, resourcename); } } // no locked siblings found return null; }
java
private CmsLock getSiblingsLock(List<CmsResource> siblings, String resourcename) { for (int i = 0; i < siblings.size(); i++) { CmsResource sibling = siblings.get(i); CmsLock exclusiveLock = getDirectLock(sibling.getRootPath()); if (exclusiveLock != null) { // a sibling is already locked return internalSiblingLock(exclusiveLock, resourcename); } } // no locked siblings found return null; }
[ "private", "CmsLock", "getSiblingsLock", "(", "List", "<", "CmsResource", ">", "siblings", ",", "String", "resourcename", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "siblings", ".", "size", "(", ")", ";", "i", "++", ")", "{", "CmsReso...
Returns the indirect lock of a resource depending on siblings lock state.<p> @param siblings the list of siblings @param resourcename the name of the resource @return the indirect lock of the resource or the null lock
[ "Returns", "the", "indirect", "lock", "of", "a", "resource", "depending", "on", "siblings", "lock", "state", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/lock/CmsLockManager.java#L813-L826
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java
SDBaseOps.normmax
public SDVariable normmax(String name, SDVariable x, int... dimensions) { return normmax(name, x, false, dimensions); }
java
public SDVariable normmax(String name, SDVariable x, int... dimensions) { return normmax(name, x, false, dimensions); }
[ "public", "SDVariable", "normmax", "(", "String", "name", ",", "SDVariable", "x", ",", "int", "...", "dimensions", ")", "{", "return", "normmax", "(", "name", ",", "x", ",", "false", ",", "dimensions", ")", ";", "}" ]
Max norm (infinity norm) reduction operation: The output contains the max norm for each tensor/subset along the specified dimensions @param name Output variable name @param x Input variable @param dimensions dimensions to reduce over @return Output variable
[ "Max", "norm", "(", "infinity", "norm", ")", "reduction", "operation", ":", "The", "output", "contains", "the", "max", "norm", "for", "each", "tensor", "/", "subset", "along", "the", "specified", "dimensions" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L1423-L1425
apereo/cas
support/cas-server-support-token-authentication/src/main/java/org/apereo/cas/token/authentication/TokenAuthenticationHandler.java
TokenAuthenticationHandler.getRegisteredServiceJwtProperty
protected String getRegisteredServiceJwtProperty(final RegisteredService service, final RegisteredServiceProperty.RegisteredServiceProperties propName) { if (service == null || !service.getAccessStrategy().isServiceAccessAllowed()) { LOGGER.debug("Service is not defined/found or its access is disabled in the registry"); throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE); } if (propName.isAssignedTo(service)) { return propName.getPropertyValue(service).getValue(); } LOGGER.warn("Service [{}] does not define a property [{}] in the registry", service.getServiceId(), propName); return null; }
java
protected String getRegisteredServiceJwtProperty(final RegisteredService service, final RegisteredServiceProperty.RegisteredServiceProperties propName) { if (service == null || !service.getAccessStrategy().isServiceAccessAllowed()) { LOGGER.debug("Service is not defined/found or its access is disabled in the registry"); throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE); } if (propName.isAssignedTo(service)) { return propName.getPropertyValue(service).getValue(); } LOGGER.warn("Service [{}] does not define a property [{}] in the registry", service.getServiceId(), propName); return null; }
[ "protected", "String", "getRegisteredServiceJwtProperty", "(", "final", "RegisteredService", "service", ",", "final", "RegisteredServiceProperty", ".", "RegisteredServiceProperties", "propName", ")", "{", "if", "(", "service", "==", "null", "||", "!", "service", ".", ...
Gets registered service jwt secret. @param service the service @param propName the prop name @return the registered service jwt secret
[ "Gets", "registered", "service", "jwt", "secret", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-token-authentication/src/main/java/org/apereo/cas/token/authentication/TokenAuthenticationHandler.java#L168-L178
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRootElement.java
TreeRootElement.changeSelected
public void changeSelected(String selectNode, ServletRequest request) { _selectedNode = TreeHelpers.changeSelected(this, _selectedNode, selectNode, request); }
java
public void changeSelected(String selectNode, ServletRequest request) { _selectedNode = TreeHelpers.changeSelected(this, _selectedNode, selectNode, request); }
[ "public", "void", "changeSelected", "(", "String", "selectNode", ",", "ServletRequest", "request", ")", "{", "_selectedNode", "=", "TreeHelpers", ".", "changeSelected", "(", "this", ",", "_selectedNode", ",", "selectNode", ",", "request", ")", ";", "}" ]
Change the node that is selected. This is an optimization were the root node can track which node is currently selected so it can unselect that node instead of searching the whole tree to find the selected node. @param selectNode
[ "Change", "the", "node", "that", "is", "selected", ".", "This", "is", "an", "optimization", "were", "the", "root", "node", "can", "track", "which", "node", "is", "currently", "selected", "so", "it", "can", "unselect", "that", "node", "instead", "of", "sear...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRootElement.java#L61-L64
openengsb/openengsb
components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/performer/TransformationPerformer.java
TransformationPerformer.writeObjectToField
private void writeObjectToField(String fieldname, Object value, Object object, Object alternative) throws Exception { Object target = object != null ? object : alternative; try { FieldUtils.writeField(target, fieldname, value, true); } catch (Exception e) { throw new IllegalArgumentException(String.format("Unable to write value '%s' to field '%s' of object %s", value.toString(), fieldname, target.getClass().getName())); } }
java
private void writeObjectToField(String fieldname, Object value, Object object, Object alternative) throws Exception { Object target = object != null ? object : alternative; try { FieldUtils.writeField(target, fieldname, value, true); } catch (Exception e) { throw new IllegalArgumentException(String.format("Unable to write value '%s' to field '%s' of object %s", value.toString(), fieldname, target.getClass().getName())); } }
[ "private", "void", "writeObjectToField", "(", "String", "fieldname", ",", "Object", "value", ",", "Object", "object", ",", "Object", "alternative", ")", "throws", "Exception", "{", "Object", "target", "=", "object", "!=", "null", "?", "object", ":", "alternati...
Writes a value to the object from the field with the given name from either the object parameter or if this parameter is null from the alternative parameter.
[ "Writes", "a", "value", "to", "the", "object", "from", "the", "field", "with", "the", "given", "name", "from", "either", "the", "object", "parameter", "or", "if", "this", "parameter", "is", "null", "from", "the", "alternative", "parameter", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/performer/TransformationPerformer.java#L210-L219
openxc/openxc-android
library/src/main/java/com/openxc/interfaces/bluetooth/DeviceManager.java
DeviceManager.setupSocket
private BluetoothSocket setupSocket(BluetoothDevice device) throws BluetoothException { if (device == null) { Log.w(TAG, "Can't setup socket -- device is null"); throw new BluetoothException(); } Log.d(TAG, "Scanning services on " + device); BluetoothSocket socket; try { socket = device.createRfcommSocketToServiceRecord(RFCOMM_UUID); } catch (IOException e) { String error = "Unable to open a socket to device " + device; Log.w(TAG, error); throw new BluetoothException(error, e); } return socket; }
java
private BluetoothSocket setupSocket(BluetoothDevice device) throws BluetoothException { if (device == null) { Log.w(TAG, "Can't setup socket -- device is null"); throw new BluetoothException(); } Log.d(TAG, "Scanning services on " + device); BluetoothSocket socket; try { socket = device.createRfcommSocketToServiceRecord(RFCOMM_UUID); } catch (IOException e) { String error = "Unable to open a socket to device " + device; Log.w(TAG, error); throw new BluetoothException(error, e); } return socket; }
[ "private", "BluetoothSocket", "setupSocket", "(", "BluetoothDevice", "device", ")", "throws", "BluetoothException", "{", "if", "(", "device", "==", "null", ")", "{", "Log", ".", "w", "(", "TAG", ",", "\"Can't setup socket -- device is null\"", ")", ";", "throw", ...
Open an RFCOMM socket to the Bluetooth device. <p> The device may or may not actually exist, the argument is just a reference to it.
[ "Open", "an", "RFCOMM", "socket", "to", "the", "Bluetooth", "device", ".", "<p", ">", "The", "device", "may", "or", "may", "not", "actually", "exist", "the", "argument", "is", "just", "a", "reference", "to", "it", "." ]
train
https://github.com/openxc/openxc-android/blob/799adbdcd107a72fe89737bbf19c039dc2881665/library/src/main/java/com/openxc/interfaces/bluetooth/DeviceManager.java#L244-L262
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java
ArrayFunctions.arrayReplace
public static Expression arrayReplace(JsonArray array, Expression value1, Expression value2, long n) { return arrayReplace(x(array), value1, value2, n); }
java
public static Expression arrayReplace(JsonArray array, Expression value1, Expression value2, long n) { return arrayReplace(x(array), value1, value2, n); }
[ "public", "static", "Expression", "arrayReplace", "(", "JsonArray", "array", ",", "Expression", "value1", ",", "Expression", "value2", ",", "long", "n", ")", "{", "return", "arrayReplace", "(", "x", "(", "array", ")", ",", "value1", ",", "value2", ",", "n"...
Returned expression results in new array with at most n occurrences of value1 replaced with value2.
[ "Returned", "expression", "results", "in", "new", "array", "with", "at", "most", "n", "occurrences", "of", "value1", "replaced", "with", "value2", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L431-L433
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedhousing/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedhousing.java
ApiOvhDedicatedhousing.serviceName_features_backupFTP_access_ipBlock_GET
public OvhBackupFtpAcl serviceName_features_backupFTP_access_ipBlock_GET(String serviceName, String ipBlock) throws IOException { String qPath = "/dedicated/housing/{serviceName}/features/backupFTP/access/{ipBlock}"; StringBuilder sb = path(qPath, serviceName, ipBlock); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBackupFtpAcl.class); }
java
public OvhBackupFtpAcl serviceName_features_backupFTP_access_ipBlock_GET(String serviceName, String ipBlock) throws IOException { String qPath = "/dedicated/housing/{serviceName}/features/backupFTP/access/{ipBlock}"; StringBuilder sb = path(qPath, serviceName, ipBlock); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBackupFtpAcl.class); }
[ "public", "OvhBackupFtpAcl", "serviceName_features_backupFTP_access_ipBlock_GET", "(", "String", "serviceName", ",", "String", "ipBlock", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/housing/{serviceName}/features/backupFTP/access/{ipBlock}\"", ";", "S...
Get this object properties REST: GET /dedicated/housing/{serviceName}/features/backupFTP/access/{ipBlock} @param serviceName [required] The internal name of your Housing bay @param ipBlock [required] The IP Block specific to this ACL
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedhousing/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedhousing.java#L180-L185
future-architect/uroborosql
src/main/java/jp/co/future/uroborosql/context/SqlContextFactoryImpl.java
SqlContextFactoryImpl.makeEnumConstParamMap
protected void makeEnumConstParamMap(final Map<String, Parameter> paramMap, final String packageName, final Class<? extends Enum<?>> targetClass) { String fieldPrefix = CaseFormat.UPPER_SNAKE_CASE.convert(targetClass.getName().substring( packageName.length() + 1)) + "_"; Enum<?>[] enumValues = targetClass.getEnumConstants(); for (Enum<?> value : enumValues) { String fieldName = getConstParamPrefix() + fieldPrefix + value.name().toUpperCase(); fieldName = fieldName.toUpperCase(); Parameter newValue = new Parameter(fieldName, value); Parameter prevValue = paramMap.put(fieldName, newValue); if (prevValue != null) { LOG.warn("Duplicate Enum name. Enum name:{}, Old name:{} destroy.", fieldName, prevValue.getValue()); } LOG.debug("Enum [name:{}, value:{}] added to parameter.", fieldName, newValue.getValue()); } }
java
protected void makeEnumConstParamMap(final Map<String, Parameter> paramMap, final String packageName, final Class<? extends Enum<?>> targetClass) { String fieldPrefix = CaseFormat.UPPER_SNAKE_CASE.convert(targetClass.getName().substring( packageName.length() + 1)) + "_"; Enum<?>[] enumValues = targetClass.getEnumConstants(); for (Enum<?> value : enumValues) { String fieldName = getConstParamPrefix() + fieldPrefix + value.name().toUpperCase(); fieldName = fieldName.toUpperCase(); Parameter newValue = new Parameter(fieldName, value); Parameter prevValue = paramMap.put(fieldName, newValue); if (prevValue != null) { LOG.warn("Duplicate Enum name. Enum name:{}, Old name:{} destroy.", fieldName, prevValue.getValue()); } LOG.debug("Enum [name:{}, value:{}] added to parameter.", fieldName, newValue.getValue()); } }
[ "protected", "void", "makeEnumConstParamMap", "(", "final", "Map", "<", "String", ",", "Parameter", ">", "paramMap", ",", "final", "String", "packageName", ",", "final", "Class", "<", "?", "extends", "Enum", "<", "?", ">", ">", "targetClass", ")", "{", "St...
Enum型の定数パラメータのMapを生成する @param paramMap 定数パラメータを保持するMap @param packageName パッケージ名 @param targetClass 対象Enumクラス
[ "Enum型の定数パラメータのMapを生成する" ]
train
https://github.com/future-architect/uroborosql/blob/4c26db51defdac3c6ed16866e33ab45e190e2e0c/src/main/java/jp/co/future/uroborosql/context/SqlContextFactoryImpl.java#L184-L203
signalapp/libsignal-service-java
java/src/main/java/org/whispersystems/signalservice/api/SignalServiceMessageReceiver.java
SignalServiceMessageReceiver.retrieveAttachment
public InputStream retrieveAttachment(SignalServiceAttachmentPointer pointer, File destination, int maxSizeBytes, ProgressListener listener) throws IOException, InvalidMessageException { if (!pointer.getDigest().isPresent()) throw new InvalidMessageException("No attachment digest!"); socket.retrieveAttachment(pointer.getId(), destination, maxSizeBytes, listener); return AttachmentCipherInputStream.createFor(destination, pointer.getSize().or(0), pointer.getKey(), pointer.getDigest().get()); }
java
public InputStream retrieveAttachment(SignalServiceAttachmentPointer pointer, File destination, int maxSizeBytes, ProgressListener listener) throws IOException, InvalidMessageException { if (!pointer.getDigest().isPresent()) throw new InvalidMessageException("No attachment digest!"); socket.retrieveAttachment(pointer.getId(), destination, maxSizeBytes, listener); return AttachmentCipherInputStream.createFor(destination, pointer.getSize().or(0), pointer.getKey(), pointer.getDigest().get()); }
[ "public", "InputStream", "retrieveAttachment", "(", "SignalServiceAttachmentPointer", "pointer", ",", "File", "destination", ",", "int", "maxSizeBytes", ",", "ProgressListener", "listener", ")", "throws", "IOException", ",", "InvalidMessageException", "{", "if", "(", "!...
Retrieves a SignalServiceAttachment. @param pointer The {@link SignalServiceAttachmentPointer} received in a {@link SignalServiceDataMessage}. @param destination The download destination for this attachment. @param listener An optional listener (may be null) to receive callbacks on download progress. @return An InputStream that streams the plaintext attachment contents. @throws IOException @throws InvalidMessageException
[ "Retrieves", "a", "SignalServiceAttachment", "." ]
train
https://github.com/signalapp/libsignal-service-java/blob/64f1150c5e4062d67d31c9a2a9c3a0237d022902/java/src/main/java/org/whispersystems/signalservice/api/SignalServiceMessageReceiver.java#L130-L137
teknux-org/jetty-bootstrap
jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/JettyBootstrap.java
JettyBootstrap.addExplodedWarAppFromClasspath
public WebAppContext addExplodedWarAppFromClasspath(String explodedWar, String descriptor) throws JettyBootstrapException { return addExplodedWarAppFromClasspath(explodedWar, descriptor, CONTEXT_PATH_ROOT); }
java
public WebAppContext addExplodedWarAppFromClasspath(String explodedWar, String descriptor) throws JettyBootstrapException { return addExplodedWarAppFromClasspath(explodedWar, descriptor, CONTEXT_PATH_ROOT); }
[ "public", "WebAppContext", "addExplodedWarAppFromClasspath", "(", "String", "explodedWar", ",", "String", "descriptor", ")", "throws", "JettyBootstrapException", "{", "return", "addExplodedWarAppFromClasspath", "(", "explodedWar", ",", "descriptor", ",", "CONTEXT_PATH_ROOT", ...
Add an exploded (not packaged) War application from the current classpath, on the default context path {@value #CONTEXT_PATH_ROOT} @param explodedWar the exploded war path @param descriptor the web.xml descriptor path @return WebAppContext @throws JettyBootstrapException on failed
[ "Add", "an", "exploded", "(", "not", "packaged", ")", "War", "application", "from", "the", "current", "classpath", "on", "the", "default", "context", "path", "{", "@value", "#CONTEXT_PATH_ROOT", "}" ]
train
https://github.com/teknux-org/jetty-bootstrap/blob/c16e710b833084c650fce35aa8c1ccaf83cd93ef/jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/JettyBootstrap.java#L358-L360
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/CrateDigger.java
CrateDigger.findTrackAnalysis
private RekordboxAnlz findTrackAnalysis(DataReference track, Database database) { File file = null; try { RekordboxPdb.TrackRow trackRow = database.trackIndex.get((long) track.rekordboxId); if (trackRow != null) { file = new File(downloadDirectory, slotPrefix(track.getSlotReference()) + "track-" + track.rekordboxId + "-anlz.dat"); final String filePath = file.getCanonicalPath(); try { synchronized (Util.allocateNamedLock(filePath)) { if (file.canRead()) { // We have already downloaded it. return new RekordboxAnlz(new RandomAccessFileKaitaiStream(filePath)); } file.deleteOnExit(); // Prepare to download it. fetchFile(track.getSlotReference(), Database.getText(trackRow.analyzePath()), file); return new RekordboxAnlz(new RandomAccessFileKaitaiStream(filePath)); } } finally { Util.freeNamedLock(filePath); } } else { logger.warn("Unable to find track " + track + " in database " + database); } } catch (Exception e) { logger.error("Problem fetching analysis file for track " + track + " from database " + database, e); if (file != null) { //noinspection ResultOfMethodCallIgnored file.delete(); } } return null; }
java
private RekordboxAnlz findTrackAnalysis(DataReference track, Database database) { File file = null; try { RekordboxPdb.TrackRow trackRow = database.trackIndex.get((long) track.rekordboxId); if (trackRow != null) { file = new File(downloadDirectory, slotPrefix(track.getSlotReference()) + "track-" + track.rekordboxId + "-anlz.dat"); final String filePath = file.getCanonicalPath(); try { synchronized (Util.allocateNamedLock(filePath)) { if (file.canRead()) { // We have already downloaded it. return new RekordboxAnlz(new RandomAccessFileKaitaiStream(filePath)); } file.deleteOnExit(); // Prepare to download it. fetchFile(track.getSlotReference(), Database.getText(trackRow.analyzePath()), file); return new RekordboxAnlz(new RandomAccessFileKaitaiStream(filePath)); } } finally { Util.freeNamedLock(filePath); } } else { logger.warn("Unable to find track " + track + " in database " + database); } } catch (Exception e) { logger.error("Problem fetching analysis file for track " + track + " from database " + database, e); if (file != null) { //noinspection ResultOfMethodCallIgnored file.delete(); } } return null; }
[ "private", "RekordboxAnlz", "findTrackAnalysis", "(", "DataReference", "track", ",", "Database", "database", ")", "{", "File", "file", "=", "null", ";", "try", "{", "RekordboxPdb", ".", "TrackRow", "trackRow", "=", "database", ".", "trackIndex", ".", "get", "(...
Find the analysis file for the specified track, downloading it from the player if we have not already done so. Be sure to call {@code _io().close()} when you are done using the returned struct. @param track the track whose analysis file is desired @param database the parsed database export from which the analysis path can be determined @return the parsed file containing the track analysis
[ "Find", "the", "analysis", "file", "for", "the", "specified", "track", "downloading", "it", "from", "the", "player", "if", "we", "have", "not", "already", "done", "so", ".", "Be", "sure", "to", "call", "{", "@code", "_io", "()", ".", "close", "()", "}"...
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/CrateDigger.java#L366-L397
apache/flink
flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java
OptimizerNode.setBroadcastInputs
public void setBroadcastInputs(Map<Operator<?>, OptimizerNode> operatorToNode, ExecutionMode defaultExchangeMode) { // skip for Operators that don't support broadcast variables if (!(getOperator() instanceof AbstractUdfOperator<?, ?>)) { return; } // get all broadcast inputs AbstractUdfOperator<?, ?> operator = ((AbstractUdfOperator<?, ?>) getOperator()); // create connections and add them for (Map.Entry<String, Operator<?>> input : operator.getBroadcastInputs().entrySet()) { OptimizerNode predecessor = operatorToNode.get(input.getValue()); DagConnection connection = new DagConnection(predecessor, this, ShipStrategyType.BROADCAST, defaultExchangeMode); addBroadcastConnection(input.getKey(), connection); predecessor.addOutgoingConnection(connection); } }
java
public void setBroadcastInputs(Map<Operator<?>, OptimizerNode> operatorToNode, ExecutionMode defaultExchangeMode) { // skip for Operators that don't support broadcast variables if (!(getOperator() instanceof AbstractUdfOperator<?, ?>)) { return; } // get all broadcast inputs AbstractUdfOperator<?, ?> operator = ((AbstractUdfOperator<?, ?>) getOperator()); // create connections and add them for (Map.Entry<String, Operator<?>> input : operator.getBroadcastInputs().entrySet()) { OptimizerNode predecessor = operatorToNode.get(input.getValue()); DagConnection connection = new DagConnection(predecessor, this, ShipStrategyType.BROADCAST, defaultExchangeMode); addBroadcastConnection(input.getKey(), connection); predecessor.addOutgoingConnection(connection); } }
[ "public", "void", "setBroadcastInputs", "(", "Map", "<", "Operator", "<", "?", ">", ",", "OptimizerNode", ">", "operatorToNode", ",", "ExecutionMode", "defaultExchangeMode", ")", "{", "// skip for Operators that don't support broadcast variables ", "if", "(", "!", "(", ...
This function connects the operators that produce the broadcast inputs to this operator. @param operatorToNode The map from program operators to optimizer nodes. @param defaultExchangeMode The data exchange mode to use, if the operator does not specify one. @throws CompilerException
[ "This", "function", "connects", "the", "operators", "that", "produce", "the", "broadcast", "inputs", "to", "this", "operator", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java#L177-L194
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/GalleriesApi.java
GalleriesApi.editMeta
public Response editMeta(String galleryId, String title, String description) throws JinxException { JinxUtils.validateParams(galleryId, title); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.galleries.editMeta"); params.put("gallery_id", galleryId); params.put("title", title); if (!JinxUtils.isNullOrEmpty(description)) { params.put("description", description); } return jinx.flickrPost(params, Response.class); }
java
public Response editMeta(String galleryId, String title, String description) throws JinxException { JinxUtils.validateParams(galleryId, title); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.galleries.editMeta"); params.put("gallery_id", galleryId); params.put("title", title); if (!JinxUtils.isNullOrEmpty(description)) { params.put("description", description); } return jinx.flickrPost(params, Response.class); }
[ "public", "Response", "editMeta", "(", "String", "galleryId", ",", "String", "title", ",", "String", "description", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "galleryId", ",", "title", ")", ";", "Map", "<", "String", ",", ...
Modify the meta-data for a gallery. <br> This method requires authentication with 'write' permission. @param galleryId Required. The gallery ID to update. @param title Required. The new title for the gallery. @param description Optional. The new description for the gallery. @return object with response from Flickr indicating ok or fail. @throws JinxException if required parameters are null or empty, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.galleries.editMeta.html">flickr.galleries.editMeta</a>
[ "Modify", "the", "meta", "-", "data", "for", "a", "gallery", ".", "<br", ">", "This", "method", "requires", "authentication", "with", "write", "permission", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/GalleriesApi.java#L112-L122
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/query/parsing/impl/ParserPropertyHelper.java
ParserPropertyHelper.isEmbeddedProperty
public boolean isEmbeddedProperty(String targetTypeName, List<String> namesWithoutAlias) { OgmEntityPersister persister = getPersister( targetTypeName ); Type propertyType = persister.getPropertyType( namesWithoutAlias.get( 0 ) ); if ( propertyType.isComponentType() ) { // Embedded return true; } else if ( propertyType.isAssociationType() ) { Joinable associatedJoinable = ( (AssociationType) propertyType ).getAssociatedJoinable( persister.getFactory() ); if ( associatedJoinable.isCollection() ) { OgmCollectionPersister collectionPersister = (OgmCollectionPersister) associatedJoinable; return collectionPersister.getType().isComponentType(); } } return false; }
java
public boolean isEmbeddedProperty(String targetTypeName, List<String> namesWithoutAlias) { OgmEntityPersister persister = getPersister( targetTypeName ); Type propertyType = persister.getPropertyType( namesWithoutAlias.get( 0 ) ); if ( propertyType.isComponentType() ) { // Embedded return true; } else if ( propertyType.isAssociationType() ) { Joinable associatedJoinable = ( (AssociationType) propertyType ).getAssociatedJoinable( persister.getFactory() ); if ( associatedJoinable.isCollection() ) { OgmCollectionPersister collectionPersister = (OgmCollectionPersister) associatedJoinable; return collectionPersister.getType().isComponentType(); } } return false; }
[ "public", "boolean", "isEmbeddedProperty", "(", "String", "targetTypeName", ",", "List", "<", "String", ">", "namesWithoutAlias", ")", "{", "OgmEntityPersister", "persister", "=", "getPersister", "(", "targetTypeName", ")", ";", "Type", "propertyType", "=", "persist...
Checks if the path leads to an embedded property or association. @param targetTypeName the entity with the property @param namesWithoutAlias the path to the property with all the aliases resolved @return {@code true} if the property is an embedded, {@code false} otherwise.
[ "Checks", "if", "the", "path", "leads", "to", "an", "embedded", "property", "or", "association", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/query/parsing/impl/ParserPropertyHelper.java#L158-L173
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.queryMessages
public void queryMessages(@NonNull final String conversationId, final Long from, @NonNull final Integer limit, @Nullable Callback<ComapiResult<MessagesQueryResponse>> callback) { adapter.adapt(queryMessages(conversationId, from, limit), callback); }
java
public void queryMessages(@NonNull final String conversationId, final Long from, @NonNull final Integer limit, @Nullable Callback<ComapiResult<MessagesQueryResponse>> callback) { adapter.adapt(queryMessages(conversationId, from, limit), callback); }
[ "public", "void", "queryMessages", "(", "@", "NonNull", "final", "String", "conversationId", ",", "final", "Long", "from", ",", "@", "NonNull", "final", "Integer", "limit", ",", "@", "Nullable", "Callback", "<", "ComapiResult", "<", "MessagesQueryResponse", ">",...
Query chanel messages. @param conversationId ID of a conversation to query messages in it. @param from ID of the message to start from. @param limit Limit of events to obtain in this call. @param callback Callback to deliver new session instance.
[ "Query", "chanel", "messages", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L902-L904
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetId.java
DatasetId.of
public static DatasetId of(String project, String dataset) { return new DatasetId(checkNotNull(project), checkNotNull(dataset)); }
java
public static DatasetId of(String project, String dataset) { return new DatasetId(checkNotNull(project), checkNotNull(dataset)); }
[ "public", "static", "DatasetId", "of", "(", "String", "project", ",", "String", "dataset", ")", "{", "return", "new", "DatasetId", "(", "checkNotNull", "(", "project", ")", ",", "checkNotNull", "(", "dataset", ")", ")", ";", "}" ]
Creates a dataset identity given project's and dataset's user-defined ids.
[ "Creates", "a", "dataset", "identity", "given", "project", "s", "and", "dataset", "s", "user", "-", "defined", "ids", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetId.java#L49-L51
Impetus/Kundera
src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClientFactory.java
DSClientFactory.buildWhiteListCollection
private Collection<InetSocketAddress> buildWhiteListCollection(String whiteList) { String[] list = whiteList.split(Constants.COMMA); Collection<InetSocketAddress> whiteListCollection = new ArrayList<InetSocketAddress>(); PersistenceUnitMetadata persistenceUnitMetadata = kunderaMetadata.getApplicationMetadata() .getPersistenceUnitMetadata(getPersistenceUnit()); Properties props = persistenceUnitMetadata.getProperties(); int defaultPort = 9042; if (externalProperties != null && externalProperties.get(PersistenceProperties.KUNDERA_PORT) != null) { try { defaultPort = Integer.parseInt((String) externalProperties.get(PersistenceProperties.KUNDERA_PORT)); } catch (NumberFormatException e) { logger.error("Port in persistence.xml should be integer"); } } else { try { defaultPort = Integer.parseInt((String) props.get(PersistenceProperties.KUNDERA_PORT)); } catch (NumberFormatException e) { logger.error("Port in persistence.xml should be integer"); } } for (String node : list) { if (node.indexOf(Constants.COLON) > 0) { String[] parts = node.split(Constants.COLON); whiteListCollection.add(new InetSocketAddress(parts[0], Integer.parseInt(parts[1]))); } else { whiteListCollection.add(new InetSocketAddress(node, defaultPort)); } } return whiteListCollection; }
java
private Collection<InetSocketAddress> buildWhiteListCollection(String whiteList) { String[] list = whiteList.split(Constants.COMMA); Collection<InetSocketAddress> whiteListCollection = new ArrayList<InetSocketAddress>(); PersistenceUnitMetadata persistenceUnitMetadata = kunderaMetadata.getApplicationMetadata() .getPersistenceUnitMetadata(getPersistenceUnit()); Properties props = persistenceUnitMetadata.getProperties(); int defaultPort = 9042; if (externalProperties != null && externalProperties.get(PersistenceProperties.KUNDERA_PORT) != null) { try { defaultPort = Integer.parseInt((String) externalProperties.get(PersistenceProperties.KUNDERA_PORT)); } catch (NumberFormatException e) { logger.error("Port in persistence.xml should be integer"); } } else { try { defaultPort = Integer.parseInt((String) props.get(PersistenceProperties.KUNDERA_PORT)); } catch (NumberFormatException e) { logger.error("Port in persistence.xml should be integer"); } } for (String node : list) { if (node.indexOf(Constants.COLON) > 0) { String[] parts = node.split(Constants.COLON); whiteListCollection.add(new InetSocketAddress(parts[0], Integer.parseInt(parts[1]))); } else { whiteListCollection.add(new InetSocketAddress(node, defaultPort)); } } return whiteListCollection; }
[ "private", "Collection", "<", "InetSocketAddress", ">", "buildWhiteListCollection", "(", "String", "whiteList", ")", "{", "String", "[", "]", "list", "=", "whiteList", ".", "split", "(", "Constants", ".", "COMMA", ")", ";", "Collection", "<", "InetSocketAddress"...
Builds the white list collection. @param whiteList the white list @return the collection
[ "Builds", "the", "white", "list", "collection", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClientFactory.java#L611-L658
mikepenz/FastAdapter
library/src/main/java/com/mikepenz/fastadapter/commons/utils/FastAdapterDiffUtil.java
FastAdapterDiffUtil.calculateDiff
public static <A extends FastItemAdapter<Item>, Item extends IItem> DiffUtil.DiffResult calculateDiff(final A adapter, final List<Item> items, final DiffCallback<Item> callback) { return calculateDiff(adapter.getItemAdapter(), items, callback); }
java
public static <A extends FastItemAdapter<Item>, Item extends IItem> DiffUtil.DiffResult calculateDiff(final A adapter, final List<Item> items, final DiffCallback<Item> callback) { return calculateDiff(adapter.getItemAdapter(), items, callback); }
[ "public", "static", "<", "A", "extends", "FastItemAdapter", "<", "Item", ">", ",", "Item", "extends", "IItem", ">", "DiffUtil", ".", "DiffResult", "calculateDiff", "(", "final", "A", "adapter", ",", "final", "List", "<", "Item", ">", "items", ",", "final",...
convenient function for {@link #calculateDiff(ModelAdapter, List, DiffCallback, boolean)} @return the {@link androidx.recyclerview.widget.DiffUtil.DiffResult} computed.
[ "convenient", "function", "for", "{", "@link", "#calculateDiff", "(", "ModelAdapter", "List", "DiffCallback", "boolean", ")", "}" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library/src/main/java/com/mikepenz/fastadapter/commons/utils/FastAdapterDiffUtil.java#L188-L190
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/ProvisionerImpl.java
ProvisionerImpl.checkStartStatus
protected void checkStartStatus(BundleStartStatus startStatus) throws InvalidBundleContextException { final String m = "checkInstallStatus"; if (startStatus.startExceptions()) { Map<Bundle, Throwable> startExceptions = startStatus.getStartExceptions(); for (Entry<Bundle, Throwable> entry : startExceptions.entrySet()) { Bundle b = entry.getKey(); FFDCFilter.processException(entry.getValue(), ME, m, this, new Object[] { b.getLocation() }); } throw new LaunchException("Exceptions occurred while starting platform bundles", BootstrapConstants.messages.getString("error.platformBundleException")); } if (!startStatus.contextIsValid()) throw new InvalidBundleContextException(); }
java
protected void checkStartStatus(BundleStartStatus startStatus) throws InvalidBundleContextException { final String m = "checkInstallStatus"; if (startStatus.startExceptions()) { Map<Bundle, Throwable> startExceptions = startStatus.getStartExceptions(); for (Entry<Bundle, Throwable> entry : startExceptions.entrySet()) { Bundle b = entry.getKey(); FFDCFilter.processException(entry.getValue(), ME, m, this, new Object[] { b.getLocation() }); } throw new LaunchException("Exceptions occurred while starting platform bundles", BootstrapConstants.messages.getString("error.platformBundleException")); } if (!startStatus.contextIsValid()) throw new InvalidBundleContextException(); }
[ "protected", "void", "checkStartStatus", "(", "BundleStartStatus", "startStatus", ")", "throws", "InvalidBundleContextException", "{", "final", "String", "m", "=", "\"checkInstallStatus\"", ";", "if", "(", "startStatus", ".", "startExceptions", "(", ")", ")", "{", "...
Check the passed in start status for exceptions starting bundles, and issue appropriate diagnostics & messages for this environment. @param startStatus @throws InvalidBundleContextException
[ "Check", "the", "passed", "in", "start", "status", "for", "exceptions", "starting", "bundles", "and", "issue", "appropriate", "diagnostics", "&", "messages", "for", "this", "environment", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/ProvisionerImpl.java#L139-L154
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/server/DataTree.java
DataTree.getCounts
private void getCounts(String path, Counts counts) { DataNode node = getNode(path); if (node == null) { return; } String[] children = null; int len = 0; synchronized (node) { Set<String> childs = node.getChildren(); if (childs != null) { children = childs.toArray(new String[childs.size()]); } len = (node.data == null ? 0 : node.data.length); } // add itself counts.count += 1; counts.bytes += len; if (children == null || children.length == 0) { return; } for (String child : children) { getCounts(path + "/" + child, counts); } }
java
private void getCounts(String path, Counts counts) { DataNode node = getNode(path); if (node == null) { return; } String[] children = null; int len = 0; synchronized (node) { Set<String> childs = node.getChildren(); if (childs != null) { children = childs.toArray(new String[childs.size()]); } len = (node.data == null ? 0 : node.data.length); } // add itself counts.count += 1; counts.bytes += len; if (children == null || children.length == 0) { return; } for (String child : children) { getCounts(path + "/" + child, counts); } }
[ "private", "void", "getCounts", "(", "String", "path", ",", "Counts", "counts", ")", "{", "DataNode", "node", "=", "getNode", "(", "path", ")", ";", "if", "(", "node", "==", "null", ")", "{", "return", ";", "}", "String", "[", "]", "children", "=", ...
this method gets the count of nodes and the bytes under a subtree @param path the path to be used @param bytes the long bytes @param count the int count
[ "this", "method", "gets", "the", "count", "of", "nodes", "and", "the", "bytes", "under", "a", "subtree" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/DataTree.java#L853-L876
haifengl/smile
graph/src/main/java/smile/graph/AdjacencyList.java
AdjacencyList.dfs
private void dfs(Visitor visitor, int v, int[] cc, int id) { visitor.visit(v); cc[v] = id; for (Edge edge : graph[v]) { int t = edge.v2; if (!digraph && t == v) { t = edge.v1; } if (cc[t] == -1) { dfs(visitor, t, cc, id); } } }
java
private void dfs(Visitor visitor, int v, int[] cc, int id) { visitor.visit(v); cc[v] = id; for (Edge edge : graph[v]) { int t = edge.v2; if (!digraph && t == v) { t = edge.v1; } if (cc[t] == -1) { dfs(visitor, t, cc, id); } } }
[ "private", "void", "dfs", "(", "Visitor", "visitor", ",", "int", "v", ",", "int", "[", "]", "cc", ",", "int", "id", ")", "{", "visitor", ".", "visit", "(", "v", ")", ";", "cc", "[", "v", "]", "=", "id", ";", "for", "(", "Edge", "edge", ":", ...
Depth-first search of graph. @param v the start vertex. @param cc the array to store the connected component id of vertices. @param id the current component id.
[ "Depth", "-", "first", "search", "of", "graph", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/graph/src/main/java/smile/graph/AdjacencyList.java#L417-L430
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.indexOfAny
public static int indexOfAny(final CharSequence str, final CharSequence... searchStrs) { if (str == null || searchStrs == null) { return INDEX_NOT_FOUND; } // String's can't have a MAX_VALUEth index. int ret = Integer.MAX_VALUE; int tmp = 0; for (final CharSequence search : searchStrs) { if (search == null) { continue; } tmp = CharSequenceUtils.indexOf(str, search, 0); if (tmp == INDEX_NOT_FOUND) { continue; } if (tmp < ret) { ret = tmp; } } return ret == Integer.MAX_VALUE ? INDEX_NOT_FOUND : ret; }
java
public static int indexOfAny(final CharSequence str, final CharSequence... searchStrs) { if (str == null || searchStrs == null) { return INDEX_NOT_FOUND; } // String's can't have a MAX_VALUEth index. int ret = Integer.MAX_VALUE; int tmp = 0; for (final CharSequence search : searchStrs) { if (search == null) { continue; } tmp = CharSequenceUtils.indexOf(str, search, 0); if (tmp == INDEX_NOT_FOUND) { continue; } if (tmp < ret) { ret = tmp; } } return ret == Integer.MAX_VALUE ? INDEX_NOT_FOUND : ret; }
[ "public", "static", "int", "indexOfAny", "(", "final", "CharSequence", "str", ",", "final", "CharSequence", "...", "searchStrs", ")", "{", "if", "(", "str", "==", "null", "||", "searchStrs", "==", "null", ")", "{", "return", "INDEX_NOT_FOUND", ";", "}", "/...
<p>Find the first index of any of a set of potential substrings.</p> <p>A {@code null} CharSequence will return {@code -1}. A {@code null} or zero length search array will return {@code -1}. A {@code null} search array entry will be ignored, but a search array containing "" will return {@code 0} if {@code str} is not null. This method uses {@link String#indexOf(String)} if possible.</p> <pre> StringUtils.indexOfAny(null, *) = -1 StringUtils.indexOfAny(*, null) = -1 StringUtils.indexOfAny(*, []) = -1 StringUtils.indexOfAny("zzabyycdxx", ["ab","cd"]) = 2 StringUtils.indexOfAny("zzabyycdxx", ["cd","ab"]) = 2 StringUtils.indexOfAny("zzabyycdxx", ["mn","op"]) = -1 StringUtils.indexOfAny("zzabyycdxx", ["zab","aby"]) = 1 StringUtils.indexOfAny("zzabyycdxx", [""]) = 0 StringUtils.indexOfAny("", [""]) = 0 StringUtils.indexOfAny("", ["a"]) = -1 </pre> @param str the CharSequence to check, may be null @param searchStrs the CharSequences to search for, may be null @return the first index of any of the searchStrs in str, -1 if no match @since 3.0 Changed signature from indexOfAny(String, String[]) to indexOfAny(CharSequence, CharSequence...)
[ "<p", ">", "Find", "the", "first", "index", "of", "any", "of", "a", "set", "of", "potential", "substrings", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L2541-L2565
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/distance/ReferenceBasedOutlierDetection.java
ReferenceBasedOutlierDetection.updateDensities
protected void updateDensities(WritableDoubleDataStore rbod_score, DoubleDBIDList referenceDists) { DoubleDBIDListIter it = referenceDists.iter(); for(int l = 0; l < referenceDists.size(); l++) { double density = computeDensity(referenceDists, it, l); // computeDensity modified the iterator, reset: it.seek(l); // NaN indicates the first run. if(!(density > rbod_score.doubleValue(it))) { rbod_score.putDouble(it, density); } } }
java
protected void updateDensities(WritableDoubleDataStore rbod_score, DoubleDBIDList referenceDists) { DoubleDBIDListIter it = referenceDists.iter(); for(int l = 0; l < referenceDists.size(); l++) { double density = computeDensity(referenceDists, it, l); // computeDensity modified the iterator, reset: it.seek(l); // NaN indicates the first run. if(!(density > rbod_score.doubleValue(it))) { rbod_score.putDouble(it, density); } } }
[ "protected", "void", "updateDensities", "(", "WritableDoubleDataStore", "rbod_score", ",", "DoubleDBIDList", "referenceDists", ")", "{", "DoubleDBIDListIter", "it", "=", "referenceDists", ".", "iter", "(", ")", ";", "for", "(", "int", "l", "=", "0", ";", "l", ...
Update the density estimates for each object. @param rbod_score Density storage @param referenceDists Distances from current reference point
[ "Update", "the", "density", "estimates", "for", "each", "object", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/distance/ReferenceBasedOutlierDetection.java#L197-L208
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.uploadFile
public GitlabUpload uploadFile(GitlabProject project, File file) throws IOException { String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(project.getId()) + GitlabUpload.URL; return dispatch().withAttachment("file", file).to(tailUrl, GitlabUpload.class); }
java
public GitlabUpload uploadFile(GitlabProject project, File file) throws IOException { String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(project.getId()) + GitlabUpload.URL; return dispatch().withAttachment("file", file).to(tailUrl, GitlabUpload.class); }
[ "public", "GitlabUpload", "uploadFile", "(", "GitlabProject", "project", ",", "File", "file", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabProject", ".", "URL", "+", "\"/\"", "+", "sanitizeProjectId", "(", "project", ".", "getId", "(", "...
Uploads a file to a project @param project @param file @return @throws IOException on gitlab api call error
[ "Uploads", "a", "file", "to", "a", "project" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L974-L977
i-net-software/jlessc
src/com/inet/lib/less/ReaderFactory.java
ReaderFactory.openStream
public InputStream openStream( URL baseURL, String urlStr, String relativeUrlStr ) throws IOException { URL url = new URL( baseURL, urlStr ); try { return openStream( url ); } catch( Exception e ) { // try rewrite location independent of option "rewrite-urls" for backward compatibility, this is not 100% compatible with Less CSS url = new URL( new URL( baseURL, relativeUrlStr ), urlStr ); return openStream( url ); } }
java
public InputStream openStream( URL baseURL, String urlStr, String relativeUrlStr ) throws IOException { URL url = new URL( baseURL, urlStr ); try { return openStream( url ); } catch( Exception e ) { // try rewrite location independent of option "rewrite-urls" for backward compatibility, this is not 100% compatible with Less CSS url = new URL( new URL( baseURL, relativeUrlStr ), urlStr ); return openStream( url ); } }
[ "public", "InputStream", "openStream", "(", "URL", "baseURL", ",", "String", "urlStr", ",", "String", "relativeUrlStr", ")", "throws", "IOException", "{", "URL", "url", "=", "new", "URL", "(", "baseURL", ",", "urlStr", ")", ";", "try", "{", "return", "open...
Open an InputStream for the given URL. This is used for inlining images via data-uri. @param baseURL the URL of the top less file @param urlStr the absolute or relative URL that should be open @param relativeUrlStr relative URL of the less script @return the stream, never null @throws IOException If any I/O error occur on reading the URL.
[ "Open", "an", "InputStream", "for", "the", "given", "URL", ".", "This", "is", "used", "for", "inlining", "images", "via", "data", "-", "uri", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ReaderFactory.java#L68-L77
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java
TopicsInner.beginDelete
public void beginDelete(String resourceGroupName, String topicName) { beginDeleteWithServiceResponseAsync(resourceGroupName, topicName).toBlocking().single().body(); }
java
public void beginDelete(String resourceGroupName, String topicName) { beginDeleteWithServiceResponseAsync(resourceGroupName, topicName).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "topicName", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "topicName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", ...
Delete a topic. Delete existing topic. @param resourceGroupName The name of the resource group within the user's subscription. @param topicName Name of the topic @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Delete", "a", "topic", ".", "Delete", "existing", "topic", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java#L470-L472
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/db/converter/CacheConverter.java
CacheConverter.cacheValue
public void cacheValue(Object objKey, Object objValue) { //x if ((objKey == null) || (objValue == null)) if (objKey == null) return; Class<?> classKey = this.getField().getDataClass(); objKey = this.convertKey(objKey, classKey); if (m_hmCache == null) m_hmCache = new HashMap<Object,Object>(); m_hmCache.put(objKey, objValue); }
java
public void cacheValue(Object objKey, Object objValue) { //x if ((objKey == null) || (objValue == null)) if (objKey == null) return; Class<?> classKey = this.getField().getDataClass(); objKey = this.convertKey(objKey, classKey); if (m_hmCache == null) m_hmCache = new HashMap<Object,Object>(); m_hmCache.put(objKey, objValue); }
[ "public", "void", "cacheValue", "(", "Object", "objKey", ",", "Object", "objValue", ")", "{", "//x if ((objKey == null) || (objValue == null))", "if", "(", "objKey", "==", "null", ")", "return", ";", "Class", "<", "?", ">", "classKey", "=", "this", ".", ...
Add this key and value to the cache. @param objKey The raw key value. @param objValue The data value to associate with this key.
[ "Add", "this", "key", "and", "value", "to", "the", "cache", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/db/converter/CacheConverter.java#L111-L121
foundation-runtime/service-directory
2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/HttpUtils.java
HttpUtils.postJson
public static HttpResponse postJson(String urlStr, String body) throws IOException { URL url = new URL(urlStr); HttpURLConnection urlConnection = (HttpURLConnection) url .openConnection(); urlConnection.addRequestProperty("Accept", "application/json"); urlConnection.setRequestMethod("POST"); urlConnection.addRequestProperty("Content-Type", "application/json"); urlConnection.addRequestProperty("Content-Length", Integer.toString(body.length())); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); urlConnection.setUseCaches(false); OutputStream out = urlConnection.getOutputStream(); out.write(body.getBytes()); ByteStreams.copy(new ByteArrayInputStream(body.getBytes()), out); BufferedReader in = null; try { int errorCode = urlConnection.getResponseCode(); if ((errorCode <= 202) && (errorCode >= 200)) { in = new BufferedReader(new InputStreamReader( urlConnection.getInputStream())); } else { InputStream error = urlConnection.getErrorStream(); if (error != null) { in = new BufferedReader(new InputStreamReader(error)); } } String json = null; if (in != null) { json = CharStreams.toString(in); } return new HttpResponse(errorCode, json); } finally { if(in != null){ in.close(); } } }
java
public static HttpResponse postJson(String urlStr, String body) throws IOException { URL url = new URL(urlStr); HttpURLConnection urlConnection = (HttpURLConnection) url .openConnection(); urlConnection.addRequestProperty("Accept", "application/json"); urlConnection.setRequestMethod("POST"); urlConnection.addRequestProperty("Content-Type", "application/json"); urlConnection.addRequestProperty("Content-Length", Integer.toString(body.length())); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); urlConnection.setUseCaches(false); OutputStream out = urlConnection.getOutputStream(); out.write(body.getBytes()); ByteStreams.copy(new ByteArrayInputStream(body.getBytes()), out); BufferedReader in = null; try { int errorCode = urlConnection.getResponseCode(); if ((errorCode <= 202) && (errorCode >= 200)) { in = new BufferedReader(new InputStreamReader( urlConnection.getInputStream())); } else { InputStream error = urlConnection.getErrorStream(); if (error != null) { in = new BufferedReader(new InputStreamReader(error)); } } String json = null; if (in != null) { json = CharStreams.toString(in); } return new HttpResponse(errorCode, json); } finally { if(in != null){ in.close(); } } }
[ "public", "static", "HttpResponse", "postJson", "(", "String", "urlStr", ",", "String", "body", ")", "throws", "IOException", "{", "URL", "url", "=", "new", "URL", "(", "urlStr", ")", ";", "HttpURLConnection", "urlConnection", "=", "(", "HttpURLConnection", ")...
Invoke REST Service using POST method. @param urlStr the REST service URL String @param body the Http Body String. @return the HttpResponse. @throws IOException
[ "Invoke", "REST", "Service", "using", "POST", "method", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/HttpUtils.java#L54-L98
windup/windup
config/api/src/main/java/org/jboss/windup/config/RuleSubset.java
RuleSubset.logTimeTakenByPhase
private void logTimeTakenByPhase(GraphContext graphContext, Class<? extends RulePhase> phase, int timeTaken) { if (!timeTakenByPhase.containsKey(phase)) { RulePhaseExecutionStatisticsModel model = new GraphService<>(graphContext, RulePhaseExecutionStatisticsModel.class).create(); model.setRulePhase(phase.toString()); model.setTimeTaken(timeTaken); model.setOrderExecuted(timeTakenByPhase.size()); timeTakenByPhase.put(phase, model.getElement().id()); } else { GraphService<RulePhaseExecutionStatisticsModel> service = new GraphService<>(graphContext, RulePhaseExecutionStatisticsModel.class); RulePhaseExecutionStatisticsModel model = service.getById(timeTakenByPhase.get(phase)); int prevTimeTaken = model.getTimeTaken(); model.setTimeTaken(prevTimeTaken + timeTaken); } }
java
private void logTimeTakenByPhase(GraphContext graphContext, Class<? extends RulePhase> phase, int timeTaken) { if (!timeTakenByPhase.containsKey(phase)) { RulePhaseExecutionStatisticsModel model = new GraphService<>(graphContext, RulePhaseExecutionStatisticsModel.class).create(); model.setRulePhase(phase.toString()); model.setTimeTaken(timeTaken); model.setOrderExecuted(timeTakenByPhase.size()); timeTakenByPhase.put(phase, model.getElement().id()); } else { GraphService<RulePhaseExecutionStatisticsModel> service = new GraphService<>(graphContext, RulePhaseExecutionStatisticsModel.class); RulePhaseExecutionStatisticsModel model = service.getById(timeTakenByPhase.get(phase)); int prevTimeTaken = model.getTimeTaken(); model.setTimeTaken(prevTimeTaken + timeTaken); } }
[ "private", "void", "logTimeTakenByPhase", "(", "GraphContext", "graphContext", ",", "Class", "<", "?", "extends", "RulePhase", ">", "phase", ",", "int", "timeTaken", ")", "{", "if", "(", "!", "timeTakenByPhase", ".", "containsKey", "(", "phase", ")", ")", "{...
Logs the time taken by this rule and adds this to the total time taken for this phase
[ "Logs", "the", "time", "taken", "by", "this", "rule", "and", "adds", "this", "to", "the", "total", "time", "taken", "for", "this", "phase" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/RuleSubset.java#L167-L186
alkacon/opencms-core
src/org/opencms/cmis/CmsCmisResourceHelper.java
CmsCmisResourceHelper.getAcl
public synchronized Acl getAcl(CmsCmisCallContext context, String objectId, boolean onlyBasicPermissions) { try { CmsObject cms = m_repository.getCmsObject(context); CmsUUID structureId = new CmsUUID(objectId); CmsResource resource = cms.readResource(structureId); return collectAcl(cms, resource, onlyBasicPermissions); } catch (CmsException e) { handleCmsException(e); return null; } }
java
public synchronized Acl getAcl(CmsCmisCallContext context, String objectId, boolean onlyBasicPermissions) { try { CmsObject cms = m_repository.getCmsObject(context); CmsUUID structureId = new CmsUUID(objectId); CmsResource resource = cms.readResource(structureId); return collectAcl(cms, resource, onlyBasicPermissions); } catch (CmsException e) { handleCmsException(e); return null; } }
[ "public", "synchronized", "Acl", "getAcl", "(", "CmsCmisCallContext", "context", ",", "String", "objectId", ",", "boolean", "onlyBasicPermissions", ")", "{", "try", "{", "CmsObject", "cms", "=", "m_repository", ".", "getCmsObject", "(", "context", ")", ";", "Cms...
Gets the ACL for an object.<p> @param context the call context @param objectId the object id @param onlyBasicPermissions flag to only get basic permissions @return the ACL for the object
[ "Gets", "the", "ACL", "for", "an", "object", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisResourceHelper.java#L147-L160
sniggle/simple-pgp
simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java
BasePGPCommon.findSecretKey
protected PGPSecretKey findSecretKey(InputStream secretKey, KeyFilter<PGPSecretKey> keyFilter) throws IOException, PGPException { LOGGER.trace("findSecretKey(InputStream, KeyFilter<PGPSecretKey>)"); PGPSecretKey result = null; LOGGER.debug("Wrapping secret key stream in ArmoredInputStream"); try( InputStream armoredSecretKey = new ArmoredInputStream(secretKey) ) { LOGGER.debug("Creating PGPSecretKeyRingCollection"); PGPSecretKeyRingCollection keyRingCollection = new PGPSecretKeyRingCollection(armoredSecretKey, new BcKeyFingerprintCalculator()); result = retrieveSecretKey(keyRingCollection, keyFilter); } return result; }
java
protected PGPSecretKey findSecretKey(InputStream secretKey, KeyFilter<PGPSecretKey> keyFilter) throws IOException, PGPException { LOGGER.trace("findSecretKey(InputStream, KeyFilter<PGPSecretKey>)"); PGPSecretKey result = null; LOGGER.debug("Wrapping secret key stream in ArmoredInputStream"); try( InputStream armoredSecretKey = new ArmoredInputStream(secretKey) ) { LOGGER.debug("Creating PGPSecretKeyRingCollection"); PGPSecretKeyRingCollection keyRingCollection = new PGPSecretKeyRingCollection(armoredSecretKey, new BcKeyFingerprintCalculator()); result = retrieveSecretKey(keyRingCollection, keyFilter); } return result; }
[ "protected", "PGPSecretKey", "findSecretKey", "(", "InputStream", "secretKey", ",", "KeyFilter", "<", "PGPSecretKey", ">", "keyFilter", ")", "throws", "IOException", ",", "PGPException", "{", "LOGGER", ".", "trace", "(", "\"findSecretKey(InputStream, KeyFilter<PGPSecretKe...
reads the given secret key and applies the provided key filter @param secretKey the secret key stream @param keyFilter the filter to apply on the stream @return the secret key or null if none matches the filter acceptance criteria @throws IOException @throws PGPException
[ "reads", "the", "given", "secret", "key", "and", "applies", "the", "provided", "key", "filter" ]
train
https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java#L165-L175
QSFT/Doradus
doradus-client/src/main/java/com/dell/doradus/dory/DoradusClient.java
DoradusClient.lookupStorageServiceByApp
private static String lookupStorageServiceByApp(RESTClient restClient, String applicationName) { Utils.require(applicationName != null, "Missing application name"); if (applicationName != null) { ApplicationDefinition appDef = Command.getAppDef(restClient, applicationName); Utils.require(appDef != null, "Unknown application: %s", applicationName); return appDef.getStorageService(); } return null; }
java
private static String lookupStorageServiceByApp(RESTClient restClient, String applicationName) { Utils.require(applicationName != null, "Missing application name"); if (applicationName != null) { ApplicationDefinition appDef = Command.getAppDef(restClient, applicationName); Utils.require(appDef != null, "Unknown application: %s", applicationName); return appDef.getStorageService(); } return null; }
[ "private", "static", "String", "lookupStorageServiceByApp", "(", "RESTClient", "restClient", ",", "String", "applicationName", ")", "{", "Utils", ".", "require", "(", "applicationName", "!=", "null", ",", "\"Missing application name\"", ")", ";", "if", "(", "applica...
Convenient method to lookup storageService of the application @param restClient @param applicationName @return storage service name
[ "Convenient", "method", "to", "lookup", "storageService", "of", "the", "application" ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/dory/DoradusClient.java#L208-L216
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/RemoteQPConsumerKey.java
RemoteQPConsumerKey.completedReceived
protected final void completedReceived(AIStreamKey key, boolean reissueGet) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "completedReceived", new Object[] {key, Boolean.valueOf(reissueGet)}); completedReceivedNoPrefetch(key, reissueGet); try { if (readAhead) tryPrefetching(); } catch (SIResourceException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.RemoteQPConsumerKey.completedReceived", "1:568:1.47.1.26", this); SibTr.exception(tc, e); // no need to throw this exception, since its only a failure in prefetching } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "completedReceived"); }
java
protected final void completedReceived(AIStreamKey key, boolean reissueGet) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "completedReceived", new Object[] {key, Boolean.valueOf(reissueGet)}); completedReceivedNoPrefetch(key, reissueGet); try { if (readAhead) tryPrefetching(); } catch (SIResourceException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.RemoteQPConsumerKey.completedReceived", "1:568:1.47.1.26", this); SibTr.exception(tc, e); // no need to throw this exception, since its only a failure in prefetching } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "completedReceived"); }
[ "protected", "final", "void", "completedReceived", "(", "AIStreamKey", "key", ",", "boolean", "reissueGet", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", ...
completed tick received from the RME corresponding to a get request issued by this consumer. Note that this method is called only when the RemoteConsumerDispatcher does not hide the completed by reissuing the get. This method will never be called for messages received due to gets issued by the RemoteQPConsumerKeyGroup @param key
[ "completed", "tick", "received", "from", "the", "RME", "corresponding", "to", "a", "get", "request", "issued", "by", "this", "consumer", ".", "Note", "that", "this", "method", "is", "called", "only", "when", "the", "RemoteConsumerDispatcher", "does", "not", "h...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/RemoteQPConsumerKey.java#L515-L537
aws/aws-sdk-java
aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/RelatedResource.java
RelatedResource.withAdditionalInfo
public RelatedResource withAdditionalInfo(java.util.Map<String, String> additionalInfo) { setAdditionalInfo(additionalInfo); return this; }
java
public RelatedResource withAdditionalInfo(java.util.Map<String, String> additionalInfo) { setAdditionalInfo(additionalInfo); return this; }
[ "public", "RelatedResource", "withAdditionalInfo", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "additionalInfo", ")", "{", "setAdditionalInfo", "(", "additionalInfo", ")", ";", "return", "this", ";", "}" ]
<p> Additional information about the resource. </p> @param additionalInfo Additional information about the resource. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Additional", "information", "about", "the", "resource", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/RelatedResource.java#L181-L184
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.endBefore
@Nonnull public Query endBefore(Object... fieldValues) { QueryOptions newOptions = new QueryOptions(options); newOptions.endCursor = createCursor(newOptions.fieldOrders, fieldValues, true); return new Query(firestore, path, newOptions); }
java
@Nonnull public Query endBefore(Object... fieldValues) { QueryOptions newOptions = new QueryOptions(options); newOptions.endCursor = createCursor(newOptions.fieldOrders, fieldValues, true); return new Query(firestore, path, newOptions); }
[ "@", "Nonnull", "public", "Query", "endBefore", "(", "Object", "...", "fieldValues", ")", "{", "QueryOptions", "newOptions", "=", "new", "QueryOptions", "(", "options", ")", ";", "newOptions", ".", "endCursor", "=", "createCursor", "(", "newOptions", ".", "fie...
Creates and returns a new Query that ends before the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query. @param fieldValues The field values to end this query before, in order of the query's order by. @return The created Query.
[ "Creates", "and", "returns", "a", "new", "Query", "that", "ends", "before", "the", "provided", "fields", "relative", "to", "the", "order", "of", "the", "query", ".", "The", "order", "of", "the", "field", "values", "must", "match", "the", "order", "of", "...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L828-L833
imsweb/naaccr-xml
src/main/java/com/imsweb/naaccrxml/NaaccrXmlDictionaryUtils.java
NaaccrXmlDictionaryUtils.writeDictionary
public static void writeDictionary(NaaccrDictionary dictionary, Writer writer) throws IOException { try { instanciateXStream().marshal(dictionary, new NaaccrPrettyPrintWriter(dictionary, writer)); } catch (XStreamException ex) { throw new IOException("Unable to write dictionary", ex); } }
java
public static void writeDictionary(NaaccrDictionary dictionary, Writer writer) throws IOException { try { instanciateXStream().marshal(dictionary, new NaaccrPrettyPrintWriter(dictionary, writer)); } catch (XStreamException ex) { throw new IOException("Unable to write dictionary", ex); } }
[ "public", "static", "void", "writeDictionary", "(", "NaaccrDictionary", "dictionary", ",", "Writer", "writer", ")", "throws", "IOException", "{", "try", "{", "instanciateXStream", "(", ")", ".", "marshal", "(", "dictionary", ",", "new", "NaaccrPrettyPrintWriter", ...
Writes the given dictionary to the provided writer. @param dictionary dictionary to write, cannot be null @param writer writer, cannot be null @throws IOException if the dictionary could not be written
[ "Writes", "the", "given", "dictionary", "to", "the", "provided", "writer", "." ]
train
https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/NaaccrXmlDictionaryUtils.java#L313-L320
gallandarakhneorg/afc
core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java
MathUtil.compareEpsilon
@Pure public static int compareEpsilon(double v1, double v2, double epsilon) { final double v = v1 - v2; final double eps = Double.isNaN(epsilon) ? Math.ulp(v) : epsilon; if (Math.abs(v) <= eps) { return 0; } if (v <= 0.) { return -1; } return 1; }
java
@Pure public static int compareEpsilon(double v1, double v2, double epsilon) { final double v = v1 - v2; final double eps = Double.isNaN(epsilon) ? Math.ulp(v) : epsilon; if (Math.abs(v) <= eps) { return 0; } if (v <= 0.) { return -1; } return 1; }
[ "@", "Pure", "public", "static", "int", "compareEpsilon", "(", "double", "v1", ",", "double", "v2", ",", "double", "epsilon", ")", "{", "final", "double", "v", "=", "v1", "-", "v2", ";", "final", "double", "eps", "=", "Double", ".", "isNaN", "(", "ep...
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. @param v1 first value. @param v2 second value. @param epsilon approximation epsilon. If {@link Double#NaN}, the function {@link Math#ulp(double)} is used for evaluating the epsilon. @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
[ "Compares", "its", "two", "arguments", "for", "order", ".", "Returns", "a", "negative", "integer", "zero", "or", "a", "positive", "integer", "as", "the", "first", "argument", "is", "less", "than", "equal", "to", "or", "greater", "than", "the", "second", "....
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L214-L225
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.installationTemplate_templateName_partitionScheme_schemeName_PUT
public void installationTemplate_templateName_partitionScheme_schemeName_PUT(String templateName, String schemeName, OvhTemplatePartitioningSchemes body) throws IOException { String qPath = "/me/installationTemplate/{templateName}/partitionScheme/{schemeName}"; StringBuilder sb = path(qPath, templateName, schemeName); exec(qPath, "PUT", sb.toString(), body); }
java
public void installationTemplate_templateName_partitionScheme_schemeName_PUT(String templateName, String schemeName, OvhTemplatePartitioningSchemes body) throws IOException { String qPath = "/me/installationTemplate/{templateName}/partitionScheme/{schemeName}"; StringBuilder sb = path(qPath, templateName, schemeName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "installationTemplate_templateName_partitionScheme_schemeName_PUT", "(", "String", "templateName", ",", "String", "schemeName", ",", "OvhTemplatePartitioningSchemes", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/installationTemplat...
Alter this object properties REST: PUT /me/installationTemplate/{templateName}/partitionScheme/{schemeName} @param body [required] New object properties @param templateName [required] This template name @param schemeName [required] name of this partitioning scheme
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3602-L3606
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FunctionMultiArgs.java
FunctionMultiArgs.setArg
public void setArg(Expression arg, int argNum) throws WrongNumberArgsException { if (argNum < 3) super.setArg(arg, argNum); else { if (null == m_args) { m_args = new Expression[1]; m_args[0] = arg; } else { // Slow but space conservative. Expression[] args = new Expression[m_args.length + 1]; System.arraycopy(m_args, 0, args, 0, m_args.length); args[m_args.length] = arg; m_args = args; } arg.exprSetParent(this); } }
java
public void setArg(Expression arg, int argNum) throws WrongNumberArgsException { if (argNum < 3) super.setArg(arg, argNum); else { if (null == m_args) { m_args = new Expression[1]; m_args[0] = arg; } else { // Slow but space conservative. Expression[] args = new Expression[m_args.length + 1]; System.arraycopy(m_args, 0, args, 0, m_args.length); args[m_args.length] = arg; m_args = args; } arg.exprSetParent(this); } }
[ "public", "void", "setArg", "(", "Expression", "arg", ",", "int", "argNum", ")", "throws", "WrongNumberArgsException", "{", "if", "(", "argNum", "<", "3", ")", "super", ".", "setArg", "(", "arg", ",", "argNum", ")", ";", "else", "{", "if", "(", "null",...
Set an argument expression for a function. This method is called by the XPath compiler. @param arg non-null expression that represents the argument. @param argNum The argument number index. @throws WrongNumberArgsException If a derived class determines that the number of arguments is incorrect.
[ "Set", "an", "argument", "expression", "for", "a", "function", ".", "This", "method", "is", "called", "by", "the", "XPath", "compiler", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FunctionMultiArgs.java#L62-L88
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/storage/types/BasicDigitalObject.java
BasicDigitalObject.setExtProperty
public void setExtProperty(String propName, String propValue) { if (m_extProperties == null) { m_extProperties = new HashMap<String, String>(); } m_extProperties.put(propName, propValue); }
java
public void setExtProperty(String propName, String propValue) { if (m_extProperties == null) { m_extProperties = new HashMap<String, String>(); } m_extProperties.put(propName, propValue); }
[ "public", "void", "setExtProperty", "(", "String", "propName", ",", "String", "propValue", ")", "{", "if", "(", "m_extProperties", "==", "null", ")", "{", "m_extProperties", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "}", "m...
Sets an extended property on the object. @param propName The extended property name, either a string, or URI as string.
[ "Sets", "an", "extended", "property", "on", "the", "object", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/types/BasicDigitalObject.java#L271-L277
apache/flink
flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java
DescriptorProperties.putIndexedVariableProperties
public void putIndexedVariableProperties(String key, List<Map<String, String>> subKeyValues) { checkNotNull(key); checkNotNull(subKeyValues); for (int idx = 0; idx < subKeyValues.size(); idx++) { final Map<String, String> values = subKeyValues.get(idx); for (Map.Entry<String, String> value : values.entrySet()) { put(key + '.' + idx + '.' + value.getKey(), value.getValue()); } } }
java
public void putIndexedVariableProperties(String key, List<Map<String, String>> subKeyValues) { checkNotNull(key); checkNotNull(subKeyValues); for (int idx = 0; idx < subKeyValues.size(); idx++) { final Map<String, String> values = subKeyValues.get(idx); for (Map.Entry<String, String> value : values.entrySet()) { put(key + '.' + idx + '.' + value.getKey(), value.getValue()); } } }
[ "public", "void", "putIndexedVariableProperties", "(", "String", "key", ",", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "subKeyValues", ")", "{", "checkNotNull", "(", "key", ")", ";", "checkNotNull", "(", "subKeyValues", ")", ";", "for", "...
Adds an indexed mapping of properties under a common key. <p>For example: <pre> schema.fields.0.type = INT, schema.fields.0.name = test schema.fields.1.name = test2 </pre> <p>The arity of the subKeyValues can differ.
[ "Adds", "an", "indexed", "mapping", "of", "properties", "under", "a", "common", "key", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java#L229-L238
greese/dasein-persist
src/main/java/org/dasein/persist/RelationalReleaseCache.java
RelationalReleaseCache.init
protected void init(Class<T> cls, Key ... keys) { readDataSource = Execution.getDataSourceName(cls.getName(), true); writeDataSource = Execution.getDataSourceName(cls.getName(), false); if( readDataSource == null ) { readDataSource = writeDataSource; } if( writeDataSource == null ) { writeDataSource = readDataSource; } if (keys != null && keys.length > 0) { secondaryCache = new ConcurrentHashMap<String,ConcurrentHashMap<String,T>>(keys.length); for (Key k : keys) { secondaryCache.put(k.toString(), new ConcurrentHashMap<String,T>(0)); } } }
java
protected void init(Class<T> cls, Key ... keys) { readDataSource = Execution.getDataSourceName(cls.getName(), true); writeDataSource = Execution.getDataSourceName(cls.getName(), false); if( readDataSource == null ) { readDataSource = writeDataSource; } if( writeDataSource == null ) { writeDataSource = readDataSource; } if (keys != null && keys.length > 0) { secondaryCache = new ConcurrentHashMap<String,ConcurrentHashMap<String,T>>(keys.length); for (Key k : keys) { secondaryCache.put(k.toString(), new ConcurrentHashMap<String,T>(0)); } } }
[ "protected", "void", "init", "(", "Class", "<", "T", ">", "cls", ",", "Key", "...", "keys", ")", "{", "readDataSource", "=", "Execution", ".", "getDataSourceName", "(", "cls", ".", "getName", "(", ")", ",", "true", ")", ";", "writeDataSource", "=", "Ex...
Constructs a new persistent factory for objects of the specified class with the named unique identifier attributes. @param cls the class of objects managed by this factory @param keys a list of unique identifiers for instances of the specified class
[ "Constructs", "a", "new", "persistent", "factory", "for", "objects", "of", "the", "specified", "class", "with", "the", "named", "unique", "identifier", "attributes", "." ]
train
https://github.com/greese/dasein-persist/blob/1104621ad1670a45488b093b984ec1db4c7be781/src/main/java/org/dasein/persist/RelationalReleaseCache.java#L99-L116
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.methodIsNamed
public static Matcher<MethodTree> methodIsNamed(final String methodName) { return new Matcher<MethodTree>() { @Override public boolean matches(MethodTree methodTree, VisitorState state) { return methodTree.getName().contentEquals(methodName); } }; }
java
public static Matcher<MethodTree> methodIsNamed(final String methodName) { return new Matcher<MethodTree>() { @Override public boolean matches(MethodTree methodTree, VisitorState state) { return methodTree.getName().contentEquals(methodName); } }; }
[ "public", "static", "Matcher", "<", "MethodTree", ">", "methodIsNamed", "(", "final", "String", "methodName", ")", "{", "return", "new", "Matcher", "<", "MethodTree", ">", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "MethodTree", "me...
Match a method declaration with a specific name. @param methodName The name of the method to match, e.g., "equals"
[ "Match", "a", "method", "declaration", "with", "a", "specific", "name", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L918-L925
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/TrifocalExtractGeometries.java
TrifocalExtractGeometries.setTensor
public void setTensor( TrifocalTensor tensor ) { this.tensor = tensor; if( !svd.decompose(tensor.T1) ) throw new RuntimeException("SVD failed?!"); SingularOps_DDRM.nullVector(svd, true, v1); SingularOps_DDRM.nullVector(svd, false,u1); // DMatrixRMaj zero = new DMatrixRMaj(3,1); // CommonOps_DDRM.mult(tensor.T1,v1,zero);zero.print(); // CommonOps_DDRM.multTransA(u1,tensor.T1,zero);zero.print(); if( !svd.decompose(tensor.T2) ) throw new RuntimeException("SVD failed?!"); SingularOps_DDRM.nullVector(svd,true,v2); SingularOps_DDRM.nullVector(svd,false,u2); // CommonOps_DDRM.mult(tensor.T2,v2,zero);zero.print(); // CommonOps_DDRM.multTransA(u2,tensor.T2,zero);zero.print(); if( !svd.decompose(tensor.T3) ) throw new RuntimeException("SVD failed?!"); SingularOps_DDRM.nullVector(svd,true,v3); SingularOps_DDRM.nullVector(svd,false,u3); // CommonOps_DDRM.mult(tensor.T3,v3,zero);zero.print(); // CommonOps_DDRM.multTransA(u3,tensor.T3,zero);zero.print(); for( int i = 0; i < 3; i++ ) { U.set(i,0,u1.get(i)); U.set(i,1,u2.get(i)); U.set(i,2,u3.get(i)); V.set(i, 0, v1.get(i)); V.set(i, 1, v2.get(i)); V.set(i, 2, v3.get(i)); } svd.decompose(U); SingularOps_DDRM.nullVector(svd, false, tempE); e2.set(tempE.get(0), tempE.get(1), tempE.get(2)); svd.decompose(V); SingularOps_DDRM.nullVector(svd, false, tempE); e3.set(tempE.get(0), tempE.get(1), tempE.get(2)); }
java
public void setTensor( TrifocalTensor tensor ) { this.tensor = tensor; if( !svd.decompose(tensor.T1) ) throw new RuntimeException("SVD failed?!"); SingularOps_DDRM.nullVector(svd, true, v1); SingularOps_DDRM.nullVector(svd, false,u1); // DMatrixRMaj zero = new DMatrixRMaj(3,1); // CommonOps_DDRM.mult(tensor.T1,v1,zero);zero.print(); // CommonOps_DDRM.multTransA(u1,tensor.T1,zero);zero.print(); if( !svd.decompose(tensor.T2) ) throw new RuntimeException("SVD failed?!"); SingularOps_DDRM.nullVector(svd,true,v2); SingularOps_DDRM.nullVector(svd,false,u2); // CommonOps_DDRM.mult(tensor.T2,v2,zero);zero.print(); // CommonOps_DDRM.multTransA(u2,tensor.T2,zero);zero.print(); if( !svd.decompose(tensor.T3) ) throw new RuntimeException("SVD failed?!"); SingularOps_DDRM.nullVector(svd,true,v3); SingularOps_DDRM.nullVector(svd,false,u3); // CommonOps_DDRM.mult(tensor.T3,v3,zero);zero.print(); // CommonOps_DDRM.multTransA(u3,tensor.T3,zero);zero.print(); for( int i = 0; i < 3; i++ ) { U.set(i,0,u1.get(i)); U.set(i,1,u2.get(i)); U.set(i,2,u3.get(i)); V.set(i, 0, v1.get(i)); V.set(i, 1, v2.get(i)); V.set(i, 2, v3.get(i)); } svd.decompose(U); SingularOps_DDRM.nullVector(svd, false, tempE); e2.set(tempE.get(0), tempE.get(1), tempE.get(2)); svd.decompose(V); SingularOps_DDRM.nullVector(svd, false, tempE); e3.set(tempE.get(0), tempE.get(1), tempE.get(2)); }
[ "public", "void", "setTensor", "(", "TrifocalTensor", "tensor", ")", "{", "this", ".", "tensor", "=", "tensor", ";", "if", "(", "!", "svd", ".", "decompose", "(", "tensor", ".", "T1", ")", ")", "throw", "new", "RuntimeException", "(", "\"SVD failed?!\"", ...
Specifies the input tensor. The epipoles are immediately extracted since they are needed to extract all other data structures @param tensor The tensor. Reference is saved but not modified
[ "Specifies", "the", "input", "tensor", ".", "The", "epipoles", "are", "immediately", "extracted", "since", "they", "are", "needed", "to", "extract", "all", "other", "data", "structures" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/TrifocalExtractGeometries.java#L92-L135
jfinal/jfinal
src/main/java/com/jfinal/plugin/activerecord/Db.java
Db.findById
public static Record findById(String tableName, Object idValue) { return MAIN.findById(tableName, idValue); }
java
public static Record findById(String tableName, Object idValue) { return MAIN.findById(tableName, idValue); }
[ "public", "static", "Record", "findById", "(", "String", "tableName", ",", "Object", "idValue", ")", "{", "return", "MAIN", ".", "findById", "(", "tableName", ",", "idValue", ")", ";", "}" ]
Find record by id with default primary key. <pre> Example: Record user = Db.findById("user", 15); </pre> @param tableName the table name of the table @param idValue the id value of the record
[ "Find", "record", "by", "id", "with", "default", "primary", "key", ".", "<pre", ">", "Example", ":", "Record", "user", "=", "Db", ".", "findById", "(", "user", "15", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Db.java#L313-L315
nats-io/java-nats-streaming
src/main/java/io/nats/streaming/StreamingConnectionFactory.java
StreamingConnectionFactory.createConnection
public StreamingConnection createConnection() throws IOException, InterruptedException { StreamingConnectionImpl conn = new StreamingConnectionImpl(clusterId, clientId, options()); conn.connect(); return conn; }
java
public StreamingConnection createConnection() throws IOException, InterruptedException { StreamingConnectionImpl conn = new StreamingConnectionImpl(clusterId, clientId, options()); conn.connect(); return conn; }
[ "public", "StreamingConnection", "createConnection", "(", ")", "throws", "IOException", ",", "InterruptedException", "{", "StreamingConnectionImpl", "conn", "=", "new", "StreamingConnectionImpl", "(", "clusterId", ",", "clientId", ",", "options", "(", ")", ")", ";", ...
Creates an active connection to a NATS Streaming server. @return the StreamingConnection. @throws IOException if a StreamingConnection cannot be established for some reason. @throws InterruptedException if the calling thread is interrupted before the connection can be established
[ "Creates", "an", "active", "connection", "to", "a", "NATS", "Streaming", "server", "." ]
train
https://github.com/nats-io/java-nats-streaming/blob/72f964e9093622875d7f1c85ce60820e028863e7/src/main/java/io/nats/streaming/StreamingConnectionFactory.java#L61-L65
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/query/parse/BasicSqlQueryParser.java
BasicSqlQueryParser.removeBracketsAndQuotes
protected String removeBracketsAndQuotes( String text, Position position ) { return removeBracketsAndQuotes(text, true, position); }
java
protected String removeBracketsAndQuotes( String text, Position position ) { return removeBracketsAndQuotes(text, true, position); }
[ "protected", "String", "removeBracketsAndQuotes", "(", "String", "text", ",", "Position", "position", ")", "{", "return", "removeBracketsAndQuotes", "(", "text", ",", "true", ",", "position", ")", ";", "}" ]
Remove all leading and trailing single-quotes, double-quotes, or square brackets from the supplied text. If multiple, properly-paired quotes or brackets are found, they will all be removed. @param text the input text; may not be null @param position the position of the text; may not be null @return the text without leading and trailing brackets and quotes, or <code>text</code> if there were no square brackets or quotes
[ "Remove", "all", "leading", "and", "trailing", "single", "-", "quotes", "double", "-", "quotes", "or", "square", "brackets", "from", "the", "supplied", "text", ".", "If", "multiple", "properly", "-", "paired", "quotes", "or", "brackets", "are", "found", "the...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/parse/BasicSqlQueryParser.java#L1353-L1356
feedzai/pdb
src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java
SqlBuilder.notBetween
public static Between notBetween(final Expression exp1, final Expression exp2, final Expression exp3) { return new Between(exp1, and(exp2, exp3)).not(); }
java
public static Between notBetween(final Expression exp1, final Expression exp2, final Expression exp3) { return new Between(exp1, and(exp2, exp3)).not(); }
[ "public", "static", "Between", "notBetween", "(", "final", "Expression", "exp1", ",", "final", "Expression", "exp2", ",", "final", "Expression", "exp3", ")", "{", "return", "new", "Between", "(", "exp1", ",", "and", "(", "exp2", ",", "exp3", ")", ")", "....
The NOT BETWEEN operator. @param exp1 The column. @param exp2 The first bound. @param exp3 The second bound. @return The between expression.
[ "The", "NOT", "BETWEEN", "operator", "." ]
train
https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java#L729-L731
couchbase/java-dcp-client
src/main/java/com/couchbase/client/dcp/transport/netty/DcpLoggingHandler.java
DcpLoggingHandler.formatByteBufHolder
protected String formatByteBufHolder(String eventName, ByteBufHolder msg) { return formatByteBuf(eventName, msg.content()); }
java
protected String formatByteBufHolder(String eventName, ByteBufHolder msg) { return formatByteBuf(eventName, msg.content()); }
[ "protected", "String", "formatByteBufHolder", "(", "String", "eventName", ",", "ByteBufHolder", "msg", ")", "{", "return", "formatByteBuf", "(", "eventName", ",", "msg", ".", "content", "(", ")", ")", ";", "}" ]
Returns a String which contains all details to log the {@link ByteBufHolder}. <p> By default this method just delegates to {@link #formatByteBuf(String, ByteBuf)}, using the content of the {@link ByteBufHolder}. Sub-classes may override this.
[ "Returns", "a", "String", "which", "contains", "all", "details", "to", "log", "the", "{" ]
train
https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/transport/netty/DcpLoggingHandler.java#L114-L116
facebookarchive/hadoop-20
src/contrib/hive-streaming/src/java/org/apache/hadoop/streaming/StreamUtil.java
StreamUtil.goodClassOrNull
public static Class goodClassOrNull(String className, String defaultPackage) { if (className.indexOf('.') == -1 && defaultPackage != null) { className = defaultPackage + "." + className; } Class clazz = null; try { clazz = Class.forName(className); } catch (ClassNotFoundException cnf) { } catch (LinkageError cnf) { } return clazz; }
java
public static Class goodClassOrNull(String className, String defaultPackage) { if (className.indexOf('.') == -1 && defaultPackage != null) { className = defaultPackage + "." + className; } Class clazz = null; try { clazz = Class.forName(className); } catch (ClassNotFoundException cnf) { } catch (LinkageError cnf) { } return clazz; }
[ "public", "static", "Class", "goodClassOrNull", "(", "String", "className", ",", "String", "defaultPackage", ")", "{", "if", "(", "className", ".", "indexOf", "(", "'", "'", ")", "==", "-", "1", "&&", "defaultPackage", "!=", "null", ")", "{", "className", ...
It may seem strange to silently switch behaviour when a String is not a classname; the reason is simplified Usage:<pre> -mapper [classname | program ] instead of the explicit Usage: [-mapper program | -javamapper classname], -mapper and -javamapper are mutually exclusive. (repeat for -reducer, -combiner) </pre>
[ "It", "may", "seem", "strange", "to", "silently", "switch", "behaviour", "when", "a", "String", "is", "not", "a", "classname", ";", "the", "reason", "is", "simplified", "Usage", ":", "<pre", ">", "-", "mapper", "[", "classname", "|", "program", "]", "ins...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/hive-streaming/src/java/org/apache/hadoop/streaming/StreamUtil.java#L49-L60
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
TypeAnnotations.organizeTypeAnnotationsSignatures
public void organizeTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) { annotate.afterRepeated( new Worker() { @Override public void run() { JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile); try { new TypeAnnotationPositions(true).scan(tree); } finally { log.useSource(oldSource); } } } ); }
java
public void organizeTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) { annotate.afterRepeated( new Worker() { @Override public void run() { JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile); try { new TypeAnnotationPositions(true).scan(tree); } finally { log.useSource(oldSource); } } } ); }
[ "public", "void", "organizeTypeAnnotationsSignatures", "(", "final", "Env", "<", "AttrContext", ">", "env", ",", "final", "JCClassDecl", "tree", ")", "{", "annotate", ".", "afterRepeated", "(", "new", "Worker", "(", ")", "{", "@", "Override", "public", "void",...
Separate type annotations from declaration annotations and determine the correct positions for type annotations. This version only visits types in signatures and should be called from MemberEnter. The method takes the Annotate object as parameter and adds an Annotate.Worker to the correct Annotate queue for later processing.
[ "Separate", "type", "annotations", "from", "declaration", "annotations", "and", "determine", "the", "correct", "positions", "for", "type", "annotations", ".", "This", "version", "only", "visits", "types", "in", "signatures", "and", "should", "be", "called", "from"...
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java#L120-L133
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/Barcode.java
Barcode.createTemplateWithBarcode
public PdfTemplate createTemplateWithBarcode(PdfContentByte cb, Color barColor, Color textColor) { PdfTemplate tp = cb.createTemplate(0, 0); Rectangle rect = placeBarcode(tp, barColor, textColor); tp.setBoundingBox(rect); return tp; }
java
public PdfTemplate createTemplateWithBarcode(PdfContentByte cb, Color barColor, Color textColor) { PdfTemplate tp = cb.createTemplate(0, 0); Rectangle rect = placeBarcode(tp, barColor, textColor); tp.setBoundingBox(rect); return tp; }
[ "public", "PdfTemplate", "createTemplateWithBarcode", "(", "PdfContentByte", "cb", ",", "Color", "barColor", ",", "Color", "textColor", ")", "{", "PdfTemplate", "tp", "=", "cb", ".", "createTemplate", "(", "0", ",", "0", ")", ";", "Rectangle", "rect", "=", "...
Creates a template with the barcode. @param cb the <CODE>PdfContentByte</CODE> to create the template. It serves no other use @param barColor the color of the bars. It can be <CODE>null</CODE> @param textColor the color of the text. It can be <CODE>null</CODE> @return the template @see #placeBarcode(PdfContentByte cb, Color barColor, Color textColor)
[ "Creates", "a", "template", "with", "the", "barcode", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/Barcode.java#L407-L412
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java
BigtableDataClient.readRowsAsync
public void readRowsAsync(Query query, ResponseObserver<Row> observer) { readRowsCallable().call(query, observer); }
java
public void readRowsAsync(Query query, ResponseObserver<Row> observer) { readRowsCallable().call(query, observer); }
[ "public", "void", "readRowsAsync", "(", "Query", "query", ",", "ResponseObserver", "<", "Row", ">", "observer", ")", "{", "readRowsCallable", "(", ")", ".", "call", "(", "query", ",", "observer", ")", ";", "}" ]
Convenience method for asynchronously streaming the results of a {@link Query}. <p>Sample code: <pre>{@code try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) { String tableId = "[TABLE]"; Query query = Query.create(tableId) .range("[START KEY]", "[END KEY]") .filter(FILTERS.qualifier().regex("[COLUMN PREFIX].*")); bigtableDataClient.readRowsAsync(query, new ResponseObserver<Row>() { public void onStart(StreamController controller) { } public void onResponse(Row row) { // Do something with Row } public void onError(Throwable t) { if (t instanceof NotFoundException) { System.out.println("Tried to read a non-existent table"); } else { t.printStackTrace(); } } public void onComplete() { // Handle stream completion } }); } }</pre>
[ "Convenience", "method", "for", "asynchronously", "streaming", "the", "results", "of", "a", "{", "@link", "Query", "}", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java#L569-L571
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java
BasicModMixer.setNewPlayerTuningFor
protected void setNewPlayerTuningFor(final ChannelMemory aktMemo, final int newPeriod) { if (newPeriod<=0) aktMemo.currentTuning = 0; else if (frequencyTableType==Helpers.XM_LINEAR_TABLE) { final int xm_period_value = newPeriod>>2; int newFrequency = Helpers.lintab[xm_period_value % 768] >> (xm_period_value / 768); aktMemo.currentTuning = (int)(((long)newFrequency<<Helpers.SHIFT) / sampleRate); } else aktMemo.currentTuning = globalTuning/newPeriod; // in globalTuning, all constant values are already calculated. (see above) }
java
protected void setNewPlayerTuningFor(final ChannelMemory aktMemo, final int newPeriod) { if (newPeriod<=0) aktMemo.currentTuning = 0; else if (frequencyTableType==Helpers.XM_LINEAR_TABLE) { final int xm_period_value = newPeriod>>2; int newFrequency = Helpers.lintab[xm_period_value % 768] >> (xm_period_value / 768); aktMemo.currentTuning = (int)(((long)newFrequency<<Helpers.SHIFT) / sampleRate); } else aktMemo.currentTuning = globalTuning/newPeriod; // in globalTuning, all constant values are already calculated. (see above) }
[ "protected", "void", "setNewPlayerTuningFor", "(", "final", "ChannelMemory", "aktMemo", ",", "final", "int", "newPeriod", ")", "{", "if", "(", "newPeriod", "<=", "0", ")", "aktMemo", ".", "currentTuning", "=", "0", ";", "else", "if", "(", "frequencyTableType",...
This Method now takes the current Period (e.g. 856<<4) and calculates the playerTuning to be used. I.e. a value like 2, which means every second sample in the current instrument is to be played. A value of 0.5 means, every sample is played twice. As we use int-values, this again is shiftet. @param aktMemo @param newPeriod
[ "This", "Method", "now", "takes", "the", "current", "Period", "(", "e", ".", "g", ".", "856<<4", ")", "and", "calculates", "the", "playerTuning", "to", "be", "used", ".", "I", ".", "e", ".", "a", "value", "like", "2", "which", "means", "every", "seco...
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/mixer/BasicModMixer.java#L466-L479
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/ClassUtils.java
ClassUtils.getShortClassName
public static String getShortClassName(final Object object, final String valueIfNull) { if (object == null) { return valueIfNull; } return getShortClassName(object.getClass()); }
java
public static String getShortClassName(final Object object, final String valueIfNull) { if (object == null) { return valueIfNull; } return getShortClassName(object.getClass()); }
[ "public", "static", "String", "getShortClassName", "(", "final", "Object", "object", ",", "final", "String", "valueIfNull", ")", "{", "if", "(", "object", "==", "null", ")", "{", "return", "valueIfNull", ";", "}", "return", "getShortClassName", "(", "object", ...
<p>Gets the class name minus the package name for an {@code Object}.</p> @param object the class to get the short name for, may be null @param valueIfNull the value to return if null @return the class name of the object without the package name, or the null value
[ "<p", ">", "Gets", "the", "class", "name", "minus", "the", "package", "name", "for", "an", "{", "@code", "Object", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassUtils.java#L176-L181
Netflix/dyno
dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/hash/Murmur2Hash.java
Murmur2Hash.hash32
public static int hash32(final String text) { final byte[] bytes = text.getBytes(); return hash32(bytes, bytes.length); }
java
public static int hash32(final String text) { final byte[] bytes = text.getBytes(); return hash32(bytes, bytes.length); }
[ "public", "static", "int", "hash32", "(", "final", "String", "text", ")", "{", "final", "byte", "[", "]", "bytes", "=", "text", ".", "getBytes", "(", ")", ";", "return", "hash32", "(", "bytes", ",", "bytes", ".", "length", ")", ";", "}" ]
Generates 32 bit hash from a string. @param text string to hash @return 32 bit hash of the given string
[ "Generates", "32", "bit", "hash", "from", "a", "string", "." ]
train
https://github.com/Netflix/dyno/blob/158f807083ea8e9b09c8089cb07f98e954ad5b23/dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/hash/Murmur2Hash.java#L101-L104
sstrickx/yahoofinance-api
src/main/java/yahoofinance/YahooFinance.java
YahooFinance.get
public static Stock get(String symbol, Calendar from) throws IOException { return YahooFinance.get(symbol, from, HistQuotesRequest.DEFAULT_TO, HistQuotesRequest.DEFAULT_INTERVAL); }
java
public static Stock get(String symbol, Calendar from) throws IOException { return YahooFinance.get(symbol, from, HistQuotesRequest.DEFAULT_TO, HistQuotesRequest.DEFAULT_INTERVAL); }
[ "public", "static", "Stock", "get", "(", "String", "symbol", ",", "Calendar", "from", ")", "throws", "IOException", "{", "return", "YahooFinance", ".", "get", "(", "symbol", ",", "from", ",", "HistQuotesRequest", ".", "DEFAULT_TO", ",", "HistQuotesRequest", "....
Sends a request with the historical quotes included starting from the specified {@link Calendar} date at the default interval (monthly). Returns null if the data can't be retrieved from Yahoo Finance. @param symbol the symbol of the stock for which you want to retrieve information @param from start date of the historical data @return a {@link Stock} object containing the requested information @throws java.io.IOException when there's a connection problem
[ "Sends", "a", "request", "with", "the", "historical", "quotes", "included", "starting", "from", "the", "specified", "{", "@link", "Calendar", "}", "date", "at", "the", "default", "interval", "(", "monthly", ")", ".", "Returns", "null", "if", "the", "data", ...
train
https://github.com/sstrickx/yahoofinance-api/blob/2766ba52fc5cccf9b4da5c06423d68059cf0a6e6/src/main/java/yahoofinance/YahooFinance.java#L127-L129
graylog-labs/syslog4j-graylog2
src/main/java/org/graylog2/syslog4j/impl/message/processor/SyslogMessageProcessor.java
SyslogMessageProcessor.createSyslogHeader
public String createSyslogHeader(int facility, int level, String localName, boolean sendLocalTimestamp, boolean sendLocalName) { StringBuffer buffer = new StringBuffer(); appendPriority(buffer, facility, level); if (sendLocalTimestamp) { appendTimestamp(buffer, new Date()); } if (sendLocalName) { appendLocalName(buffer, localName); } return buffer.toString(); }
java
public String createSyslogHeader(int facility, int level, String localName, boolean sendLocalTimestamp, boolean sendLocalName) { StringBuffer buffer = new StringBuffer(); appendPriority(buffer, facility, level); if (sendLocalTimestamp) { appendTimestamp(buffer, new Date()); } if (sendLocalName) { appendLocalName(buffer, localName); } return buffer.toString(); }
[ "public", "String", "createSyslogHeader", "(", "int", "facility", ",", "int", "level", ",", "String", "localName", ",", "boolean", "sendLocalTimestamp", ",", "boolean", "sendLocalName", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";...
/* (non-Javadoc) @see org.graylog2.syslog4j.SyslogMessageProcessorIF#createSyslogHeader(int, int, java.lang.String, boolean, boolean) This is compatible with BSD protocol
[ "/", "*", "(", "non", "-", "Javadoc", ")", "@see", "org", ".", "graylog2", ".", "syslog4j", ".", "SyslogMessageProcessorIF#createSyslogHeader", "(", "int", "int", "java", ".", "lang", ".", "String", "boolean", "boolean", ")" ]
train
https://github.com/graylog-labs/syslog4j-graylog2/blob/374bc20d77c3aaa36a68bec5125dd82ce0a88aab/src/main/java/org/graylog2/syslog4j/impl/message/processor/SyslogMessageProcessor.java#L67-L81
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/imageclassify/AipImageClassify.java
AipImageClassify.logoAdd
public JSONObject logoAdd(byte[] image, String brief, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); String base64Content = Base64Util.encode(image); request.addBody("image", base64Content); request.addBody("brief", brief); if (options != null) { request.addBody(options); } request.setUri(ImageClassifyConsts.LOGO_ADD); postOperation(request); return requestServer(request); }
java
public JSONObject logoAdd(byte[] image, String brief, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); String base64Content = Base64Util.encode(image); request.addBody("image", base64Content); request.addBody("brief", brief); if (options != null) { request.addBody(options); } request.setUri(ImageClassifyConsts.LOGO_ADD); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "logoAdd", "(", "byte", "[", "]", "image", ",", "String", "brief", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "req...
logo商标识别—添加接口 使用入库接口请先在[控制台](https://console.bce.baidu.com/ai/#/ai/imagerecognition/overview/index)创建应用并申请建库,建库成功后方可正常使用。 @param image - 二进制图像数据 @param brief - brief,检索时带回。此处要传对应的name与code字段,name长度小于100B,code长度小于150B @param options - 可选参数对象,key: value都为string类型 options - options列表: @return JSONObject
[ "logo商标识别—添加接口", "使用入库接口请先在", "[", "控制台", "]", "(", "https", ":", "//", "console", ".", "bce", ".", "baidu", ".", "com", "/", "ai", "/", "#", "/", "ai", "/", "imagerecognition", "/", "overview", "/", "index", ")", "创建应用并申请建库,建库成功后方可正常使用。" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/imageclassify/AipImageClassify.java#L224-L238
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyEncoder.java
KeyEncoder.encodeDesc
public static int encodeDesc(Byte value, byte[] dst, int dstOffset) { if (value == null) { dst[dstOffset] = NULL_BYTE_LOW; return 1; } else { dst[dstOffset] = NOT_NULL_BYTE_LOW; dst[dstOffset + 1] = (byte)(value ^ 0x7f); return 2; } }
java
public static int encodeDesc(Byte value, byte[] dst, int dstOffset) { if (value == null) { dst[dstOffset] = NULL_BYTE_LOW; return 1; } else { dst[dstOffset] = NOT_NULL_BYTE_LOW; dst[dstOffset + 1] = (byte)(value ^ 0x7f); return 2; } }
[ "public", "static", "int", "encodeDesc", "(", "Byte", "value", ",", "byte", "[", "]", "dst", ",", "int", "dstOffset", ")", "{", "if", "(", "value", "==", "null", ")", "{", "dst", "[", "dstOffset", "]", "=", "NULL_BYTE_LOW", ";", "return", "1", ";", ...
Encodes the given signed Byte object into exactly 1 or 2 bytes for descending order. If the Byte object is never expected to be null, consider encoding as a byte primitive. @param value optional signed Byte value to encode @param dst destination for encoded bytes @param dstOffset offset into destination array @return amount of bytes written
[ "Encodes", "the", "given", "signed", "Byte", "object", "into", "exactly", "1", "or", "2", "bytes", "for", "descending", "order", ".", "If", "the", "Byte", "object", "is", "never", "expected", "to", "be", "null", "consider", "encoding", "as", "a", "byte", ...
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java#L126-L135
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuTexRefSetArray
public static int cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, int Flags) { return checkResult(cuTexRefSetArrayNative(hTexRef, hArray, Flags)); }
java
public static int cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, int Flags) { return checkResult(cuTexRefSetArrayNative(hTexRef, hArray, Flags)); }
[ "public", "static", "int", "cuTexRefSetArray", "(", "CUtexref", "hTexRef", ",", "CUarray", "hArray", ",", "int", "Flags", ")", "{", "return", "checkResult", "(", "cuTexRefSetArrayNative", "(", "hTexRef", ",", "hArray", ",", "Flags", ")", ")", ";", "}" ]
Binds an array as a texture reference. <pre> CUresult cuTexRefSetArray ( CUtexref hTexRef, CUarray hArray, unsigned int Flags ) </pre> <div> <p>Binds an array as a texture reference. Binds the CUDA array <tt>hArray</tt> to the texture reference <tt>hTexRef</tt>. Any previous address or CUDA array state associated with the texture reference is superseded by this function. <tt>Flags</tt> must be set to CU_TRSA_OVERRIDE_FORMAT. Any CUDA array previously bound to <tt>hTexRef</tt> is unbound. </p> </div> @param hTexRef Texture reference to bind @param hArray Array to bind @param Flags Options (must be CU_TRSA_OVERRIDE_FORMAT) @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuTexRefSetAddress @see JCudaDriver#cuTexRefSetAddress2D @see JCudaDriver#cuTexRefSetAddressMode @see JCudaDriver#cuTexRefSetFilterMode @see JCudaDriver#cuTexRefSetFlags @see JCudaDriver#cuTexRefSetFormat @see JCudaDriver#cuTexRefGetAddress @see JCudaDriver#cuTexRefGetAddressMode @see JCudaDriver#cuTexRefGetArray @see JCudaDriver#cuTexRefGetFilterMode @see JCudaDriver#cuTexRefGetFlags @see JCudaDriver#cuTexRefGetFormat
[ "Binds", "an", "array", "as", "a", "texture", "reference", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L9718-L9721
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java
CachedRemoteTable.getRemoteDatabase
public RemoteDatabase getRemoteDatabase(Map<String, Object> properties) throws RemoteException { return m_tableRemote.getRemoteDatabase(properties); }
java
public RemoteDatabase getRemoteDatabase(Map<String, Object> properties) throws RemoteException { return m_tableRemote.getRemoteDatabase(properties); }
[ "public", "RemoteDatabase", "getRemoteDatabase", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "RemoteException", "{", "return", "m_tableRemote", ".", "getRemoteDatabase", "(", "properties", ")", ";", "}" ]
Get/Make this remote database session for this table session. @param properties The client database properties (Typically for transaction support).
[ "Get", "/", "Make", "this", "remote", "database", "session", "for", "this", "table", "session", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java#L710-L713
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java
DataService.updateAsync
public <T extends IEntity> void updateAsync(T entity, CallbackHandler callbackHandler) throws FMSException { IntuitMessage intuitMessage = prepareUpdate(entity); //set callback handler intuitMessage.getRequestElements().setCallbackHandler(callbackHandler); //execute async interceptors executeAsyncInterceptors(intuitMessage); }
java
public <T extends IEntity> void updateAsync(T entity, CallbackHandler callbackHandler) throws FMSException { IntuitMessage intuitMessage = prepareUpdate(entity); //set callback handler intuitMessage.getRequestElements().setCallbackHandler(callbackHandler); //execute async interceptors executeAsyncInterceptors(intuitMessage); }
[ "public", "<", "T", "extends", "IEntity", ">", "void", "updateAsync", "(", "T", "entity", ",", "CallbackHandler", "callbackHandler", ")", "throws", "FMSException", "{", "IntuitMessage", "intuitMessage", "=", "prepareUpdate", "(", "entity", ")", ";", "//set callbac...
Method to update the record of the corresponding entity in asynchronous fashion @param entity the entity @param callbackHandler the callback handler @throws FMSException
[ "Method", "to", "update", "the", "record", "of", "the", "corresponding", "entity", "in", "asynchronous", "fashion" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L799-L808
dita-ot/dita-ot
src/main/java/org/dita/dost/writer/ValidationFilter.java
ValidationFilter.setValidateMap
public void setValidateMap(final Map<QName, Map<String, Set<String>>> validateMap) { this.validateMap = validateMap; }
java
public void setValidateMap(final Map<QName, Map<String, Set<String>>> validateMap) { this.validateMap = validateMap; }
[ "public", "void", "setValidateMap", "(", "final", "Map", "<", "QName", ",", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", ">", "validateMap", ")", "{", "this", ".", "validateMap", "=", "validateMap", ";", "}" ]
Set valid attribute values. <p>The contents of the map is in pseudo-code {@code Map<AttName, Map<ElemName, <Set<Value>>>}. For default element mapping, the value is {@code *}.
[ "Set", "valid", "attribute", "values", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/writer/ValidationFilter.java#L56-L58