repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/clientlibs/servlet/ClientlibCategoryServlet.java
ClientlibCategoryServlet.makePath
public static String makePath(String category, Clientlib.Type type, boolean minified, String hash) { """ Creates an path that is rendered by this servlet containing the given parameters. """ StringBuilder buf = new StringBuilder(PATH); if (minified) buf.append(".min"); buf.append(".").append(type.name()); if (null != hash) { buf.append("/").append(hash); } buf.append("/").append(Clientlib.sanitizeCategory(category)); buf.append(".").append(type.name()); return buf.toString(); }
java
public static String makePath(String category, Clientlib.Type type, boolean minified, String hash) { StringBuilder buf = new StringBuilder(PATH); if (minified) buf.append(".min"); buf.append(".").append(type.name()); if (null != hash) { buf.append("/").append(hash); } buf.append("/").append(Clientlib.sanitizeCategory(category)); buf.append(".").append(type.name()); return buf.toString(); }
[ "public", "static", "String", "makePath", "(", "String", "category", ",", "Clientlib", ".", "Type", "type", ",", "boolean", "minified", ",", "String", "hash", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "PATH", ")", ";", "if", "(", "minified", ")", "buf", ".", "append", "(", "\".min\"", ")", ";", "buf", ".", "append", "(", "\".\"", ")", ".", "append", "(", "type", ".", "name", "(", ")", ")", ";", "if", "(", "null", "!=", "hash", ")", "{", "buf", ".", "append", "(", "\"/\"", ")", ".", "append", "(", "hash", ")", ";", "}", "buf", ".", "append", "(", "\"/\"", ")", ".", "append", "(", "Clientlib", ".", "sanitizeCategory", "(", "category", ")", ")", ";", "buf", ".", "append", "(", "\".\"", ")", ".", "append", "(", "type", ".", "name", "(", ")", ")", ";", "return", "buf", ".", "toString", "(", ")", ";", "}" ]
Creates an path that is rendered by this servlet containing the given parameters.
[ "Creates", "an", "path", "that", "is", "rendered", "by", "this", "servlet", "containing", "the", "given", "parameters", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/clientlibs/servlet/ClientlibCategoryServlet.java#L40-L50
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/datetime/PDTWebDateHelper.java
PDTWebDateHelper.getDateTimeFromRFC822
@Nullable public static ZonedDateTime getDateTimeFromRFC822 (@Nullable final String sDate) { """ Parses a Date out of a String with a date in RFC822 format. <br> It parsers the following formats: <ul> <li>"EEE, dd MMM uuuu HH:mm:ss z"</li> <li>"EEE, dd MMM uuuu HH:mm z"</li> <li>"EEE, dd MMM uu HH:mm:ss z"</li> <li>"EEE, dd MMM uu HH:mm z"</li> <li>"dd MMM uuuu HH:mm:ss z"</li> <li>"dd MMM uuuu HH:mm z"</li> <li>"dd MMM uu HH:mm:ss z"</li> <li>"dd MMM uu HH:mm z"</li> </ul> <p> Refer to the java.text.SimpleDateFormat javadocs for details on the format of each element. </p> @param sDate string to parse for a date. May be <code>null</code>. @return the Date represented by the given RFC822 string. It returns <b>null</b> if it was not possible to parse the given string into a {@link ZonedDateTime} or if the passed {@link String} was <code>null</code>. """ if (StringHelper.hasNoText (sDate)) return null; final WithZoneId aPair = extractDateTimeZone (sDate.trim ()); return parseZonedDateTimeUsingMask (RFC822_MASKS, aPair.getString (), aPair.getZoneId ()); }
java
@Nullable public static ZonedDateTime getDateTimeFromRFC822 (@Nullable final String sDate) { if (StringHelper.hasNoText (sDate)) return null; final WithZoneId aPair = extractDateTimeZone (sDate.trim ()); return parseZonedDateTimeUsingMask (RFC822_MASKS, aPair.getString (), aPair.getZoneId ()); }
[ "@", "Nullable", "public", "static", "ZonedDateTime", "getDateTimeFromRFC822", "(", "@", "Nullable", "final", "String", "sDate", ")", "{", "if", "(", "StringHelper", ".", "hasNoText", "(", "sDate", ")", ")", "return", "null", ";", "final", "WithZoneId", "aPair", "=", "extractDateTimeZone", "(", "sDate", ".", "trim", "(", ")", ")", ";", "return", "parseZonedDateTimeUsingMask", "(", "RFC822_MASKS", ",", "aPair", ".", "getString", "(", ")", ",", "aPair", ".", "getZoneId", "(", ")", ")", ";", "}" ]
Parses a Date out of a String with a date in RFC822 format. <br> It parsers the following formats: <ul> <li>"EEE, dd MMM uuuu HH:mm:ss z"</li> <li>"EEE, dd MMM uuuu HH:mm z"</li> <li>"EEE, dd MMM uu HH:mm:ss z"</li> <li>"EEE, dd MMM uu HH:mm z"</li> <li>"dd MMM uuuu HH:mm:ss z"</li> <li>"dd MMM uuuu HH:mm z"</li> <li>"dd MMM uu HH:mm:ss z"</li> <li>"dd MMM uu HH:mm z"</li> </ul> <p> Refer to the java.text.SimpleDateFormat javadocs for details on the format of each element. </p> @param sDate string to parse for a date. May be <code>null</code>. @return the Date represented by the given RFC822 string. It returns <b>null</b> if it was not possible to parse the given string into a {@link ZonedDateTime} or if the passed {@link String} was <code>null</code>.
[ "Parses", "a", "Date", "out", "of", "a", "String", "with", "a", "date", "in", "RFC822", "format", ".", "<br", ">", "It", "parsers", "the", "following", "formats", ":", "<ul", ">", "<li", ">", "EEE", "dd", "MMM", "uuuu", "HH", ":", "mm", ":", "ss", "z", "<", "/", "li", ">", "<li", ">", "EEE", "dd", "MMM", "uuuu", "HH", ":", "mm", "z", "<", "/", "li", ">", "<li", ">", "EEE", "dd", "MMM", "uu", "HH", ":", "mm", ":", "ss", "z", "<", "/", "li", ">", "<li", ">", "EEE", "dd", "MMM", "uu", "HH", ":", "mm", "z", "<", "/", "li", ">", "<li", ">", "dd", "MMM", "uuuu", "HH", ":", "mm", ":", "ss", "z", "<", "/", "li", ">", "<li", ">", "dd", "MMM", "uuuu", "HH", ":", "mm", "z", "<", "/", "li", ">", "<li", ">", "dd", "MMM", "uu", "HH", ":", "mm", ":", "ss", "z", "<", "/", "li", ">", "<li", ">", "dd", "MMM", "uu", "HH", ":", "mm", "z", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "Refer", "to", "the", "java", ".", "text", ".", "SimpleDateFormat", "javadocs", "for", "details", "on", "the", "format", "of", "each", "element", ".", "<", "/", "p", ">" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/datetime/PDTWebDateHelper.java#L281-L289
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureConverter.java
SignatureConverter.convertMethodSignature
public static String convertMethodSignature(String className, String methodName, String methodSig) { """ Convenience method for generating a method signature in human readable form. @param className name of the class containing the method @param methodName the name of the method @param methodSig the signature of the method """ return convertMethodSignature(className, methodName, methodSig, ""); }
java
public static String convertMethodSignature(String className, String methodName, String methodSig) { return convertMethodSignature(className, methodName, methodSig, ""); }
[ "public", "static", "String", "convertMethodSignature", "(", "String", "className", ",", "String", "methodName", ",", "String", "methodSig", ")", "{", "return", "convertMethodSignature", "(", "className", ",", "methodName", ",", "methodSig", ",", "\"\"", ")", ";", "}" ]
Convenience method for generating a method signature in human readable form. @param className name of the class containing the method @param methodName the name of the method @param methodSig the signature of the method
[ "Convenience", "method", "for", "generating", "a", "method", "signature", "in", "human", "readable", "form", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureConverter.java#L185-L187
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java
BootstrapConfig.setSystemProperties
public void setSystemProperties() { """ Set configured attributes from bootstrap.properties as system properties. <p> This is a separate step from config to ensure it is called once (by the launcher), rather than every/any time configure is called (could be more than once, some future nested environment.. who knows?). """ // copy all other initial properties to system properties for (Map.Entry<String, String> entry : initProps.entrySet()) { if (!entry.getKey().equals("websphere.java.security")) { final String key = entry.getKey(); final String value = entry.getValue(); try { AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { System.setProperty(key, value); return null; } }); } catch (Exception ex) { } } } }
java
public void setSystemProperties() { // copy all other initial properties to system properties for (Map.Entry<String, String> entry : initProps.entrySet()) { if (!entry.getKey().equals("websphere.java.security")) { final String key = entry.getKey(); final String value = entry.getValue(); try { AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { System.setProperty(key, value); return null; } }); } catch (Exception ex) { } } } }
[ "public", "void", "setSystemProperties", "(", ")", "{", "// copy all other initial properties to system properties", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "initProps", ".", "entrySet", "(", ")", ")", "{", "if", "(", "!", "entry", ".", "getKey", "(", ")", ".", "equals", "(", "\"websphere.java.security\"", ")", ")", "{", "final", "String", "key", "=", "entry", ".", "getKey", "(", ")", ";", "final", "String", "value", "=", "entry", ".", "getValue", "(", ")", ";", "try", "{", "AccessController", ".", "doPrivileged", "(", "new", "java", ".", "security", ".", "PrivilegedExceptionAction", "<", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "run", "(", ")", "throws", "Exception", "{", "System", ".", "setProperty", "(", "key", ",", "value", ")", ";", "return", "null", ";", "}", "}", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "}", "}", "}", "}" ]
Set configured attributes from bootstrap.properties as system properties. <p> This is a separate step from config to ensure it is called once (by the launcher), rather than every/any time configure is called (could be more than once, some future nested environment.. who knows?).
[ "Set", "configured", "attributes", "from", "bootstrap", ".", "properties", "as", "system", "properties", ".", "<p", ">", "This", "is", "a", "separate", "step", "from", "config", "to", "ensure", "it", "is", "called", "once", "(", "by", "the", "launcher", ")", "rather", "than", "every", "/", "any", "time", "configure", "is", "called", "(", "could", "be", "more", "than", "once", "some", "future", "nested", "environment", "..", "who", "knows?", ")", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L415-L434
looly/hutool
hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java
ThreadUtil.newThread
public static Thread newThread(Runnable runnable, String name, boolean isDeamon) { """ 创建新线程 @param runnable {@link Runnable} @param name 线程名 @param isDeamon 是否守护线程 @return {@link Thread} @since 4.1.2 """ final Thread t = new Thread(null, runnable, name); t.setDaemon(isDeamon); return t; }
java
public static Thread newThread(Runnable runnable, String name, boolean isDeamon) { final Thread t = new Thread(null, runnable, name); t.setDaemon(isDeamon); return t; }
[ "public", "static", "Thread", "newThread", "(", "Runnable", "runnable", ",", "String", "name", ",", "boolean", "isDeamon", ")", "{", "final", "Thread", "t", "=", "new", "Thread", "(", "null", ",", "runnable", ",", "name", ")", ";", "t", ".", "setDaemon", "(", "isDeamon", ")", ";", "return", "t", ";", "}" ]
创建新线程 @param runnable {@link Runnable} @param name 线程名 @param isDeamon 是否守护线程 @return {@link Thread} @since 4.1.2
[ "创建新线程" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java#L196-L200
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/FavoriteResourcesImpl.java
FavoriteResourcesImpl.removeFavorites
public void removeFavorites(FavoriteType favoriteType, Set<Long> objectIds) throws SmartsheetException { """ Deletes a list of favorites (all of the same type) It mirrors to the following Smartsheet REST API method: DELETE /favorites Exceptions: IllegalArgumentException : if any argument is null InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation @param favoriteType the favorite type @param objectIds a single Favorite object or an array of Favorite objects @throws SmartsheetException the smartsheet exception """ String path = "favorites/" + favoriteType.toString(); HashMap<String, Object> parameters = new HashMap<String, Object>(); if (objectIds != null) { parameters.put("objectIds", QueryUtil.generateCommaSeparatedList(objectIds)); } path += QueryUtil.generateUrl(null, parameters); this.deleteResource(path, Favorite.class); }
java
public void removeFavorites(FavoriteType favoriteType, Set<Long> objectIds) throws SmartsheetException{ String path = "favorites/" + favoriteType.toString(); HashMap<String, Object> parameters = new HashMap<String, Object>(); if (objectIds != null) { parameters.put("objectIds", QueryUtil.generateCommaSeparatedList(objectIds)); } path += QueryUtil.generateUrl(null, parameters); this.deleteResource(path, Favorite.class); }
[ "public", "void", "removeFavorites", "(", "FavoriteType", "favoriteType", ",", "Set", "<", "Long", ">", "objectIds", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"favorites/\"", "+", "favoriteType", ".", "toString", "(", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "if", "(", "objectIds", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"objectIds\"", ",", "QueryUtil", ".", "generateCommaSeparatedList", "(", "objectIds", ")", ")", ";", "}", "path", "+=", "QueryUtil", ".", "generateUrl", "(", "null", ",", "parameters", ")", ";", "this", ".", "deleteResource", "(", "path", ",", "Favorite", ".", "class", ")", ";", "}" ]
Deletes a list of favorites (all of the same type) It mirrors to the following Smartsheet REST API method: DELETE /favorites Exceptions: IllegalArgumentException : if any argument is null InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation @param favoriteType the favorite type @param objectIds a single Favorite object or an array of Favorite objects @throws SmartsheetException the smartsheet exception
[ "Deletes", "a", "list", "of", "favorites", "(", "all", "of", "the", "same", "type", ")" ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/FavoriteResourcesImpl.java#L122-L133
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java
BlockSender.sendChunks
private int sendChunks(ByteBuffer pkt, int maxChunks, OutputStream out) throws IOException { """ Sends upto maxChunks chunks of data. When blockInPosition is >= 0, assumes 'out' is a {@link SocketOutputStream} and tries {@link SocketOutputStream#transferToFully(FileChannel, long, int)} to send data (and updates blockInPosition). """ // Sends multiple chunks in one packet with a single write(). int len = (int) Math.min(endOffset - offset, (((long) bytesPerChecksum) * ((long) maxChunks))); // truncate len so that any partial chunks will be sent as a final packet. // this is not necessary for correctness, but partial chunks are // ones that may be recomputed and sent via buffer copy, so try to minimize // those bytes if (len > bytesPerChecksum && len % bytesPerChecksum != 0) { len -= len % bytesPerChecksum; } if (len == 0) { return 0; } int numChunks = (len + bytesPerChecksum - 1)/bytesPerChecksum; int packetLen = len + numChunks*checksumSize + 4; pkt.clear(); // The packet format is documented in DFSOuputStream.Packet.getBuffer(). // Here we need to use the exact packet format since it can be received // by both of DFSClient, or BlockReceiver in the case of replication, which // uses the same piece of codes as receiving data from DFSOutputStream. // // write packet header pkt.putInt(packetLen); if (pktIncludeVersion) { pkt.putInt(packetVersion); } pkt.putLong(offset); pkt.putLong(seqno); pkt.put((byte)((offset + len >= endOffset) ? 1 : 0)); //why no ByteBuf.putBoolean()? pkt.putInt(len); int checksumOff = pkt.position(); byte[] buf = pkt.array(); blockReader.sendChunks(out, buf, offset, checksumOff, numChunks, len, crcUpdater, packetVersion); if (throttler != null) { // rebalancing so throttle throttler.throttle(packetLen); } return len; }
java
private int sendChunks(ByteBuffer pkt, int maxChunks, OutputStream out) throws IOException { // Sends multiple chunks in one packet with a single write(). int len = (int) Math.min(endOffset - offset, (((long) bytesPerChecksum) * ((long) maxChunks))); // truncate len so that any partial chunks will be sent as a final packet. // this is not necessary for correctness, but partial chunks are // ones that may be recomputed and sent via buffer copy, so try to minimize // those bytes if (len > bytesPerChecksum && len % bytesPerChecksum != 0) { len -= len % bytesPerChecksum; } if (len == 0) { return 0; } int numChunks = (len + bytesPerChecksum - 1)/bytesPerChecksum; int packetLen = len + numChunks*checksumSize + 4; pkt.clear(); // The packet format is documented in DFSOuputStream.Packet.getBuffer(). // Here we need to use the exact packet format since it can be received // by both of DFSClient, or BlockReceiver in the case of replication, which // uses the same piece of codes as receiving data from DFSOutputStream. // // write packet header pkt.putInt(packetLen); if (pktIncludeVersion) { pkt.putInt(packetVersion); } pkt.putLong(offset); pkt.putLong(seqno); pkt.put((byte)((offset + len >= endOffset) ? 1 : 0)); //why no ByteBuf.putBoolean()? pkt.putInt(len); int checksumOff = pkt.position(); byte[] buf = pkt.array(); blockReader.sendChunks(out, buf, offset, checksumOff, numChunks, len, crcUpdater, packetVersion); if (throttler != null) { // rebalancing so throttle throttler.throttle(packetLen); } return len; }
[ "private", "int", "sendChunks", "(", "ByteBuffer", "pkt", ",", "int", "maxChunks", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "// Sends multiple chunks in one packet with a single write().", "int", "len", "=", "(", "int", ")", "Math", ".", "min", "(", "endOffset", "-", "offset", ",", "(", "(", "(", "long", ")", "bytesPerChecksum", ")", "*", "(", "(", "long", ")", "maxChunks", ")", ")", ")", ";", "// truncate len so that any partial chunks will be sent as a final packet.", "// this is not necessary for correctness, but partial chunks are ", "// ones that may be recomputed and sent via buffer copy, so try to minimize", "// those bytes", "if", "(", "len", ">", "bytesPerChecksum", "&&", "len", "%", "bytesPerChecksum", "!=", "0", ")", "{", "len", "-=", "len", "%", "bytesPerChecksum", ";", "}", "if", "(", "len", "==", "0", ")", "{", "return", "0", ";", "}", "int", "numChunks", "=", "(", "len", "+", "bytesPerChecksum", "-", "1", ")", "/", "bytesPerChecksum", ";", "int", "packetLen", "=", "len", "+", "numChunks", "*", "checksumSize", "+", "4", ";", "pkt", ".", "clear", "(", ")", ";", "// The packet format is documented in DFSOuputStream.Packet.getBuffer().", "// Here we need to use the exact packet format since it can be received", "// by both of DFSClient, or BlockReceiver in the case of replication, which", "// uses the same piece of codes as receiving data from DFSOutputStream.", "//", "// write packet header", "pkt", ".", "putInt", "(", "packetLen", ")", ";", "if", "(", "pktIncludeVersion", ")", "{", "pkt", ".", "putInt", "(", "packetVersion", ")", ";", "}", "pkt", ".", "putLong", "(", "offset", ")", ";", "pkt", ".", "putLong", "(", "seqno", ")", ";", "pkt", ".", "put", "(", "(", "byte", ")", "(", "(", "offset", "+", "len", ">=", "endOffset", ")", "?", "1", ":", "0", ")", ")", ";", "//why no ByteBuf.putBoolean()?", "pkt", ".", "putInt", "(", "len", ")", ";", "int", "checksumOff", "=", "pkt", ".", "position", "(", ")", ";", "byte", "[", "]", "buf", "=", "pkt", ".", "array", "(", ")", ";", "blockReader", ".", "sendChunks", "(", "out", ",", "buf", ",", "offset", ",", "checksumOff", ",", "numChunks", ",", "len", ",", "crcUpdater", ",", "packetVersion", ")", ";", "if", "(", "throttler", "!=", "null", ")", "{", "// rebalancing so throttle", "throttler", ".", "throttle", "(", "packetLen", ")", ";", "}", "return", "len", ";", "}" ]
Sends upto maxChunks chunks of data. When blockInPosition is >= 0, assumes 'out' is a {@link SocketOutputStream} and tries {@link SocketOutputStream#transferToFully(FileChannel, long, int)} to send data (and updates blockInPosition).
[ "Sends", "upto", "maxChunks", "chunks", "of", "data", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java#L256-L307
passwordmaker/java-passwordmaker-lib
src/main/java/org/daveware/passwordmaker/Database.java
Database.addAccount
public void addAccount(Account parent, Account child) throws Exception { """ Adds an account to a parent. This will first check to see if the account already has a parent and if so remove it from that parent before adding it to the new parent. @param parent The parent to add the child under. @param child The child to add. @throws Exception On error. """ // Check to see if the account physically already exists - there is something funny with // some Firefox RDF exports where an RDF:li node gets duplicated multiple times. for (Account dup : parent.getChildren()) { if (dup == child) { logger.warning("Duplicate RDF:li=" + child.getId() + " detected. Dropping duplicate"); return; } } int iterationCount = 0; final int maxIteration = 0x100000; // if we can't find a hash in 1 million iterations, something is wrong while (findAccountById(child.getId()) != null && (iterationCount++ < maxIteration)) { logger.warning("ID collision detected on '" + child.getId() + "', attempting to regenerate ID. iteration=" + iterationCount); child.setId(Account.createId(child)); } if (iterationCount >= maxIteration) { throw new Exception("Could not genererate a unique ID in " + iterationCount + " iterations, this is really rare. I know it's lame, but change the description and try again."); } // add to new parent parent.getChildren().add(child); sendAccountAdded(parent, child); setDirty(true); }
java
public void addAccount(Account parent, Account child) throws Exception { // Check to see if the account physically already exists - there is something funny with // some Firefox RDF exports where an RDF:li node gets duplicated multiple times. for (Account dup : parent.getChildren()) { if (dup == child) { logger.warning("Duplicate RDF:li=" + child.getId() + " detected. Dropping duplicate"); return; } } int iterationCount = 0; final int maxIteration = 0x100000; // if we can't find a hash in 1 million iterations, something is wrong while (findAccountById(child.getId()) != null && (iterationCount++ < maxIteration)) { logger.warning("ID collision detected on '" + child.getId() + "', attempting to regenerate ID. iteration=" + iterationCount); child.setId(Account.createId(child)); } if (iterationCount >= maxIteration) { throw new Exception("Could not genererate a unique ID in " + iterationCount + " iterations, this is really rare. I know it's lame, but change the description and try again."); } // add to new parent parent.getChildren().add(child); sendAccountAdded(parent, child); setDirty(true); }
[ "public", "void", "addAccount", "(", "Account", "parent", ",", "Account", "child", ")", "throws", "Exception", "{", "// Check to see if the account physically already exists - there is something funny with", "// some Firefox RDF exports where an RDF:li node gets duplicated multiple times.", "for", "(", "Account", "dup", ":", "parent", ".", "getChildren", "(", ")", ")", "{", "if", "(", "dup", "==", "child", ")", "{", "logger", ".", "warning", "(", "\"Duplicate RDF:li=\"", "+", "child", ".", "getId", "(", ")", "+", "\" detected. Dropping duplicate\"", ")", ";", "return", ";", "}", "}", "int", "iterationCount", "=", "0", ";", "final", "int", "maxIteration", "=", "0x100000", ";", "// if we can't find a hash in 1 million iterations, something is wrong", "while", "(", "findAccountById", "(", "child", ".", "getId", "(", ")", ")", "!=", "null", "&&", "(", "iterationCount", "++", "<", "maxIteration", ")", ")", "{", "logger", ".", "warning", "(", "\"ID collision detected on '\"", "+", "child", ".", "getId", "(", ")", "+", "\"', attempting to regenerate ID. iteration=\"", "+", "iterationCount", ")", ";", "child", ".", "setId", "(", "Account", ".", "createId", "(", "child", ")", ")", ";", "}", "if", "(", "iterationCount", ">=", "maxIteration", ")", "{", "throw", "new", "Exception", "(", "\"Could not genererate a unique ID in \"", "+", "iterationCount", "+", "\" iterations, this is really rare. I know it's lame, but change the description and try again.\"", ")", ";", "}", "// add to new parent", "parent", ".", "getChildren", "(", ")", ".", "add", "(", "child", ")", ";", "sendAccountAdded", "(", "parent", ",", "child", ")", ";", "setDirty", "(", "true", ")", ";", "}" ]
Adds an account to a parent. This will first check to see if the account already has a parent and if so remove it from that parent before adding it to the new parent. @param parent The parent to add the child under. @param child The child to add. @throws Exception On error.
[ "Adds", "an", "account", "to", "a", "parent", ".", "This", "will", "first", "check", "to", "see", "if", "the", "account", "already", "has", "a", "parent", "and", "if", "so", "remove", "it", "from", "that", "parent", "before", "adding", "it", "to", "the", "new", "parent", "." ]
train
https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/Database.java#L87-L113
JadiraOrg/jadira
cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java
UnsafeOperations.putDouble
public final void putDouble(Object parent, long offset, double value) { """ Puts the value at the given offset of the supplied parent object @param parent The Object's parent @param offset The offset @param value double to be put """ THE_UNSAFE.putDouble(parent, offset, value); }
java
public final void putDouble(Object parent, long offset, double value) { THE_UNSAFE.putDouble(parent, offset, value); }
[ "public", "final", "void", "putDouble", "(", "Object", "parent", ",", "long", "offset", ",", "double", "value", ")", "{", "THE_UNSAFE", ".", "putDouble", "(", "parent", ",", "offset", ",", "value", ")", ";", "}" ]
Puts the value at the given offset of the supplied parent object @param parent The Object's parent @param offset The offset @param value double to be put
[ "Puts", "the", "value", "at", "the", "given", "offset", "of", "the", "supplied", "parent", "object" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java#L1013-L1015
HiddenStage/divide
Client/android-client/src/main/java/com/google/android/gcm/GCMRegistrar.java
GCMRegistrar.setBackoff
static void setBackoff(Context context, int backoff) { """ Sets the backoff counter. <p> This method should be called after a GCM call fails, passing an exponential value. @param context application's context. @param backoff new backoff counter, in milliseconds. """ final SharedPreferences prefs = getGCMPreferences(context); Editor editor = prefs.edit(); editor.putInt(BACKOFF_MS, backoff); editor.commit(); }
java
static void setBackoff(Context context, int backoff) { final SharedPreferences prefs = getGCMPreferences(context); Editor editor = prefs.edit(); editor.putInt(BACKOFF_MS, backoff); editor.commit(); }
[ "static", "void", "setBackoff", "(", "Context", "context", ",", "int", "backoff", ")", "{", "final", "SharedPreferences", "prefs", "=", "getGCMPreferences", "(", "context", ")", ";", "Editor", "editor", "=", "prefs", ".", "edit", "(", ")", ";", "editor", ".", "putInt", "(", "BACKOFF_MS", ",", "backoff", ")", ";", "editor", ".", "commit", "(", ")", ";", "}" ]
Sets the backoff counter. <p> This method should be called after a GCM call fails, passing an exponential value. @param context application's context. @param backoff new backoff counter, in milliseconds.
[ "Sets", "the", "backoff", "counter", ".", "<p", ">", "This", "method", "should", "be", "called", "after", "a", "GCM", "call", "fails", "passing", "an", "exponential", "value", "." ]
train
https://github.com/HiddenStage/divide/blob/14e36598c50d92b4393e6649915e32b86141c598/Client/android-client/src/main/java/com/google/android/gcm/GCMRegistrar.java#L489-L494
liferay/com-liferay-commerce
commerce-tax-api/src/main/java/com/liferay/commerce/tax/model/CommerceTaxMethodWrapper.java
CommerceTaxMethodWrapper.setNameMap
@Override public void setNameMap(Map<java.util.Locale, String> nameMap) { """ Sets the localized names of this commerce tax method from the map of locales and localized names. @param nameMap the locales and localized names of this commerce tax method """ _commerceTaxMethod.setNameMap(nameMap); }
java
@Override public void setNameMap(Map<java.util.Locale, String> nameMap) { _commerceTaxMethod.setNameMap(nameMap); }
[ "@", "Override", "public", "void", "setNameMap", "(", "Map", "<", "java", ".", "util", ".", "Locale", ",", "String", ">", "nameMap", ")", "{", "_commerceTaxMethod", ".", "setNameMap", "(", "nameMap", ")", ";", "}" ]
Sets the localized names of this commerce tax method from the map of locales and localized names. @param nameMap the locales and localized names of this commerce tax method
[ "Sets", "the", "localized", "names", "of", "this", "commerce", "tax", "method", "from", "the", "map", "of", "locales", "and", "localized", "names", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-api/src/main/java/com/liferay/commerce/tax/model/CommerceTaxMethodWrapper.java#L709-L712
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/rowio/RowInputBase.java
RowInputBase.resetRow
public void resetRow(int filepos, int rowsize) throws IOException { """ Used to reset the row, ready for a new row to be written into the byte[] buffer by an external routine. """ mark = 0; reset(); if (buf.length < rowsize) { buf = new byte[rowsize]; } filePos = filepos; size = count = rowsize; pos = 4; buf[0] = (byte) ((rowsize >>> 24) & 0xFF); buf[1] = (byte) ((rowsize >>> 16) & 0xFF); buf[2] = (byte) ((rowsize >>> 8) & 0xFF); buf[3] = (byte) ((rowsize >>> 0) & 0xFF); }
java
public void resetRow(int filepos, int rowsize) throws IOException { mark = 0; reset(); if (buf.length < rowsize) { buf = new byte[rowsize]; } filePos = filepos; size = count = rowsize; pos = 4; buf[0] = (byte) ((rowsize >>> 24) & 0xFF); buf[1] = (byte) ((rowsize >>> 16) & 0xFF); buf[2] = (byte) ((rowsize >>> 8) & 0xFF); buf[3] = (byte) ((rowsize >>> 0) & 0xFF); }
[ "public", "void", "resetRow", "(", "int", "filepos", ",", "int", "rowsize", ")", "throws", "IOException", "{", "mark", "=", "0", ";", "reset", "(", ")", ";", "if", "(", "buf", ".", "length", "<", "rowsize", ")", "{", "buf", "=", "new", "byte", "[", "rowsize", "]", ";", "}", "filePos", "=", "filepos", ";", "size", "=", "count", "=", "rowsize", ";", "pos", "=", "4", ";", "buf", "[", "0", "]", "=", "(", "byte", ")", "(", "(", "rowsize", ">>>", "24", ")", "&", "0xFF", ")", ";", "buf", "[", "1", "]", "=", "(", "byte", ")", "(", "(", "rowsize", ">>>", "16", ")", "&", "0xFF", ")", ";", "buf", "[", "2", "]", "=", "(", "byte", ")", "(", "(", "rowsize", ">>>", "8", ")", "&", "0xFF", ")", ";", "buf", "[", "3", "]", "=", "(", "byte", ")", "(", "(", "rowsize", ">>>", "0", ")", "&", "0xFF", ")", ";", "}" ]
Used to reset the row, ready for a new row to be written into the byte[] buffer by an external routine.
[ "Used", "to", "reset", "the", "row", "ready", "for", "a", "new", "row", "to", "be", "written", "into", "the", "byte", "[]", "buffer", "by", "an", "external", "routine", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/rowio/RowInputBase.java#L277-L294
apache/flink
flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/IncrementalSSSP.java
IncrementalSSSP.isInSSSP
public static boolean isInSSSP(final Edge<Long, Double> edgeToBeRemoved, DataSet<Edge<Long, Double>> edgesInSSSP) throws Exception { """ Function that verifies whether the edge to be removed is part of the SSSP or not. If it is, the src vertex will be invalidated. @param edgeToBeRemoved @param edgesInSSSP @return true or false """ return edgesInSSSP.filter(new FilterFunction<Edge<Long, Double>>() { @Override public boolean filter(Edge<Long, Double> edge) throws Exception { return edge.equals(edgeToBeRemoved); } }).count() > 0; }
java
public static boolean isInSSSP(final Edge<Long, Double> edgeToBeRemoved, DataSet<Edge<Long, Double>> edgesInSSSP) throws Exception { return edgesInSSSP.filter(new FilterFunction<Edge<Long, Double>>() { @Override public boolean filter(Edge<Long, Double> edge) throws Exception { return edge.equals(edgeToBeRemoved); } }).count() > 0; }
[ "public", "static", "boolean", "isInSSSP", "(", "final", "Edge", "<", "Long", ",", "Double", ">", "edgeToBeRemoved", ",", "DataSet", "<", "Edge", "<", "Long", ",", "Double", ">", ">", "edgesInSSSP", ")", "throws", "Exception", "{", "return", "edgesInSSSP", ".", "filter", "(", "new", "FilterFunction", "<", "Edge", "<", "Long", ",", "Double", ">", ">", "(", ")", "{", "@", "Override", "public", "boolean", "filter", "(", "Edge", "<", "Long", ",", "Double", ">", "edge", ")", "throws", "Exception", "{", "return", "edge", ".", "equals", "(", "edgeToBeRemoved", ")", ";", "}", "}", ")", ".", "count", "(", ")", ">", "0", ";", "}" ]
Function that verifies whether the edge to be removed is part of the SSSP or not. If it is, the src vertex will be invalidated. @param edgeToBeRemoved @param edgesInSSSP @return true or false
[ "Function", "that", "verifies", "whether", "the", "edge", "to", "be", "removed", "is", "part", "of", "the", "SSSP", "or", "not", ".", "If", "it", "is", "the", "src", "vertex", "will", "be", "invalidated", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/IncrementalSSSP.java#L140-L148
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/scale/SystemUtcRules.java
SystemUtcRules.loadLeapSeconds
private static Data loadLeapSeconds(URL url) throws ClassNotFoundException, IOException { """ Loads the leap second rules from a URL, often in a jar file. @param url the jar file to load, not null @throws Exception if an error occurs """ List<String> lines; try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), StandardCharsets.UTF_8))) { lines = reader.lines().collect(Collectors.toList()); } List<Long> dates = new ArrayList<>(); List<Integer> offsets = new ArrayList<>(); for (String line : lines) { line = line.trim(); if (line.isEmpty() || line.startsWith("#")) { continue; } Matcher matcher = LEAP_FILE_FORMAT.matcher(line); if (matcher.matches() == false) { throw new StreamCorruptedException("Invalid leap second file"); } dates.add(LocalDate.parse(matcher.group(1)).getLong(JulianFields.MODIFIED_JULIAN_DAY)); offsets.add(Integer.valueOf(matcher.group(2))); } long[] datesData = new long[dates.size()]; int[] offsetsData = new int[dates.size()]; long[] taiData = new long[dates.size()]; for (int i = 0; i < datesData.length; i++) { datesData[i] = dates.get(i); offsetsData[i] = offsets.get(i); taiData[i] = tai(datesData[i], offsetsData[i]); } return new Data(datesData, offsetsData, taiData); }
java
private static Data loadLeapSeconds(URL url) throws ClassNotFoundException, IOException { List<String> lines; try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), StandardCharsets.UTF_8))) { lines = reader.lines().collect(Collectors.toList()); } List<Long> dates = new ArrayList<>(); List<Integer> offsets = new ArrayList<>(); for (String line : lines) { line = line.trim(); if (line.isEmpty() || line.startsWith("#")) { continue; } Matcher matcher = LEAP_FILE_FORMAT.matcher(line); if (matcher.matches() == false) { throw new StreamCorruptedException("Invalid leap second file"); } dates.add(LocalDate.parse(matcher.group(1)).getLong(JulianFields.MODIFIED_JULIAN_DAY)); offsets.add(Integer.valueOf(matcher.group(2))); } long[] datesData = new long[dates.size()]; int[] offsetsData = new int[dates.size()]; long[] taiData = new long[dates.size()]; for (int i = 0; i < datesData.length; i++) { datesData[i] = dates.get(i); offsetsData[i] = offsets.get(i); taiData[i] = tai(datesData[i], offsetsData[i]); } return new Data(datesData, offsetsData, taiData); }
[ "private", "static", "Data", "loadLeapSeconds", "(", "URL", "url", ")", "throws", "ClassNotFoundException", ",", "IOException", "{", "List", "<", "String", ">", "lines", ";", "try", "(", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "url", ".", "openStream", "(", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ")", ")", "{", "lines", "=", "reader", ".", "lines", "(", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}", "List", "<", "Long", ">", "dates", "=", "new", "ArrayList", "<>", "(", ")", ";", "List", "<", "Integer", ">", "offsets", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "line", ":", "lines", ")", "{", "line", "=", "line", ".", "trim", "(", ")", ";", "if", "(", "line", ".", "isEmpty", "(", ")", "||", "line", ".", "startsWith", "(", "\"#\"", ")", ")", "{", "continue", ";", "}", "Matcher", "matcher", "=", "LEAP_FILE_FORMAT", ".", "matcher", "(", "line", ")", ";", "if", "(", "matcher", ".", "matches", "(", ")", "==", "false", ")", "{", "throw", "new", "StreamCorruptedException", "(", "\"Invalid leap second file\"", ")", ";", "}", "dates", ".", "add", "(", "LocalDate", ".", "parse", "(", "matcher", ".", "group", "(", "1", ")", ")", ".", "getLong", "(", "JulianFields", ".", "MODIFIED_JULIAN_DAY", ")", ")", ";", "offsets", ".", "add", "(", "Integer", ".", "valueOf", "(", "matcher", ".", "group", "(", "2", ")", ")", ")", ";", "}", "long", "[", "]", "datesData", "=", "new", "long", "[", "dates", ".", "size", "(", ")", "]", ";", "int", "[", "]", "offsetsData", "=", "new", "int", "[", "dates", ".", "size", "(", ")", "]", ";", "long", "[", "]", "taiData", "=", "new", "long", "[", "dates", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "datesData", ".", "length", ";", "i", "++", ")", "{", "datesData", "[", "i", "]", "=", "dates", ".", "get", "(", "i", ")", ";", "offsetsData", "[", "i", "]", "=", "offsets", ".", "get", "(", "i", ")", ";", "taiData", "[", "i", "]", "=", "tai", "(", "datesData", "[", "i", "]", ",", "offsetsData", "[", "i", "]", ")", ";", "}", "return", "new", "Data", "(", "datesData", ",", "offsetsData", ",", "taiData", ")", ";", "}" ]
Loads the leap second rules from a URL, often in a jar file. @param url the jar file to load, not null @throws Exception if an error occurs
[ "Loads", "the", "leap", "second", "rules", "from", "a", "URL", "often", "in", "a", "jar", "file", "." ]
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/scale/SystemUtcRules.java#L263-L291
samskivert/pythagoras
src/main/java/pythagoras/f/Points.java
Points.epsilonEquals
public static boolean epsilonEquals (IPoint p1, IPoint p2, float epsilon) { """ Returns true if the supplied points' x and y components are equal to one another within {@code epsilon}. """ return Math.abs(p1.x() - p2.x()) < epsilon && Math.abs(p1.y() - p2.y()) < epsilon; }
java
public static boolean epsilonEquals (IPoint p1, IPoint p2, float epsilon) { return Math.abs(p1.x() - p2.x()) < epsilon && Math.abs(p1.y() - p2.y()) < epsilon; }
[ "public", "static", "boolean", "epsilonEquals", "(", "IPoint", "p1", ",", "IPoint", "p2", ",", "float", "epsilon", ")", "{", "return", "Math", ".", "abs", "(", "p1", ".", "x", "(", ")", "-", "p2", ".", "x", "(", ")", ")", "<", "epsilon", "&&", "Math", ".", "abs", "(", "p1", ".", "y", "(", ")", "-", "p2", ".", "y", "(", ")", ")", "<", "epsilon", ";", "}" ]
Returns true if the supplied points' x and y components are equal to one another within {@code epsilon}.
[ "Returns", "true", "if", "the", "supplied", "points", "x", "and", "y", "components", "are", "equal", "to", "one", "another", "within", "{" ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Points.java#L43-L45
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/tracer/Tracer.java
Tracer.pushCCMContext
public static synchronized void pushCCMContext(String key, Throwable callstack) { """ Push CCM context @param key The frame key @param callstack The call stack """ log.tracef("%s", new TraceEvent("CachedConnectionManager", "NONE", TraceEvent.PUSH_CCM_CONTEXT, "NONE", key, callstack != null ? toString(callstack) : "")); }
java
public static synchronized void pushCCMContext(String key, Throwable callstack) { log.tracef("%s", new TraceEvent("CachedConnectionManager", "NONE", TraceEvent.PUSH_CCM_CONTEXT, "NONE", key, callstack != null ? toString(callstack) : "")); }
[ "public", "static", "synchronized", "void", "pushCCMContext", "(", "String", "key", ",", "Throwable", "callstack", ")", "{", "log", ".", "tracef", "(", "\"%s\"", ",", "new", "TraceEvent", "(", "\"CachedConnectionManager\"", ",", "\"NONE\"", ",", "TraceEvent", ".", "PUSH_CCM_CONTEXT", ",", "\"NONE\"", ",", "key", ",", "callstack", "!=", "null", "?", "toString", "(", "callstack", ")", ":", "\"\"", ")", ")", ";", "}" ]
Push CCM context @param key The frame key @param callstack The call stack
[ "Push", "CCM", "context" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tracer/Tracer.java#L584-L588
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java
RedundentExprEliminator.createMultistepExprList
protected MultistepExprHolder createMultistepExprList(Vector paths) { """ For the reduction of location path parts, create a list of all the multistep paths with more than one step, sorted by the number of steps, with the most steps occuring earlier in the list. If the list is only one member, don't bother returning it. @param paths Vector of ExpressionOwner objects, which may contain null entries. The ExpressionOwner objects must own LocPathIterator objects. @return null if no multipart paths are found or the list is only of length 1, otherwise the first MultistepExprHolder in a linked list of these objects. """ MultistepExprHolder first = null; int n = paths.size(); for(int i = 0; i < n; i++) { ExpressionOwner eo = (ExpressionOwner)paths.elementAt(i); if(null == eo) continue; // Assuming location path iterators should be OK. LocPathIterator lpi = (LocPathIterator)eo.getExpression(); int numPaths = countSteps(lpi); if(numPaths > 1) { if(null == first) first = new MultistepExprHolder(eo, numPaths, null); else first = first.addInSortedOrder(eo, numPaths); } } if((null == first) || (first.getLength() <= 1)) return null; else return first; }
java
protected MultistepExprHolder createMultistepExprList(Vector paths) { MultistepExprHolder first = null; int n = paths.size(); for(int i = 0; i < n; i++) { ExpressionOwner eo = (ExpressionOwner)paths.elementAt(i); if(null == eo) continue; // Assuming location path iterators should be OK. LocPathIterator lpi = (LocPathIterator)eo.getExpression(); int numPaths = countSteps(lpi); if(numPaths > 1) { if(null == first) first = new MultistepExprHolder(eo, numPaths, null); else first = first.addInSortedOrder(eo, numPaths); } } if((null == first) || (first.getLength() <= 1)) return null; else return first; }
[ "protected", "MultistepExprHolder", "createMultistepExprList", "(", "Vector", "paths", ")", "{", "MultistepExprHolder", "first", "=", "null", ";", "int", "n", "=", "paths", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "ExpressionOwner", "eo", "=", "(", "ExpressionOwner", ")", "paths", ".", "elementAt", "(", "i", ")", ";", "if", "(", "null", "==", "eo", ")", "continue", ";", "// Assuming location path iterators should be OK.", "LocPathIterator", "lpi", "=", "(", "LocPathIterator", ")", "eo", ".", "getExpression", "(", ")", ";", "int", "numPaths", "=", "countSteps", "(", "lpi", ")", ";", "if", "(", "numPaths", ">", "1", ")", "{", "if", "(", "null", "==", "first", ")", "first", "=", "new", "MultistepExprHolder", "(", "eo", ",", "numPaths", ",", "null", ")", ";", "else", "first", "=", "first", ".", "addInSortedOrder", "(", "eo", ",", "numPaths", ")", ";", "}", "}", "if", "(", "(", "null", "==", "first", ")", "||", "(", "first", ".", "getLength", "(", ")", "<=", "1", ")", ")", "return", "null", ";", "else", "return", "first", ";", "}" ]
For the reduction of location path parts, create a list of all the multistep paths with more than one step, sorted by the number of steps, with the most steps occuring earlier in the list. If the list is only one member, don't bother returning it. @param paths Vector of ExpressionOwner objects, which may contain null entries. The ExpressionOwner objects must own LocPathIterator objects. @return null if no multipart paths are found or the list is only of length 1, otherwise the first MultistepExprHolder in a linked list of these objects.
[ "For", "the", "reduction", "of", "location", "path", "parts", "create", "a", "list", "of", "all", "the", "multistep", "paths", "with", "more", "than", "one", "step", "sorted", "by", "the", "number", "of", "steps", "with", "the", "most", "steps", "occuring", "earlier", "in", "the", "list", ".", "If", "the", "list", "is", "only", "one", "member", "don", "t", "bother", "returning", "it", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L554-L580
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/inject/qualifiers/TypeArgumentQualifier.java
TypeArgumentQualifier.areTypesCompatible
public static boolean areTypesCompatible(Class[] typeArguments, List<Class> classToCompare) { """ Are the given types compatible. @param typeArguments The type arguments @param classToCompare The classes to check for alignments @return True if they are """ if (classToCompare.size() == 0) { // in this case the type doesn't specify type arguments, so this is the equivalent of using Object return true; } else { if (classToCompare.size() != typeArguments.length) { return false; } else { for (int i = 0; i < classToCompare.size(); i++) { Class left = classToCompare.get(i); Class right = typeArguments[i]; if (right == Object.class) { continue; } if (left != right && !left.isAssignableFrom(right)) { return false; } } } } return true; }
java
public static boolean areTypesCompatible(Class[] typeArguments, List<Class> classToCompare) { if (classToCompare.size() == 0) { // in this case the type doesn't specify type arguments, so this is the equivalent of using Object return true; } else { if (classToCompare.size() != typeArguments.length) { return false; } else { for (int i = 0; i < classToCompare.size(); i++) { Class left = classToCompare.get(i); Class right = typeArguments[i]; if (right == Object.class) { continue; } if (left != right && !left.isAssignableFrom(right)) { return false; } } } } return true; }
[ "public", "static", "boolean", "areTypesCompatible", "(", "Class", "[", "]", "typeArguments", ",", "List", "<", "Class", ">", "classToCompare", ")", "{", "if", "(", "classToCompare", ".", "size", "(", ")", "==", "0", ")", "{", "// in this case the type doesn't specify type arguments, so this is the equivalent of using Object", "return", "true", ";", "}", "else", "{", "if", "(", "classToCompare", ".", "size", "(", ")", "!=", "typeArguments", ".", "length", ")", "{", "return", "false", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "classToCompare", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Class", "left", "=", "classToCompare", ".", "get", "(", "i", ")", ";", "Class", "right", "=", "typeArguments", "[", "i", "]", ";", "if", "(", "right", "==", "Object", ".", "class", ")", "{", "continue", ";", "}", "if", "(", "left", "!=", "right", "&&", "!", "left", ".", "isAssignableFrom", "(", "right", ")", ")", "{", "return", "false", ";", "}", "}", "}", "}", "return", "true", ";", "}" ]
Are the given types compatible. @param typeArguments The type arguments @param classToCompare The classes to check for alignments @return True if they are
[ "Are", "the", "given", "types", "compatible", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/qualifiers/TypeArgumentQualifier.java#L116-L137
box/box-java-sdk
src/main/java/com/box/sdk/BoxGroup.java
BoxGroup.getAllGroups
public static Iterable<BoxGroup.Info> getAllGroups(final BoxAPIConnection api) { """ Gets an iterable of all the groups in the enterprise. @param api the API connection to be used when retrieving the groups. @return an iterable containing info about all the groups. """ return new Iterable<BoxGroup.Info>() { public Iterator<BoxGroup.Info> iterator() { URL url = GROUPS_URL_TEMPLATE.build(api.getBaseURL()); return new BoxGroupIterator(api, url); } }; }
java
public static Iterable<BoxGroup.Info> getAllGroups(final BoxAPIConnection api) { return new Iterable<BoxGroup.Info>() { public Iterator<BoxGroup.Info> iterator() { URL url = GROUPS_URL_TEMPLATE.build(api.getBaseURL()); return new BoxGroupIterator(api, url); } }; }
[ "public", "static", "Iterable", "<", "BoxGroup", ".", "Info", ">", "getAllGroups", "(", "final", "BoxAPIConnection", "api", ")", "{", "return", "new", "Iterable", "<", "BoxGroup", ".", "Info", ">", "(", ")", "{", "public", "Iterator", "<", "BoxGroup", ".", "Info", ">", "iterator", "(", ")", "{", "URL", "url", "=", "GROUPS_URL_TEMPLATE", ".", "build", "(", "api", ".", "getBaseURL", "(", ")", ")", ";", "return", "new", "BoxGroupIterator", "(", "api", ",", "url", ")", ";", "}", "}", ";", "}" ]
Gets an iterable of all the groups in the enterprise. @param api the API connection to be used when retrieving the groups. @return an iterable containing info about all the groups.
[ "Gets", "an", "iterable", "of", "all", "the", "groups", "in", "the", "enterprise", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxGroup.java#L115-L122
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.getPrivilege
public Privilege getPrivilege(String id) throws OAuthSystemException, OAuthProblemException, URISyntaxException { """ Get a Privilege @param id The id of the privilege you want to update. @return Privilege @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.Privilege @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/privileges/get-privilege">Get Privilege documentation</a> """ cleanError(); prepareToken(); URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_PRIVILEGE_URL, id)); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); Privilege privilege = null; OneloginOAuth2JSONResourceResponse oAuth2Response = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.GET, OneloginOAuth2JSONResourceResponse.class); if (oAuth2Response.getResponseCode() == 200) { JSONObject data = oAuth2Response.getJSONObjectFromContent(); privilege = new Privilege(data); } else { error = oAuth2Response.getError(); errorDescription = oAuth2Response.getErrorDescription(); } return privilege; }
java
public Privilege getPrivilege(String id) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_PRIVILEGE_URL, id)); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); Privilege privilege = null; OneloginOAuth2JSONResourceResponse oAuth2Response = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.GET, OneloginOAuth2JSONResourceResponse.class); if (oAuth2Response.getResponseCode() == 200) { JSONObject data = oAuth2Response.getJSONObjectFromContent(); privilege = new Privilege(data); } else { error = oAuth2Response.getError(); errorDescription = oAuth2Response.getErrorDescription(); } return privilege; }
[ "public", "Privilege", "getPrivilege", "(", "String", "id", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "cleanError", "(", ")", ";", "prepareToken", "(", ")", ";", "URIBuilder", "url", "=", "new", "URIBuilder", "(", "settings", ".", "getURL", "(", "Constants", ".", "GET_PRIVILEGE_URL", ",", "id", ")", ")", ";", "OneloginURLConnectionClient", "httpClient", "=", "new", "OneloginURLConnectionClient", "(", ")", ";", "OAuthClient", "oAuthClient", "=", "new", "OAuthClient", "(", "httpClient", ")", ";", "OAuthClientRequest", "bearerRequest", "=", "new", "OAuthBearerClientRequest", "(", "url", ".", "toString", "(", ")", ")", ".", "buildHeaderMessage", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "headers", "=", "getAuthorizedHeader", "(", ")", ";", "bearerRequest", ".", "setHeaders", "(", "headers", ")", ";", "Privilege", "privilege", "=", "null", ";", "OneloginOAuth2JSONResourceResponse", "oAuth2Response", "=", "oAuthClient", ".", "resource", "(", "bearerRequest", ",", "OAuth", ".", "HttpMethod", ".", "GET", ",", "OneloginOAuth2JSONResourceResponse", ".", "class", ")", ";", "if", "(", "oAuth2Response", ".", "getResponseCode", "(", ")", "==", "200", ")", "{", "JSONObject", "data", "=", "oAuth2Response", ".", "getJSONObjectFromContent", "(", ")", ";", "privilege", "=", "new", "Privilege", "(", "data", ")", ";", "}", "else", "{", "error", "=", "oAuth2Response", ".", "getError", "(", ")", ";", "errorDescription", "=", "oAuth2Response", ".", "getErrorDescription", "(", ")", ";", "}", "return", "privilege", ";", "}" ]
Get a Privilege @param id The id of the privilege you want to update. @return Privilege @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.Privilege @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/privileges/get-privilege">Get Privilege documentation</a>
[ "Get", "a", "Privilege" ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L3295-L3319
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java
ProtobufIDLProxy.createSingle
public static IDLProxyObject createSingle(InputStream is, boolean debug, boolean isUniName) throws IOException { """ Creates the single. @param is the is @param debug the debug @param isUniName the is uni name @return the IDL proxy object @throws IOException Signals that an I/O exception has occurred. """ return createSingle(is, debug, null, isUniName); }
java
public static IDLProxyObject createSingle(InputStream is, boolean debug, boolean isUniName) throws IOException { return createSingle(is, debug, null, isUniName); }
[ "public", "static", "IDLProxyObject", "createSingle", "(", "InputStream", "is", ",", "boolean", "debug", ",", "boolean", "isUniName", ")", "throws", "IOException", "{", "return", "createSingle", "(", "is", ",", "debug", ",", "null", ",", "isUniName", ")", ";", "}" ]
Creates the single. @param is the is @param debug the debug @param isUniName the is uni name @return the IDL proxy object @throws IOException Signals that an I/O exception has occurred.
[ "Creates", "the", "single", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java#L989-L991
houbb/log-integration
src/main/java/com/github/houbb/log/integration/adaptors/jdbc/StatementLogger.java
StatementLogger.newInstance
public static Statement newInstance(Statement stmt, Log statementLog, int queryStack) { """ /* Creates a logging version of a Statement @param stmt - the statement @return - the proxy """ InvocationHandler handler = new StatementLogger(stmt, statementLog, queryStack); ClassLoader cl = Statement.class.getClassLoader(); return (Statement) Proxy.newProxyInstance(cl, new Class[]{Statement.class}, handler); }
java
public static Statement newInstance(Statement stmt, Log statementLog, int queryStack) { InvocationHandler handler = new StatementLogger(stmt, statementLog, queryStack); ClassLoader cl = Statement.class.getClassLoader(); return (Statement) Proxy.newProxyInstance(cl, new Class[]{Statement.class}, handler); }
[ "public", "static", "Statement", "newInstance", "(", "Statement", "stmt", ",", "Log", "statementLog", ",", "int", "queryStack", ")", "{", "InvocationHandler", "handler", "=", "new", "StatementLogger", "(", "stmt", ",", "statementLog", ",", "queryStack", ")", ";", "ClassLoader", "cl", "=", "Statement", ".", "class", ".", "getClassLoader", "(", ")", ";", "return", "(", "Statement", ")", "Proxy", ".", "newProxyInstance", "(", "cl", ",", "new", "Class", "[", "]", "{", "Statement", ".", "class", "}", ",", "handler", ")", ";", "}" ]
/* Creates a logging version of a Statement @param stmt - the statement @return - the proxy
[ "/", "*", "Creates", "a", "logging", "version", "of", "a", "Statement" ]
train
https://github.com/houbb/log-integration/blob/c5e979719aec12a02f7d22b24b04b6fbb1789ca5/src/main/java/com/github/houbb/log/integration/adaptors/jdbc/StatementLogger.java#L88-L92
alkacon/opencms-core
src/org/opencms/relations/CmsCategoryService.java
CmsCategoryService.readResourceCategories
public List<CmsCategory> readResourceCategories(CmsObject cms, String resourceName) throws CmsException { """ Reads the categories for a resource identified by the given resource name.<p> @param cms the current cms context @param resourceName the path of the resource to get the categories for @return the categories list @throws CmsException if something goes wrong """ return internalReadResourceCategories(cms, cms.readResource(resourceName), false); }
java
public List<CmsCategory> readResourceCategories(CmsObject cms, String resourceName) throws CmsException { return internalReadResourceCategories(cms, cms.readResource(resourceName), false); }
[ "public", "List", "<", "CmsCategory", ">", "readResourceCategories", "(", "CmsObject", "cms", ",", "String", "resourceName", ")", "throws", "CmsException", "{", "return", "internalReadResourceCategories", "(", "cms", ",", "cms", ".", "readResource", "(", "resourceName", ")", ",", "false", ")", ";", "}" ]
Reads the categories for a resource identified by the given resource name.<p> @param cms the current cms context @param resourceName the path of the resource to get the categories for @return the categories list @throws CmsException if something goes wrong
[ "Reads", "the", "categories", "for", "a", "resource", "identified", "by", "the", "given", "resource", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L664-L667
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/svg/inkscape/Util.java
Util.getTransform
static Transform getTransform(Element element, String attribute) { """ Get a transform defined in the XML @param element The element from which the transform should be read @param attribute The name of the attribute holding the transform @return The transform to be applied """ String str = element.getAttribute(attribute); if (str == null) { return new Transform(); } if (str.equals("")) { return new Transform(); } else if (str.startsWith("translate")) { str = str.substring(0, str.length()-1); str = str.substring("translate(".length()); StringTokenizer tokens = new StringTokenizer(str, ", "); float x = Float.parseFloat(tokens.nextToken()); float y = Float.parseFloat(tokens.nextToken()); return Transform.createTranslateTransform(x,y); } else if (str.startsWith("matrix")) { float[] pose = new float[6]; str = str.substring(0, str.length()-1); str = str.substring("matrix(".length()); StringTokenizer tokens = new StringTokenizer(str, ", "); float[] tr = new float[6]; for (int j=0;j<tr.length;j++) { tr[j] = Float.parseFloat(tokens.nextToken()); } pose[0] = tr[0]; pose[1] = tr[2]; pose[2] = tr[4]; pose[3] = tr[1]; pose[4] = tr[3]; pose[5] = tr[5]; return new Transform(pose); } return new Transform(); }
java
static Transform getTransform(Element element, String attribute) { String str = element.getAttribute(attribute); if (str == null) { return new Transform(); } if (str.equals("")) { return new Transform(); } else if (str.startsWith("translate")) { str = str.substring(0, str.length()-1); str = str.substring("translate(".length()); StringTokenizer tokens = new StringTokenizer(str, ", "); float x = Float.parseFloat(tokens.nextToken()); float y = Float.parseFloat(tokens.nextToken()); return Transform.createTranslateTransform(x,y); } else if (str.startsWith("matrix")) { float[] pose = new float[6]; str = str.substring(0, str.length()-1); str = str.substring("matrix(".length()); StringTokenizer tokens = new StringTokenizer(str, ", "); float[] tr = new float[6]; for (int j=0;j<tr.length;j++) { tr[j] = Float.parseFloat(tokens.nextToken()); } pose[0] = tr[0]; pose[1] = tr[2]; pose[2] = tr[4]; pose[3] = tr[1]; pose[4] = tr[3]; pose[5] = tr[5]; return new Transform(pose); } return new Transform(); }
[ "static", "Transform", "getTransform", "(", "Element", "element", ",", "String", "attribute", ")", "{", "String", "str", "=", "element", ".", "getAttribute", "(", "attribute", ")", ";", "if", "(", "str", "==", "null", ")", "{", "return", "new", "Transform", "(", ")", ";", "}", "if", "(", "str", ".", "equals", "(", "\"\"", ")", ")", "{", "return", "new", "Transform", "(", ")", ";", "}", "else", "if", "(", "str", ".", "startsWith", "(", "\"translate\"", ")", ")", "{", "str", "=", "str", ".", "substring", "(", "0", ",", "str", ".", "length", "(", ")", "-", "1", ")", ";", "str", "=", "str", ".", "substring", "(", "\"translate(\"", ".", "length", "(", ")", ")", ";", "StringTokenizer", "tokens", "=", "new", "StringTokenizer", "(", "str", ",", "\", \"", ")", ";", "float", "x", "=", "Float", ".", "parseFloat", "(", "tokens", ".", "nextToken", "(", ")", ")", ";", "float", "y", "=", "Float", ".", "parseFloat", "(", "tokens", ".", "nextToken", "(", ")", ")", ";", "return", "Transform", ".", "createTranslateTransform", "(", "x", ",", "y", ")", ";", "}", "else", "if", "(", "str", ".", "startsWith", "(", "\"matrix\"", ")", ")", "{", "float", "[", "]", "pose", "=", "new", "float", "[", "6", "]", ";", "str", "=", "str", ".", "substring", "(", "0", ",", "str", ".", "length", "(", ")", "-", "1", ")", ";", "str", "=", "str", ".", "substring", "(", "\"matrix(\"", ".", "length", "(", ")", ")", ";", "StringTokenizer", "tokens", "=", "new", "StringTokenizer", "(", "str", ",", "\", \"", ")", ";", "float", "[", "]", "tr", "=", "new", "float", "[", "6", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "tr", ".", "length", ";", "j", "++", ")", "{", "tr", "[", "j", "]", "=", "Float", ".", "parseFloat", "(", "tokens", ".", "nextToken", "(", ")", ")", ";", "}", "pose", "[", "0", "]", "=", "tr", "[", "0", "]", ";", "pose", "[", "1", "]", "=", "tr", "[", "2", "]", ";", "pose", "[", "2", "]", "=", "tr", "[", "4", "]", ";", "pose", "[", "3", "]", "=", "tr", "[", "1", "]", ";", "pose", "[", "4", "]", "=", "tr", "[", "3", "]", ";", "pose", "[", "5", "]", "=", "tr", "[", "5", "]", ";", "return", "new", "Transform", "(", "pose", ")", ";", "}", "return", "new", "Transform", "(", ")", ";", "}" ]
Get a transform defined in the XML @param element The element from which the transform should be read @param attribute The name of the attribute holding the transform @return The transform to be applied
[ "Get", "a", "transform", "defined", "in", "the", "XML" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/svg/inkscape/Util.java#L122-L159
JodaOrg/joda-time-jsptags
src/main/java/org/joda/time/contrib/jsptag/Util.java
Util.findFormattingMatch
private static Locale findFormattingMatch(Locale pref, Locale[] avail) { """ Returns the best match between the given preferred locale and the given available locales. The best match is given as the first available locale that exactly matches the given preferred locale ("exact match"). If no exact match exists, the best match is given to an available locale that meets the following criteria (in order of priority): - available locale's variant is empty and exact match for both language and country - available locale's variant and country are empty, and exact match for language. @param pref the preferred locale @param avail the available formatting locales @return Available locale that best matches the given preferred locale, or <tt>null</tt> if no match exists """ Locale match = null; boolean langAndCountryMatch = false; for (int i = 0; i < avail.length; i++) { if (pref.equals(avail[i])) { // Exact match match = avail[i]; break; } else if (!"".equals(pref.getVariant()) && "".equals(avail[i].getVariant()) && pref.getLanguage().equals(avail[i].getLanguage()) && pref.getCountry().equals(avail[i].getCountry())) { // Language and country match; different variant match = avail[i]; langAndCountryMatch = true; } else if (!langAndCountryMatch && pref.getLanguage().equals(avail[i].getLanguage()) && ("".equals(avail[i].getCountry()))) { // Language match if (match == null) { match = avail[i]; } } } return match; }
java
private static Locale findFormattingMatch(Locale pref, Locale[] avail) { Locale match = null; boolean langAndCountryMatch = false; for (int i = 0; i < avail.length; i++) { if (pref.equals(avail[i])) { // Exact match match = avail[i]; break; } else if (!"".equals(pref.getVariant()) && "".equals(avail[i].getVariant()) && pref.getLanguage().equals(avail[i].getLanguage()) && pref.getCountry().equals(avail[i].getCountry())) { // Language and country match; different variant match = avail[i]; langAndCountryMatch = true; } else if (!langAndCountryMatch && pref.getLanguage().equals(avail[i].getLanguage()) && ("".equals(avail[i].getCountry()))) { // Language match if (match == null) { match = avail[i]; } } } return match; }
[ "private", "static", "Locale", "findFormattingMatch", "(", "Locale", "pref", ",", "Locale", "[", "]", "avail", ")", "{", "Locale", "match", "=", "null", ";", "boolean", "langAndCountryMatch", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "avail", ".", "length", ";", "i", "++", ")", "{", "if", "(", "pref", ".", "equals", "(", "avail", "[", "i", "]", ")", ")", "{", "// Exact match", "match", "=", "avail", "[", "i", "]", ";", "break", ";", "}", "else", "if", "(", "!", "\"\"", ".", "equals", "(", "pref", ".", "getVariant", "(", ")", ")", "&&", "\"\"", ".", "equals", "(", "avail", "[", "i", "]", ".", "getVariant", "(", ")", ")", "&&", "pref", ".", "getLanguage", "(", ")", ".", "equals", "(", "avail", "[", "i", "]", ".", "getLanguage", "(", ")", ")", "&&", "pref", ".", "getCountry", "(", ")", ".", "equals", "(", "avail", "[", "i", "]", ".", "getCountry", "(", ")", ")", ")", "{", "// Language and country match; different variant", "match", "=", "avail", "[", "i", "]", ";", "langAndCountryMatch", "=", "true", ";", "}", "else", "if", "(", "!", "langAndCountryMatch", "&&", "pref", ".", "getLanguage", "(", ")", ".", "equals", "(", "avail", "[", "i", "]", ".", "getLanguage", "(", ")", ")", "&&", "(", "\"\"", ".", "equals", "(", "avail", "[", "i", "]", ".", "getCountry", "(", ")", ")", ")", ")", "{", "// Language match", "if", "(", "match", "==", "null", ")", "{", "match", "=", "avail", "[", "i", "]", ";", "}", "}", "}", "return", "match", ";", "}" ]
Returns the best match between the given preferred locale and the given available locales. The best match is given as the first available locale that exactly matches the given preferred locale ("exact match"). If no exact match exists, the best match is given to an available locale that meets the following criteria (in order of priority): - available locale's variant is empty and exact match for both language and country - available locale's variant and country are empty, and exact match for language. @param pref the preferred locale @param avail the available formatting locales @return Available locale that best matches the given preferred locale, or <tt>null</tt> if no match exists
[ "Returns", "the", "best", "match", "between", "the", "given", "preferred", "locale", "and", "the", "given", "available", "locales", "." ]
train
https://github.com/JodaOrg/joda-time-jsptags/blob/69008a813568cb6f3e37ea7a80f8b1f2070edf14/src/main/java/org/joda/time/contrib/jsptag/Util.java#L406-L431
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java
DeployerResolverOverriderConverter.overrideUseArtifactoryGradlePlugin
private void overrideUseArtifactoryGradlePlugin(T overrider, Class overriderClass) { """ Convert the Boolean skipInjectInitScript parameter to Boolean useArtifactoryGradlePlugin This convertion comes after a name change (skipInjectInitScript -> useArtifactoryGradlePlugin) """ if (overriderClass.getSimpleName().equals(ArtifactoryGradleConfigurator.class.getSimpleName())) { try { Field useArtifactoryGradlePluginField = overriderClass.getDeclaredField("useArtifactoryGradlePlugin"); useArtifactoryGradlePluginField.setAccessible(true); Object useArtifactoryGradlePlugin = useArtifactoryGradlePluginField.get(overrider); if (useArtifactoryGradlePlugin == null) { Field skipInjectInitScriptField = overriderClass.getDeclaredField("skipInjectInitScript"); skipInjectInitScriptField.setAccessible(true); Object skipInjectInitScript = skipInjectInitScriptField.get(overrider); if (skipInjectInitScript instanceof Boolean && skipInjectInitScript != null) { useArtifactoryGradlePluginField.set(overrider, skipInjectInitScript); } } } catch (NoSuchFieldException | IllegalAccessException e) { converterErrors.add(getConversionErrorMessage(overrider, e)); } } }
java
private void overrideUseArtifactoryGradlePlugin(T overrider, Class overriderClass) { if (overriderClass.getSimpleName().equals(ArtifactoryGradleConfigurator.class.getSimpleName())) { try { Field useArtifactoryGradlePluginField = overriderClass.getDeclaredField("useArtifactoryGradlePlugin"); useArtifactoryGradlePluginField.setAccessible(true); Object useArtifactoryGradlePlugin = useArtifactoryGradlePluginField.get(overrider); if (useArtifactoryGradlePlugin == null) { Field skipInjectInitScriptField = overriderClass.getDeclaredField("skipInjectInitScript"); skipInjectInitScriptField.setAccessible(true); Object skipInjectInitScript = skipInjectInitScriptField.get(overrider); if (skipInjectInitScript instanceof Boolean && skipInjectInitScript != null) { useArtifactoryGradlePluginField.set(overrider, skipInjectInitScript); } } } catch (NoSuchFieldException | IllegalAccessException e) { converterErrors.add(getConversionErrorMessage(overrider, e)); } } }
[ "private", "void", "overrideUseArtifactoryGradlePlugin", "(", "T", "overrider", ",", "Class", "overriderClass", ")", "{", "if", "(", "overriderClass", ".", "getSimpleName", "(", ")", ".", "equals", "(", "ArtifactoryGradleConfigurator", ".", "class", ".", "getSimpleName", "(", ")", ")", ")", "{", "try", "{", "Field", "useArtifactoryGradlePluginField", "=", "overriderClass", ".", "getDeclaredField", "(", "\"useArtifactoryGradlePlugin\"", ")", ";", "useArtifactoryGradlePluginField", ".", "setAccessible", "(", "true", ")", ";", "Object", "useArtifactoryGradlePlugin", "=", "useArtifactoryGradlePluginField", ".", "get", "(", "overrider", ")", ";", "if", "(", "useArtifactoryGradlePlugin", "==", "null", ")", "{", "Field", "skipInjectInitScriptField", "=", "overriderClass", ".", "getDeclaredField", "(", "\"skipInjectInitScript\"", ")", ";", "skipInjectInitScriptField", ".", "setAccessible", "(", "true", ")", ";", "Object", "skipInjectInitScript", "=", "skipInjectInitScriptField", ".", "get", "(", "overrider", ")", ";", "if", "(", "skipInjectInitScript", "instanceof", "Boolean", "&&", "skipInjectInitScript", "!=", "null", ")", "{", "useArtifactoryGradlePluginField", ".", "set", "(", "overrider", ",", "skipInjectInitScript", ")", ";", "}", "}", "}", "catch", "(", "NoSuchFieldException", "|", "IllegalAccessException", "e", ")", "{", "converterErrors", ".", "add", "(", "getConversionErrorMessage", "(", "overrider", ",", "e", ")", ")", ";", "}", "}", "}" ]
Convert the Boolean skipInjectInitScript parameter to Boolean useArtifactoryGradlePlugin This convertion comes after a name change (skipInjectInitScript -> useArtifactoryGradlePlugin)
[ "Convert", "the", "Boolean", "skipInjectInitScript", "parameter", "to", "Boolean", "useArtifactoryGradlePlugin", "This", "convertion", "comes", "after", "a", "name", "change", "(", "skipInjectInitScript", "-", ">", "useArtifactoryGradlePlugin", ")" ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java#L256-L275
alkacon/opencms-core
src/org/opencms/loader/A_CmsXmlDocumentLoader.java
A_CmsXmlDocumentLoader.setTemplateRequestAttributes
protected void setTemplateRequestAttributes(CmsTemplateLoaderFacade loaderFacade, HttpServletRequest req) { """ Sets request attributes that provide access to the template configuration.<p> @param loaderFacade the template loader facade @param req the servlet request """ CmsTemplateContext context = loaderFacade.getTemplateContext(); req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_CONTEXT, context); TemplateBean templateBean = new TemplateBean( context != null ? context.getKey() : loaderFacade.getTemplateName(), loaderFacade.getTemplate()); templateBean.setForced((context != null) && context.isForced()); req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_BEAN, templateBean); }
java
protected void setTemplateRequestAttributes(CmsTemplateLoaderFacade loaderFacade, HttpServletRequest req) { CmsTemplateContext context = loaderFacade.getTemplateContext(); req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_CONTEXT, context); TemplateBean templateBean = new TemplateBean( context != null ? context.getKey() : loaderFacade.getTemplateName(), loaderFacade.getTemplate()); templateBean.setForced((context != null) && context.isForced()); req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_BEAN, templateBean); }
[ "protected", "void", "setTemplateRequestAttributes", "(", "CmsTemplateLoaderFacade", "loaderFacade", ",", "HttpServletRequest", "req", ")", "{", "CmsTemplateContext", "context", "=", "loaderFacade", ".", "getTemplateContext", "(", ")", ";", "req", ".", "setAttribute", "(", "CmsTemplateContextManager", ".", "ATTR_TEMPLATE_CONTEXT", ",", "context", ")", ";", "TemplateBean", "templateBean", "=", "new", "TemplateBean", "(", "context", "!=", "null", "?", "context", ".", "getKey", "(", ")", ":", "loaderFacade", ".", "getTemplateName", "(", ")", ",", "loaderFacade", ".", "getTemplate", "(", ")", ")", ";", "templateBean", ".", "setForced", "(", "(", "context", "!=", "null", ")", "&&", "context", ".", "isForced", "(", ")", ")", ";", "req", ".", "setAttribute", "(", "CmsTemplateContextManager", ".", "ATTR_TEMPLATE_BEAN", ",", "templateBean", ")", ";", "}" ]
Sets request attributes that provide access to the template configuration.<p> @param loaderFacade the template loader facade @param req the servlet request
[ "Sets", "request", "attributes", "that", "provide", "access", "to", "the", "template", "configuration", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/A_CmsXmlDocumentLoader.java#L281-L290
landawn/AbacusUtil
src/com/landawn/abacus/util/HBaseExecutor.java
HBaseExecutor.get
Result get(final String tableName, final Object rowKey) throws UncheckedIOException { """ And it may cause error because the "Object" is ambiguous to any type. """ return get(tableName, AnyGet.of(rowKey)); }
java
Result get(final String tableName, final Object rowKey) throws UncheckedIOException { return get(tableName, AnyGet.of(rowKey)); }
[ "Result", "get", "(", "final", "String", "tableName", ",", "final", "Object", "rowKey", ")", "throws", "UncheckedIOException", "{", "return", "get", "(", "tableName", ",", "AnyGet", ".", "of", "(", "rowKey", ")", ")", ";", "}" ]
And it may cause error because the "Object" is ambiguous to any type.
[ "And", "it", "may", "cause", "error", "because", "the", "Object", "is", "ambiguous", "to", "any", "type", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/HBaseExecutor.java#L764-L766
networknt/light-4j
server/src/main/java/com/networknt/server/Server.java
Server.loadConfigs
static public void loadConfigs() { """ Locate the Config Loader class, instantiate it and then call init() method on it. Uses DefaultConfigLoader if startup.yml is missing or configLoaderClass is missing in startup.yml """ IConfigLoader configLoader; Map<String, Object> startupConfig = Config.getInstance().getJsonMapConfig(STARTUP_CONFIG_NAME); if(startupConfig ==null || startupConfig.get(CONFIG_LOADER_CLASS) ==null){ configLoader = new DefaultConfigLoader(); }else{ try { Class clazz = Class.forName((String) startupConfig.get(CONFIG_LOADER_CLASS)); configLoader = (IConfigLoader) clazz.getConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException("configLoaderClass mentioned in startup.yml could not be found or constructed", e); } } configLoader.init(); }
java
static public void loadConfigs(){ IConfigLoader configLoader; Map<String, Object> startupConfig = Config.getInstance().getJsonMapConfig(STARTUP_CONFIG_NAME); if(startupConfig ==null || startupConfig.get(CONFIG_LOADER_CLASS) ==null){ configLoader = new DefaultConfigLoader(); }else{ try { Class clazz = Class.forName((String) startupConfig.get(CONFIG_LOADER_CLASS)); configLoader = (IConfigLoader) clazz.getConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException("configLoaderClass mentioned in startup.yml could not be found or constructed", e); } } configLoader.init(); }
[ "static", "public", "void", "loadConfigs", "(", ")", "{", "IConfigLoader", "configLoader", ";", "Map", "<", "String", ",", "Object", ">", "startupConfig", "=", "Config", ".", "getInstance", "(", ")", ".", "getJsonMapConfig", "(", "STARTUP_CONFIG_NAME", ")", ";", "if", "(", "startupConfig", "==", "null", "||", "startupConfig", ".", "get", "(", "CONFIG_LOADER_CLASS", ")", "==", "null", ")", "{", "configLoader", "=", "new", "DefaultConfigLoader", "(", ")", ";", "}", "else", "{", "try", "{", "Class", "clazz", "=", "Class", ".", "forName", "(", "(", "String", ")", "startupConfig", ".", "get", "(", "CONFIG_LOADER_CLASS", ")", ")", ";", "configLoader", "=", "(", "IConfigLoader", ")", "clazz", ".", "getConstructor", "(", ")", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"configLoaderClass mentioned in startup.yml could not be found or constructed\"", ",", "e", ")", ";", "}", "}", "configLoader", ".", "init", "(", ")", ";", "}" ]
Locate the Config Loader class, instantiate it and then call init() method on it. Uses DefaultConfigLoader if startup.yml is missing or configLoaderClass is missing in startup.yml
[ "Locate", "the", "Config", "Loader", "class", "instantiate", "it", "and", "then", "call", "init", "()", "method", "on", "it", ".", "Uses", "DefaultConfigLoader", "if", "startup", ".", "yml", "is", "missing", "or", "configLoaderClass", "is", "missing", "in", "startup", ".", "yml" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/server/src/main/java/com/networknt/server/Server.java#L125-L139
alkacon/opencms-core
src/org/opencms/main/CmsShellCommands.java
CmsShellCommands.exportResources
public void exportResources(String exportFile, String pathList) throws Exception { """ Exports a list of resources from the current site root to a ZIP file.<p> The resource names in the list must be separated with a ";".<p> @param exportFile the name (absolute path) of the ZIP file to export to @param pathList the list of resource to export, separated with a ";" @throws Exception if something goes wrong """ exportResources(exportFile, pathList, false); }
java
public void exportResources(String exportFile, String pathList) throws Exception { exportResources(exportFile, pathList, false); }
[ "public", "void", "exportResources", "(", "String", "exportFile", ",", "String", "pathList", ")", "throws", "Exception", "{", "exportResources", "(", "exportFile", ",", "pathList", ",", "false", ")", ";", "}" ]
Exports a list of resources from the current site root to a ZIP file.<p> The resource names in the list must be separated with a ";".<p> @param exportFile the name (absolute path) of the ZIP file to export to @param pathList the list of resource to export, separated with a ";" @throws Exception if something goes wrong
[ "Exports", "a", "list", "of", "resources", "from", "the", "current", "site", "root", "to", "a", "ZIP", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L664-L667
azkaban/azkaban
az-flow-trigger-dependency-type/kafka-event-trigger/src/main/java/trigger/kafka/KafkaEventMonitor.java
KafkaEventMonitor.triggerDependencies
private void triggerDependencies(final Set<String> matchedList, final ConsumerRecord<String, String> record) { """ If the matcher returns true, remove the dependency from collection. """ final List<KafkaDependencyInstanceContext> deleteList = new LinkedList<>(); for (final String it : matchedList) { final List<KafkaDependencyInstanceContext> possibleAvailableDeps = this.depInstances.getDepsByTopicAndEvent(record.topic(), it); for (final KafkaDependencyInstanceContext dep : possibleAvailableDeps) { dep.getCallback().onSuccess(dep); deleteList.add(dep); } //If dependencies that need to be removed could lead to unsubscribing topics, do the topics rebalance if (!this.depInstances.removeList(record.topic(), it, deleteList)) { this.subscribedTopics.addAll(this.depInstances.getTopicList()); } } }
java
private void triggerDependencies(final Set<String> matchedList, final ConsumerRecord<String, String> record) { final List<KafkaDependencyInstanceContext> deleteList = new LinkedList<>(); for (final String it : matchedList) { final List<KafkaDependencyInstanceContext> possibleAvailableDeps = this.depInstances.getDepsByTopicAndEvent(record.topic(), it); for (final KafkaDependencyInstanceContext dep : possibleAvailableDeps) { dep.getCallback().onSuccess(dep); deleteList.add(dep); } //If dependencies that need to be removed could lead to unsubscribing topics, do the topics rebalance if (!this.depInstances.removeList(record.topic(), it, deleteList)) { this.subscribedTopics.addAll(this.depInstances.getTopicList()); } } }
[ "private", "void", "triggerDependencies", "(", "final", "Set", "<", "String", ">", "matchedList", ",", "final", "ConsumerRecord", "<", "String", ",", "String", ">", "record", ")", "{", "final", "List", "<", "KafkaDependencyInstanceContext", ">", "deleteList", "=", "new", "LinkedList", "<>", "(", ")", ";", "for", "(", "final", "String", "it", ":", "matchedList", ")", "{", "final", "List", "<", "KafkaDependencyInstanceContext", ">", "possibleAvailableDeps", "=", "this", ".", "depInstances", ".", "getDepsByTopicAndEvent", "(", "record", ".", "topic", "(", ")", ",", "it", ")", ";", "for", "(", "final", "KafkaDependencyInstanceContext", "dep", ":", "possibleAvailableDeps", ")", "{", "dep", ".", "getCallback", "(", ")", ".", "onSuccess", "(", "dep", ")", ";", "deleteList", ".", "add", "(", "dep", ")", ";", "}", "//If dependencies that need to be removed could lead to unsubscribing topics, do the topics rebalance", "if", "(", "!", "this", ".", "depInstances", ".", "removeList", "(", "record", ".", "topic", "(", ")", ",", "it", ",", "deleteList", ")", ")", "{", "this", ".", "subscribedTopics", ".", "addAll", "(", "this", ".", "depInstances", ".", "getTopicList", "(", ")", ")", ";", "}", "}", "}" ]
If the matcher returns true, remove the dependency from collection.
[ "If", "the", "matcher", "returns", "true", "remove", "the", "dependency", "from", "collection", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-flow-trigger-dependency-type/kafka-event-trigger/src/main/java/trigger/kafka/KafkaEventMonitor.java#L149-L163
alkacon/opencms-core
src/org/opencms/relations/CmsRelation.java
CmsRelation.getSource
public CmsResource getSource(CmsObject cms, CmsResourceFilter filter) throws CmsException { """ Returns the source resource when possible to read with the given filter.<p> @param cms the current user context @param filter the filter to use @return the source resource @throws CmsException if something goes wrong """ try { // first look up by id return cms.readResource(getSourceId(), filter); } catch (CmsVfsResourceNotFoundException e) { // then look up by name, but from the root site String storedSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(""); return cms.readResource(getSourcePath(), filter); } finally { cms.getRequestContext().setSiteRoot(storedSiteRoot); } } }
java
public CmsResource getSource(CmsObject cms, CmsResourceFilter filter) throws CmsException { try { // first look up by id return cms.readResource(getSourceId(), filter); } catch (CmsVfsResourceNotFoundException e) { // then look up by name, but from the root site String storedSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(""); return cms.readResource(getSourcePath(), filter); } finally { cms.getRequestContext().setSiteRoot(storedSiteRoot); } } }
[ "public", "CmsResource", "getSource", "(", "CmsObject", "cms", ",", "CmsResourceFilter", "filter", ")", "throws", "CmsException", "{", "try", "{", "// first look up by id", "return", "cms", ".", "readResource", "(", "getSourceId", "(", ")", ",", "filter", ")", ";", "}", "catch", "(", "CmsVfsResourceNotFoundException", "e", ")", "{", "// then look up by name, but from the root site", "String", "storedSiteRoot", "=", "cms", ".", "getRequestContext", "(", ")", ".", "getSiteRoot", "(", ")", ";", "try", "{", "cms", ".", "getRequestContext", "(", ")", ".", "setSiteRoot", "(", "\"\"", ")", ";", "return", "cms", ".", "readResource", "(", "getSourcePath", "(", ")", ",", "filter", ")", ";", "}", "finally", "{", "cms", ".", "getRequestContext", "(", ")", ".", "setSiteRoot", "(", "storedSiteRoot", ")", ";", "}", "}", "}" ]
Returns the source resource when possible to read with the given filter.<p> @param cms the current user context @param filter the filter to use @return the source resource @throws CmsException if something goes wrong
[ "Returns", "the", "source", "resource", "when", "possible", "to", "read", "with", "the", "given", "filter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsRelation.java#L148-L163
wisdom-framework/wisdom-jcr
wisdom-jcr-core/src/main/java/org/wisdom/jcrom/runtime/JcromBundleContext.java
JcromBundleContext.addCrudService
public void addCrudService(Class clazz, BundleContext bundleContext, JcrRepository repository) throws RepositoryException { """ Create a crud service for given class and context, and registers it @param clazz @param context @param repository @throws RepositoryException """ jcrom.map(clazz); JcrCrudService<? extends Object> jcromCrudService; jcromCrudService = new JcrCrudService<>(repository, jcrom, clazz); crudServiceRegistrations.put(jcromCrudService, registerCrud(bundleContext, jcromCrudService)); }
java
public void addCrudService(Class clazz, BundleContext bundleContext, JcrRepository repository) throws RepositoryException { jcrom.map(clazz); JcrCrudService<? extends Object> jcromCrudService; jcromCrudService = new JcrCrudService<>(repository, jcrom, clazz); crudServiceRegistrations.put(jcromCrudService, registerCrud(bundleContext, jcromCrudService)); }
[ "public", "void", "addCrudService", "(", "Class", "clazz", ",", "BundleContext", "bundleContext", ",", "JcrRepository", "repository", ")", "throws", "RepositoryException", "{", "jcrom", ".", "map", "(", "clazz", ")", ";", "JcrCrudService", "<", "?", "extends", "Object", ">", "jcromCrudService", ";", "jcromCrudService", "=", "new", "JcrCrudService", "<>", "(", "repository", ",", "jcrom", ",", "clazz", ")", ";", "crudServiceRegistrations", ".", "put", "(", "jcromCrudService", ",", "registerCrud", "(", "bundleContext", ",", "jcromCrudService", ")", ")", ";", "}" ]
Create a crud service for given class and context, and registers it @param clazz @param context @param repository @throws RepositoryException
[ "Create", "a", "crud", "service", "for", "given", "class", "and", "context", "and", "registers", "it" ]
train
https://github.com/wisdom-framework/wisdom-jcr/blob/2711383dde2239a19b90c226b3fd2aecab5715e4/wisdom-jcr-core/src/main/java/org/wisdom/jcrom/runtime/JcromBundleContext.java#L60-L65
netty/netty
transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java
AbstractCoalescingBufferQueue.composeIntoComposite
protected final ByteBuf composeIntoComposite(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) { """ Compose {@code cumulation} and {@code next} into a new {@link CompositeByteBuf}. """ // Create a composite buffer to accumulate this pair and potentially all the buffers // in the queue. Using +2 as we have already dequeued current and next. CompositeByteBuf composite = alloc.compositeBuffer(size() + 2); try { composite.addComponent(true, cumulation); composite.addComponent(true, next); } catch (Throwable cause) { composite.release(); safeRelease(next); throwException(cause); } return composite; }
java
protected final ByteBuf composeIntoComposite(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) { // Create a composite buffer to accumulate this pair and potentially all the buffers // in the queue. Using +2 as we have already dequeued current and next. CompositeByteBuf composite = alloc.compositeBuffer(size() + 2); try { composite.addComponent(true, cumulation); composite.addComponent(true, next); } catch (Throwable cause) { composite.release(); safeRelease(next); throwException(cause); } return composite; }
[ "protected", "final", "ByteBuf", "composeIntoComposite", "(", "ByteBufAllocator", "alloc", ",", "ByteBuf", "cumulation", ",", "ByteBuf", "next", ")", "{", "// Create a composite buffer to accumulate this pair and potentially all the buffers", "// in the queue. Using +2 as we have already dequeued current and next.", "CompositeByteBuf", "composite", "=", "alloc", ".", "compositeBuffer", "(", "size", "(", ")", "+", "2", ")", ";", "try", "{", "composite", ".", "addComponent", "(", "true", ",", "cumulation", ")", ";", "composite", ".", "addComponent", "(", "true", ",", "next", ")", ";", "}", "catch", "(", "Throwable", "cause", ")", "{", "composite", ".", "release", "(", ")", ";", "safeRelease", "(", "next", ")", ";", "throwException", "(", "cause", ")", ";", "}", "return", "composite", ";", "}" ]
Compose {@code cumulation} and {@code next} into a new {@link CompositeByteBuf}.
[ "Compose", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java#L270-L283
duracloud/duracloud
common/src/main/java/org/duracloud/common/util/IOUtil.java
IOUtil.addFileToZipOutputStream
public static void addFileToZipOutputStream(File file, ZipOutputStream zipOs) throws IOException { """ Adds the specified file to the zip output stream. @param file @param zipOs """ String fileName = file.getName(); try (FileInputStream fos = new FileInputStream(file)) { ZipEntry zipEntry = new ZipEntry(fileName); zipEntry.setSize(file.length()); zipEntry.setTime(System.currentTimeMillis()); zipOs.putNextEntry(zipEntry); byte[] buf = new byte[1024]; int bytesRead; while ((bytesRead = fos.read(buf)) > 0) { zipOs.write(buf, 0, bytesRead); } zipOs.closeEntry(); fos.close(); } }
java
public static void addFileToZipOutputStream(File file, ZipOutputStream zipOs) throws IOException { String fileName = file.getName(); try (FileInputStream fos = new FileInputStream(file)) { ZipEntry zipEntry = new ZipEntry(fileName); zipEntry.setSize(file.length()); zipEntry.setTime(System.currentTimeMillis()); zipOs.putNextEntry(zipEntry); byte[] buf = new byte[1024]; int bytesRead; while ((bytesRead = fos.read(buf)) > 0) { zipOs.write(buf, 0, bytesRead); } zipOs.closeEntry(); fos.close(); } }
[ "public", "static", "void", "addFileToZipOutputStream", "(", "File", "file", ",", "ZipOutputStream", "zipOs", ")", "throws", "IOException", "{", "String", "fileName", "=", "file", ".", "getName", "(", ")", ";", "try", "(", "FileInputStream", "fos", "=", "new", "FileInputStream", "(", "file", ")", ")", "{", "ZipEntry", "zipEntry", "=", "new", "ZipEntry", "(", "fileName", ")", ";", "zipEntry", ".", "setSize", "(", "file", ".", "length", "(", ")", ")", ";", "zipEntry", ".", "setTime", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "zipOs", ".", "putNextEntry", "(", "zipEntry", ")", ";", "byte", "[", "]", "buf", "=", "new", "byte", "[", "1024", "]", ";", "int", "bytesRead", ";", "while", "(", "(", "bytesRead", "=", "fos", ".", "read", "(", "buf", ")", ")", ">", "0", ")", "{", "zipOs", ".", "write", "(", "buf", ",", "0", ",", "bytesRead", ")", ";", "}", "zipOs", ".", "closeEntry", "(", ")", ";", "fos", ".", "close", "(", ")", ";", "}", "}" ]
Adds the specified file to the zip output stream. @param file @param zipOs
[ "Adds", "the", "specified", "file", "to", "the", "zip", "output", "stream", "." ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/common/src/main/java/org/duracloud/common/util/IOUtil.java#L140-L155
alkacon/opencms-core
src/org/opencms/loader/CmsJspLoader.java
CmsJspLoader.processTaglibAttributes
@Deprecated public String processTaglibAttributes(String content) { """ Replaces taglib attributes in page directives with taglib directives.<p> @param content the JSP source text @return the transformed JSP text """ // matches a whole page directive final Pattern directivePattern = Pattern.compile("(?sm)<%@\\s*page.*?%>"); // matches a taglibs attribute and captures its values final Pattern taglibPattern = Pattern.compile("(?sm)taglibs\\s*=\\s*\"(.*?)\""); final Pattern commaPattern = Pattern.compile("(?sm)\\s*,\\s*"); final Set<String> taglibs = new LinkedHashSet<String>(); // we insert the marker after the first page directive final String marker = ":::TAGLIBS:::"; I_CmsRegexSubstitution directiveSub = new I_CmsRegexSubstitution() { private boolean m_first = true; public String substituteMatch(String string, Matcher matcher) { String match = string.substring(matcher.start(), matcher.end()); I_CmsRegexSubstitution taglibSub = new I_CmsRegexSubstitution() { public String substituteMatch(String string1, Matcher matcher1) { // values of the taglibs attribute String match1 = string1.substring(matcher1.start(1), matcher1.end(1)); for (String taglibKey : Splitter.on(commaPattern).split(match1)) { taglibs.add(taglibKey); } return ""; } }; String result = CmsStringUtil.substitute(taglibPattern, match, taglibSub); if (m_first) { result += marker; m_first = false; } return result; } }; String substituted = CmsStringUtil.substitute(directivePattern, content, directiveSub); // insert taglib inclusion substituted = substituted.replaceAll(marker, generateTaglibInclusions(taglibs)); // remove empty page directives substituted = substituted.replaceAll("(?sm)<%@\\s*page\\s*%>", ""); return substituted; }
java
@Deprecated public String processTaglibAttributes(String content) { // matches a whole page directive final Pattern directivePattern = Pattern.compile("(?sm)<%@\\s*page.*?%>"); // matches a taglibs attribute and captures its values final Pattern taglibPattern = Pattern.compile("(?sm)taglibs\\s*=\\s*\"(.*?)\""); final Pattern commaPattern = Pattern.compile("(?sm)\\s*,\\s*"); final Set<String> taglibs = new LinkedHashSet<String>(); // we insert the marker after the first page directive final String marker = ":::TAGLIBS:::"; I_CmsRegexSubstitution directiveSub = new I_CmsRegexSubstitution() { private boolean m_first = true; public String substituteMatch(String string, Matcher matcher) { String match = string.substring(matcher.start(), matcher.end()); I_CmsRegexSubstitution taglibSub = new I_CmsRegexSubstitution() { public String substituteMatch(String string1, Matcher matcher1) { // values of the taglibs attribute String match1 = string1.substring(matcher1.start(1), matcher1.end(1)); for (String taglibKey : Splitter.on(commaPattern).split(match1)) { taglibs.add(taglibKey); } return ""; } }; String result = CmsStringUtil.substitute(taglibPattern, match, taglibSub); if (m_first) { result += marker; m_first = false; } return result; } }; String substituted = CmsStringUtil.substitute(directivePattern, content, directiveSub); // insert taglib inclusion substituted = substituted.replaceAll(marker, generateTaglibInclusions(taglibs)); // remove empty page directives substituted = substituted.replaceAll("(?sm)<%@\\s*page\\s*%>", ""); return substituted; }
[ "@", "Deprecated", "public", "String", "processTaglibAttributes", "(", "String", "content", ")", "{", "// matches a whole page directive", "final", "Pattern", "directivePattern", "=", "Pattern", ".", "compile", "(", "\"(?sm)<%@\\\\s*page.*?%>\"", ")", ";", "// matches a taglibs attribute and captures its values", "final", "Pattern", "taglibPattern", "=", "Pattern", ".", "compile", "(", "\"(?sm)taglibs\\\\s*=\\\\s*\\\"(.*?)\\\"\"", ")", ";", "final", "Pattern", "commaPattern", "=", "Pattern", ".", "compile", "(", "\"(?sm)\\\\s*,\\\\s*\"", ")", ";", "final", "Set", "<", "String", ">", "taglibs", "=", "new", "LinkedHashSet", "<", "String", ">", "(", ")", ";", "// we insert the marker after the first page directive", "final", "String", "marker", "=", "\":::TAGLIBS:::\"", ";", "I_CmsRegexSubstitution", "directiveSub", "=", "new", "I_CmsRegexSubstitution", "(", ")", "{", "private", "boolean", "m_first", "=", "true", ";", "public", "String", "substituteMatch", "(", "String", "string", ",", "Matcher", "matcher", ")", "{", "String", "match", "=", "string", ".", "substring", "(", "matcher", ".", "start", "(", ")", ",", "matcher", ".", "end", "(", ")", ")", ";", "I_CmsRegexSubstitution", "taglibSub", "=", "new", "I_CmsRegexSubstitution", "(", ")", "{", "public", "String", "substituteMatch", "(", "String", "string1", ",", "Matcher", "matcher1", ")", "{", "// values of the taglibs attribute", "String", "match1", "=", "string1", ".", "substring", "(", "matcher1", ".", "start", "(", "1", ")", ",", "matcher1", ".", "end", "(", "1", ")", ")", ";", "for", "(", "String", "taglibKey", ":", "Splitter", ".", "on", "(", "commaPattern", ")", ".", "split", "(", "match1", ")", ")", "{", "taglibs", ".", "add", "(", "taglibKey", ")", ";", "}", "return", "\"\"", ";", "}", "}", ";", "String", "result", "=", "CmsStringUtil", ".", "substitute", "(", "taglibPattern", ",", "match", ",", "taglibSub", ")", ";", "if", "(", "m_first", ")", "{", "result", "+=", "marker", ";", "m_first", "=", "false", ";", "}", "return", "result", ";", "}", "}", ";", "String", "substituted", "=", "CmsStringUtil", ".", "substitute", "(", "directivePattern", ",", "content", ",", "directiveSub", ")", ";", "// insert taglib inclusion", "substituted", "=", "substituted", ".", "replaceAll", "(", "marker", ",", "generateTaglibInclusions", "(", "taglibs", ")", ")", ";", "// remove empty page directives", "substituted", "=", "substituted", ".", "replaceAll", "(", "\"(?sm)<%@\\\\s*page\\\\s*%>\"", ",", "\"\"", ")", ";", "return", "substituted", ";", "}" ]
Replaces taglib attributes in page directives with taglib directives.<p> @param content the JSP source text @return the transformed JSP text
[ "Replaces", "taglib", "attributes", "in", "page", "directives", "with", "taglib", "directives", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsJspLoader.java#L550-L594
hellosign/hellosign-java-sdk
src/main/java/com/hellosign/sdk/HelloSignClient.java
HelloSignClient.getFiles
public File getFiles(String requestId, String format) throws HelloSignException { """ Retrieves the file associated with a signature request. @param requestId String signature request ID @param format String format, see SignatureRequest for available types @return File @throws HelloSignException thrown if there's a problem processing the HTTP request or the JSON response. """ if (format == null || format.isEmpty()) { format = FILES_FILE_EXT; } String url = BASE_URI + SIGNATURE_REQUEST_FILES_URI + "/" + requestId; String fileName = FILES_FILE_NAME + "." + format; return httpClient.withAuth(auth).withGetParam(PARAM_FILE_TYPE_URI, format).get(url).asFile(fileName); }
java
public File getFiles(String requestId, String format) throws HelloSignException { if (format == null || format.isEmpty()) { format = FILES_FILE_EXT; } String url = BASE_URI + SIGNATURE_REQUEST_FILES_URI + "/" + requestId; String fileName = FILES_FILE_NAME + "." + format; return httpClient.withAuth(auth).withGetParam(PARAM_FILE_TYPE_URI, format).get(url).asFile(fileName); }
[ "public", "File", "getFiles", "(", "String", "requestId", ",", "String", "format", ")", "throws", "HelloSignException", "{", "if", "(", "format", "==", "null", "||", "format", ".", "isEmpty", "(", ")", ")", "{", "format", "=", "FILES_FILE_EXT", ";", "}", "String", "url", "=", "BASE_URI", "+", "SIGNATURE_REQUEST_FILES_URI", "+", "\"/\"", "+", "requestId", ";", "String", "fileName", "=", "FILES_FILE_NAME", "+", "\".\"", "+", "format", ";", "return", "httpClient", ".", "withAuth", "(", "auth", ")", ".", "withGetParam", "(", "PARAM_FILE_TYPE_URI", ",", "format", ")", ".", "get", "(", "url", ")", ".", "asFile", "(", "fileName", ")", ";", "}" ]
Retrieves the file associated with a signature request. @param requestId String signature request ID @param format String format, see SignatureRequest for available types @return File @throws HelloSignException thrown if there's a problem processing the HTTP request or the JSON response.
[ "Retrieves", "the", "file", "associated", "with", "a", "signature", "request", "." ]
train
https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/HelloSignClient.java#L771-L778
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
JavacParser.variableDeclarators
public <T extends ListBuffer<? super JCVariableDecl>> T variableDeclarators(JCModifiers mods, JCExpression type, T vdefs) { """ VariableDeclarators = VariableDeclarator { "," VariableDeclarator } """ return variableDeclaratorsRest(token.pos, mods, type, ident(), false, null, vdefs); }
java
public <T extends ListBuffer<? super JCVariableDecl>> T variableDeclarators(JCModifiers mods, JCExpression type, T vdefs) { return variableDeclaratorsRest(token.pos, mods, type, ident(), false, null, vdefs); }
[ "public", "<", "T", "extends", "ListBuffer", "<", "?", "super", "JCVariableDecl", ">", ">", "T", "variableDeclarators", "(", "JCModifiers", "mods", ",", "JCExpression", "type", ",", "T", "vdefs", ")", "{", "return", "variableDeclaratorsRest", "(", "token", ".", "pos", ",", "mods", ",", "type", ",", "ident", "(", ")", ",", "false", ",", "null", ",", "vdefs", ")", ";", "}" ]
VariableDeclarators = VariableDeclarator { "," VariableDeclarator }
[ "VariableDeclarators", "=", "VariableDeclarator", "{", "VariableDeclarator", "}" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L2973-L2978
CenturyLinkCloud/mdw
mdw-workflow/src/com/centurylink/mdw/workflow/adapter/TextAdapterActivity.java
TextAdapterActivity.directInvoke
public Response directInvoke(String request, int timeout, Map<String,String> meta_data) throws AdapterException, ConnectionException { """ This method is used for directly invoke the adapter activity from code, rather than as part of process execution flow. """ init(); if (logger == null) logger = LoggerUtil.getStandardLogger(); Object connection = null; try { connection = openConnection(); return doInvoke(connection, new Request(request), timeout, meta_data); } finally { if (connection != null) closeConnection(connection); } }
java
public Response directInvoke(String request, int timeout, Map<String,String> meta_data) throws AdapterException, ConnectionException { init(); if (logger == null) logger = LoggerUtil.getStandardLogger(); Object connection = null; try { connection = openConnection(); return doInvoke(connection, new Request(request), timeout, meta_data); } finally { if (connection != null) closeConnection(connection); } }
[ "public", "Response", "directInvoke", "(", "String", "request", ",", "int", "timeout", ",", "Map", "<", "String", ",", "String", ">", "meta_data", ")", "throws", "AdapterException", ",", "ConnectionException", "{", "init", "(", ")", ";", "if", "(", "logger", "==", "null", ")", "logger", "=", "LoggerUtil", ".", "getStandardLogger", "(", ")", ";", "Object", "connection", "=", "null", ";", "try", "{", "connection", "=", "openConnection", "(", ")", ";", "return", "doInvoke", "(", "connection", ",", "new", "Request", "(", "request", ")", ",", "timeout", ",", "meta_data", ")", ";", "}", "finally", "{", "if", "(", "connection", "!=", "null", ")", "closeConnection", "(", "connection", ")", ";", "}", "}" ]
This method is used for directly invoke the adapter activity from code, rather than as part of process execution flow.
[ "This", "method", "is", "used", "for", "directly", "invoke", "the", "adapter", "activity", "from", "code", "rather", "than", "as", "part", "of", "process", "execution", "flow", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/src/com/centurylink/mdw/workflow/adapter/TextAdapterActivity.java#L656-L669
pressgang-ccms/PressGangCCMSCommonUtilities
src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java
DocBookUtilities.wrapInItemizedGlossDef
public static String wrapInItemizedGlossDef(final String title, final List<String> items) { """ Creates a Glossary Definition element that contains an itemized list. Each item specified in the items list is wrapped in a {@code<para>} and {@code<listitem>} element and then added to the itemizedlist. @param title The title for the itemized list. @param items The list of items that should be created in the list. @return The {@code<glossdef>} wrapped list of items. """ final List<String> itemizedList = new ArrayList<String>(); for (final String listItem : items) { itemizedList.add(wrapInListItem(wrapInPara(listItem))); } return "<glossdef>" + DocBookUtilities.wrapListItems(itemizedList) + "</glossdef>"; }
java
public static String wrapInItemizedGlossDef(final String title, final List<String> items) { final List<String> itemizedList = new ArrayList<String>(); for (final String listItem : items) { itemizedList.add(wrapInListItem(wrapInPara(listItem))); } return "<glossdef>" + DocBookUtilities.wrapListItems(itemizedList) + "</glossdef>"; }
[ "public", "static", "String", "wrapInItemizedGlossDef", "(", "final", "String", "title", ",", "final", "List", "<", "String", ">", "items", ")", "{", "final", "List", "<", "String", ">", "itemizedList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "final", "String", "listItem", ":", "items", ")", "{", "itemizedList", ".", "add", "(", "wrapInListItem", "(", "wrapInPara", "(", "listItem", ")", ")", ")", ";", "}", "return", "\"<glossdef>\"", "+", "DocBookUtilities", ".", "wrapListItems", "(", "itemizedList", ")", "+", "\"</glossdef>\"", ";", "}" ]
Creates a Glossary Definition element that contains an itemized list. Each item specified in the items list is wrapped in a {@code<para>} and {@code<listitem>} element and then added to the itemizedlist. @param title The title for the itemized list. @param items The list of items that should be created in the list. @return The {@code<glossdef>} wrapped list of items.
[ "Creates", "a", "Glossary", "Definition", "element", "that", "contains", "an", "itemized", "list", ".", "Each", "item", "specified", "in", "the", "items", "list", "is", "wrapped", "in", "a", "{", "@code<para", ">", "}", "and", "{", "@code<listitem", ">", "}", "element", "and", "then", "added", "to", "the", "itemizedlist", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L3056-L3062
cojen/Cojen
src/main/java/org/cojen/classfile/ConstantPool.java
ConstantPool.addConstantNameAndType
public ConstantNameAndTypeInfo addConstantNameAndType(String name, Descriptor type) { """ Get or create a constant name and type structure from the constant pool. """ return (ConstantNameAndTypeInfo)addConstant(new ConstantNameAndTypeInfo(this, name, type)); }
java
public ConstantNameAndTypeInfo addConstantNameAndType(String name, Descriptor type) { return (ConstantNameAndTypeInfo)addConstant(new ConstantNameAndTypeInfo(this, name, type)); }
[ "public", "ConstantNameAndTypeInfo", "addConstantNameAndType", "(", "String", "name", ",", "Descriptor", "type", ")", "{", "return", "(", "ConstantNameAndTypeInfo", ")", "addConstant", "(", "new", "ConstantNameAndTypeInfo", "(", "this", ",", "name", ",", "type", ")", ")", ";", "}" ]
Get or create a constant name and type structure from the constant pool.
[ "Get", "or", "create", "a", "constant", "name", "and", "type", "structure", "from", "the", "constant", "pool", "." ]
train
https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/classfile/ConstantPool.java#L235-L238
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.setNonStrokingColor
public void setNonStrokingColor (final Color color) throws IOException { """ Set the non-stroking color using an AWT color. Conversion uses the default sRGB color space. @param color The color to set. @throws IOException If an IO error occurs while writing to the stream. """ final float [] components = new float [] { color.getRed () / 255f, color.getGreen () / 255f, color.getBlue () / 255f }; final PDColor pdColor = new PDColor (components, PDDeviceRGB.INSTANCE); setNonStrokingColor (pdColor); }
java
public void setNonStrokingColor (final Color color) throws IOException { final float [] components = new float [] { color.getRed () / 255f, color.getGreen () / 255f, color.getBlue () / 255f }; final PDColor pdColor = new PDColor (components, PDDeviceRGB.INSTANCE); setNonStrokingColor (pdColor); }
[ "public", "void", "setNonStrokingColor", "(", "final", "Color", "color", ")", "throws", "IOException", "{", "final", "float", "[", "]", "components", "=", "new", "float", "[", "]", "{", "color", ".", "getRed", "(", ")", "/", "255f", ",", "color", ".", "getGreen", "(", ")", "/", "255f", ",", "color", ".", "getBlue", "(", ")", "/", "255f", "}", ";", "final", "PDColor", "pdColor", "=", "new", "PDColor", "(", "components", ",", "PDDeviceRGB", ".", "INSTANCE", ")", ";", "setNonStrokingColor", "(", "pdColor", ")", ";", "}" ]
Set the non-stroking color using an AWT color. Conversion uses the default sRGB color space. @param color The color to set. @throws IOException If an IO error occurs while writing to the stream.
[ "Set", "the", "non", "-", "stroking", "color", "using", "an", "AWT", "color", ".", "Conversion", "uses", "the", "default", "sRGB", "color", "space", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L929-L936
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java
LayoutRefiner.visitAdj
private int visitAdj(boolean[] visited, int[] result, int p, int v) { """ Recursively visit 'v' and all vertices adjacent to it (excluding 'p') adding all except 'v' to the result array. @param visited visit flags array, should be cleared before search @param result visited vertices @param p previous vertex @param v start vertex @return number of visited vertices """ int n = 0; Arrays.fill(visited, false); visited[v] = true; for (int w : adjList[v]) { if (w != p && !visited[w]) { n = visit(visited, result, v, w, n); } } visited[v] = false; return n; }
java
private int visitAdj(boolean[] visited, int[] result, int p, int v) { int n = 0; Arrays.fill(visited, false); visited[v] = true; for (int w : adjList[v]) { if (w != p && !visited[w]) { n = visit(visited, result, v, w, n); } } visited[v] = false; return n; }
[ "private", "int", "visitAdj", "(", "boolean", "[", "]", "visited", ",", "int", "[", "]", "result", ",", "int", "p", ",", "int", "v", ")", "{", "int", "n", "=", "0", ";", "Arrays", ".", "fill", "(", "visited", ",", "false", ")", ";", "visited", "[", "v", "]", "=", "true", ";", "for", "(", "int", "w", ":", "adjList", "[", "v", "]", ")", "{", "if", "(", "w", "!=", "p", "&&", "!", "visited", "[", "w", "]", ")", "{", "n", "=", "visit", "(", "visited", ",", "result", ",", "v", ",", "w", ",", "n", ")", ";", "}", "}", "visited", "[", "v", "]", "=", "false", ";", "return", "n", ";", "}" ]
Recursively visit 'v' and all vertices adjacent to it (excluding 'p') adding all except 'v' to the result array. @param visited visit flags array, should be cleared before search @param result visited vertices @param p previous vertex @param v start vertex @return number of visited vertices
[ "Recursively", "visit", "v", "and", "all", "vertices", "adjacent", "to", "it", "(", "excluding", "p", ")", "adding", "all", "except", "v", "to", "the", "result", "array", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java#L998-L1009
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java
ElasticPoolsInner.createOrUpdateAsync
public Observable<ElasticPoolInner> createOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { """ Creates a new elastic pool or updates an existing elastic pool. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param elasticPoolName The name of the elastic pool to be operated on (updated or created). @param parameters The required parameters for creating or updating an elastic pool. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1<ServiceResponse<ElasticPoolInner>, ElasticPoolInner>() { @Override public ElasticPoolInner call(ServiceResponse<ElasticPoolInner> response) { return response.body(); } }); }
java
public Observable<ElasticPoolInner> createOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1<ServiceResponse<ElasticPoolInner>, ElasticPoolInner>() { @Override public ElasticPoolInner call(ServiceResponse<ElasticPoolInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ElasticPoolInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "elasticPoolName", ",", "ElasticPoolInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "elasticPoolName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ElasticPoolInner", ">", ",", "ElasticPoolInner", ">", "(", ")", "{", "@", "Override", "public", "ElasticPoolInner", "call", "(", "ServiceResponse", "<", "ElasticPoolInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates a new elastic pool or updates an existing elastic pool. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param elasticPoolName The name of the elastic pool to be operated on (updated or created). @param parameters The required parameters for creating or updating an elastic pool. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "a", "new", "elastic", "pool", "or", "updates", "an", "existing", "elastic", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java#L140-L147
auth0/Auth0.Android
auth0/src/main/java/com/auth0/android/authentication/request/SignUpRequest.java
SignUpRequest.addAuthenticationParameters
@Override public SignUpRequest addAuthenticationParameters(Map<String, Object> parameters) { """ Add additional parameters sent when logging the user in @param parameters sent with the request and must be non-null @return itself @see ParameterBuilder """ authenticationRequest.addAuthenticationParameters(parameters); return this; }
java
@Override public SignUpRequest addAuthenticationParameters(Map<String, Object> parameters) { authenticationRequest.addAuthenticationParameters(parameters); return this; }
[ "@", "Override", "public", "SignUpRequest", "addAuthenticationParameters", "(", "Map", "<", "String", ",", "Object", ">", "parameters", ")", "{", "authenticationRequest", ".", "addAuthenticationParameters", "(", "parameters", ")", ";", "return", "this", ";", "}" ]
Add additional parameters sent when logging the user in @param parameters sent with the request and must be non-null @return itself @see ParameterBuilder
[ "Add", "additional", "parameters", "sent", "when", "logging", "the", "user", "in" ]
train
https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/request/SignUpRequest.java#L88-L92
op4j/op4j
src/main/java/org/op4j/functions/FnFunc.java
FnFunc.ifNullThen
public static final <T> Function<T,T> ifNullThen(final Type<T> targetType, final IFunction<? super T,? extends T> thenFunction) { """ <p> Builds a function that will execute the specified function <tt>thenFunction</tt> only if the target object is null. </p> <p> The built function cannot change the return type (receives <tt>T</tt> and returns <tt>T</tt>) because the <tt>thenFunction</tt> could remain unexecuted, and so the type returned by <tt>thenFunction</tt> must be the same as the type required as input, in order to keep consistency. </p> @param targetType the target type. @param thenFunction the function to be executed on the target object if it is null. @return a function that executes the "thenFunction" if the target object is null. """ return ifTrueThen(targetType, FnObject.isNull(), thenFunction); }
java
public static final <T> Function<T,T> ifNullThen(final Type<T> targetType, final IFunction<? super T,? extends T> thenFunction) { return ifTrueThen(targetType, FnObject.isNull(), thenFunction); }
[ "public", "static", "final", "<", "T", ">", "Function", "<", "T", ",", "T", ">", "ifNullThen", "(", "final", "Type", "<", "T", ">", "targetType", ",", "final", "IFunction", "<", "?", "super", "T", ",", "?", "extends", "T", ">", "thenFunction", ")", "{", "return", "ifTrueThen", "(", "targetType", ",", "FnObject", ".", "isNull", "(", ")", ",", "thenFunction", ")", ";", "}" ]
<p> Builds a function that will execute the specified function <tt>thenFunction</tt> only if the target object is null. </p> <p> The built function cannot change the return type (receives <tt>T</tt> and returns <tt>T</tt>) because the <tt>thenFunction</tt> could remain unexecuted, and so the type returned by <tt>thenFunction</tt> must be the same as the type required as input, in order to keep consistency. </p> @param targetType the target type. @param thenFunction the function to be executed on the target object if it is null. @return a function that executes the "thenFunction" if the target object is null.
[ "<p", ">", "Builds", "a", "function", "that", "will", "execute", "the", "specified", "function", "<tt", ">", "thenFunction<", "/", "tt", ">", "only", "if", "the", "target", "object", "is", "null", ".", "<", "/", "p", ">", "<p", ">", "The", "built", "function", "cannot", "change", "the", "return", "type", "(", "receives", "<tt", ">", "T<", "/", "tt", ">", "and", "returns", "<tt", ">", "T<", "/", "tt", ">", ")", "because", "the", "<tt", ">", "thenFunction<", "/", "tt", ">", "could", "remain", "unexecuted", "and", "so", "the", "type", "returned", "by", "<tt", ">", "thenFunction<", "/", "tt", ">", "must", "be", "the", "same", "as", "the", "type", "required", "as", "input", "in", "order", "to", "keep", "consistency", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnFunc.java#L176-L178
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.telephony_billingAccount_accessories_GET
public OvhOrder telephony_billingAccount_accessories_GET(String billingAccount, String[] accessories, String mondialRelayId, Boolean retractation, Long shippingContactId) throws IOException { """ Get prices and contracts information REST: GET /order/telephony/{billingAccount}/accessories @param mondialRelayId [required] Use /supply/mondialRelay entry point to specify a relay point and ignore shipping contact address information entry. @param shippingContactId [required] Shipping contact information id from /me entry point @param retractation [required] Retractation rights if set @param accessories [required] Accessories to order @param billingAccount [required] The name of your billingAccount """ String qPath = "/order/telephony/{billingAccount}/accessories"; StringBuilder sb = path(qPath, billingAccount); query(sb, "accessories", accessories); query(sb, "mondialRelayId", mondialRelayId); query(sb, "retractation", retractation); query(sb, "shippingContactId", shippingContactId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder telephony_billingAccount_accessories_GET(String billingAccount, String[] accessories, String mondialRelayId, Boolean retractation, Long shippingContactId) throws IOException { String qPath = "/order/telephony/{billingAccount}/accessories"; StringBuilder sb = path(qPath, billingAccount); query(sb, "accessories", accessories); query(sb, "mondialRelayId", mondialRelayId); query(sb, "retractation", retractation); query(sb, "shippingContactId", shippingContactId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "telephony_billingAccount_accessories_GET", "(", "String", "billingAccount", ",", "String", "[", "]", "accessories", ",", "String", "mondialRelayId", ",", "Boolean", "retractation", ",", "Long", "shippingContactId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/telephony/{billingAccount}/accessories\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ")", ";", "query", "(", "sb", ",", "\"accessories\"", ",", "accessories", ")", ";", "query", "(", "sb", ",", "\"mondialRelayId\"", ",", "mondialRelayId", ")", ";", "query", "(", "sb", ",", "\"retractation\"", ",", "retractation", ")", ";", "query", "(", "sb", ",", "\"shippingContactId\"", ",", "shippingContactId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/telephony/{billingAccount}/accessories @param mondialRelayId [required] Use /supply/mondialRelay entry point to specify a relay point and ignore shipping contact address information entry. @param shippingContactId [required] Shipping contact information id from /me entry point @param retractation [required] Retractation rights if set @param accessories [required] Accessories to order @param billingAccount [required] The name of your billingAccount
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6680-L6689
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextFactory.java
ContextFactory.newContext
public EvaluatorContext newContext(final String contextId, final Optional<String> parentID) { """ Instantiate a new Context representer with the given id and parent id. @param contextId @param parentID @return a new Context representer with the given id and parent id. """ synchronized (this.priorIds) { if (this.priorIds.contains(contextId)) { throw new IllegalStateException("Creating second EvaluatorContext instance for id " + contextId); } this.priorIds.add(contextId); } return new EvaluatorContext(contextId, this.evaluatorId, this.evaluatorDescriptor, parentID, this.configurationSerializer, this.contextControlHandler, this.messageDispatcher, this.exceptionCodec, this.contextRepresenters.get()); }
java
public EvaluatorContext newContext(final String contextId, final Optional<String> parentID) { synchronized (this.priorIds) { if (this.priorIds.contains(contextId)) { throw new IllegalStateException("Creating second EvaluatorContext instance for id " + contextId); } this.priorIds.add(contextId); } return new EvaluatorContext(contextId, this.evaluatorId, this.evaluatorDescriptor, parentID, this.configurationSerializer, this.contextControlHandler, this.messageDispatcher, this.exceptionCodec, this.contextRepresenters.get()); }
[ "public", "EvaluatorContext", "newContext", "(", "final", "String", "contextId", ",", "final", "Optional", "<", "String", ">", "parentID", ")", "{", "synchronized", "(", "this", ".", "priorIds", ")", "{", "if", "(", "this", ".", "priorIds", ".", "contains", "(", "contextId", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Creating second EvaluatorContext instance for id \"", "+", "contextId", ")", ";", "}", "this", ".", "priorIds", ".", "add", "(", "contextId", ")", ";", "}", "return", "new", "EvaluatorContext", "(", "contextId", ",", "this", ".", "evaluatorId", ",", "this", ".", "evaluatorDescriptor", ",", "parentID", ",", "this", ".", "configurationSerializer", ",", "this", ".", "contextControlHandler", ",", "this", ".", "messageDispatcher", ",", "this", ".", "exceptionCodec", ",", "this", ".", "contextRepresenters", ".", "get", "(", ")", ")", ";", "}" ]
Instantiate a new Context representer with the given id and parent id. @param contextId @param parentID @return a new Context representer with the given id and parent id.
[ "Instantiate", "a", "new", "Context", "representer", "with", "the", "given", "id", "and", "parent", "id", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextFactory.java#L80-L96
line/armeria
core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
ServerBuilder.serviceUnder
public ServerBuilder serviceUnder(String pathPrefix, Service<HttpRequest, HttpResponse> service) { """ Binds the specified {@link Service} under the specified directory of the default {@link VirtualHost}. @throws IllegalStateException if the default {@link VirtualHost} has been set via {@link #defaultVirtualHost(VirtualHost)} already """ defaultVirtualHostBuilderUpdated(); defaultVirtualHostBuilder.serviceUnder(pathPrefix, service); return this; }
java
public ServerBuilder serviceUnder(String pathPrefix, Service<HttpRequest, HttpResponse> service) { defaultVirtualHostBuilderUpdated(); defaultVirtualHostBuilder.serviceUnder(pathPrefix, service); return this; }
[ "public", "ServerBuilder", "serviceUnder", "(", "String", "pathPrefix", ",", "Service", "<", "HttpRequest", ",", "HttpResponse", ">", "service", ")", "{", "defaultVirtualHostBuilderUpdated", "(", ")", ";", "defaultVirtualHostBuilder", ".", "serviceUnder", "(", "pathPrefix", ",", "service", ")", ";", "return", "this", ";", "}" ]
Binds the specified {@link Service} under the specified directory of the default {@link VirtualHost}. @throws IllegalStateException if the default {@link VirtualHost} has been set via {@link #defaultVirtualHost(VirtualHost)} already
[ "Binds", "the", "specified", "{", "@link", "Service", "}", "under", "the", "specified", "directory", "of", "the", "default", "{", "@link", "VirtualHost", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L891-L895
massfords/jaxb-visitor
src/main/java/com/massfords/jaxb/ClassDiscoverer.java
ClassDiscoverer.allConcreteClasses
static List<JClass> allConcreteClasses(Set<ClassOutline> classes) { """ Returns all of the concrete classes in the system @param classes collection of classes to examine @return List of concrete classes """ return allConcreteClasses(classes, Collections.emptySet()); }
java
static List<JClass> allConcreteClasses(Set<ClassOutline> classes) { return allConcreteClasses(classes, Collections.emptySet()); }
[ "static", "List", "<", "JClass", ">", "allConcreteClasses", "(", "Set", "<", "ClassOutline", ">", "classes", ")", "{", "return", "allConcreteClasses", "(", "classes", ",", "Collections", ".", "emptySet", "(", ")", ")", ";", "}" ]
Returns all of the concrete classes in the system @param classes collection of classes to examine @return List of concrete classes
[ "Returns", "all", "of", "the", "concrete", "classes", "in", "the", "system" ]
train
https://github.com/massfords/jaxb-visitor/blob/0d66cd4d8b6700b5eb67c028a87b53792be895b8/src/main/java/com/massfords/jaxb/ClassDiscoverer.java#L188-L190
alipay/sofa-rpc
extension-impl/registry-local/src/main/java/com/alipay/sofa/rpc/registry/local/LocalRegistryHelper.java
LocalRegistryHelper.checkModified
public static boolean checkModified(String address, String lastDigest) { """ Check file's digest. @param address the address @param lastDigest the update digest @return true被修改,false未被修改 """ // 检查文件是否被修改了 String newDigest = calMD5Checksum(address); return !StringUtils.equals(newDigest, lastDigest); }
java
public static boolean checkModified(String address, String lastDigest) { // 检查文件是否被修改了 String newDigest = calMD5Checksum(address); return !StringUtils.equals(newDigest, lastDigest); }
[ "public", "static", "boolean", "checkModified", "(", "String", "address", ",", "String", "lastDigest", ")", "{", "// 检查文件是否被修改了", "String", "newDigest", "=", "calMD5Checksum", "(", "address", ")", ";", "return", "!", "StringUtils", ".", "equals", "(", "newDigest", ",", "lastDigest", ")", ";", "}" ]
Check file's digest. @param address the address @param lastDigest the update digest @return true被修改,false未被修改
[ "Check", "file", "s", "digest", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-local/src/main/java/com/alipay/sofa/rpc/registry/local/LocalRegistryHelper.java#L72-L76
tomgibara/bits
src/main/java/com/tomgibara/bits/Bits.java
Bits.asStore
public static BitStore asStore(BitSet bitSet, int size) { """ Exposes a <code>BitSet</code> as a {@link BitStore}. The returned bit store is a live view over the bit set; changes made to the bit set are reflected in the bit store and vice versa. Unlike bit sets, bit stores have a fixed size which must be specified at construction time and which is not required to match the length of the bit set. In all cases, the bits of the bit set are drawn from the lowest-indexed bits. @param bitSet the bits of the {@link BitStore} @param size the size, in bits, of the {@link BitStore} @return a {@link BitStore} view over the bit set. """ if (bitSet == null) throw new IllegalArgumentException("null bitSet"); checkSize(size); return new BitSetBitStore(bitSet, 0, size, true); }
java
public static BitStore asStore(BitSet bitSet, int size) { if (bitSet == null) throw new IllegalArgumentException("null bitSet"); checkSize(size); return new BitSetBitStore(bitSet, 0, size, true); }
[ "public", "static", "BitStore", "asStore", "(", "BitSet", "bitSet", ",", "int", "size", ")", "{", "if", "(", "bitSet", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null bitSet\"", ")", ";", "checkSize", "(", "size", ")", ";", "return", "new", "BitSetBitStore", "(", "bitSet", ",", "0", ",", "size", ",", "true", ")", ";", "}" ]
Exposes a <code>BitSet</code> as a {@link BitStore}. The returned bit store is a live view over the bit set; changes made to the bit set are reflected in the bit store and vice versa. Unlike bit sets, bit stores have a fixed size which must be specified at construction time and which is not required to match the length of the bit set. In all cases, the bits of the bit set are drawn from the lowest-indexed bits. @param bitSet the bits of the {@link BitStore} @param size the size, in bits, of the {@link BitStore} @return a {@link BitStore} view over the bit set.
[ "Exposes", "a", "<code", ">", "BitSet<", "/", "code", ">", "as", "a", "{", "@link", "BitStore", "}", ".", "The", "returned", "bit", "store", "is", "a", "live", "view", "over", "the", "bit", "set", ";", "changes", "made", "to", "the", "bit", "set", "are", "reflected", "in", "the", "bit", "store", "and", "vice", "versa", ".", "Unlike", "bit", "sets", "bit", "stores", "have", "a", "fixed", "size", "which", "must", "be", "specified", "at", "construction", "time", "and", "which", "is", "not", "required", "to", "match", "the", "length", "of", "the", "bit", "set", ".", "In", "all", "cases", "the", "bits", "of", "the", "bit", "set", "are", "drawn", "from", "the", "lowest", "-", "indexed", "bits", "." ]
train
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L492-L496
bThink-BGU/BPjs
src/main/java/il/ac/bgu/cs/bp/bpjs/internal/ScriptableUtils.java
ScriptableUtils.jsEquals
public static boolean jsEquals(Object o1, Object o2) { """ Deep-compare of {@code o1} and {@code o2}. Recurses down these objects, when needed. <em>DOES NOT DEAL WITH CIRCULAR REFERENCES!</em> @param o1 @param o2 @return {@code true} iff both objects are recursively equal """ // quick breakers if (o1 == o2) return true; if (o1 == null ^ o2 == null) return false; // Can we do a by-part comparison? if (o1 instanceof ScriptableObject && o2 instanceof ScriptableObject) { return jsScriptableObjectEqual((ScriptableObject) o1, (ScriptableObject) o2); } // Concatenated strings in Rhino have a different type. We need to manually // resolve to String semantics, which is what the following lines do. if (o1 instanceof ConsString) { o1 = o1.toString(); } if (o2 instanceof ConsString) { o2 = o2.toString(); } // default comparison (hopefully they have meaningful equals()) return o1.equals(o2); }
java
public static boolean jsEquals(Object o1, Object o2) { // quick breakers if (o1 == o2) return true; if (o1 == null ^ o2 == null) return false; // Can we do a by-part comparison? if (o1 instanceof ScriptableObject && o2 instanceof ScriptableObject) { return jsScriptableObjectEqual((ScriptableObject) o1, (ScriptableObject) o2); } // Concatenated strings in Rhino have a different type. We need to manually // resolve to String semantics, which is what the following lines do. if (o1 instanceof ConsString) { o1 = o1.toString(); } if (o2 instanceof ConsString) { o2 = o2.toString(); } // default comparison (hopefully they have meaningful equals()) return o1.equals(o2); }
[ "public", "static", "boolean", "jsEquals", "(", "Object", "o1", ",", "Object", "o2", ")", "{", "// quick breakers", "if", "(", "o1", "==", "o2", ")", "return", "true", ";", "if", "(", "o1", "==", "null", "^", "o2", "==", "null", ")", "return", "false", ";", "// Can we do a by-part comparison?", "if", "(", "o1", "instanceof", "ScriptableObject", "&&", "o2", "instanceof", "ScriptableObject", ")", "{", "return", "jsScriptableObjectEqual", "(", "(", "ScriptableObject", ")", "o1", ",", "(", "ScriptableObject", ")", "o2", ")", ";", "}", "// Concatenated strings in Rhino have a different type. We need to manually", "// resolve to String semantics, which is what the following lines do.", "if", "(", "o1", "instanceof", "ConsString", ")", "{", "o1", "=", "o1", ".", "toString", "(", ")", ";", "}", "if", "(", "o2", "instanceof", "ConsString", ")", "{", "o2", "=", "o2", ".", "toString", "(", ")", ";", "}", "// default comparison (hopefully they have meaningful equals())", "return", "o1", ".", "equals", "(", "o2", ")", ";", "}" ]
Deep-compare of {@code o1} and {@code o2}. Recurses down these objects, when needed. <em>DOES NOT DEAL WITH CIRCULAR REFERENCES!</em> @param o1 @param o2 @return {@code true} iff both objects are recursively equal
[ "Deep", "-", "compare", "of", "{", "@code", "o1", "}", "and", "{", "@code", "o2", "}", ".", "Recurses", "down", "these", "objects", "when", "needed", "." ]
train
https://github.com/bThink-BGU/BPjs/blob/2d388365a27ad79ded108eaf98a35a7ef292ae1f/src/main/java/il/ac/bgu/cs/bp/bpjs/internal/ScriptableUtils.java#L71-L93
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteResult.java
CreateRouteResult.withRequestModels
public CreateRouteResult withRequestModels(java.util.Map<String, String> requestModels) { """ <p> The request models for the route. </p> @param requestModels The request models for the route. @return Returns a reference to this object so that method calls can be chained together. """ setRequestModels(requestModels); return this; }
java
public CreateRouteResult withRequestModels(java.util.Map<String, String> requestModels) { setRequestModels(requestModels); return this; }
[ "public", "CreateRouteResult", "withRequestModels", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "requestModels", ")", "{", "setRequestModels", "(", "requestModels", ")", ";", "return", "this", ";", "}" ]
<p> The request models for the route. </p> @param requestModels The request models for the route. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "request", "models", "for", "the", "route", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteResult.java#L486-L489
MenoData/Time4J
base/src/main/java/net/time4j/tz/model/GregorianTimezoneRule.java
GregorianTimezoneRule.ofWeekdayAfterDate
public static GregorianTimezoneRule ofWeekdayAfterDate( Month month, int dayOfMonth, Weekday dayOfWeek, int timeOfDay, OffsetIndicator indicator, int savings ) { """ /*[deutsch] <p>Konstruiert ein Muster f&uuml;r einen Wochentag nach einem festen Monatstag im angegebenen Monat. </p> <p>Beispiel =&gt; F&uuml;r den zweiten Sonntag im April sei zu setzen: {@code month=APRIL, dayOfMonth=8, dayOfWeek=SUNDAY}. </p> @param month calendar month @param dayOfMonth reference day of month (1 - 31) @param dayOfWeek day of week when time switch happens @param timeOfDay clock time in seconds after midnight when time switch happens @param indicator offset indicator @param savings fixed DST-offset in seconds @return new daylight saving rule @throws IllegalArgumentException if the last argument is out of range or if the day of month is not valid in context of given month @since 5.0 """ return new DayOfWeekInMonthPattern(month, dayOfMonth, dayOfWeek, timeOfDay, indicator, savings, true); }
java
public static GregorianTimezoneRule ofWeekdayAfterDate( Month month, int dayOfMonth, Weekday dayOfWeek, int timeOfDay, OffsetIndicator indicator, int savings ) { return new DayOfWeekInMonthPattern(month, dayOfMonth, dayOfWeek, timeOfDay, indicator, savings, true); }
[ "public", "static", "GregorianTimezoneRule", "ofWeekdayAfterDate", "(", "Month", "month", ",", "int", "dayOfMonth", ",", "Weekday", "dayOfWeek", ",", "int", "timeOfDay", ",", "OffsetIndicator", "indicator", ",", "int", "savings", ")", "{", "return", "new", "DayOfWeekInMonthPattern", "(", "month", ",", "dayOfMonth", ",", "dayOfWeek", ",", "timeOfDay", ",", "indicator", ",", "savings", ",", "true", ")", ";", "}" ]
/*[deutsch] <p>Konstruiert ein Muster f&uuml;r einen Wochentag nach einem festen Monatstag im angegebenen Monat. </p> <p>Beispiel =&gt; F&uuml;r den zweiten Sonntag im April sei zu setzen: {@code month=APRIL, dayOfMonth=8, dayOfWeek=SUNDAY}. </p> @param month calendar month @param dayOfMonth reference day of month (1 - 31) @param dayOfWeek day of week when time switch happens @param timeOfDay clock time in seconds after midnight when time switch happens @param indicator offset indicator @param savings fixed DST-offset in seconds @return new daylight saving rule @throws IllegalArgumentException if the last argument is out of range or if the day of month is not valid in context of given month @since 5.0
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Konstruiert", "ein", "Muster", "f&uuml", ";", "r", "einen", "Wochentag", "nach", "einem", "festen", "Monatstag", "im", "angegebenen", "Monat", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/tz/model/GregorianTimezoneRule.java#L336-L347
lucee/Lucee
core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java
XMLConfigWebFactory.reloadInstance
public static void reloadInstance(CFMLEngine engine, ConfigServerImpl cs, ConfigWebImpl cw, boolean force) throws SAXException, ClassException, PageException, IOException, TagLibException, FunctionLibException, BundleException { """ reloads the Config Object @param cs @param force @throws SAXException @throws ClassNotFoundException @throws PageException @throws IOException @throws TagLibException @throws FunctionLibException @throws BundleException @throws NoSuchAlgorithmException """ Resource configFile = cw.getConfigFile(); Resource configDir = cw.getConfigDir(); int iDoNew = doNew(engine, configDir, false).updateType; boolean doNew = iDoNew != NEW_NONE; if (configFile == null) return; if (second(cw.getLoadTime()) > second(configFile.lastModified()) && !force) return; Document doc = loadDocument(configFile); createContextFiles(configDir, null, doNew); cw.reset(); load(cs, cw, doc, true, doNew); createContextFilesPost(configDir, cw, null, false, doNew); ((CFMLEngineImpl) ConfigWebUtil.getEngine(cw)).onStart(cw, true); }
java
public static void reloadInstance(CFMLEngine engine, ConfigServerImpl cs, ConfigWebImpl cw, boolean force) throws SAXException, ClassException, PageException, IOException, TagLibException, FunctionLibException, BundleException { Resource configFile = cw.getConfigFile(); Resource configDir = cw.getConfigDir(); int iDoNew = doNew(engine, configDir, false).updateType; boolean doNew = iDoNew != NEW_NONE; if (configFile == null) return; if (second(cw.getLoadTime()) > second(configFile.lastModified()) && !force) return; Document doc = loadDocument(configFile); createContextFiles(configDir, null, doNew); cw.reset(); load(cs, cw, doc, true, doNew); createContextFilesPost(configDir, cw, null, false, doNew); ((CFMLEngineImpl) ConfigWebUtil.getEngine(cw)).onStart(cw, true); }
[ "public", "static", "void", "reloadInstance", "(", "CFMLEngine", "engine", ",", "ConfigServerImpl", "cs", ",", "ConfigWebImpl", "cw", ",", "boolean", "force", ")", "throws", "SAXException", ",", "ClassException", ",", "PageException", ",", "IOException", ",", "TagLibException", ",", "FunctionLibException", ",", "BundleException", "{", "Resource", "configFile", "=", "cw", ".", "getConfigFile", "(", ")", ";", "Resource", "configDir", "=", "cw", ".", "getConfigDir", "(", ")", ";", "int", "iDoNew", "=", "doNew", "(", "engine", ",", "configDir", ",", "false", ")", ".", "updateType", ";", "boolean", "doNew", "=", "iDoNew", "!=", "NEW_NONE", ";", "if", "(", "configFile", "==", "null", ")", "return", ";", "if", "(", "second", "(", "cw", ".", "getLoadTime", "(", ")", ")", ">", "second", "(", "configFile", ".", "lastModified", "(", ")", ")", "&&", "!", "force", ")", "return", ";", "Document", "doc", "=", "loadDocument", "(", "configFile", ")", ";", "createContextFiles", "(", "configDir", ",", "null", ",", "doNew", ")", ";", "cw", ".", "reset", "(", ")", ";", "load", "(", "cs", ",", "cw", ",", "doc", ",", "true", ",", "doNew", ")", ";", "createContextFilesPost", "(", "configDir", ",", "cw", ",", "null", ",", "false", ",", "doNew", ")", ";", "(", "(", "CFMLEngineImpl", ")", "ConfigWebUtil", ".", "getEngine", "(", "cw", ")", ")", ".", "onStart", "(", "cw", ",", "true", ")", ";", "}" ]
reloads the Config Object @param cs @param force @throws SAXException @throws ClassNotFoundException @throws PageException @throws IOException @throws TagLibException @throws FunctionLibException @throws BundleException @throws NoSuchAlgorithmException
[ "reloads", "the", "Config", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java#L321-L340
openengsb/openengsb
components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java
AbstractEDBService.updateDeletedObjectsThroughEntityManager
private void updateDeletedObjectsThroughEntityManager(List<String> oids, Long timestamp) { """ Updates all deleted objects with the timestamp, mark them as deleted and persist them through the entity manager. """ for (String id : oids) { EDBObject o = new EDBObject(id); o.updateTimestamp(timestamp); o.setDeleted(true); JPAObject j = EDBUtils.convertEDBObjectToJPAObject(o); entityManager.persist(j); } }
java
private void updateDeletedObjectsThroughEntityManager(List<String> oids, Long timestamp) { for (String id : oids) { EDBObject o = new EDBObject(id); o.updateTimestamp(timestamp); o.setDeleted(true); JPAObject j = EDBUtils.convertEDBObjectToJPAObject(o); entityManager.persist(j); } }
[ "private", "void", "updateDeletedObjectsThroughEntityManager", "(", "List", "<", "String", ">", "oids", ",", "Long", "timestamp", ")", "{", "for", "(", "String", "id", ":", "oids", ")", "{", "EDBObject", "o", "=", "new", "EDBObject", "(", "id", ")", ";", "o", ".", "updateTimestamp", "(", "timestamp", ")", ";", "o", ".", "setDeleted", "(", "true", ")", ";", "JPAObject", "j", "=", "EDBUtils", ".", "convertEDBObjectToJPAObject", "(", "o", ")", ";", "entityManager", ".", "persist", "(", "j", ")", ";", "}", "}" ]
Updates all deleted objects with the timestamp, mark them as deleted and persist them through the entity manager.
[ "Updates", "all", "deleted", "objects", "with", "the", "timestamp", "mark", "them", "as", "deleted", "and", "persist", "them", "through", "the", "entity", "manager", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java#L135-L143
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.getRelationsForResource
public List<CmsRelation> getRelationsForResource(String resourceName, CmsRelationFilter filter) throws CmsException { """ Returns all relations for the given resource matching the given filter.<p> You should have view/read permissions on the given resource.<p> You may become source and/or target paths to resource you do not have view/read permissions on.<p> @param resourceName the name of the resource to retrieve the relations for @param filter the filter to match the relation @return a List containing all {@link org.opencms.relations.CmsRelation} objects for the given resource matching the given filter @throws CmsException if something goes wrong @see CmsSecurityManager#getRelationsForResource(CmsRequestContext, CmsResource, CmsRelationFilter) """ return getRelationsForResource(readResource(resourceName, CmsResourceFilter.ALL), filter); }
java
public List<CmsRelation> getRelationsForResource(String resourceName, CmsRelationFilter filter) throws CmsException { return getRelationsForResource(readResource(resourceName, CmsResourceFilter.ALL), filter); }
[ "public", "List", "<", "CmsRelation", ">", "getRelationsForResource", "(", "String", "resourceName", ",", "CmsRelationFilter", "filter", ")", "throws", "CmsException", "{", "return", "getRelationsForResource", "(", "readResource", "(", "resourceName", ",", "CmsResourceFilter", ".", "ALL", ")", ",", "filter", ")", ";", "}" ]
Returns all relations for the given resource matching the given filter.<p> You should have view/read permissions on the given resource.<p> You may become source and/or target paths to resource you do not have view/read permissions on.<p> @param resourceName the name of the resource to retrieve the relations for @param filter the filter to match the relation @return a List containing all {@link org.opencms.relations.CmsRelation} objects for the given resource matching the given filter @throws CmsException if something goes wrong @see CmsSecurityManager#getRelationsForResource(CmsRequestContext, CmsResource, CmsRelationFilter)
[ "Returns", "all", "relations", "for", "the", "given", "resource", "matching", "the", "given", "filter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1725-L1729
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/util/JsonUtil.java
JsonUtil.read
public static final String read(String name, ClassLoader classLoader) throws IOException { """ Strips out comment lines (where first non-whitespace is //). Does not support multi-line comments. """ if (ApplicationContext.isCloudFoundry()) { return System.getenv("mdw_" + name.substring(0, name.lastIndexOf('.'))); } else { InputStream stream = FileHelper.readFile(name, classLoader); if (stream == null) stream = FileHelper.readFile(name, classLoader); if (stream == null) { return null; } else { BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); try { StringBuffer config = new StringBuffer(); String line; while ((line = reader.readLine()) != null) { if (!line.matches("^\\s*//.*$")) config.append(line).append("\n"); } return config.toString(); } finally { reader.close(); } } } }
java
public static final String read(String name, ClassLoader classLoader) throws IOException { if (ApplicationContext.isCloudFoundry()) { return System.getenv("mdw_" + name.substring(0, name.lastIndexOf('.'))); } else { InputStream stream = FileHelper.readFile(name, classLoader); if (stream == null) stream = FileHelper.readFile(name, classLoader); if (stream == null) { return null; } else { BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); try { StringBuffer config = new StringBuffer(); String line; while ((line = reader.readLine()) != null) { if (!line.matches("^\\s*//.*$")) config.append(line).append("\n"); } return config.toString(); } finally { reader.close(); } } } }
[ "public", "static", "final", "String", "read", "(", "String", "name", ",", "ClassLoader", "classLoader", ")", "throws", "IOException", "{", "if", "(", "ApplicationContext", ".", "isCloudFoundry", "(", ")", ")", "{", "return", "System", ".", "getenv", "(", "\"mdw_\"", "+", "name", ".", "substring", "(", "0", ",", "name", ".", "lastIndexOf", "(", "'", "'", ")", ")", ")", ";", "}", "else", "{", "InputStream", "stream", "=", "FileHelper", ".", "readFile", "(", "name", ",", "classLoader", ")", ";", "if", "(", "stream", "==", "null", ")", "stream", "=", "FileHelper", ".", "readFile", "(", "name", ",", "classLoader", ")", ";", "if", "(", "stream", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "stream", ")", ")", ";", "try", "{", "StringBuffer", "config", "=", "new", "StringBuffer", "(", ")", ";", "String", "line", ";", "while", "(", "(", "line", "=", "reader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "!", "line", ".", "matches", "(", "\"^\\\\s*//.*$\"", ")", ")", "config", ".", "append", "(", "line", ")", ".", "append", "(", "\"\\n\"", ")", ";", "}", "return", "config", ".", "toString", "(", ")", ";", "}", "finally", "{", "reader", ".", "close", "(", ")", ";", "}", "}", "}", "}" ]
Strips out comment lines (where first non-whitespace is //). Does not support multi-line comments.
[ "Strips", "out", "comment", "lines", "(", "where", "first", "non", "-", "whitespace", "is", "//", ")", ".", "Does", "not", "support", "multi", "-", "line", "comments", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/JsonUtil.java#L55-L82
wso2/transport-http
components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/listener/HttpServerChannelInitializer.java
HttpServerChannelInitializer.configureHttpPipeline
public void configureHttpPipeline(ChannelPipeline serverPipeline, String initialHttpScheme) { """ Configures HTTP/1.x pipeline. @param serverPipeline the channel pipeline @param initialHttpScheme initial http scheme """ if (initialHttpScheme.equals(Constants.HTTP_SCHEME)) { serverPipeline.addLast(Constants.HTTP_ENCODER, new HttpResponseEncoder()); serverPipeline.addLast(Constants.HTTP_DECODER, new HttpRequestDecoder(reqSizeValidationConfig.getMaxUriLength(), reqSizeValidationConfig.getMaxHeaderSize(), reqSizeValidationConfig.getMaxChunkSize())); serverPipeline.addLast(Constants.HTTP_COMPRESSOR, new CustomHttpContentCompressor()); serverPipeline.addLast(Constants.HTTP_CHUNK_WRITER, new ChunkedWriteHandler()); if (httpTraceLogEnabled) { serverPipeline.addLast(HTTP_TRACE_LOG_HANDLER, new HttpTraceLoggingHandler(TRACE_LOG_DOWNSTREAM)); } if (httpAccessLogEnabled) { serverPipeline.addLast(HTTP_ACCESS_LOG_HANDLER, new HttpAccessLoggingHandler(ACCESS_LOG)); } } serverPipeline.addLast("uriLengthValidator", new UriAndHeaderLengthValidator(this.serverName)); if (reqSizeValidationConfig.getMaxEntityBodySize() > -1) { serverPipeline.addLast("maxEntityBodyValidator", new MaxEntityBodyValidator(this.serverName, reqSizeValidationConfig.getMaxEntityBodySize())); } serverPipeline.addLast(Constants.WEBSOCKET_SERVER_HANDSHAKE_HANDLER, new WebSocketServerHandshakeHandler(this.serverConnectorFuture, this.interfaceId)); serverPipeline.addLast(Constants.BACK_PRESSURE_HANDLER, new BackPressureHandler()); serverPipeline.addLast(Constants.HTTP_SOURCE_HANDLER, new SourceHandler(this.serverConnectorFuture, this.interfaceId, this.chunkConfig, keepAliveConfig, this.serverName, this.allChannels, this.pipeliningEnabled, this.pipeliningLimit, this.pipeliningGroup)); if (socketIdleTimeout >= 0) { serverPipeline.addBefore(Constants.HTTP_SOURCE_HANDLER, Constants.IDLE_STATE_HANDLER, new IdleStateHandler(0, 0, socketIdleTimeout, TimeUnit.MILLISECONDS)); } }
java
public void configureHttpPipeline(ChannelPipeline serverPipeline, String initialHttpScheme) { if (initialHttpScheme.equals(Constants.HTTP_SCHEME)) { serverPipeline.addLast(Constants.HTTP_ENCODER, new HttpResponseEncoder()); serverPipeline.addLast(Constants.HTTP_DECODER, new HttpRequestDecoder(reqSizeValidationConfig.getMaxUriLength(), reqSizeValidationConfig.getMaxHeaderSize(), reqSizeValidationConfig.getMaxChunkSize())); serverPipeline.addLast(Constants.HTTP_COMPRESSOR, new CustomHttpContentCompressor()); serverPipeline.addLast(Constants.HTTP_CHUNK_WRITER, new ChunkedWriteHandler()); if (httpTraceLogEnabled) { serverPipeline.addLast(HTTP_TRACE_LOG_HANDLER, new HttpTraceLoggingHandler(TRACE_LOG_DOWNSTREAM)); } if (httpAccessLogEnabled) { serverPipeline.addLast(HTTP_ACCESS_LOG_HANDLER, new HttpAccessLoggingHandler(ACCESS_LOG)); } } serverPipeline.addLast("uriLengthValidator", new UriAndHeaderLengthValidator(this.serverName)); if (reqSizeValidationConfig.getMaxEntityBodySize() > -1) { serverPipeline.addLast("maxEntityBodyValidator", new MaxEntityBodyValidator(this.serverName, reqSizeValidationConfig.getMaxEntityBodySize())); } serverPipeline.addLast(Constants.WEBSOCKET_SERVER_HANDSHAKE_HANDLER, new WebSocketServerHandshakeHandler(this.serverConnectorFuture, this.interfaceId)); serverPipeline.addLast(Constants.BACK_PRESSURE_HANDLER, new BackPressureHandler()); serverPipeline.addLast(Constants.HTTP_SOURCE_HANDLER, new SourceHandler(this.serverConnectorFuture, this.interfaceId, this.chunkConfig, keepAliveConfig, this.serverName, this.allChannels, this.pipeliningEnabled, this.pipeliningLimit, this.pipeliningGroup)); if (socketIdleTimeout >= 0) { serverPipeline.addBefore(Constants.HTTP_SOURCE_HANDLER, Constants.IDLE_STATE_HANDLER, new IdleStateHandler(0, 0, socketIdleTimeout, TimeUnit.MILLISECONDS)); } }
[ "public", "void", "configureHttpPipeline", "(", "ChannelPipeline", "serverPipeline", ",", "String", "initialHttpScheme", ")", "{", "if", "(", "initialHttpScheme", ".", "equals", "(", "Constants", ".", "HTTP_SCHEME", ")", ")", "{", "serverPipeline", ".", "addLast", "(", "Constants", ".", "HTTP_ENCODER", ",", "new", "HttpResponseEncoder", "(", ")", ")", ";", "serverPipeline", ".", "addLast", "(", "Constants", ".", "HTTP_DECODER", ",", "new", "HttpRequestDecoder", "(", "reqSizeValidationConfig", ".", "getMaxUriLength", "(", ")", ",", "reqSizeValidationConfig", ".", "getMaxHeaderSize", "(", ")", ",", "reqSizeValidationConfig", ".", "getMaxChunkSize", "(", ")", ")", ")", ";", "serverPipeline", ".", "addLast", "(", "Constants", ".", "HTTP_COMPRESSOR", ",", "new", "CustomHttpContentCompressor", "(", ")", ")", ";", "serverPipeline", ".", "addLast", "(", "Constants", ".", "HTTP_CHUNK_WRITER", ",", "new", "ChunkedWriteHandler", "(", ")", ")", ";", "if", "(", "httpTraceLogEnabled", ")", "{", "serverPipeline", ".", "addLast", "(", "HTTP_TRACE_LOG_HANDLER", ",", "new", "HttpTraceLoggingHandler", "(", "TRACE_LOG_DOWNSTREAM", ")", ")", ";", "}", "if", "(", "httpAccessLogEnabled", ")", "{", "serverPipeline", ".", "addLast", "(", "HTTP_ACCESS_LOG_HANDLER", ",", "new", "HttpAccessLoggingHandler", "(", "ACCESS_LOG", ")", ")", ";", "}", "}", "serverPipeline", ".", "addLast", "(", "\"uriLengthValidator\"", ",", "new", "UriAndHeaderLengthValidator", "(", "this", ".", "serverName", ")", ")", ";", "if", "(", "reqSizeValidationConfig", ".", "getMaxEntityBodySize", "(", ")", ">", "-", "1", ")", "{", "serverPipeline", ".", "addLast", "(", "\"maxEntityBodyValidator\"", ",", "new", "MaxEntityBodyValidator", "(", "this", ".", "serverName", ",", "reqSizeValidationConfig", ".", "getMaxEntityBodySize", "(", ")", ")", ")", ";", "}", "serverPipeline", ".", "addLast", "(", "Constants", ".", "WEBSOCKET_SERVER_HANDSHAKE_HANDLER", ",", "new", "WebSocketServerHandshakeHandler", "(", "this", ".", "serverConnectorFuture", ",", "this", ".", "interfaceId", ")", ")", ";", "serverPipeline", ".", "addLast", "(", "Constants", ".", "BACK_PRESSURE_HANDLER", ",", "new", "BackPressureHandler", "(", ")", ")", ";", "serverPipeline", ".", "addLast", "(", "Constants", ".", "HTTP_SOURCE_HANDLER", ",", "new", "SourceHandler", "(", "this", ".", "serverConnectorFuture", ",", "this", ".", "interfaceId", ",", "this", ".", "chunkConfig", ",", "keepAliveConfig", ",", "this", ".", "serverName", ",", "this", ".", "allChannels", ",", "this", ".", "pipeliningEnabled", ",", "this", ".", "pipeliningLimit", ",", "this", ".", "pipeliningGroup", ")", ")", ";", "if", "(", "socketIdleTimeout", ">=", "0", ")", "{", "serverPipeline", ".", "addBefore", "(", "Constants", ".", "HTTP_SOURCE_HANDLER", ",", "Constants", ".", "IDLE_STATE_HANDLER", ",", "new", "IdleStateHandler", "(", "0", ",", "0", ",", "socketIdleTimeout", ",", "TimeUnit", ".", "MILLISECONDS", ")", ")", ";", "}", "}" ]
Configures HTTP/1.x pipeline. @param serverPipeline the channel pipeline @param initialHttpScheme initial http scheme
[ "Configures", "HTTP", "/", "1", ".", "x", "pipeline", "." ]
train
https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/listener/HttpServerChannelInitializer.java#L194-L230
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/VisualizationTree.java
VisualizationTree.setVisible
public static void setVisible(VisualizerContext context, VisualizationTask task, boolean visibility) { """ Utility function to change Visualizer visibility. @param context Visualization context @param task Visualization task @param visibility Visibility value """ // Hide other tools if(visibility && task.isTool()) { Hierarchy<Object> vistree = context.getVisHierarchy(); for(It<VisualizationTask> iter2 = vistree.iterAll().filter(VisualizationTask.class); iter2.valid(); iter2.advance()) { VisualizationTask other = iter2.get(); if(other != task && other.isTool() && other.isVisible()) { context.visChanged(other.visibility(false)); } } } context.visChanged(task.visibility(visibility)); }
java
public static void setVisible(VisualizerContext context, VisualizationTask task, boolean visibility) { // Hide other tools if(visibility && task.isTool()) { Hierarchy<Object> vistree = context.getVisHierarchy(); for(It<VisualizationTask> iter2 = vistree.iterAll().filter(VisualizationTask.class); iter2.valid(); iter2.advance()) { VisualizationTask other = iter2.get(); if(other != task && other.isTool() && other.isVisible()) { context.visChanged(other.visibility(false)); } } } context.visChanged(task.visibility(visibility)); }
[ "public", "static", "void", "setVisible", "(", "VisualizerContext", "context", ",", "VisualizationTask", "task", ",", "boolean", "visibility", ")", "{", "// Hide other tools", "if", "(", "visibility", "&&", "task", ".", "isTool", "(", ")", ")", "{", "Hierarchy", "<", "Object", ">", "vistree", "=", "context", ".", "getVisHierarchy", "(", ")", ";", "for", "(", "It", "<", "VisualizationTask", ">", "iter2", "=", "vistree", ".", "iterAll", "(", ")", ".", "filter", "(", "VisualizationTask", ".", "class", ")", ";", "iter2", ".", "valid", "(", ")", ";", "iter2", ".", "advance", "(", ")", ")", "{", "VisualizationTask", "other", "=", "iter2", ".", "get", "(", ")", ";", "if", "(", "other", "!=", "task", "&&", "other", ".", "isTool", "(", ")", "&&", "other", ".", "isVisible", "(", ")", ")", "{", "context", ".", "visChanged", "(", "other", ".", "visibility", "(", "false", ")", ")", ";", "}", "}", "}", "context", ".", "visChanged", "(", "task", ".", "visibility", "(", "visibility", ")", ")", ";", "}" ]
Utility function to change Visualizer visibility. @param context Visualization context @param task Visualization task @param visibility Visibility value
[ "Utility", "function", "to", "change", "Visualizer", "visibility", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/VisualizationTree.java#L221-L233
lessthanoptimal/ejml
main/ejml-core/src/org/ejml/ops/MatrixIO.java
MatrixIO.saveDenseCSV
public static void saveDenseCSV(DMatrix A , String fileName ) throws IOException { """ Saves a matrix to disk using in a Column Space Value (CSV) format. For a description of the format see {@link MatrixIO#loadCSV(String,boolean)}. @param A The matrix being saved. @param fileName Name of the file its being saved at. @throws java.io.IOException """ PrintStream fileStream = new PrintStream(fileName); fileStream.println(A.getNumRows() + " " + A.getNumCols() + " real"); for( int i = 0; i < A.getNumRows(); i++ ) { for( int j = 0; j < A.getNumCols(); j++ ) { fileStream.print(A.get(i,j)+" "); } fileStream.println(); } fileStream.close(); }
java
public static void saveDenseCSV(DMatrix A , String fileName ) throws IOException { PrintStream fileStream = new PrintStream(fileName); fileStream.println(A.getNumRows() + " " + A.getNumCols() + " real"); for( int i = 0; i < A.getNumRows(); i++ ) { for( int j = 0; j < A.getNumCols(); j++ ) { fileStream.print(A.get(i,j)+" "); } fileStream.println(); } fileStream.close(); }
[ "public", "static", "void", "saveDenseCSV", "(", "DMatrix", "A", ",", "String", "fileName", ")", "throws", "IOException", "{", "PrintStream", "fileStream", "=", "new", "PrintStream", "(", "fileName", ")", ";", "fileStream", ".", "println", "(", "A", ".", "getNumRows", "(", ")", "+", "\" \"", "+", "A", ".", "getNumCols", "(", ")", "+", "\" real\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "A", ".", "getNumRows", "(", ")", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "A", ".", "getNumCols", "(", ")", ";", "j", "++", ")", "{", "fileStream", ".", "print", "(", "A", ".", "get", "(", "i", ",", "j", ")", "+", "\" \"", ")", ";", "}", "fileStream", ".", "println", "(", ")", ";", "}", "fileStream", ".", "close", "(", ")", ";", "}" ]
Saves a matrix to disk using in a Column Space Value (CSV) format. For a description of the format see {@link MatrixIO#loadCSV(String,boolean)}. @param A The matrix being saved. @param fileName Name of the file its being saved at. @throws java.io.IOException
[ "Saves", "a", "matrix", "to", "disk", "using", "in", "a", "Column", "Space", "Value", "(", "CSV", ")", "format", ".", "For", "a", "description", "of", "the", "format", "see", "{", "@link", "MatrixIO#loadCSV", "(", "String", "boolean", ")", "}", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/MatrixIO.java#L104-L117
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java
UCharacter.getName
public static String getName(String s, String separator) { """ <strong>[icu]</strong> Returns the names for each of the characters in a string @param s string to format @param separator string to go between names @return string of names """ if (s.length() == 1) { // handle common case return getName(s.charAt(0)); } int cp; StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); i += Character.charCount(cp)) { cp = s.codePointAt(i); if (i != 0) sb.append(separator); sb.append(UCharacter.getName(cp)); } return sb.toString(); }
java
public static String getName(String s, String separator) { if (s.length() == 1) { // handle common case return getName(s.charAt(0)); } int cp; StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); i += Character.charCount(cp)) { cp = s.codePointAt(i); if (i != 0) sb.append(separator); sb.append(UCharacter.getName(cp)); } return sb.toString(); }
[ "public", "static", "String", "getName", "(", "String", "s", ",", "String", "separator", ")", "{", "if", "(", "s", ".", "length", "(", ")", "==", "1", ")", "{", "// handle common case", "return", "getName", "(", "s", ".", "charAt", "(", "0", ")", ")", ";", "}", "int", "cp", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", "(", ")", ";", "i", "+=", "Character", ".", "charCount", "(", "cp", ")", ")", "{", "cp", "=", "s", ".", "codePointAt", "(", "i", ")", ";", "if", "(", "i", "!=", "0", ")", "sb", ".", "append", "(", "separator", ")", ";", "sb", ".", "append", "(", "UCharacter", ".", "getName", "(", "cp", ")", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
<strong>[icu]</strong> Returns the names for each of the characters in a string @param s string to format @param separator string to go between names @return string of names
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Returns", "the", "names", "for", "each", "of", "the", "characters", "in", "a", "string" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L3901-L3913
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java
AbstractStreamOperator.getPartitionedState
protected <S extends State> S getPartitionedState(StateDescriptor<S, ?> stateDescriptor) throws Exception { """ Creates a partitioned state handle, using the state backend configured for this task. @throws IllegalStateException Thrown, if the key/value state was already initialized. @throws Exception Thrown, if the state backend cannot create the key/value state. """ return getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, stateDescriptor); }
java
protected <S extends State> S getPartitionedState(StateDescriptor<S, ?> stateDescriptor) throws Exception { return getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, stateDescriptor); }
[ "protected", "<", "S", "extends", "State", ">", "S", "getPartitionedState", "(", "StateDescriptor", "<", "S", ",", "?", ">", "stateDescriptor", ")", "throws", "Exception", "{", "return", "getPartitionedState", "(", "VoidNamespace", ".", "INSTANCE", ",", "VoidNamespaceSerializer", ".", "INSTANCE", ",", "stateDescriptor", ")", ";", "}" ]
Creates a partitioned state handle, using the state backend configured for this task. @throws IllegalStateException Thrown, if the key/value state was already initialized. @throws Exception Thrown, if the state backend cannot create the key/value state.
[ "Creates", "a", "partitioned", "state", "handle", "using", "the", "state", "backend", "configured", "for", "this", "task", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java#L559-L561
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java
ImageDeformPointMLS_F32.setUndistorted
public void setUndistorted(int which, float x, float y) { """ Sets the location of a control point. @param x coordinate x-axis in image pixels @param y coordinate y-axis in image pixels """ if( scaleX <= 0 || scaleY <= 0 ) throw new IllegalArgumentException("Must call configure first"); controls.get(which).p.set(x/scaleX,y/scaleY); }
java
public void setUndistorted(int which, float x, float y) { if( scaleX <= 0 || scaleY <= 0 ) throw new IllegalArgumentException("Must call configure first"); controls.get(which).p.set(x/scaleX,y/scaleY); }
[ "public", "void", "setUndistorted", "(", "int", "which", ",", "float", "x", ",", "float", "y", ")", "{", "if", "(", "scaleX", "<=", "0", "||", "scaleY", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Must call configure first\"", ")", ";", "controls", ".", "get", "(", "which", ")", ".", "p", ".", "set", "(", "x", "/", "scaleX", ",", "y", "/", "scaleY", ")", ";", "}" ]
Sets the location of a control point. @param x coordinate x-axis in image pixels @param y coordinate y-axis in image pixels
[ "Sets", "the", "location", "of", "a", "control", "point", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java#L149-L154
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/KMedoidsPark.java
KMedoidsPark.currentCluster
protected int currentCluster(List<? extends ModifiableDBIDs> clusters, DBIDRef id) { """ Find the current cluster assignment. @param clusters Clusters @param id Current object @return Current cluster assignment. """ for(int i = 0; i < k; i++) { if(clusters.get(i).contains(id)) { return i; } } return -1; }
java
protected int currentCluster(List<? extends ModifiableDBIDs> clusters, DBIDRef id) { for(int i = 0; i < k; i++) { if(clusters.get(i).contains(id)) { return i; } } return -1; }
[ "protected", "int", "currentCluster", "(", "List", "<", "?", "extends", "ModifiableDBIDs", ">", "clusters", ",", "DBIDRef", "id", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "k", ";", "i", "++", ")", "{", "if", "(", "clusters", ".", "get", "(", "i", ")", ".", "contains", "(", "id", ")", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
Find the current cluster assignment. @param clusters Clusters @param id Current object @return Current cluster assignment.
[ "Find", "the", "current", "cluster", "assignment", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/KMedoidsPark.java#L286-L293
microfocus-idol/java-content-parameter-api
src/main/java/com/hp/autonomy/aci/content/fieldtext/FieldTextBuilder.java
FieldTextBuilder.AND
@Override public FieldTextBuilder AND(final FieldText fieldText) { """ Appends the specified fieldtext onto the builder using the AND operator. Parentheses are omitted where possible and logical simplifications are made in certain cases: <p> <pre>(A AND A) {@literal =>} A</pre> <pre>(* AND A) {@literal =>} A</pre> <pre>(0 AND A) {@literal =>} 0</pre> @param fieldText A fieldtext expression or specifier. @return {@code this} """ Validate.notNull(fieldText, "FieldText should not be null"); if(fieldText == this || toString().equals(fieldText.toString())) { return this; } if(isEmpty()) { return setFieldText(fieldText); } if(fieldText.isEmpty()) { return this; } if(MATCHNOTHING.equals(this) || MATCHNOTHING.equals(fieldText)) { return setFieldText(MATCHNOTHING); } return binaryOperation("AND", fieldText); }
java
@Override public FieldTextBuilder AND(final FieldText fieldText) { Validate.notNull(fieldText, "FieldText should not be null"); if(fieldText == this || toString().equals(fieldText.toString())) { return this; } if(isEmpty()) { return setFieldText(fieldText); } if(fieldText.isEmpty()) { return this; } if(MATCHNOTHING.equals(this) || MATCHNOTHING.equals(fieldText)) { return setFieldText(MATCHNOTHING); } return binaryOperation("AND", fieldText); }
[ "@", "Override", "public", "FieldTextBuilder", "AND", "(", "final", "FieldText", "fieldText", ")", "{", "Validate", ".", "notNull", "(", "fieldText", ",", "\"FieldText should not be null\"", ")", ";", "if", "(", "fieldText", "==", "this", "||", "toString", "(", ")", ".", "equals", "(", "fieldText", ".", "toString", "(", ")", ")", ")", "{", "return", "this", ";", "}", "if", "(", "isEmpty", "(", ")", ")", "{", "return", "setFieldText", "(", "fieldText", ")", ";", "}", "if", "(", "fieldText", ".", "isEmpty", "(", ")", ")", "{", "return", "this", ";", "}", "if", "(", "MATCHNOTHING", ".", "equals", "(", "this", ")", "||", "MATCHNOTHING", ".", "equals", "(", "fieldText", ")", ")", "{", "return", "setFieldText", "(", "MATCHNOTHING", ")", ";", "}", "return", "binaryOperation", "(", "\"AND\"", ",", "fieldText", ")", ";", "}" ]
Appends the specified fieldtext onto the builder using the AND operator. Parentheses are omitted where possible and logical simplifications are made in certain cases: <p> <pre>(A AND A) {@literal =>} A</pre> <pre>(* AND A) {@literal =>} A</pre> <pre>(0 AND A) {@literal =>} 0</pre> @param fieldText A fieldtext expression or specifier. @return {@code this}
[ "Appends", "the", "specified", "fieldtext", "onto", "the", "builder", "using", "the", "AND", "operator", ".", "Parentheses", "are", "omitted", "where", "possible", "and", "logical", "simplifications", "are", "made", "in", "certain", "cases", ":", "<p", ">", "<pre", ">", "(", "A", "AND", "A", ")", "{", "@literal", "=", ">", "}", "A<", "/", "pre", ">", "<pre", ">", "(", "*", "AND", "A", ")", "{", "@literal", "=", ">", "}", "A<", "/", "pre", ">", "<pre", ">", "(", "0", "AND", "A", ")", "{", "@literal", "=", ">", "}", "0<", "/", "pre", ">" ]
train
https://github.com/microfocus-idol/java-content-parameter-api/blob/8d33dc633f8df2a470a571ac7694e423e7004ad0/src/main/java/com/hp/autonomy/aci/content/fieldtext/FieldTextBuilder.java#L128-L149
kochedykov/jlibmodbus
src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java
ModbusMaster.writeMultipleCoils
final public void writeMultipleCoils(int serverAddress, int startAddress, boolean[] coils) throws ModbusProtocolException, ModbusNumberException, ModbusIOException { """ This function code is used to force each coil in a sequence of coils to either ON or OFF in a remote device. The Request PDU specifies the coil references to be forced. Coils are addressed starting at zero. Therefore coil numbered 1 is addressed as 0. The requested ON/OFF states are specified by contents of the request array of boolean. A logical 'true' in position of the array requests the corresponding output to be ON. A logical 'false' requests it to be OFF. @param serverAddress a slave address @param startAddress the address of the coils to be written @param coils the coils @throws ModbusProtocolException if modbus-exception is received @throws ModbusNumberException if response is invalid @throws ModbusIOException if remote slave is unavailable """ processRequest(ModbusRequestBuilder.getInstance().buildWriteMultipleCoils(serverAddress, startAddress, coils)); }
java
final public void writeMultipleCoils(int serverAddress, int startAddress, boolean[] coils) throws ModbusProtocolException, ModbusNumberException, ModbusIOException { processRequest(ModbusRequestBuilder.getInstance().buildWriteMultipleCoils(serverAddress, startAddress, coils)); }
[ "final", "public", "void", "writeMultipleCoils", "(", "int", "serverAddress", ",", "int", "startAddress", ",", "boolean", "[", "]", "coils", ")", "throws", "ModbusProtocolException", ",", "ModbusNumberException", ",", "ModbusIOException", "{", "processRequest", "(", "ModbusRequestBuilder", ".", "getInstance", "(", ")", ".", "buildWriteMultipleCoils", "(", "serverAddress", ",", "startAddress", ",", "coils", ")", ")", ";", "}" ]
This function code is used to force each coil in a sequence of coils to either ON or OFF in a remote device. The Request PDU specifies the coil references to be forced. Coils are addressed starting at zero. Therefore coil numbered 1 is addressed as 0. The requested ON/OFF states are specified by contents of the request array of boolean. A logical 'true' in position of the array requests the corresponding output to be ON. A logical 'false' requests it to be OFF. @param serverAddress a slave address @param startAddress the address of the coils to be written @param coils the coils @throws ModbusProtocolException if modbus-exception is received @throws ModbusNumberException if response is invalid @throws ModbusIOException if remote slave is unavailable
[ "This", "function", "code", "is", "used", "to", "force", "each", "coil", "in", "a", "sequence", "of", "coils", "to", "either", "ON", "or", "OFF", "in", "a", "remote", "device", ".", "The", "Request", "PDU", "specifies", "the", "coil", "references", "to", "be", "forced", ".", "Coils", "are", "addressed", "starting", "at", "zero", ".", "Therefore", "coil", "numbered", "1", "is", "addressed", "as", "0", ".", "The", "requested", "ON", "/", "OFF", "states", "are", "specified", "by", "contents", "of", "the", "request", "array", "of", "boolean", ".", "A", "logical", "true", "in", "position", "of", "the", "array", "requests", "the", "corresponding", "output", "to", "be", "ON", ".", "A", "logical", "false", "requests", "it", "to", "be", "OFF", "." ]
train
https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java#L320-L323
lucee/Lucee
core/src/main/java/lucee/runtime/net/http/HttpServletRequestDummy.java
HttpServletRequestDummy.translateQS
private Pair[] translateQS(String qs) { """ constructor of the class @throws PageException / public HttpServletRequestDummy(String serverName, String scriptName,Struct queryString) throws PageException { this.serverName=serverName; requestURI=scriptName; StringBuffer qs=new StringBuffer(); String[] keys=queryString.keys(); parameters=new Item[keys.length]; String key; Object value; for(int i=0;i<keys.length;i++) { if(i>0) qs.append('&'); key=keys[i]; value=queryString.get(key); parameters[i]=new Item(key,value); qs.append(key); qs.append('='); qs.append(Caster.toString(value)); } this.queryString=qs.toString(); } """ if (qs == null) return new Pair[0]; Array arr = lucee.runtime.type.util.ListUtil.listToArrayRemoveEmpty(qs, "&"); Pair[] parameters = new Pair[arr.size()]; // Array item; int index; String name; for (int i = 1; i <= parameters.length; i++) { name = Caster.toString(arr.get(i, ""), ""); index = name.indexOf('='); if (index != -1) parameters[i - 1] = new Pair(name.substring(0, index), name.substring(index + 1)); else parameters[i - 1] = new Pair(name, ""); } return parameters; }
java
private Pair[] translateQS(String qs) { if (qs == null) return new Pair[0]; Array arr = lucee.runtime.type.util.ListUtil.listToArrayRemoveEmpty(qs, "&"); Pair[] parameters = new Pair[arr.size()]; // Array item; int index; String name; for (int i = 1; i <= parameters.length; i++) { name = Caster.toString(arr.get(i, ""), ""); index = name.indexOf('='); if (index != -1) parameters[i - 1] = new Pair(name.substring(0, index), name.substring(index + 1)); else parameters[i - 1] = new Pair(name, ""); } return parameters; }
[ "private", "Pair", "[", "]", "translateQS", "(", "String", "qs", ")", "{", "if", "(", "qs", "==", "null", ")", "return", "new", "Pair", "[", "0", "]", ";", "Array", "arr", "=", "lucee", ".", "runtime", ".", "type", ".", "util", ".", "ListUtil", ".", "listToArrayRemoveEmpty", "(", "qs", ",", "\"&\"", ")", ";", "Pair", "[", "]", "parameters", "=", "new", "Pair", "[", "arr", ".", "size", "(", ")", "]", ";", "// Array item;", "int", "index", ";", "String", "name", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "parameters", ".", "length", ";", "i", "++", ")", "{", "name", "=", "Caster", ".", "toString", "(", "arr", ".", "get", "(", "i", ",", "\"\"", ")", ",", "\"\"", ")", ";", "index", "=", "name", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "parameters", "[", "i", "-", "1", "]", "=", "new", "Pair", "(", "name", ".", "substring", "(", "0", ",", "index", ")", ",", "name", ".", "substring", "(", "index", "+", "1", ")", ")", ";", "else", "parameters", "[", "i", "-", "1", "]", "=", "new", "Pair", "(", "name", ",", "\"\"", ")", ";", "}", "return", "parameters", ";", "}" ]
constructor of the class @throws PageException / public HttpServletRequestDummy(String serverName, String scriptName,Struct queryString) throws PageException { this.serverName=serverName; requestURI=scriptName; StringBuffer qs=new StringBuffer(); String[] keys=queryString.keys(); parameters=new Item[keys.length]; String key; Object value; for(int i=0;i<keys.length;i++) { if(i>0) qs.append('&'); key=keys[i]; value=queryString.get(key); parameters[i]=new Item(key,value); qs.append(key); qs.append('='); qs.append(Caster.toString(value)); } this.queryString=qs.toString(); }
[ "constructor", "of", "the", "class" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/http/HttpServletRequestDummy.java#L161-L177
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java
MediaServicesInner.listKeysAsync
public Observable<ServiceKeysInner> listKeysAsync(String resourceGroupName, String mediaServiceName) { """ Lists the keys for a Media Service. @param resourceGroupName Name of the resource group within the Azure subscription. @param mediaServiceName Name of the Media Service. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServiceKeysInner object """ return listKeysWithServiceResponseAsync(resourceGroupName, mediaServiceName).map(new Func1<ServiceResponse<ServiceKeysInner>, ServiceKeysInner>() { @Override public ServiceKeysInner call(ServiceResponse<ServiceKeysInner> response) { return response.body(); } }); }
java
public Observable<ServiceKeysInner> listKeysAsync(String resourceGroupName, String mediaServiceName) { return listKeysWithServiceResponseAsync(resourceGroupName, mediaServiceName).map(new Func1<ServiceResponse<ServiceKeysInner>, ServiceKeysInner>() { @Override public ServiceKeysInner call(ServiceResponse<ServiceKeysInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServiceKeysInner", ">", "listKeysAsync", "(", "String", "resourceGroupName", ",", "String", "mediaServiceName", ")", "{", "return", "listKeysWithServiceResponseAsync", "(", "resourceGroupName", ",", "mediaServiceName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ServiceKeysInner", ">", ",", "ServiceKeysInner", ">", "(", ")", "{", "@", "Override", "public", "ServiceKeysInner", "call", "(", "ServiceResponse", "<", "ServiceKeysInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Lists the keys for a Media Service. @param resourceGroupName Name of the resource group within the Azure subscription. @param mediaServiceName Name of the Media Service. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServiceKeysInner object
[ "Lists", "the", "keys", "for", "a", "Media", "Service", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java#L766-L773
apiman/apiman
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/DefaultESClientFactory.java
DefaultESClientFactory.updateHttpConfig
protected void updateHttpConfig(Builder httpClientConfig, Map<String, String> config) { """ Update the http client config. @param httpClientConfig @param config """ String username = config.get("client.username"); //$NON-NLS-1$ String password = config.get("client.password"); //$NON-NLS-1$ String timeout = config.get("client.timeout"); //$NON-NLS-1$ if (StringUtils.isBlank(timeout)) { timeout = "10000"; //$NON-NLS-1$ } httpClientConfig .connTimeout(new Integer(timeout)) .readTimeout(new Integer(timeout)) .maxTotalConnection(75) .defaultMaxTotalConnectionPerRoute(75) .multiThreaded(true); if (!StringUtils.isBlank(username)) { httpClientConfig.defaultCredentials(username, password); } if ("https".equals(config.get("protocol"))) { //$NON-NLS-1$ //$NON-NLS-2$ updateSslConfig(httpClientConfig, config); } }
java
protected void updateHttpConfig(Builder httpClientConfig, Map<String, String> config) { String username = config.get("client.username"); //$NON-NLS-1$ String password = config.get("client.password"); //$NON-NLS-1$ String timeout = config.get("client.timeout"); //$NON-NLS-1$ if (StringUtils.isBlank(timeout)) { timeout = "10000"; //$NON-NLS-1$ } httpClientConfig .connTimeout(new Integer(timeout)) .readTimeout(new Integer(timeout)) .maxTotalConnection(75) .defaultMaxTotalConnectionPerRoute(75) .multiThreaded(true); if (!StringUtils.isBlank(username)) { httpClientConfig.defaultCredentials(username, password); } if ("https".equals(config.get("protocol"))) { //$NON-NLS-1$ //$NON-NLS-2$ updateSslConfig(httpClientConfig, config); } }
[ "protected", "void", "updateHttpConfig", "(", "Builder", "httpClientConfig", ",", "Map", "<", "String", ",", "String", ">", "config", ")", "{", "String", "username", "=", "config", ".", "get", "(", "\"client.username\"", ")", ";", "//$NON-NLS-1$", "String", "password", "=", "config", ".", "get", "(", "\"client.password\"", ")", ";", "//$NON-NLS-1$", "String", "timeout", "=", "config", ".", "get", "(", "\"client.timeout\"", ")", ";", "//$NON-NLS-1$", "if", "(", "StringUtils", ".", "isBlank", "(", "timeout", ")", ")", "{", "timeout", "=", "\"10000\"", ";", "//$NON-NLS-1$", "}", "httpClientConfig", ".", "connTimeout", "(", "new", "Integer", "(", "timeout", ")", ")", ".", "readTimeout", "(", "new", "Integer", "(", "timeout", ")", ")", ".", "maxTotalConnection", "(", "75", ")", ".", "defaultMaxTotalConnectionPerRoute", "(", "75", ")", ".", "multiThreaded", "(", "true", ")", ";", "if", "(", "!", "StringUtils", ".", "isBlank", "(", "username", ")", ")", "{", "httpClientConfig", ".", "defaultCredentials", "(", "username", ",", "password", ")", ";", "}", "if", "(", "\"https\"", ".", "equals", "(", "config", ".", "get", "(", "\"protocol\"", ")", ")", ")", "{", "//$NON-NLS-1$ //$NON-NLS-2$", "updateSslConfig", "(", "httpClientConfig", ",", "config", ")", ";", "}", "}" ]
Update the http client config. @param httpClientConfig @param config
[ "Update", "the", "http", "client", "config", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/DefaultESClientFactory.java#L133-L154
jqno/equalsverifier
src/main/java/nl/jqno/equalsverifier/internal/reflection/annotations/NonnullAnnotationVerifier.java
NonnullAnnotationVerifier.fieldIsNonnull
public static boolean fieldIsNonnull(Field field, AnnotationCache annotationCache) { """ Checks whether the given field is marked with an Nonnull annotation, whether directly, or through some default annotation mechanism. @param field The field to be checked. @param annotationCache To provide access to the annotations on the field and the field's class @return True if the field is to be treated as Nonnull. """ Class<?> type = field.getDeclaringClass(); if (annotationCache.hasFieldAnnotation(type, field.getName(), NONNULL)) { return true; } if (annotationCache.hasFieldAnnotation(type, field.getName(), NULLABLE)) { return false; } return annotationCache.hasClassAnnotation(type, FINDBUGS1X_DEFAULT_ANNOTATION_NONNULL) || annotationCache.hasClassAnnotation(type, JSR305_DEFAULT_ANNOTATION_NONNULL) || annotationCache.hasClassAnnotation(type, ECLIPSE_DEFAULT_ANNOTATION_NONNULL); }
java
public static boolean fieldIsNonnull(Field field, AnnotationCache annotationCache) { Class<?> type = field.getDeclaringClass(); if (annotationCache.hasFieldAnnotation(type, field.getName(), NONNULL)) { return true; } if (annotationCache.hasFieldAnnotation(type, field.getName(), NULLABLE)) { return false; } return annotationCache.hasClassAnnotation(type, FINDBUGS1X_DEFAULT_ANNOTATION_NONNULL) || annotationCache.hasClassAnnotation(type, JSR305_DEFAULT_ANNOTATION_NONNULL) || annotationCache.hasClassAnnotation(type, ECLIPSE_DEFAULT_ANNOTATION_NONNULL); }
[ "public", "static", "boolean", "fieldIsNonnull", "(", "Field", "field", ",", "AnnotationCache", "annotationCache", ")", "{", "Class", "<", "?", ">", "type", "=", "field", ".", "getDeclaringClass", "(", ")", ";", "if", "(", "annotationCache", ".", "hasFieldAnnotation", "(", "type", ",", "field", ".", "getName", "(", ")", ",", "NONNULL", ")", ")", "{", "return", "true", ";", "}", "if", "(", "annotationCache", ".", "hasFieldAnnotation", "(", "type", ",", "field", ".", "getName", "(", ")", ",", "NULLABLE", ")", ")", "{", "return", "false", ";", "}", "return", "annotationCache", ".", "hasClassAnnotation", "(", "type", ",", "FINDBUGS1X_DEFAULT_ANNOTATION_NONNULL", ")", "||", "annotationCache", ".", "hasClassAnnotation", "(", "type", ",", "JSR305_DEFAULT_ANNOTATION_NONNULL", ")", "||", "annotationCache", ".", "hasClassAnnotation", "(", "type", ",", "ECLIPSE_DEFAULT_ANNOTATION_NONNULL", ")", ";", "}" ]
Checks whether the given field is marked with an Nonnull annotation, whether directly, or through some default annotation mechanism. @param field The field to be checked. @param annotationCache To provide access to the annotations on the field and the field's class @return True if the field is to be treated as Nonnull.
[ "Checks", "whether", "the", "given", "field", "is", "marked", "with", "an", "Nonnull", "annotation", "whether", "directly", "or", "through", "some", "default", "annotation", "mechanism", "." ]
train
https://github.com/jqno/equalsverifier/blob/25d73c9cb801c8b20b257d1d1283ac6e0585ef1d/src/main/java/nl/jqno/equalsverifier/internal/reflection/annotations/NonnullAnnotationVerifier.java#L23-L34
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/LabeledScoredTreeFactory.java
LabeledScoredTreeFactory.newTreeNode
@Override public Tree newTreeNode(Label parentLabel, List<Tree> children) { """ Create a new non-leaf tree node with the given label @param parentLabel The label for the node @param children A <code>List</code> of the children of this node, each of which should itself be a <code>LabeledScoredTree</code> @return A new internal tree node """ return new LabeledScoredTreeNode(lf.newLabel(parentLabel), children); }
java
@Override public Tree newTreeNode(Label parentLabel, List<Tree> children) { return new LabeledScoredTreeNode(lf.newLabel(parentLabel), children); }
[ "@", "Override", "public", "Tree", "newTreeNode", "(", "Label", "parentLabel", ",", "List", "<", "Tree", ">", "children", ")", "{", "return", "new", "LabeledScoredTreeNode", "(", "lf", ".", "newLabel", "(", "parentLabel", ")", ",", "children", ")", ";", "}" ]
Create a new non-leaf tree node with the given label @param parentLabel The label for the node @param children A <code>List</code> of the children of this node, each of which should itself be a <code>LabeledScoredTree</code> @return A new internal tree node
[ "Create", "a", "new", "non", "-", "leaf", "tree", "node", "with", "the", "given", "label" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/LabeledScoredTreeFactory.java#L67-L70
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java
DockerUtils.pullImage
public static void pullImage(String imageTag, String username, String password, String host) throws IOException { """ Pull docker image using the docker java client. @param imageTag @param username @param password @param host """ final AuthConfig authConfig = new AuthConfig(); authConfig.withUsername(username); authConfig.withPassword(password); DockerClient dockerClient = null; try { dockerClient = getDockerClient(host); dockerClient.pullImageCmd(imageTag).withAuthConfig(authConfig).exec(new PullImageResultCallback()).awaitSuccess(); } finally { closeQuietly(dockerClient); } }
java
public static void pullImage(String imageTag, String username, String password, String host) throws IOException { final AuthConfig authConfig = new AuthConfig(); authConfig.withUsername(username); authConfig.withPassword(password); DockerClient dockerClient = null; try { dockerClient = getDockerClient(host); dockerClient.pullImageCmd(imageTag).withAuthConfig(authConfig).exec(new PullImageResultCallback()).awaitSuccess(); } finally { closeQuietly(dockerClient); } }
[ "public", "static", "void", "pullImage", "(", "String", "imageTag", ",", "String", "username", ",", "String", "password", ",", "String", "host", ")", "throws", "IOException", "{", "final", "AuthConfig", "authConfig", "=", "new", "AuthConfig", "(", ")", ";", "authConfig", ".", "withUsername", "(", "username", ")", ";", "authConfig", ".", "withPassword", "(", "password", ")", ";", "DockerClient", "dockerClient", "=", "null", ";", "try", "{", "dockerClient", "=", "getDockerClient", "(", "host", ")", ";", "dockerClient", ".", "pullImageCmd", "(", "imageTag", ")", ".", "withAuthConfig", "(", "authConfig", ")", ".", "exec", "(", "new", "PullImageResultCallback", "(", ")", ")", ".", "awaitSuccess", "(", ")", ";", "}", "finally", "{", "closeQuietly", "(", "dockerClient", ")", ";", "}", "}" ]
Pull docker image using the docker java client. @param imageTag @param username @param password @param host
[ "Pull", "docker", "image", "using", "the", "docker", "java", "client", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java#L74-L86
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.pages_isFan
public boolean pages_isFan(Long pageId, Integer userId) throws FacebookException, IOException { """ Checks whether a user is a fan of the page with the given <code>pageId</code>. @param pageId the ID of the page @param userId the ID of the user (defaults to the logged-in user if null) @return true if the user is a fan of the page @see <a href="http://wiki.developers.facebook.com/index.php/Pages.isFan"> Developers Wiki: Pages.isFan</a> """ return extractBoolean(this.callMethod(FacebookMethod.PAGES_IS_FAN, new Pair<String,CharSequence>("page_id", pageId.toString()), new Pair<String,CharSequence>("uid", userId.toString()))); }
java
public boolean pages_isFan(Long pageId, Integer userId) throws FacebookException, IOException { return extractBoolean(this.callMethod(FacebookMethod.PAGES_IS_FAN, new Pair<String,CharSequence>("page_id", pageId.toString()), new Pair<String,CharSequence>("uid", userId.toString()))); }
[ "public", "boolean", "pages_isFan", "(", "Long", "pageId", ",", "Integer", "userId", ")", "throws", "FacebookException", ",", "IOException", "{", "return", "extractBoolean", "(", "this", ".", "callMethod", "(", "FacebookMethod", ".", "PAGES_IS_FAN", ",", "new", "Pair", "<", "String", ",", "CharSequence", ">", "(", "\"page_id\"", ",", "pageId", ".", "toString", "(", ")", ")", ",", "new", "Pair", "<", "String", ",", "CharSequence", ">", "(", "\"uid\"", ",", "userId", ".", "toString", "(", ")", ")", ")", ")", ";", "}" ]
Checks whether a user is a fan of the page with the given <code>pageId</code>. @param pageId the ID of the page @param userId the ID of the user (defaults to the logged-in user if null) @return true if the user is a fan of the page @see <a href="http://wiki.developers.facebook.com/index.php/Pages.isFan"> Developers Wiki: Pages.isFan</a>
[ "Checks", "whether", "a", "user", "is", "a", "fan", "of", "the", "page", "with", "the", "given", "<code", ">", "pageId<", "/", "code", ">", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L2186-L2191
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/channel/AbstractCommunicationHandler.java
AbstractCommunicationHandler.getNewSocket
private SSLSocket getNewSocket() throws IOException { """ Before we allocate a new socket, try to delete the old one. closeTcpConnection() needs to be a nop for non-opened connections. @return @throws IOException """ String host = getUrl().getHost(); int port = getPort(); Socket socketConnection = new Socket(); InetSocketAddress mapServerAddress = new InetSocketAddress(host, port); socketConnection.connect(mapServerAddress, mInitialConnectionTimeout); SSLSocket ret = (SSLSocket) mSocketFactory.createSocket(socketConnection, host, port, true); ret.setTcpNoDelay(true); ret.setWantClientAuth(true); // Check if all is good... Will throw IOException if we don't // like the other end... ret.getSession().getPeerCertificates(); if (!mHostnameVerifier.verify(mUrl.getHost(), ret.getSession())) { throw new IOException("Hostname Verification failed! " + "Did you set ifmapj.communication.verifypeerhost?"); } return ret; }
java
private SSLSocket getNewSocket() throws IOException { String host = getUrl().getHost(); int port = getPort(); Socket socketConnection = new Socket(); InetSocketAddress mapServerAddress = new InetSocketAddress(host, port); socketConnection.connect(mapServerAddress, mInitialConnectionTimeout); SSLSocket ret = (SSLSocket) mSocketFactory.createSocket(socketConnection, host, port, true); ret.setTcpNoDelay(true); ret.setWantClientAuth(true); // Check if all is good... Will throw IOException if we don't // like the other end... ret.getSession().getPeerCertificates(); if (!mHostnameVerifier.verify(mUrl.getHost(), ret.getSession())) { throw new IOException("Hostname Verification failed! " + "Did you set ifmapj.communication.verifypeerhost?"); } return ret; }
[ "private", "SSLSocket", "getNewSocket", "(", ")", "throws", "IOException", "{", "String", "host", "=", "getUrl", "(", ")", ".", "getHost", "(", ")", ";", "int", "port", "=", "getPort", "(", ")", ";", "Socket", "socketConnection", "=", "new", "Socket", "(", ")", ";", "InetSocketAddress", "mapServerAddress", "=", "new", "InetSocketAddress", "(", "host", ",", "port", ")", ";", "socketConnection", ".", "connect", "(", "mapServerAddress", ",", "mInitialConnectionTimeout", ")", ";", "SSLSocket", "ret", "=", "(", "SSLSocket", ")", "mSocketFactory", ".", "createSocket", "(", "socketConnection", ",", "host", ",", "port", ",", "true", ")", ";", "ret", ".", "setTcpNoDelay", "(", "true", ")", ";", "ret", ".", "setWantClientAuth", "(", "true", ")", ";", "// Check if all is good... Will throw IOException if we don't", "// like the other end...", "ret", ".", "getSession", "(", ")", ".", "getPeerCertificates", "(", ")", ";", "if", "(", "!", "mHostnameVerifier", ".", "verify", "(", "mUrl", ".", "getHost", "(", ")", ",", "ret", ".", "getSession", "(", ")", ")", ")", "{", "throw", "new", "IOException", "(", "\"Hostname Verification failed! \"", "+", "\"Did you set ifmapj.communication.verifypeerhost?\"", ")", ";", "}", "return", "ret", ";", "}" ]
Before we allocate a new socket, try to delete the old one. closeTcpConnection() needs to be a nop for non-opened connections. @return @throws IOException
[ "Before", "we", "allocate", "a", "new", "socket", "try", "to", "delete", "the", "old", "one", ".", "closeTcpConnection", "()", "needs", "to", "be", "a", "nop", "for", "non", "-", "opened", "connections", "." ]
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/channel/AbstractCommunicationHandler.java#L284-L305
magro/memcached-session-manager
core/src/main/java/de/javakaffee/web/msm/BackupSessionTask.java
BackupSessionTask.doBackupSession
BackupResult doBackupSession( final MemcachedBackupSession session, final byte[] data, final byte[] attributesData ) throws InterruptedException { """ Store the provided session in memcached. @param session the session to backup @param data the serialized session data (session fields and session attributes). @param attributesData just the serialized session attributes. @return the {@link BackupResultStatus} """ if ( _log.isDebugEnabled() ) { _log.debug( "Trying to store session in memcached: " + session.getId() ); } try { storeSessionInMemcached( session, data ); return new BackupResult( BackupResultStatus.SUCCESS, data, attributesData ); } catch (final ExecutionException e) { handleException(session, e); return new BackupResult(BackupResultStatus.FAILURE, data, null); } catch (final TimeoutException e) { handleException(session, e); return new BackupResult(BackupResultStatus.FAILURE, data, null); } }
java
BackupResult doBackupSession( final MemcachedBackupSession session, final byte[] data, final byte[] attributesData ) throws InterruptedException { if ( _log.isDebugEnabled() ) { _log.debug( "Trying to store session in memcached: " + session.getId() ); } try { storeSessionInMemcached( session, data ); return new BackupResult( BackupResultStatus.SUCCESS, data, attributesData ); } catch (final ExecutionException e) { handleException(session, e); return new BackupResult(BackupResultStatus.FAILURE, data, null); } catch (final TimeoutException e) { handleException(session, e); return new BackupResult(BackupResultStatus.FAILURE, data, null); } }
[ "BackupResult", "doBackupSession", "(", "final", "MemcachedBackupSession", "session", ",", "final", "byte", "[", "]", "data", ",", "final", "byte", "[", "]", "attributesData", ")", "throws", "InterruptedException", "{", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "\"Trying to store session in memcached: \"", "+", "session", ".", "getId", "(", ")", ")", ";", "}", "try", "{", "storeSessionInMemcached", "(", "session", ",", "data", ")", ";", "return", "new", "BackupResult", "(", "BackupResultStatus", ".", "SUCCESS", ",", "data", ",", "attributesData", ")", ";", "}", "catch", "(", "final", "ExecutionException", "e", ")", "{", "handleException", "(", "session", ",", "e", ")", ";", "return", "new", "BackupResult", "(", "BackupResultStatus", ".", "FAILURE", ",", "data", ",", "null", ")", ";", "}", "catch", "(", "final", "TimeoutException", "e", ")", "{", "handleException", "(", "session", ",", "e", ")", ";", "return", "new", "BackupResult", "(", "BackupResultStatus", ".", "FAILURE", ",", "data", ",", "null", ")", ";", "}", "}" ]
Store the provided session in memcached. @param session the session to backup @param data the serialized session data (session fields and session attributes). @param attributesData just the serialized session attributes. @return the {@link BackupResultStatus}
[ "Store", "the", "provided", "session", "in", "memcached", ".", "@param", "session", "the", "session", "to", "backup", "@param", "data", "the", "serialized", "session", "data", "(", "session", "fields", "and", "session", "attributes", ")", ".", "@param", "attributesData", "just", "the", "serialized", "session", "attributes", "." ]
train
https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/BackupSessionTask.java#L192-L207
osglworks/java-mvc
src/main/java/org/osgl/mvc/result/UnsupportedMediaType.java
UnsupportedMediaType.of
public static UnsupportedMediaType of(int errorCode) { """ Returns a static UnsupportedMediaType instance and set the {@link #payload} thread local with error code and default message. When calling the instance on {@link #getMessage()} method, it will return whatever stored in the {@link #payload} thread local @param errorCode the app defined error code @return a static UnsupportedMediaType instance as described above """ if (_localizedErrorMsg()) { return of(errorCode, defaultMessage(UNSUPPORTED_MEDIA_TYPE)); } else { touchPayload().errorCode(errorCode); return _INSTANCE; } }
java
public static UnsupportedMediaType of(int errorCode) { if (_localizedErrorMsg()) { return of(errorCode, defaultMessage(UNSUPPORTED_MEDIA_TYPE)); } else { touchPayload().errorCode(errorCode); return _INSTANCE; } }
[ "public", "static", "UnsupportedMediaType", "of", "(", "int", "errorCode", ")", "{", "if", "(", "_localizedErrorMsg", "(", ")", ")", "{", "return", "of", "(", "errorCode", ",", "defaultMessage", "(", "UNSUPPORTED_MEDIA_TYPE", ")", ")", ";", "}", "else", "{", "touchPayload", "(", ")", ".", "errorCode", "(", "errorCode", ")", ";", "return", "_INSTANCE", ";", "}", "}" ]
Returns a static UnsupportedMediaType instance and set the {@link #payload} thread local with error code and default message. When calling the instance on {@link #getMessage()} method, it will return whatever stored in the {@link #payload} thread local @param errorCode the app defined error code @return a static UnsupportedMediaType instance as described above
[ "Returns", "a", "static", "UnsupportedMediaType", "instance", "and", "set", "the", "{", "@link", "#payload", "}", "thread", "local", "with", "error", "code", "and", "default", "message", "." ]
train
https://github.com/osglworks/java-mvc/blob/4d2b2ec40498ac6ee7040c0424377cbeacab124b/src/main/java/org/osgl/mvc/result/UnsupportedMediaType.java#L145-L152
primefaces-extensions/core
src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java
SheetRenderer.encodeOptionalAttr
protected void encodeOptionalAttr(final WidgetBuilder wb, final String attrName, final String value) throws IOException { """ Encodes an optional attribute to the widget builder specified. @param wb the WidgetBuilder to append to @param attrName the attribute name @param value the value @throws IOException """ if (value != null) { wb.attr(attrName, value); } }
java
protected void encodeOptionalAttr(final WidgetBuilder wb, final String attrName, final String value) throws IOException { if (value != null) { wb.attr(attrName, value); } }
[ "protected", "void", "encodeOptionalAttr", "(", "final", "WidgetBuilder", "wb", ",", "final", "String", "attrName", ",", "final", "String", "value", ")", "throws", "IOException", "{", "if", "(", "value", "!=", "null", ")", "{", "wb", ".", "attr", "(", "attrName", ",", "value", ")", ";", "}", "}" ]
Encodes an optional attribute to the widget builder specified. @param wb the WidgetBuilder to append to @param attrName the attribute name @param value the value @throws IOException
[ "Encodes", "an", "optional", "attribute", "to", "the", "widget", "builder", "specified", "." ]
train
https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L153-L158
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java
DocCommentParser.blockTag
protected DCTree blockTag() { """ Read a single block tag, including its content. Standard tags parse their content appropriately. Non-standard tags are represented by {@link UnknownBlockTag}. """ int p = bp; try { nextChar(); if (isIdentifierStart(ch)) { Name name = readTagName(); TagParser tp = tagParsers.get(name); if (tp == null) { List<DCTree> content = blockContent(); return m.at(p).UnknownBlockTag(name, content); } else { switch (tp.getKind()) { case BLOCK: return tp.parse(p); case INLINE: return erroneous("dc.bad.inline.tag", p); } } } blockContent(); return erroneous("dc.no.tag.name", p); } catch (ParseException e) { blockContent(); return erroneous(e.getMessage(), p); } }
java
protected DCTree blockTag() { int p = bp; try { nextChar(); if (isIdentifierStart(ch)) { Name name = readTagName(); TagParser tp = tagParsers.get(name); if (tp == null) { List<DCTree> content = blockContent(); return m.at(p).UnknownBlockTag(name, content); } else { switch (tp.getKind()) { case BLOCK: return tp.parse(p); case INLINE: return erroneous("dc.bad.inline.tag", p); } } } blockContent(); return erroneous("dc.no.tag.name", p); } catch (ParseException e) { blockContent(); return erroneous(e.getMessage(), p); } }
[ "protected", "DCTree", "blockTag", "(", ")", "{", "int", "p", "=", "bp", ";", "try", "{", "nextChar", "(", ")", ";", "if", "(", "isIdentifierStart", "(", "ch", ")", ")", "{", "Name", "name", "=", "readTagName", "(", ")", ";", "TagParser", "tp", "=", "tagParsers", ".", "get", "(", "name", ")", ";", "if", "(", "tp", "==", "null", ")", "{", "List", "<", "DCTree", ">", "content", "=", "blockContent", "(", ")", ";", "return", "m", ".", "at", "(", "p", ")", ".", "UnknownBlockTag", "(", "name", ",", "content", ")", ";", "}", "else", "{", "switch", "(", "tp", ".", "getKind", "(", ")", ")", "{", "case", "BLOCK", ":", "return", "tp", ".", "parse", "(", "p", ")", ";", "case", "INLINE", ":", "return", "erroneous", "(", "\"dc.bad.inline.tag\"", ",", "p", ")", ";", "}", "}", "}", "blockContent", "(", ")", ";", "return", "erroneous", "(", "\"dc.no.tag.name\"", ",", "p", ")", ";", "}", "catch", "(", "ParseException", "e", ")", "{", "blockContent", "(", ")", ";", "return", "erroneous", "(", "e", ".", "getMessage", "(", ")", ",", "p", ")", ";", "}", "}" ]
Read a single block tag, including its content. Standard tags parse their content appropriately. Non-standard tags are represented by {@link UnknownBlockTag}.
[ "Read", "a", "single", "block", "tag", "including", "its", "content", ".", "Standard", "tags", "parse", "their", "content", "appropriately", ".", "Non", "-", "standard", "tags", "are", "represented", "by", "{" ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java#L279-L305
dkpro/dkpro-argumentation
dkpro-argumentation-preprocessing/src/main/java/org/dkpro/argumentation/preprocessing/annotation/ArgumentTokenBIOAnnotator.java
ArgumentTokenBIOAnnotator.getLabel
protected String getLabel(ArgumentComponent argumentComponent, Token token) { """ Returns a label for the annotated token @param argumentComponent covering argument component @param token token @return BIO label """ StringBuilder sb = new StringBuilder(argumentComponent.getClass().getSimpleName()); if ("BIO".equals(this.codingGranularity)) { // Does the component begin here? if (argumentComponent.getBegin() == token.getBegin()) { sb.append(B_SUFFIX); } else { sb.append(I_SUFFIX); } } else { sb.append(I_SUFFIX); } return sb.toString(); }
java
protected String getLabel(ArgumentComponent argumentComponent, Token token) { StringBuilder sb = new StringBuilder(argumentComponent.getClass().getSimpleName()); if ("BIO".equals(this.codingGranularity)) { // Does the component begin here? if (argumentComponent.getBegin() == token.getBegin()) { sb.append(B_SUFFIX); } else { sb.append(I_SUFFIX); } } else { sb.append(I_SUFFIX); } return sb.toString(); }
[ "protected", "String", "getLabel", "(", "ArgumentComponent", "argumentComponent", ",", "Token", "token", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "argumentComponent", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "if", "(", "\"BIO\"", ".", "equals", "(", "this", ".", "codingGranularity", ")", ")", "{", "// Does the component begin here?", "if", "(", "argumentComponent", ".", "getBegin", "(", ")", "==", "token", ".", "getBegin", "(", ")", ")", "{", "sb", ".", "append", "(", "B_SUFFIX", ")", ";", "}", "else", "{", "sb", ".", "append", "(", "I_SUFFIX", ")", ";", "}", "}", "else", "{", "sb", ".", "append", "(", "I_SUFFIX", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns a label for the annotated token @param argumentComponent covering argument component @param token token @return BIO label
[ "Returns", "a", "label", "for", "the", "annotated", "token" ]
train
https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-preprocessing/src/main/java/org/dkpro/argumentation/preprocessing/annotation/ArgumentTokenBIOAnnotator.java#L69-L87
VoltDB/voltdb
src/frontend/org/voltcore/zk/BabySitter.java
BabySitter.nonblockingFactory
public static BabySitter nonblockingFactory(ZooKeeper zk, String dir, Callback cb, ExecutorService es) throws InterruptedException, ExecutionException { """ Create a new BabySitter and make sure it reads the initial children list. Use the provided ExecutorService to queue events to, rather than creating a private ExecutorService. """ BabySitter bs = new BabySitter(zk, dir, cb, es); bs.m_es.submit(bs.m_eventHandler); return bs; }
java
public static BabySitter nonblockingFactory(ZooKeeper zk, String dir, Callback cb, ExecutorService es) throws InterruptedException, ExecutionException { BabySitter bs = new BabySitter(zk, dir, cb, es); bs.m_es.submit(bs.m_eventHandler); return bs; }
[ "public", "static", "BabySitter", "nonblockingFactory", "(", "ZooKeeper", "zk", ",", "String", "dir", ",", "Callback", "cb", ",", "ExecutorService", "es", ")", "throws", "InterruptedException", ",", "ExecutionException", "{", "BabySitter", "bs", "=", "new", "BabySitter", "(", "zk", ",", "dir", ",", "cb", ",", "es", ")", ";", "bs", ".", "m_es", ".", "submit", "(", "bs", ".", "m_eventHandler", ")", ";", "return", "bs", ";", "}" ]
Create a new BabySitter and make sure it reads the initial children list. Use the provided ExecutorService to queue events to, rather than creating a private ExecutorService.
[ "Create", "a", "new", "BabySitter", "and", "make", "sure", "it", "reads", "the", "initial", "children", "list", ".", "Use", "the", "provided", "ExecutorService", "to", "queue", "events", "to", "rather", "than", "creating", "a", "private", "ExecutorService", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/zk/BabySitter.java#L150-L157
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/ProductSortDefinitionUrl.java
ProductSortDefinitionUrl.updateProductSortDefinitionUrl
public static MozuUrl updateProductSortDefinitionUrl(Integer productSortDefinitionId, String responseFields) { """ Get Resource Url for UpdateProductSortDefinition @param productSortDefinitionId Unique identifier of the product sort definition. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/productsortdefinitions/{productSortDefinitionId}?responseFields={responseFields}"); formatter.formatUrl("productSortDefinitionId", productSortDefinitionId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateProductSortDefinitionUrl(Integer productSortDefinitionId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/productsortdefinitions/{productSortDefinitionId}?responseFields={responseFields}"); formatter.formatUrl("productSortDefinitionId", productSortDefinitionId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateProductSortDefinitionUrl", "(", "Integer", "productSortDefinitionId", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/productsortdefinitions/{productSortDefinitionId}?responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"productSortDefinitionId\"", ",", "productSortDefinitionId", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for UpdateProductSortDefinition @param productSortDefinitionId Unique identifier of the product sort definition. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateProductSortDefinition" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/ProductSortDefinitionUrl.java#L70-L76
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplaceSettings.java
CmsWorkplaceSettings.setTreeSite
public void setTreeSite(String type, String value) { """ Sets the tree resource uri for the specified tree type.<p> @param type the type of the tree @param value the resource uri to set for the type """ if (value == null) { return; } m_treeSite.put(type, value); }
java
public void setTreeSite(String type, String value) { if (value == null) { return; } m_treeSite.put(type, value); }
[ "public", "void", "setTreeSite", "(", "String", "type", ",", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", ";", "}", "m_treeSite", ".", "put", "(", "type", ",", "value", ")", ";", "}" ]
Sets the tree resource uri for the specified tree type.<p> @param type the type of the tree @param value the resource uri to set for the type
[ "Sets", "the", "tree", "resource", "uri", "for", "the", "specified", "tree", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceSettings.java#L769-L775
zxing/zxing
core/src/main/java/com/google/zxing/aztec/detector/Detector.java
Detector.sampleLine
private int sampleLine(ResultPoint p1, ResultPoint p2, int size) { """ Samples a line. @param p1 start point (inclusive) @param p2 end point (exclusive) @param size number of bits @return the array of bits as an int (first bit is high-order bit of result) """ int result = 0; float d = distance(p1, p2); float moduleSize = d / size; float px = p1.getX(); float py = p1.getY(); float dx = moduleSize * (p2.getX() - p1.getX()) / d; float dy = moduleSize * (p2.getY() - p1.getY()) / d; for (int i = 0; i < size; i++) { if (image.get(MathUtils.round(px + i * dx), MathUtils.round(py + i * dy))) { result |= 1 << (size - i - 1); } } return result; }
java
private int sampleLine(ResultPoint p1, ResultPoint p2, int size) { int result = 0; float d = distance(p1, p2); float moduleSize = d / size; float px = p1.getX(); float py = p1.getY(); float dx = moduleSize * (p2.getX() - p1.getX()) / d; float dy = moduleSize * (p2.getY() - p1.getY()) / d; for (int i = 0; i < size; i++) { if (image.get(MathUtils.round(px + i * dx), MathUtils.round(py + i * dy))) { result |= 1 << (size - i - 1); } } return result; }
[ "private", "int", "sampleLine", "(", "ResultPoint", "p1", ",", "ResultPoint", "p2", ",", "int", "size", ")", "{", "int", "result", "=", "0", ";", "float", "d", "=", "distance", "(", "p1", ",", "p2", ")", ";", "float", "moduleSize", "=", "d", "/", "size", ";", "float", "px", "=", "p1", ".", "getX", "(", ")", ";", "float", "py", "=", "p1", ".", "getY", "(", ")", ";", "float", "dx", "=", "moduleSize", "*", "(", "p2", ".", "getX", "(", ")", "-", "p1", ".", "getX", "(", ")", ")", "/", "d", ";", "float", "dy", "=", "moduleSize", "*", "(", "p2", ".", "getY", "(", ")", "-", "p1", ".", "getY", "(", ")", ")", "/", "d", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "if", "(", "image", ".", "get", "(", "MathUtils", ".", "round", "(", "px", "+", "i", "*", "dx", ")", ",", "MathUtils", ".", "round", "(", "py", "+", "i", "*", "dy", ")", ")", ")", "{", "result", "|=", "1", "<<", "(", "size", "-", "i", "-", "1", ")", ";", "}", "}", "return", "result", ";", "}" ]
Samples a line. @param p1 start point (inclusive) @param p2 end point (exclusive) @param size number of bits @return the array of bits as an int (first bit is high-order bit of result)
[ "Samples", "a", "line", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/detector/Detector.java#L400-L415
raydac/java-comment-preprocessor
jcp/src/main/java/com/igormaznitsa/jcp/expression/ExpressionTree.java
ExpressionTree.addItem
public void addItem(@Nonnull final ExpressionItem item) { """ Add new expression item into tree @param item an item to be added, must not be null """ if (item == null) { throw new PreprocessorException("[Expression]Item is null", this.sources, this.includeStack, null); } if (last.isEmptySlot()) { last = new ExpressionTreeElement(item, this.includeStack, this.sources); } else { last = last.addTreeElement(new ExpressionTreeElement(item, this.includeStack, this.sources)); } }
java
public void addItem(@Nonnull final ExpressionItem item) { if (item == null) { throw new PreprocessorException("[Expression]Item is null", this.sources, this.includeStack, null); } if (last.isEmptySlot()) { last = new ExpressionTreeElement(item, this.includeStack, this.sources); } else { last = last.addTreeElement(new ExpressionTreeElement(item, this.includeStack, this.sources)); } }
[ "public", "void", "addItem", "(", "@", "Nonnull", "final", "ExpressionItem", "item", ")", "{", "if", "(", "item", "==", "null", ")", "{", "throw", "new", "PreprocessorException", "(", "\"[Expression]Item is null\"", ",", "this", ".", "sources", ",", "this", ".", "includeStack", ",", "null", ")", ";", "}", "if", "(", "last", ".", "isEmptySlot", "(", ")", ")", "{", "last", "=", "new", "ExpressionTreeElement", "(", "item", ",", "this", ".", "includeStack", ",", "this", ".", "sources", ")", ";", "}", "else", "{", "last", "=", "last", ".", "addTreeElement", "(", "new", "ExpressionTreeElement", "(", "item", ",", "this", ".", "includeStack", ",", "this", ".", "sources", ")", ")", ";", "}", "}" ]
Add new expression item into tree @param item an item to be added, must not be null
[ "Add", "new", "expression", "item", "into", "tree" ]
train
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/jcp/expression/ExpressionTree.java#L68-L78
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java
DefaultFacelet.getRelativePath
private URL getRelativePath(FacesContext facesContext, String path) throws IOException { """ Delegates resolution to DefaultFaceletFactory reference. Also, caches URLs for relative paths. @param path a relative url path @return URL pointing to destination @throws IOException if there is a problem creating the URL for the path specified """ URL url = (URL) _relativePaths.get(path); if (url == null) { url = _factory.resolveURL(facesContext, _src, path); if (url != null) { ViewResource viewResource = (ViewResource) facesContext.getAttributes().get( FaceletFactory.LAST_RESOURCE_RESOLVED); if (viewResource != null) { // If a view resource has been used to resolve a resource, the cache is in // the ResourceHandler implementation. No need to cache in _relativeLocations. } else { _relativePaths.put(path, url); } } } return url; }
java
private URL getRelativePath(FacesContext facesContext, String path) throws IOException { URL url = (URL) _relativePaths.get(path); if (url == null) { url = _factory.resolveURL(facesContext, _src, path); if (url != null) { ViewResource viewResource = (ViewResource) facesContext.getAttributes().get( FaceletFactory.LAST_RESOURCE_RESOLVED); if (viewResource != null) { // If a view resource has been used to resolve a resource, the cache is in // the ResourceHandler implementation. No need to cache in _relativeLocations. } else { _relativePaths.put(path, url); } } } return url; }
[ "private", "URL", "getRelativePath", "(", "FacesContext", "facesContext", ",", "String", "path", ")", "throws", "IOException", "{", "URL", "url", "=", "(", "URL", ")", "_relativePaths", ".", "get", "(", "path", ")", ";", "if", "(", "url", "==", "null", ")", "{", "url", "=", "_factory", ".", "resolveURL", "(", "facesContext", ",", "_src", ",", "path", ")", ";", "if", "(", "url", "!=", "null", ")", "{", "ViewResource", "viewResource", "=", "(", "ViewResource", ")", "facesContext", ".", "getAttributes", "(", ")", ".", "get", "(", "FaceletFactory", ".", "LAST_RESOURCE_RESOLVED", ")", ";", "if", "(", "viewResource", "!=", "null", ")", "{", "// If a view resource has been used to resolve a resource, the cache is in", "// the ResourceHandler implementation. No need to cache in _relativeLocations.", "}", "else", "{", "_relativePaths", ".", "put", "(", "path", ",", "url", ")", ";", "}", "}", "}", "return", "url", ";", "}" ]
Delegates resolution to DefaultFaceletFactory reference. Also, caches URLs for relative paths. @param path a relative url path @return URL pointing to destination @throws IOException if there is a problem creating the URL for the path specified
[ "Delegates", "resolution", "to", "DefaultFaceletFactory", "reference", ".", "Also", "caches", "URLs", "for", "relative", "paths", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java#L470-L492
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getNestingPageFlow
public static PageFlowController getNestingPageFlow( HttpServletRequest request ) { """ Get the {@link PageFlowController} that is nesting the current one. @deprecated Use {@link #getNestingPageFlow(HttpServletRequest, ServletContext)} instead. @param request the current HttpServletRequest. @return the nesting {@link PageFlowController}, or <code>null</code> if the current one is not being nested. """ ServletContext servletContext = InternalUtils.getServletContext( request ); return getNestingPageFlow( request, servletContext ); }
java
public static PageFlowController getNestingPageFlow( HttpServletRequest request ) { ServletContext servletContext = InternalUtils.getServletContext( request ); return getNestingPageFlow( request, servletContext ); }
[ "public", "static", "PageFlowController", "getNestingPageFlow", "(", "HttpServletRequest", "request", ")", "{", "ServletContext", "servletContext", "=", "InternalUtils", ".", "getServletContext", "(", "request", ")", ";", "return", "getNestingPageFlow", "(", "request", ",", "servletContext", ")", ";", "}" ]
Get the {@link PageFlowController} that is nesting the current one. @deprecated Use {@link #getNestingPageFlow(HttpServletRequest, ServletContext)} instead. @param request the current HttpServletRequest. @return the nesting {@link PageFlowController}, or <code>null</code> if the current one is not being nested.
[ "Get", "the", "{", "@link", "PageFlowController", "}", "that", "is", "nesting", "the", "current", "one", ".", "@deprecated", "Use", "{", "@link", "#getNestingPageFlow", "(", "HttpServletRequest", "ServletContext", ")", "}", "instead", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L217-L221
alkacon/opencms-core
src/org/opencms/workplace/tools/CmsToolManager.java
CmsToolManager.setCurrentToolPath
public void setCurrentToolPath(CmsWorkplace wp, String currentToolPath) { """ Sets the current tool path.<p> @param wp the workplace object @param currentToolPath the current tool path to set """ // use last used path if param empty if (CmsStringUtil.isEmptyOrWhitespaceOnly(currentToolPath) || currentToolPath.trim().equals("null")) { currentToolPath = getCurrentToolPath(wp); } currentToolPath = repairPath(wp, currentToolPath); // use it CmsToolUserData userData = getUserData(wp); userData.setCurrentToolPath(userData.getRootKey(), currentToolPath); }
java
public void setCurrentToolPath(CmsWorkplace wp, String currentToolPath) { // use last used path if param empty if (CmsStringUtil.isEmptyOrWhitespaceOnly(currentToolPath) || currentToolPath.trim().equals("null")) { currentToolPath = getCurrentToolPath(wp); } currentToolPath = repairPath(wp, currentToolPath); // use it CmsToolUserData userData = getUserData(wp); userData.setCurrentToolPath(userData.getRootKey(), currentToolPath); }
[ "public", "void", "setCurrentToolPath", "(", "CmsWorkplace", "wp", ",", "String", "currentToolPath", ")", "{", "// use last used path if param empty", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "currentToolPath", ")", "||", "currentToolPath", ".", "trim", "(", ")", ".", "equals", "(", "\"null\"", ")", ")", "{", "currentToolPath", "=", "getCurrentToolPath", "(", "wp", ")", ";", "}", "currentToolPath", "=", "repairPath", "(", "wp", ",", "currentToolPath", ")", ";", "// use it", "CmsToolUserData", "userData", "=", "getUserData", "(", "wp", ")", ";", "userData", ".", "setCurrentToolPath", "(", "userData", ".", "getRootKey", "(", ")", ",", "currentToolPath", ")", ";", "}" ]
Sets the current tool path.<p> @param wp the workplace object @param currentToolPath the current tool path to set
[ "Sets", "the", "current", "tool", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/tools/CmsToolManager.java#L570-L580
actorapp/actor-platform
actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/crypto/CRC32.java
CRC32.update
public void update(byte[] buf, int off, int len) { """ Adds the byte array to the data checksum. @param buf the buffer which contains the data @param off the offset in the buffer where the data starts @param len the length of the data """ int c = ~crc; while (--len >= 0) c = crc_table[(c ^ buf[off++]) & 0xff] ^ (c >>> 8); crc = ~c; }
java
public void update(byte[] buf, int off, int len) { int c = ~crc; while (--len >= 0) c = crc_table[(c ^ buf[off++]) & 0xff] ^ (c >>> 8); crc = ~c; }
[ "public", "void", "update", "(", "byte", "[", "]", "buf", ",", "int", "off", ",", "int", "len", ")", "{", "int", "c", "=", "~", "crc", ";", "while", "(", "--", "len", ">=", "0", ")", "c", "=", "crc_table", "[", "(", "c", "^", "buf", "[", "off", "++", "]", ")", "&", "0xff", "]", "^", "(", "c", ">>>", "8", ")", ";", "crc", "=", "~", "c", ";", "}" ]
Adds the byte array to the data checksum. @param buf the buffer which contains the data @param off the offset in the buffer where the data starts @param len the length of the data
[ "Adds", "the", "byte", "array", "to", "the", "data", "checksum", "." ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/crypto/CRC32.java#L78-L83
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.readColumn
private void readColumn(int startIndex, int length) throws Exception { """ Read data for a single column. @param startIndex block start @param length block length """ if (m_currentTable != null) { int value = FastTrackUtility.getByte(m_buffer, startIndex); Class<?> klass = COLUMN_MAP[value]; if (klass == null) { klass = UnknownColumn.class; } FastTrackColumn column = (FastTrackColumn) klass.newInstance(); m_currentColumn = column; logColumnData(startIndex, length); column.read(m_currentTable.getType(), m_buffer, startIndex, length); FastTrackField type = column.getType(); // // Don't try to add this data if: // 1. We don't know what type it is // 2. We have seen the type already // if (type != null && !m_currentFields.contains(type)) { m_currentFields.add(type); m_currentTable.addColumn(column); updateDurationTimeUnit(column); updateWorkTimeUnit(column); logColumn(column); } } }
java
private void readColumn(int startIndex, int length) throws Exception { if (m_currentTable != null) { int value = FastTrackUtility.getByte(m_buffer, startIndex); Class<?> klass = COLUMN_MAP[value]; if (klass == null) { klass = UnknownColumn.class; } FastTrackColumn column = (FastTrackColumn) klass.newInstance(); m_currentColumn = column; logColumnData(startIndex, length); column.read(m_currentTable.getType(), m_buffer, startIndex, length); FastTrackField type = column.getType(); // // Don't try to add this data if: // 1. We don't know what type it is // 2. We have seen the type already // if (type != null && !m_currentFields.contains(type)) { m_currentFields.add(type); m_currentTable.addColumn(column); updateDurationTimeUnit(column); updateWorkTimeUnit(column); logColumn(column); } } }
[ "private", "void", "readColumn", "(", "int", "startIndex", ",", "int", "length", ")", "throws", "Exception", "{", "if", "(", "m_currentTable", "!=", "null", ")", "{", "int", "value", "=", "FastTrackUtility", ".", "getByte", "(", "m_buffer", ",", "startIndex", ")", ";", "Class", "<", "?", ">", "klass", "=", "COLUMN_MAP", "[", "value", "]", ";", "if", "(", "klass", "==", "null", ")", "{", "klass", "=", "UnknownColumn", ".", "class", ";", "}", "FastTrackColumn", "column", "=", "(", "FastTrackColumn", ")", "klass", ".", "newInstance", "(", ")", ";", "m_currentColumn", "=", "column", ";", "logColumnData", "(", "startIndex", ",", "length", ")", ";", "column", ".", "read", "(", "m_currentTable", ".", "getType", "(", ")", ",", "m_buffer", ",", "startIndex", ",", "length", ")", ";", "FastTrackField", "type", "=", "column", ".", "getType", "(", ")", ";", "//", "// Don't try to add this data if:", "// 1. We don't know what type it is", "// 2. We have seen the type already", "//", "if", "(", "type", "!=", "null", "&&", "!", "m_currentFields", ".", "contains", "(", "type", ")", ")", "{", "m_currentFields", ".", "add", "(", "type", ")", ";", "m_currentTable", ".", "addColumn", "(", "column", ")", ";", "updateDurationTimeUnit", "(", "column", ")", ";", "updateWorkTimeUnit", "(", "column", ")", ";", "logColumn", "(", "column", ")", ";", "}", "}", "}" ]
Read data for a single column. @param startIndex block start @param length block length
[ "Read", "data", "for", "a", "single", "column", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L232-L266
baratine/baratine
framework/src/main/java/com/caucho/v5/vfs/PathWrapper.java
PathWrapper.lookup
public PathImpl lookup(String userPath, Map<String,Object> newAttributes) { """ Returns a new path relative to the current one. <p>Path only handles scheme:xxx. Subclasses of Path will specialize the xxx. @param userPath relative or absolute path, essentially any url. @param newAttributes attributes for the new path. @return the new path or null if the scheme doesn't exist """ return getWrappedPath().lookup(userPath, newAttributes); }
java
public PathImpl lookup(String userPath, Map<String,Object> newAttributes) { return getWrappedPath().lookup(userPath, newAttributes); }
[ "public", "PathImpl", "lookup", "(", "String", "userPath", ",", "Map", "<", "String", ",", "Object", ">", "newAttributes", ")", "{", "return", "getWrappedPath", "(", ")", ".", "lookup", "(", "userPath", ",", "newAttributes", ")", ";", "}" ]
Returns a new path relative to the current one. <p>Path only handles scheme:xxx. Subclasses of Path will specialize the xxx. @param userPath relative or absolute path, essentially any url. @param newAttributes attributes for the new path. @return the new path or null if the scheme doesn't exist
[ "Returns", "a", "new", "path", "relative", "to", "the", "current", "one", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathWrapper.java#L81-L84
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/saverestore/IndexSnapshotWritePlan.java
IndexSnapshotWritePlan.createIndexExpressionForTable
public static AbstractExpression createIndexExpressionForTable(Table table, Map<Integer, Integer> ranges) { """ Create the expression used to build elastic index for a given table. @param table The table to build the elastic index on @param ranges The hash ranges that the index should include """ HashRangeExpression predicate = new HashRangeExpression(); predicate.setRanges(ranges); predicate.setHashColumnIndex(table.getPartitioncolumn().getIndex()); return predicate; }
java
public static AbstractExpression createIndexExpressionForTable(Table table, Map<Integer, Integer> ranges) { HashRangeExpression predicate = new HashRangeExpression(); predicate.setRanges(ranges); predicate.setHashColumnIndex(table.getPartitioncolumn().getIndex()); return predicate; }
[ "public", "static", "AbstractExpression", "createIndexExpressionForTable", "(", "Table", "table", ",", "Map", "<", "Integer", ",", "Integer", ">", "ranges", ")", "{", "HashRangeExpression", "predicate", "=", "new", "HashRangeExpression", "(", ")", ";", "predicate", ".", "setRanges", "(", "ranges", ")", ";", "predicate", ".", "setHashColumnIndex", "(", "table", ".", "getPartitioncolumn", "(", ")", ".", "getIndex", "(", ")", ")", ";", "return", "predicate", ";", "}" ]
Create the expression used to build elastic index for a given table. @param table The table to build the elastic index on @param ranges The hash ranges that the index should include
[ "Create", "the", "expression", "used", "to", "build", "elastic", "index", "for", "a", "given", "table", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/saverestore/IndexSnapshotWritePlan.java#L116-L123
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/action/toolbar/ToolbarRegistry.java
ToolbarRegistry.getToolbarAction
public static ToolbarBaseAction getToolbarAction(String key, MapWidget mapWidget) { """ Get the toolbar action which matches the given key. @param key key for toolbar action @param mapWidget map which will contain this tool @return toolbar action or null when key not found """ ToolCreator toolCreator = REGISTRY.get(key); if (null == toolCreator) { return null; } return toolCreator.createTool(mapWidget); }
java
public static ToolbarBaseAction getToolbarAction(String key, MapWidget mapWidget) { ToolCreator toolCreator = REGISTRY.get(key); if (null == toolCreator) { return null; } return toolCreator.createTool(mapWidget); }
[ "public", "static", "ToolbarBaseAction", "getToolbarAction", "(", "String", "key", ",", "MapWidget", "mapWidget", ")", "{", "ToolCreator", "toolCreator", "=", "REGISTRY", ".", "get", "(", "key", ")", ";", "if", "(", "null", "==", "toolCreator", ")", "{", "return", "null", ";", "}", "return", "toolCreator", ".", "createTool", "(", "mapWidget", ")", ";", "}" ]
Get the toolbar action which matches the given key. @param key key for toolbar action @param mapWidget map which will contain this tool @return toolbar action or null when key not found
[ "Get", "the", "toolbar", "action", "which", "matches", "the", "given", "key", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/toolbar/ToolbarRegistry.java#L179-L185
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/config/S3ReportStorage.java
S3ReportStorage.getKey
protected String getKey(final String ref, final String filename, final String extension) { """ Compute the key to use. @param ref The reference number. @param filename The filename. @param extension The file extension. """ return prefix + ref + "/" + filename + "." + extension; }
java
protected String getKey(final String ref, final String filename, final String extension) { return prefix + ref + "/" + filename + "." + extension; }
[ "protected", "String", "getKey", "(", "final", "String", "ref", ",", "final", "String", "filename", ",", "final", "String", "extension", ")", "{", "return", "prefix", "+", "ref", "+", "\"/\"", "+", "filename", "+", "\".\"", "+", "extension", ";", "}" ]
Compute the key to use. @param ref The reference number. @param filename The filename. @param extension The file extension.
[ "Compute", "the", "key", "to", "use", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/config/S3ReportStorage.java#L125-L127
otto-de/edison-microservice
edison-core/src/main/java/de/otto/edison/status/domain/StatusDetail.java
StatusDetail.withDetail
public StatusDetail withDetail(final String key, final String value) { """ Create a copy of this StatusDetail, add a detail and return the new StatusDetail. @param key the key of the additional detail @param value the value of the additional detail @return StatusDetail """ final LinkedHashMap<String, String> newDetails = new LinkedHashMap<>(details); newDetails.put(key, value); return statusDetail(name,status,message, newDetails); }
java
public StatusDetail withDetail(final String key, final String value) { final LinkedHashMap<String, String> newDetails = new LinkedHashMap<>(details); newDetails.put(key, value); return statusDetail(name,status,message, newDetails); }
[ "public", "StatusDetail", "withDetail", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "final", "LinkedHashMap", "<", "String", ",", "String", ">", "newDetails", "=", "new", "LinkedHashMap", "<>", "(", "details", ")", ";", "newDetails", ".", "put", "(", "key", ",", "value", ")", ";", "return", "statusDetail", "(", "name", ",", "status", ",", "message", ",", "newDetails", ")", ";", "}" ]
Create a copy of this StatusDetail, add a detail and return the new StatusDetail. @param key the key of the additional detail @param value the value of the additional detail @return StatusDetail
[ "Create", "a", "copy", "of", "this", "StatusDetail", "add", "a", "detail", "and", "return", "the", "new", "StatusDetail", "." ]
train
https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-core/src/main/java/de/otto/edison/status/domain/StatusDetail.java#L132-L136
camunda/camunda-commons
typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
Variables.objectValue
public static ObjectValueBuilder objectValue(Object value, boolean isTransient) { """ Returns a builder to create a new {@link ObjectValue} that encapsulates the given {@code value}. """ return (ObjectValueBuilder) objectValue(value).setTransient(isTransient); }
java
public static ObjectValueBuilder objectValue(Object value, boolean isTransient) { return (ObjectValueBuilder) objectValue(value).setTransient(isTransient); }
[ "public", "static", "ObjectValueBuilder", "objectValue", "(", "Object", "value", ",", "boolean", "isTransient", ")", "{", "return", "(", "ObjectValueBuilder", ")", "objectValue", "(", "value", ")", ".", "setTransient", "(", "isTransient", ")", ";", "}" ]
Returns a builder to create a new {@link ObjectValue} that encapsulates the given {@code value}.
[ "Returns", "a", "builder", "to", "create", "a", "new", "{" ]
train
https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java#L183-L185
tropo/tropo-webapi-java
src/main/java/com/voxeo/tropo/Key.java
Key.SAY_OF_RECORD
public static Key SAY_OF_RECORD(com.voxeo.tropo.actions.RecordAction.Say... says ) { """ <p> This determines what is played or sent to the caller. This can be a single object or an array of objects. When say is a part of a record action, it can also take an event key. This determines if the prompt will be played based on a particular event; for record, the only possible event is 'timeout'. </p> """ return createKey("say", says); }
java
public static Key SAY_OF_RECORD(com.voxeo.tropo.actions.RecordAction.Say... says ) { return createKey("say", says); }
[ "public", "static", "Key", "SAY_OF_RECORD", "(", "com", ".", "voxeo", ".", "tropo", ".", "actions", ".", "RecordAction", ".", "Say", "...", "says", ")", "{", "return", "createKey", "(", "\"say\"", ",", "says", ")", ";", "}" ]
<p> This determines what is played or sent to the caller. This can be a single object or an array of objects. When say is a part of a record action, it can also take an event key. This determines if the prompt will be played based on a particular event; for record, the only possible event is 'timeout'. </p>
[ "<p", ">", "This", "determines", "what", "is", "played", "or", "sent", "to", "the", "caller", ".", "This", "can", "be", "a", "single", "object", "or", "an", "array", "of", "objects", ".", "When", "say", "is", "a", "part", "of", "a", "record", "action", "it", "can", "also", "take", "an", "event", "key", ".", "This", "determines", "if", "the", "prompt", "will", "be", "played", "based", "on", "a", "particular", "event", ";", "for", "record", "the", "only", "possible", "event", "is", "timeout", ".", "<", "/", "p", ">" ]
train
https://github.com/tropo/tropo-webapi-java/blob/96af1fa292c1d4b6321d85a559d9718d33eec7e0/src/main/java/com/voxeo/tropo/Key.java#L835-L838
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/builder/JavaSqlInfoBuilder.java
JavaSqlInfoBuilder.buildInSqlByCollection
public void buildInSqlByCollection(String fieldText, Collection<Object> values) { """ 构建" IN "范围查询的sql信息. @param fieldText 数据库字段文本 @param values 对象集合 """ super.buildInSql(fieldText, values == null ? null : values.toArray()); }
java
public void buildInSqlByCollection(String fieldText, Collection<Object> values) { super.buildInSql(fieldText, values == null ? null : values.toArray()); }
[ "public", "void", "buildInSqlByCollection", "(", "String", "fieldText", ",", "Collection", "<", "Object", ">", "values", ")", "{", "super", ".", "buildInSql", "(", "fieldText", ",", "values", "==", "null", "?", "null", ":", "values", ".", "toArray", "(", ")", ")", ";", "}" ]
构建" IN "范围查询的sql信息. @param fieldText 数据库字段文本 @param values 对象集合
[ "构建", "IN", "范围查询的sql信息", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/builder/JavaSqlInfoBuilder.java#L36-L38
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator._generate
protected void _generate(SarlEnumeration enumeration, IExtraLanguageGeneratorContext context) { """ Generate the given object. @param enumeration the enumeration. @param context the context. """ final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(enumeration); final PyAppendable appendable = createAppendable(jvmType, context); if (generateEnumerationDeclaration(enumeration, appendable, context)) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(enumeration); writeFile(name, appendable, context); } }
java
protected void _generate(SarlEnumeration enumeration, IExtraLanguageGeneratorContext context) { final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(enumeration); final PyAppendable appendable = createAppendable(jvmType, context); if (generateEnumerationDeclaration(enumeration, appendable, context)) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(enumeration); writeFile(name, appendable, context); } }
[ "protected", "void", "_generate", "(", "SarlEnumeration", "enumeration", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "final", "JvmDeclaredType", "jvmType", "=", "getJvmModelAssociations", "(", ")", ".", "getInferredType", "(", "enumeration", ")", ";", "final", "PyAppendable", "appendable", "=", "createAppendable", "(", "jvmType", ",", "context", ")", ";", "if", "(", "generateEnumerationDeclaration", "(", "enumeration", ",", "appendable", ",", "context", ")", ")", "{", "final", "QualifiedName", "name", "=", "getQualifiedNameProvider", "(", ")", ".", "getFullyQualifiedName", "(", "enumeration", ")", ";", "writeFile", "(", "name", ",", "appendable", ",", "context", ")", ";", "}", "}" ]
Generate the given object. @param enumeration the enumeration. @param context the context.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L711-L718